diff --git a/Workflows/.OwlBot.yaml b/Workflows/.OwlBot.yaml index cccaf7cc9f4b..f5e116db072f 100644 --- a/Workflows/.OwlBot.yaml +++ b/Workflows/.OwlBot.yaml @@ -1,6 +1,6 @@ deep-copy-regex: - - source: /google/cloud/workflows/(v1|v1beta)/.*-php/(.*) + - source: /google/cloud/workflows/(v1)/.*-php/(.*) dest: /owl-bot-staging/Workflows/$1/$2 - - source: /google/cloud/workflows/executions/(v1|v1beta)/.*-php/(.*) + - source: /google/cloud/workflows/executions/(v1)/.*-php/(.*) dest: /owl-bot-staging/Workflows/Executions/$1/$2 api-name: Workflows diff --git a/Workflows/metadata/Executions/V1Beta/Executions.php b/Workflows/metadata/Executions/V1Beta/Executions.php deleted file mode 100644 index 8b5c8dcf8245..000000000000 Binary files a/Workflows/metadata/Executions/V1Beta/Executions.php and /dev/null differ diff --git a/Workflows/metadata/V1Beta/Workflows.php b/Workflows/metadata/V1Beta/Workflows.php deleted file mode 100644 index 15098a62f958..000000000000 Binary files a/Workflows/metadata/V1Beta/Workflows.php and /dev/null differ diff --git a/Workflows/owlbot.py b/Workflows/owlbot.py index a6a1e329c44f..919178c0216c 100644 --- a/Workflows/owlbot.py +++ b/Workflows/owlbot.py @@ -41,34 +41,33 @@ ] ) -for version in ['v1', 'v1beta']: - executions_library = Path(f"../{php.STAGING_DIR}/Workflows/Executions/{version}").resolve() - - # copy all src including partial veneer classes - s.move( - executions_library / 'src', - 'src/Executions', - merge=preserve_copyright_year, - ) - # copy proto files to src also - s.move( - executions_library / 'proto/src/Google/Cloud/Workflows', - 'src/', - merge=preserve_copyright_year, - excludes=[ - executions_library / "**/*_*.php" - ] - ) - s.move( - executions_library / 'tests/Unit', - 'tests/Unit/Executions', - merge=preserve_copyright_year, - ) - # copy GPBMetadata file to metadata - s.move(executions_library / 'proto/src/GPBMetadata/Google/Cloud/Workflows', - 'metadata/', - merge=preserve_copyright_year, - ) +executions_library = Path(f"../{php.STAGING_DIR}/Workflows/Executions/v1").resolve() + +# copy all src including partial veneer classes +s.move( + executions_library / 'src', + 'src/Executions', + merge=preserve_copyright_year, +) +# copy proto files to src also +s.move( + executions_library / 'proto/src/Google/Cloud/Workflows', + 'src/', + merge=preserve_copyright_year, + excludes=[ + executions_library / "**/*_*.php" + ] +) +s.move( + executions_library / 'tests/Unit', + 'tests/Unit/Executions', + merge=preserve_copyright_year, +) +# copy GPBMetadata file to metadata +s.move(executions_library / 'proto/src/GPBMetadata/Google/Cloud/Workflows', + 'metadata/', + merge=preserve_copyright_year, +) # remove class_alias code s.replace( diff --git a/Workflows/samples/V1/WorkflowsClient/create_workflow.php b/Workflows/samples/V1/WorkflowsClient/create_workflow.php index f24d7ea3d11d..638eb45727ab 100644 --- a/Workflows/samples/V1/WorkflowsClient/create_workflow.php +++ b/Workflows/samples/V1/WorkflowsClient/create_workflow.php @@ -1,6 +1,6 @@ createWorkflow($formattedParent, $workflow, $workflowId); - $response->pollUntilComplete(); - - if ($response->operationSucceeded()) { - /** @var Workflow $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 = WorkflowsClient::locationName('[PROJECT]', '[LOCATION]'); - $workflowId = '[WORKFLOW_ID]'; - - create_workflow_sample($formattedParent, $workflowId); -} -// [END workflows_v1beta_generated_Workflows_CreateWorkflow_sync] diff --git a/Workflows/samples/V1beta/WorkflowsClient/delete_workflow.php b/Workflows/samples/V1beta/WorkflowsClient/delete_workflow.php deleted file mode 100644 index a305c4d2d238..000000000000 --- a/Workflows/samples/V1beta/WorkflowsClient/delete_workflow.php +++ /dev/null @@ -1,78 +0,0 @@ -deleteWorkflow($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 = WorkflowsClient::workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); - - delete_workflow_sample($formattedName); -} -// [END workflows_v1beta_generated_Workflows_DeleteWorkflow_sync] diff --git a/Workflows/samples/V1beta/WorkflowsClient/get_workflow.php b/Workflows/samples/V1beta/WorkflowsClient/get_workflow.php deleted file mode 100644 index 7838c50c6113..000000000000 --- a/Workflows/samples/V1beta/WorkflowsClient/get_workflow.php +++ /dev/null @@ -1,67 +0,0 @@ -getWorkflow($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 = WorkflowsClient::workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); - - get_workflow_sample($formattedName); -} -// [END workflows_v1beta_generated_Workflows_GetWorkflow_sync] diff --git a/Workflows/samples/V1beta/WorkflowsClient/list_workflows.php b/Workflows/samples/V1beta/WorkflowsClient/list_workflows.php deleted file mode 100644 index e35a6284f500..000000000000 --- a/Workflows/samples/V1beta/WorkflowsClient/list_workflows.php +++ /dev/null @@ -1,73 +0,0 @@ -listWorkflows($formattedParent); - - /** @var Workflow $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 = WorkflowsClient::locationName('[PROJECT]', '[LOCATION]'); - - list_workflows_sample($formattedParent); -} -// [END workflows_v1beta_generated_Workflows_ListWorkflows_sync] diff --git a/Workflows/samples/V1beta/WorkflowsClient/update_workflow.php b/Workflows/samples/V1beta/WorkflowsClient/update_workflow.php deleted file mode 100644 index e8a510886a34..000000000000 --- a/Workflows/samples/V1beta/WorkflowsClient/update_workflow.php +++ /dev/null @@ -1,72 +0,0 @@ -updateWorkflow($workflow); - $response->pollUntilComplete(); - - if ($response->operationSucceeded()) { - /** @var Workflow $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 workflows_v1beta_generated_Workflows_UpdateWorkflow_sync] diff --git a/Workflows/src/Executions/V1beta/CancelExecutionRequest.php b/Workflows/src/Executions/V1beta/CancelExecutionRequest.php deleted file mode 100644 index 7ec069f5f6af..000000000000 --- a/Workflows/src/Executions/V1beta/CancelExecutionRequest.php +++ /dev/null @@ -1,77 +0,0 @@ -google.cloud.workflows.executions.v1beta.CancelExecutionRequest - */ -class CancelExecutionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Name of the execution to be cancelled. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - private $name = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. Name of the execution to be cancelled. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Workflows\Executions\V1Beta\Executions::initOnce(); - parent::__construct($data); - } - - /** - * Required. Name of the execution to be cancelled. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * - * 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 execution to be cancelled. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * - * 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/Workflows/src/Executions/V1beta/CreateExecutionRequest.php b/Workflows/src/Executions/V1beta/CreateExecutionRequest.php deleted file mode 100644 index cb37251b366b..000000000000 --- a/Workflows/src/Executions/V1beta/CreateExecutionRequest.php +++ /dev/null @@ -1,121 +0,0 @@ -google.cloud.workflows.executions.v1beta.CreateExecutionRequest - */ -class CreateExecutionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Name of the workflow for which an execution should be created. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * The latest revision of the workflow will be used. - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - private $parent = ''; - /** - * Required. Execution to be created. - * - * Generated from protobuf field .google.cloud.workflows.executions.v1beta.Execution execution = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - private $execution = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. Name of the workflow for which an execution should be created. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * The latest revision of the workflow will be used. - * @type \Google\Cloud\Workflows\Executions\V1beta\Execution $execution - * Required. Execution to be created. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Workflows\Executions\V1Beta\Executions::initOnce(); - parent::__construct($data); - } - - /** - * Required. Name of the workflow for which an execution should be created. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * The latest revision of the workflow will be used. - * - * 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 workflow for which an execution should be created. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * The latest revision of the workflow will be used. - * - * 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. Execution to be created. - * - * Generated from protobuf field .google.cloud.workflows.executions.v1beta.Execution execution = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Workflows\Executions\V1beta\Execution|null - */ - public function getExecution() - { - return $this->execution; - } - - public function hasExecution() - { - return isset($this->execution); - } - - public function clearExecution() - { - unset($this->execution); - } - - /** - * Required. Execution to be created. - * - * Generated from protobuf field .google.cloud.workflows.executions.v1beta.Execution execution = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Workflows\Executions\V1beta\Execution $var - * @return $this - */ - public function setExecution($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Workflows\Executions\V1beta\Execution::class); - $this->execution = $var; - - return $this; - } - -} - diff --git a/Workflows/src/Executions/V1beta/Execution.php b/Workflows/src/Executions/V1beta/Execution.php deleted file mode 100644 index 55ec57797309..000000000000 --- a/Workflows/src/Executions/V1beta/Execution.php +++ /dev/null @@ -1,359 +0,0 @@ -google.cloud.workflows.executions.v1beta.Execution - */ -class Execution extends \Google\Protobuf\Internal\Message -{ - /** - * Output only. The resource name of the execution. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $name = ''; - /** - * Output only. Marks the beginning of execution. - * - * Generated from protobuf field .google.protobuf.Timestamp start_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $start_time = null; - /** - * Output only. Marks the end of execution, successful or not. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $end_time = null; - /** - * Output only. Current state of the execution. - * - * Generated from protobuf field .google.cloud.workflows.executions.v1beta.Execution.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $state = 0; - /** - * Input parameters of the execution represented as a JSON string. - * The size limit is 32KB. - * - * Generated from protobuf field string argument = 5; - */ - private $argument = ''; - /** - * Output only. Output of the execution represented as a JSON string. The - * value can only be present if the execution's state is `SUCCEEDED`. - * - * Generated from protobuf field string result = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $result = ''; - /** - * Output only. The error which caused the execution to finish prematurely. - * The value is only present if the execution's state is `FAILED` - * or `CANCELLED`. - * - * Generated from protobuf field .google.cloud.workflows.executions.v1beta.Execution.Error error = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $error = null; - /** - * Output only. Revision of the workflow this execution is using. - * - * Generated from protobuf field string workflow_revision_id = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $workflow_revision_id = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Output only. The resource name of the execution. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * @type \Google\Protobuf\Timestamp $start_time - * Output only. Marks the beginning of execution. - * @type \Google\Protobuf\Timestamp $end_time - * Output only. Marks the end of execution, successful or not. - * @type int $state - * Output only. Current state of the execution. - * @type string $argument - * Input parameters of the execution represented as a JSON string. - * The size limit is 32KB. - * @type string $result - * Output only. Output of the execution represented as a JSON string. The - * value can only be present if the execution's state is `SUCCEEDED`. - * @type \Google\Cloud\Workflows\Executions\V1beta\Execution\Error $error - * Output only. The error which caused the execution to finish prematurely. - * The value is only present if the execution's state is `FAILED` - * or `CANCELLED`. - * @type string $workflow_revision_id - * Output only. Revision of the workflow this execution is using. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Workflows\Executions\V1Beta\Executions::initOnce(); - parent::__construct($data); - } - - /** - * Output only. The resource name of the execution. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * Output only. The resource name of the execution. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * - * 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. Marks the beginning of execution. - * - * Generated from protobuf field .google.protobuf.Timestamp start_time = 2 [(.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. Marks the beginning of execution. - * - * Generated from protobuf field .google.protobuf.Timestamp start_time = 2 [(.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. Marks the end of execution, successful or not. - * - * 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. Marks the end of execution, successful or not. - * - * 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. Current state of the execution. - * - * Generated from protobuf field .google.cloud.workflows.executions.v1beta.Execution.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int - */ - public function getState() - { - return $this->state; - } - - /** - * Output only. Current state of the execution. - * - * Generated from protobuf field .google.cloud.workflows.executions.v1beta.Execution.State state = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setState($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Workflows\Executions\V1beta\Execution\State::class); - $this->state = $var; - - return $this; - } - - /** - * Input parameters of the execution represented as a JSON string. - * The size limit is 32KB. - * - * Generated from protobuf field string argument = 5; - * @return string - */ - public function getArgument() - { - return $this->argument; - } - - /** - * Input parameters of the execution represented as a JSON string. - * The size limit is 32KB. - * - * Generated from protobuf field string argument = 5; - * @param string $var - * @return $this - */ - public function setArgument($var) - { - GPBUtil::checkString($var, True); - $this->argument = $var; - - return $this; - } - - /** - * Output only. Output of the execution represented as a JSON string. The - * value can only be present if the execution's state is `SUCCEEDED`. - * - * Generated from protobuf field string result = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getResult() - { - return $this->result; - } - - /** - * Output only. Output of the execution represented as a JSON string. The - * value can only be present if the execution's state is `SUCCEEDED`. - * - * Generated from protobuf field string result = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setResult($var) - { - GPBUtil::checkString($var, True); - $this->result = $var; - - return $this; - } - - /** - * Output only. The error which caused the execution to finish prematurely. - * The value is only present if the execution's state is `FAILED` - * or `CANCELLED`. - * - * Generated from protobuf field .google.cloud.workflows.executions.v1beta.Execution.Error error = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Cloud\Workflows\Executions\V1beta\Execution\Error|null - */ - public function getError() - { - return $this->error; - } - - public function hasError() - { - return isset($this->error); - } - - public function clearError() - { - unset($this->error); - } - - /** - * Output only. The error which caused the execution to finish prematurely. - * The value is only present if the execution's state is `FAILED` - * or `CANCELLED`. - * - * Generated from protobuf field .google.cloud.workflows.executions.v1beta.Execution.Error error = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Cloud\Workflows\Executions\V1beta\Execution\Error $var - * @return $this - */ - public function setError($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Workflows\Executions\V1beta\Execution\Error::class); - $this->error = $var; - - return $this; - } - - /** - * Output only. Revision of the workflow this execution is using. - * - * Generated from protobuf field string workflow_revision_id = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getWorkflowRevisionId() - { - return $this->workflow_revision_id; - } - - /** - * Output only. Revision of the workflow this execution is using. - * - * Generated from protobuf field string workflow_revision_id = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setWorkflowRevisionId($var) - { - GPBUtil::checkString($var, True); - $this->workflow_revision_id = $var; - - return $this; - } - -} - diff --git a/Workflows/src/Executions/V1beta/Execution/Error.php b/Workflows/src/Executions/V1beta/Execution/Error.php deleted file mode 100644 index 1b33ff29b549..000000000000 --- a/Workflows/src/Executions/V1beta/Execution/Error.php +++ /dev/null @@ -1,104 +0,0 @@ -google.cloud.workflows.executions.v1beta.Execution.Error - */ -class Error extends \Google\Protobuf\Internal\Message -{ - /** - * Error payload returned by the execution, represented as a JSON string. - * - * Generated from protobuf field string payload = 1; - */ - private $payload = ''; - /** - * Human readable error context, helpful for debugging purposes. - * - * Generated from protobuf field string context = 2; - */ - private $context = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $payload - * Error payload returned by the execution, represented as a JSON string. - * @type string $context - * Human readable error context, helpful for debugging purposes. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Workflows\Executions\V1Beta\Executions::initOnce(); - parent::__construct($data); - } - - /** - * Error payload returned by the execution, represented as a JSON string. - * - * Generated from protobuf field string payload = 1; - * @return string - */ - public function getPayload() - { - return $this->payload; - } - - /** - * Error payload returned by the execution, represented as a JSON string. - * - * Generated from protobuf field string payload = 1; - * @param string $var - * @return $this - */ - public function setPayload($var) - { - GPBUtil::checkString($var, True); - $this->payload = $var; - - return $this; - } - - /** - * Human readable error context, helpful for debugging purposes. - * - * Generated from protobuf field string context = 2; - * @return string - */ - public function getContext() - { - return $this->context; - } - - /** - * Human readable error context, helpful for debugging purposes. - * - * Generated from protobuf field string context = 2; - * @param string $var - * @return $this - */ - public function setContext($var) - { - GPBUtil::checkString($var, True); - $this->context = $var; - - return $this; - } - -} - -// Adding a class alias for backwards compatibility with the previous class name. -class_alias(Error::class, \Google\Cloud\Workflows\Executions\V1beta\Execution_Error::class); - diff --git a/Workflows/src/Executions/V1beta/Execution/State.php b/Workflows/src/Executions/V1beta/Execution/State.php deleted file mode 100644 index cb9bfc9bd8b8..000000000000 --- a/Workflows/src/Executions/V1beta/Execution/State.php +++ /dev/null @@ -1,79 +0,0 @@ -google.cloud.workflows.executions.v1beta.Execution.State - */ -class State -{ - /** - * Invalid state. - * - * Generated from protobuf enum STATE_UNSPECIFIED = 0; - */ - const STATE_UNSPECIFIED = 0; - /** - * The execution is in progress. - * - * Generated from protobuf enum ACTIVE = 1; - */ - const ACTIVE = 1; - /** - * The execution finished successfully. - * - * Generated from protobuf enum SUCCEEDED = 2; - */ - const SUCCEEDED = 2; - /** - * The execution failed with an error. - * - * Generated from protobuf enum FAILED = 3; - */ - const FAILED = 3; - /** - * The execution was stopped intentionally. - * - * Generated from protobuf enum CANCELLED = 4; - */ - const CANCELLED = 4; - - private static $valueToName = [ - self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', - self::ACTIVE => 'ACTIVE', - 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\Workflows\Executions\V1beta\Execution_State::class); - diff --git a/Workflows/src/Executions/V1beta/ExecutionView.php b/Workflows/src/Executions/V1beta/ExecutionView.php deleted file mode 100644 index 22912dec5990..000000000000 --- a/Workflows/src/Executions/V1beta/ExecutionView.php +++ /dev/null @@ -1,63 +0,0 @@ -google.cloud.workflows.executions.v1beta.ExecutionView - */ -class ExecutionView -{ - /** - * The default / unset value. - * - * Generated from protobuf enum EXECUTION_VIEW_UNSPECIFIED = 0; - */ - const EXECUTION_VIEW_UNSPECIFIED = 0; - /** - * Includes only basic metadata about the execution. - * Following fields are returned: name, start_time, end_time, state - * and workflow_revision_id. - * - * Generated from protobuf enum BASIC = 1; - */ - const BASIC = 1; - /** - * Includes all data. - * - * Generated from protobuf enum FULL = 2; - */ - const FULL = 2; - - private static $valueToName = [ - self::EXECUTION_VIEW_UNSPECIFIED => 'EXECUTION_VIEW_UNSPECIFIED', - self::BASIC => 'BASIC', - self::FULL => 'FULL', - ]; - - 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/Workflows/src/Executions/V1beta/ExecutionsClient.php b/Workflows/src/Executions/V1beta/ExecutionsClient.php deleted file mode 100644 index a68a0572ff64..000000000000 --- a/Workflows/src/Executions/V1beta/ExecutionsClient.php +++ /dev/null @@ -1,36 +0,0 @@ -executionName('[PROJECT]', '[LOCATION]', '[WORKFLOW]', '[EXECUTION]'); - * $response = $executionsClient->cancelExecution($formattedName); - * } finally { - * $executionsClient->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 - * - * @deprecated This class will be removed in the next major version update. - */ -class ExecutionsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.workflows.executions.v1beta.Executions'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'workflowexecutions.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'workflowexecutions.UNIVERSE_DOMAIN'; - - /** 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 $executionNameTemplate; - - private static $workflowNameTemplate; - - private static $pathTemplateMap; - - private static function getClientDefaults() - { - return [ - 'serviceName' => self::SERVICE_NAME, - 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, - 'clientConfig' => __DIR__ . '/../resources/executions_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/executions_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/executions_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/executions_rest_client_config.php', - ], - ], - ]; - } - - private static function getExecutionNameTemplate() - { - if (self::$executionNameTemplate == null) { - self::$executionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution}'); - } - - return self::$executionNameTemplate; - } - - private static function getWorkflowNameTemplate() - { - if (self::$workflowNameTemplate == null) { - self::$workflowNameTemplate = new PathTemplate('projects/{project}/locations/{location}/workflows/{workflow}'); - } - - return self::$workflowNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'execution' => self::getExecutionNameTemplate(), - 'workflow' => self::getWorkflowNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * Formats a string containing the fully-qualified path to represent a execution - * resource. - * - * @param string $project - * @param string $location - * @param string $workflow - * @param string $execution - * - * @return string The formatted execution resource. - * - * @experimental - */ - public static function executionName($project, $location, $workflow, $execution) - { - return self::getExecutionNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'workflow' => $workflow, - 'execution' => $execution, - ]); - } - - /** - * Formats a string containing the fully-qualified path to represent a workflow - * resource. - * - * @param string $project - * @param string $location - * @param string $workflow - * - * @return string The formatted workflow resource. - * - * @experimental - */ - public static function workflowName($project, $location, $workflow) - { - return self::getWorkflowNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'workflow' => $workflow, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - execution: projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * - workflow: projects/{project}/locations/{location}/workflows/{workflow} - * - * 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 'workflowexecutions.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); - } - - /** - * Cancels an execution of the given name. - * - * Sample code: - * ``` - * $executionsClient = new ExecutionsClient(); - * try { - * $formattedName = $executionsClient->executionName('[PROJECT]', '[LOCATION]', '[WORKFLOW]', '[EXECUTION]'); - * $response = $executionsClient->cancelExecution($formattedName); - * } finally { - * $executionsClient->close(); - * } - * ``` - * - * @param string $name Required. Name of the execution to be cancelled. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * @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\Workflows\Executions\V1beta\Execution - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function cancelExecution($name, array $optionalArgs = []) - { - $request = new CancelExecutionRequest(); - $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('CancelExecution', Execution::class, $optionalArgs, $request)->wait(); - } - - /** - * Creates a new execution using the latest revision of the given workflow. - * - * Sample code: - * ``` - * $executionsClient = new ExecutionsClient(); - * try { - * $formattedParent = $executionsClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); - * $execution = new Execution(); - * $response = $executionsClient->createExecution($formattedParent, $execution); - * } finally { - * $executionsClient->close(); - * } - * ``` - * - * @param string $parent Required. Name of the workflow for which an execution should be created. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * The latest revision of the workflow will be used. - * @param Execution $execution Required. Execution to be created. - * @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\Workflows\Executions\V1beta\Execution - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function createExecution($parent, $execution, array $optionalArgs = []) - { - $request = new CreateExecutionRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setExecution($execution); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('CreateExecution', Execution::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns an execution of the given name. - * - * Sample code: - * ``` - * $executionsClient = new ExecutionsClient(); - * try { - * $formattedName = $executionsClient->executionName('[PROJECT]', '[LOCATION]', '[WORKFLOW]', '[EXECUTION]'); - * $response = $executionsClient->getExecution($formattedName); - * } finally { - * $executionsClient->close(); - * } - * ``` - * - * @param string $name Required. Name of the execution to be retrieved. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * @param array $optionalArgs { - * Optional. - * - * @type int $view - * Optional. A view defining which fields should be filled in the returned execution. - * The API will default to the FULL view. - * For allowed values, use constants defined on {@see \Google\Cloud\Workflows\Executions\V1beta\ExecutionView} - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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\Workflows\Executions\V1beta\Execution - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function getExecution($name, array $optionalArgs = []) - { - $request = new GetExecutionRequest(); - $requestParamHeaders = []; - $request->setName($name); - $requestParamHeaders['name'] = $name; - if (isset($optionalArgs['view'])) { - $request->setView($optionalArgs['view']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startCall('GetExecution', Execution::class, $optionalArgs, $request)->wait(); - } - - /** - * Returns a list of executions which belong to the workflow with - * the given name. The method returns executions of all workflow - * revisions. Returned executions are ordered by their start time (newest - * first). - * - * Sample code: - * ``` - * $executionsClient = new ExecutionsClient(); - * try { - * $formattedParent = $executionsClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); - * // Iterate over pages of elements - * $pagedResponse = $executionsClient->listExecutions($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $executionsClient->listExecutions($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $executionsClient->close(); - * } - * ``` - * - * @param string $parent Required. Name of the workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @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 int $view - * Optional. A view defining which fields should be filled in the returned executions. - * The API will default to the BASIC view. - * For allowed values, use constants defined on {@see \Google\Cloud\Workflows\Executions\V1beta\ExecutionView} - * @type RetrySettings|array $retrySettings - * Retry settings to use for this call. Can 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 listExecutions($parent, array $optionalArgs = []) - { - $request = new ListExecutionsRequest(); - $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['view'])) { - $request->setView($optionalArgs['view']); - } - - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->getPagedListResponse('ListExecutions', $optionalArgs, ListExecutionsResponse::class, $request); - } -} diff --git a/Workflows/src/Executions/V1beta/GetExecutionRequest.php b/Workflows/src/Executions/V1beta/GetExecutionRequest.php deleted file mode 100644 index 2ac342a3b887..000000000000 --- a/Workflows/src/Executions/V1beta/GetExecutionRequest.php +++ /dev/null @@ -1,115 +0,0 @@ -google.cloud.workflows.executions.v1beta.GetExecutionRequest - */ -class GetExecutionRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Name of the execution to be retrieved. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - private $name = ''; - /** - * Optional. A view defining which fields should be filled in the returned execution. - * The API will default to the FULL view. - * - * Generated from protobuf field .google.cloud.workflows.executions.v1beta.ExecutionView view = 2 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $view = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. Name of the execution to be retrieved. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * @type int $view - * Optional. A view defining which fields should be filled in the returned execution. - * The API will default to the FULL view. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Workflows\Executions\V1Beta\Executions::initOnce(); - parent::__construct($data); - } - - /** - * Required. Name of the execution to be retrieved. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * - * 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 execution to be retrieved. - * Format: - * projects/{project}/locations/{location}/workflows/{workflow}/executions/{execution} - * - * 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 view defining which fields should be filled in the returned execution. - * The API will default to the FULL view. - * - * Generated from protobuf field .google.cloud.workflows.executions.v1beta.ExecutionView view = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @return int - */ - public function getView() - { - return $this->view; - } - - /** - * Optional. A view defining which fields should be filled in the returned execution. - * The API will default to the FULL view. - * - * Generated from protobuf field .google.cloud.workflows.executions.v1beta.ExecutionView view = 2 [(.google.api.field_behavior) = OPTIONAL]; - * @param int $var - * @return $this - */ - public function setView($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Workflows\Executions\V1beta\ExecutionView::class); - $this->view = $var; - - return $this; - } - -} - diff --git a/Workflows/src/Executions/V1beta/ListExecutionsRequest.php b/Workflows/src/Executions/V1beta/ListExecutionsRequest.php deleted file mode 100644 index 381379eca97d..000000000000 --- a/Workflows/src/Executions/V1beta/ListExecutionsRequest.php +++ /dev/null @@ -1,207 +0,0 @@ -google.cloud.workflows.executions.v1beta.ListExecutionsRequest - */ -class ListExecutionsRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Name of the workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - private $parent = ''; - /** - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 10000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * - * Generated from protobuf field int32 page_size = 2; - */ - private $page_size = 0; - /** - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * - * Generated from protobuf field string page_token = 3; - */ - private $page_token = ''; - /** - * Optional. A view defining which fields should be filled in the returned executions. - * The API will default to the BASIC view. - * - * Generated from protobuf field .google.cloud.workflows.executions.v1beta.ExecutionView view = 4 [(.google.api.field_behavior) = OPTIONAL]; - */ - private $view = 0; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. Name of the workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @type int $page_size - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 10000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * @type string $page_token - * A page token, received from a previous `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListExecutions` must - * match the call that provided the page token. - * @type int $view - * Optional. A view defining which fields should be filled in the returned executions. - * The API will default to the BASIC view. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Workflows\Executions\V1Beta\Executions::initOnce(); - parent::__construct($data); - } - - /** - * Required. Name of the workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * - * 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 workflow for which the executions should be listed. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * - * 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; - } - - /** - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 10000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * - * Generated from protobuf field int32 page_size = 2; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * Maximum number of executions to return per call. - * Max supported value depends on the selected Execution view: it's 10000 for - * BASIC and 100 for FULL. The default value used if the field is not - * specified is 100, regardless of the selected view. Values greater than - * the max value will be coerced down to it. - * - * 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 `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListExecutions` 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 `ListExecutions` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListExecutions` 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; - } - - /** - * Optional. A view defining which fields should be filled in the returned executions. - * The API will default to the BASIC view. - * - * Generated from protobuf field .google.cloud.workflows.executions.v1beta.ExecutionView view = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @return int - */ - public function getView() - { - return $this->view; - } - - /** - * Optional. A view defining which fields should be filled in the returned executions. - * The API will default to the BASIC view. - * - * Generated from protobuf field .google.cloud.workflows.executions.v1beta.ExecutionView view = 4 [(.google.api.field_behavior) = OPTIONAL]; - * @param int $var - * @return $this - */ - public function setView($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Workflows\Executions\V1beta\ExecutionView::class); - $this->view = $var; - - return $this; - } - -} - diff --git a/Workflows/src/Executions/V1beta/ListExecutionsResponse.php b/Workflows/src/Executions/V1beta/ListExecutionsResponse.php deleted file mode 100644 index ce188e047f70..000000000000 --- a/Workflows/src/Executions/V1beta/ListExecutionsResponse.php +++ /dev/null @@ -1,107 +0,0 @@ -google.cloud.workflows.executions.v1beta.ListExecutionsResponse - */ -class ListExecutionsResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The executions which match the request. - * - * Generated from protobuf field repeated .google.cloud.workflows.executions.v1beta.Execution executions = 1; - */ - private $executions; - /** - * 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; - */ - private $next_page_token = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type array<\Google\Cloud\Workflows\Executions\V1beta\Execution>|\Google\Protobuf\Internal\RepeatedField $executions - * The executions which match the request. - * @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\Workflows\Executions\V1Beta\Executions::initOnce(); - parent::__construct($data); - } - - /** - * The executions which match the request. - * - * Generated from protobuf field repeated .google.cloud.workflows.executions.v1beta.Execution executions = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getExecutions() - { - return $this->executions; - } - - /** - * The executions which match the request. - * - * Generated from protobuf field repeated .google.cloud.workflows.executions.v1beta.Execution executions = 1; - * @param array<\Google\Cloud\Workflows\Executions\V1beta\Execution>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setExecutions($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Workflows\Executions\V1beta\Execution::class); - $this->executions = $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/Workflows/src/Executions/V1beta/gapic_metadata.json b/Workflows/src/Executions/V1beta/gapic_metadata.json deleted file mode 100644 index 81c967306926..000000000000 --- a/Workflows/src/Executions/V1beta/gapic_metadata.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services\/RPCs to the corresponding library clients\/methods", - "language": "php", - "protoPackage": "google.cloud.workflows.executions.v1beta", - "libraryPackage": "Google\\Cloud\\Workflows\\Executions\\V1beta", - "services": { - "Executions": { - "clients": { - "grpc": { - "libraryClient": "ExecutionsGapicClient", - "rpcs": { - "CancelExecution": { - "methods": [ - "cancelExecution" - ] - }, - "CreateExecution": { - "methods": [ - "createExecution" - ] - }, - "GetExecution": { - "methods": [ - "getExecution" - ] - }, - "ListExecutions": { - "methods": [ - "listExecutions" - ] - } - } - } - } - } - } -} \ No newline at end of file diff --git a/Workflows/src/Executions/V1beta/resources/executions_client_config.json b/Workflows/src/Executions/V1beta/resources/executions_client_config.json deleted file mode 100644 index a3c456bd2230..000000000000 --- a/Workflows/src/Executions/V1beta/resources/executions_client_config.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.cloud.workflows.executions.v1beta.Executions": { - "retry_codes": { - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "non_idempotent": [] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 20000, - "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 20000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CancelExecution": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateExecution": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetExecution": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListExecutions": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/Workflows/src/Executions/V1beta/resources/executions_descriptor_config.php b/Workflows/src/Executions/V1beta/resources/executions_descriptor_config.php deleted file mode 100644 index 2b27d3161e9f..000000000000 --- a/Workflows/src/Executions/V1beta/resources/executions_descriptor_config.php +++ /dev/null @@ -1,38 +0,0 @@ - [ - 'google.cloud.workflows.executions.v1beta.Executions' => [ - 'ListExecutions' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getExecutions', - ], - ], - ], - ], -]; diff --git a/Workflows/src/Executions/V1beta/resources/executions_rest_client_config.php b/Workflows/src/Executions/V1beta/resources/executions_rest_client_config.php deleted file mode 100644 index fe15ac4028fa..000000000000 --- a/Workflows/src/Executions/V1beta/resources/executions_rest_client_config.php +++ /dev/null @@ -1,74 +0,0 @@ - [ - 'google.cloud.workflows.executions.v1beta.Executions' => [ - 'CancelExecution' => [ - 'method' => 'post', - 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/workflows/*/executions/*}:cancel', - 'body' => '*', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'CreateExecution' => [ - 'method' => 'post', - 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*/workflows/*}/executions', - 'body' => 'execution', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'GetExecution' => [ - 'method' => 'get', - 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/workflows/*/executions/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'ListExecutions' => [ - 'method' => 'get', - 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*/workflows/*}/executions', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - ], - ], -]; diff --git a/Workflows/src/V1beta/CreateWorkflowRequest.php b/Workflows/src/V1beta/CreateWorkflowRequest.php deleted file mode 100644 index a6088d858c0c..000000000000 --- a/Workflows/src/V1beta/CreateWorkflowRequest.php +++ /dev/null @@ -1,175 +0,0 @@ -google.cloud.workflows.v1beta.CreateWorkflowRequest - */ -class CreateWorkflowRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Project and location in which the workflow should be created. - * Format: projects/{project}/locations/{location} - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - private $parent = ''; - /** - * Required. Workflow to be created. - * - * Generated from protobuf field .google.cloud.workflows.v1beta.Workflow workflow = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - private $workflow = null; - /** - * Required. The ID of the workflow to be created. It has to fulfill the - * following requirements: - * * Must contain only letters, numbers, underscores and hyphens. - * * Must start with a letter. - * * Must be between 1-64 characters. - * * Must end with a number or a letter. - * * Must be unique within the customer project and location. - * - * Generated from protobuf field string workflow_id = 3 [(.google.api.field_behavior) = REQUIRED]; - */ - private $workflow_id = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. Project and location in which the workflow should be created. - * Format: projects/{project}/locations/{location} - * @type \Google\Cloud\Workflows\V1beta\Workflow $workflow - * Required. Workflow to be created. - * @type string $workflow_id - * Required. The ID of the workflow to be created. It has to fulfill the - * following requirements: - * * Must contain only letters, numbers, underscores and hyphens. - * * Must start with a letter. - * * Must be between 1-64 characters. - * * Must end with a number or a letter. - * * Must be unique within the customer project and location. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Workflows\V1Beta\Workflows::initOnce(); - parent::__construct($data); - } - - /** - * Required. Project and location in which the workflow should be created. - * Format: projects/{project}/locations/{location} - * - * 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. Project and location in which the workflow should be created. - * Format: projects/{project}/locations/{location} - * - * 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. Workflow to be created. - * - * Generated from protobuf field .google.cloud.workflows.v1beta.Workflow workflow = 2 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Workflows\V1beta\Workflow|null - */ - public function getWorkflow() - { - return $this->workflow; - } - - public function hasWorkflow() - { - return isset($this->workflow); - } - - public function clearWorkflow() - { - unset($this->workflow); - } - - /** - * Required. Workflow to be created. - * - * Generated from protobuf field .google.cloud.workflows.v1beta.Workflow workflow = 2 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Workflows\V1beta\Workflow $var - * @return $this - */ - public function setWorkflow($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Workflows\V1beta\Workflow::class); - $this->workflow = $var; - - return $this; - } - - /** - * Required. The ID of the workflow to be created. It has to fulfill the - * following requirements: - * * Must contain only letters, numbers, underscores and hyphens. - * * Must start with a letter. - * * Must be between 1-64 characters. - * * Must end with a number or a letter. - * * Must be unique within the customer project and location. - * - * Generated from protobuf field string workflow_id = 3 [(.google.api.field_behavior) = REQUIRED]; - * @return string - */ - public function getWorkflowId() - { - return $this->workflow_id; - } - - /** - * Required. The ID of the workflow to be created. It has to fulfill the - * following requirements: - * * Must contain only letters, numbers, underscores and hyphens. - * * Must start with a letter. - * * Must be between 1-64 characters. - * * Must end with a number or a letter. - * * Must be unique within the customer project and location. - * - * Generated from protobuf field string workflow_id = 3 [(.google.api.field_behavior) = REQUIRED]; - * @param string $var - * @return $this - */ - public function setWorkflowId($var) - { - GPBUtil::checkString($var, True); - $this->workflow_id = $var; - - return $this; - } - -} - diff --git a/Workflows/src/V1beta/DeleteWorkflowRequest.php b/Workflows/src/V1beta/DeleteWorkflowRequest.php deleted file mode 100644 index 70a0f827318a..000000000000 --- a/Workflows/src/V1beta/DeleteWorkflowRequest.php +++ /dev/null @@ -1,73 +0,0 @@ -google.cloud.workflows.v1beta.DeleteWorkflowRequest - */ -class DeleteWorkflowRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Name of the workflow to be deleted. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - private $name = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. Name of the workflow to be deleted. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Workflows\V1Beta\Workflows::initOnce(); - parent::__construct($data); - } - - /** - * Required. Name of the workflow to be deleted. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * - * 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 workflow to be deleted. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * - * 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/Workflows/src/V1beta/Gapic/WorkflowsGapicClient.php b/Workflows/src/V1beta/Gapic/WorkflowsGapicClient.php deleted file mode 100644 index 80b599e4264b..000000000000 --- a/Workflows/src/V1beta/Gapic/WorkflowsGapicClient.php +++ /dev/null @@ -1,723 +0,0 @@ -locationName('[PROJECT]', '[LOCATION]'); - * $workflow = new Workflow(); - * $workflowId = 'workflow_id'; - * $operationResponse = $workflowsClient->createWorkflow($formattedParent, $workflow, $workflowId); - * $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 = $workflowsClient->createWorkflow($formattedParent, $workflow, $workflowId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $workflowsClient->resumeOperation($operationName, 'createWorkflow'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $workflowsClient->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 - * - * @deprecated This class will be removed in the next major version update. - */ -class WorkflowsGapicClient -{ - use GapicClientTrait; - - /** The name of the service. */ - const SERVICE_NAME = 'google.cloud.workflows.v1beta.Workflows'; - - /** - * The default address of the service. - * - * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. - */ - const SERVICE_ADDRESS = 'workflows.googleapis.com'; - - /** The address template of the service. */ - private const SERVICE_ADDRESS_TEMPLATE = 'workflows.UNIVERSE_DOMAIN'; - - /** 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 $locationNameTemplate; - - private static $workflowNameTemplate; - - 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/workflows_client_config.json', - 'descriptorsConfigPath' => __DIR__ . '/../resources/workflows_descriptor_config.php', - 'gcpApiConfigPath' => __DIR__ . '/../resources/workflows_grpc_config.json', - 'credentialsConfig' => [ - 'defaultScopes' => self::$serviceScopes, - ], - 'transportConfig' => [ - 'rest' => [ - 'restClientConfigPath' => __DIR__ . '/../resources/workflows_rest_client_config.php', - ], - ], - ]; - } - - private static function getLocationNameTemplate() - { - if (self::$locationNameTemplate == null) { - self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); - } - - return self::$locationNameTemplate; - } - - private static function getWorkflowNameTemplate() - { - if (self::$workflowNameTemplate == null) { - self::$workflowNameTemplate = new PathTemplate('projects/{project}/locations/{location}/workflows/{workflow}'); - } - - return self::$workflowNameTemplate; - } - - private static function getPathTemplateMap() - { - if (self::$pathTemplateMap == null) { - self::$pathTemplateMap = [ - 'location' => self::getLocationNameTemplate(), - 'workflow' => self::getWorkflowNameTemplate(), - ]; - } - - return self::$pathTemplateMap; - } - - /** - * 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 workflow - * resource. - * - * @param string $project - * @param string $location - * @param string $workflow - * - * @return string The formatted workflow resource. - * - * @experimental - */ - public static function workflowName($project, $location, $workflow) - { - return self::getWorkflowNameTemplate()->render([ - 'project' => $project, - 'location' => $location, - 'workflow' => $workflow, - ]); - } - - /** - * Parses a formatted name string and returns an associative array of the components in the name. - * The following name formats are supported: - * Template: Pattern - * - location: projects/{project}/locations/{location} - * - workflow: projects/{project}/locations/{location}/workflows/{workflow} - * - * 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 'workflows.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 new workflow. If a workflow with the specified name already - * exists in the specified project and location, the long running operation - * will return [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS] error. - * - * Sample code: - * ``` - * $workflowsClient = new WorkflowsClient(); - * try { - * $formattedParent = $workflowsClient->locationName('[PROJECT]', '[LOCATION]'); - * $workflow = new Workflow(); - * $workflowId = 'workflow_id'; - * $operationResponse = $workflowsClient->createWorkflow($formattedParent, $workflow, $workflowId); - * $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 = $workflowsClient->createWorkflow($formattedParent, $workflow, $workflowId); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $workflowsClient->resumeOperation($operationName, 'createWorkflow'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $workflowsClient->close(); - * } - * ``` - * - * @param string $parent Required. Project and location in which the workflow should be created. - * Format: projects/{project}/locations/{location} - * @param Workflow $workflow Required. Workflow to be created. - * @param string $workflowId Required. The ID of the workflow to be created. It has to fulfill the - * following requirements: - * - * * Must contain only letters, numbers, underscores and hyphens. - * * Must start with a letter. - * * Must be between 1-64 characters. - * * Must end with a number or a letter. - * * Must be unique within the customer project and 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 - * - * @experimental - */ - public function createWorkflow($parent, $workflow, $workflowId, array $optionalArgs = []) - { - $request = new CreateWorkflowRequest(); - $requestParamHeaders = []; - $request->setParent($parent); - $request->setWorkflow($workflow); - $request->setWorkflowId($workflowId); - $requestParamHeaders['parent'] = $parent; - $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); - $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); - return $this->startOperationsCall('CreateWorkflow', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Deletes a workflow with the specified name. - * This method also cancels and deletes all running executions of the - * workflow. - * - * Sample code: - * ``` - * $workflowsClient = new WorkflowsClient(); - * try { - * $formattedName = $workflowsClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); - * $operationResponse = $workflowsClient->deleteWorkflow($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 = $workflowsClient->deleteWorkflow($formattedName); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $workflowsClient->resumeOperation($operationName, 'deleteWorkflow'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * // operation succeeded and returns no value - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $workflowsClient->close(); - * } - * ``` - * - * @param string $name Required. Name of the workflow to be deleted. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @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 deleteWorkflow($name, array $optionalArgs = []) - { - $request = new DeleteWorkflowRequest(); - $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->startOperationsCall('DeleteWorkflow', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } - - /** - * Gets details of a single Workflow. - * - * Sample code: - * ``` - * $workflowsClient = new WorkflowsClient(); - * try { - * $formattedName = $workflowsClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); - * $response = $workflowsClient->getWorkflow($formattedName); - * } finally { - * $workflowsClient->close(); - * } - * ``` - * - * @param string $name Required. Name of the workflow which information should be retrieved. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @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\Workflows\V1beta\Workflow - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function getWorkflow($name, array $optionalArgs = []) - { - $request = new GetWorkflowRequest(); - $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('GetWorkflow', Workflow::class, $optionalArgs, $request)->wait(); - } - - /** - * Lists Workflows in a given project and location. - * The default order is not specified. - * - * Sample code: - * ``` - * $workflowsClient = new WorkflowsClient(); - * try { - * $formattedParent = $workflowsClient->locationName('[PROJECT]', '[LOCATION]'); - * // Iterate over pages of elements - * $pagedResponse = $workflowsClient->listWorkflows($formattedParent); - * foreach ($pagedResponse->iteratePages() as $page) { - * foreach ($page as $element) { - * // doSomethingWith($element); - * } - * } - * // Alternatively: - * // Iterate through all elements - * $pagedResponse = $workflowsClient->listWorkflows($formattedParent); - * foreach ($pagedResponse->iterateAllElements() as $element) { - * // doSomethingWith($element); - * } - * } finally { - * $workflowsClient->close(); - * } - * ``` - * - * @param string $parent Required. Project and location from which the workflows should be listed. - * Format: projects/{project}/locations/{location} - * @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 to restrict results to specific workflows. - * @type string $orderBy - * Comma-separated list of fields that that specify the order of the results. - * Default sorting order for a field is ascending. To specify descending order - * for a field, append a " desc" suffix. - * If not specified, the results will be returned in an unspecified 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 listWorkflows($parent, array $optionalArgs = []) - { - $request = new ListWorkflowsRequest(); - $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('ListWorkflows', $optionalArgs, ListWorkflowsResponse::class, $request); - } - - /** - * Updates an existing workflow. - * Running this method has no impact on already running executions of the - * workflow. A new revision of the workflow may be created as a result of a - * successful update operation. In that case, such revision will be used - * in new workflow executions. - * - * Sample code: - * ``` - * $workflowsClient = new WorkflowsClient(); - * try { - * $workflow = new Workflow(); - * $operationResponse = $workflowsClient->updateWorkflow($workflow); - * $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 = $workflowsClient->updateWorkflow($workflow); - * $operationName = $operationResponse->getName(); - * // ... do other work - * $newOperationResponse = $workflowsClient->resumeOperation($operationName, 'updateWorkflow'); - * while (!$newOperationResponse->isDone()) { - * // ... do other work - * $newOperationResponse->reload(); - * } - * if ($newOperationResponse->operationSucceeded()) { - * $result = $newOperationResponse->getResult(); - * // doSomethingWith($result) - * } else { - * $error = $newOperationResponse->getError(); - * // handleError($error) - * } - * } finally { - * $workflowsClient->close(); - * } - * ``` - * - * @param Workflow $workflow Required. Workflow to be updated. - * @param array $optionalArgs { - * Optional. - * - * @type FieldMask $updateMask - * List of fields to be updated. If not present, the entire workflow - * 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\ApiCore\OperationResponse - * - * @throws ApiException if the remote call fails - * - * @experimental - */ - public function updateWorkflow($workflow, array $optionalArgs = []) - { - $request = new UpdateWorkflowRequest(); - $requestParamHeaders = []; - $request->setWorkflow($workflow); - $requestParamHeaders['workflow.name'] = $workflow->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('UpdateWorkflow', $optionalArgs, $request, $this->getOperationsClient())->wait(); - } -} diff --git a/Workflows/src/V1beta/GetWorkflowRequest.php b/Workflows/src/V1beta/GetWorkflowRequest.php deleted file mode 100644 index eb4653f6db69..000000000000 --- a/Workflows/src/V1beta/GetWorkflowRequest.php +++ /dev/null @@ -1,72 +0,0 @@ -google.cloud.workflows.v1beta.GetWorkflowRequest - */ -class GetWorkflowRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Name of the workflow which information should be retrieved. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * - * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - private $name = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * Required. Name of the workflow which information should be retrieved. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Workflows\V1Beta\Workflows::initOnce(); - parent::__construct($data); - } - - /** - * Required. Name of the workflow which information should be retrieved. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * - * 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 workflow which information should be retrieved. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * - * 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/Workflows/src/V1beta/ListWorkflowsRequest.php b/Workflows/src/V1beta/ListWorkflowsRequest.php deleted file mode 100644 index d6301521ecc5..000000000000 --- a/Workflows/src/V1beta/ListWorkflowsRequest.php +++ /dev/null @@ -1,245 +0,0 @@ -google.cloud.workflows.v1beta.ListWorkflowsRequest - */ -class ListWorkflowsRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Project and location from which the workflows should be listed. - * Format: projects/{project}/locations/{location} - * - * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { - */ - private $parent = ''; - /** - * Maximum number of workflows to return per call. The service may return - * fewer than this value. If the value is not specified, a default value of - * 500 will be used. The maximum permitted value is 1000 and values greater - * than 1000 will be coerced down to 1000. - * - * Generated from protobuf field int32 page_size = 2; - */ - private $page_size = 0; - /** - * A page token, received from a previous `ListWorkflows` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListWorkflows` must - * match the call that provided the page token. - * - * Generated from protobuf field string page_token = 3; - */ - private $page_token = ''; - /** - * Filter to restrict results to specific workflows. - * - * Generated from protobuf field string filter = 4; - */ - private $filter = ''; - /** - * Comma-separated list of fields that that specify the order of the results. - * Default sorting order for a field is ascending. To specify descending order - * for a field, append a " desc" suffix. - * If not specified, the results will be returned in an unspecified order. - * - * Generated from protobuf field string order_by = 5; - */ - private $order_by = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $parent - * Required. Project and location from which the workflows should be listed. - * Format: projects/{project}/locations/{location} - * @type int $page_size - * Maximum number of workflows to return per call. The service may return - * fewer than this value. If the value is not specified, a default value of - * 500 will be used. The maximum permitted value is 1000 and values greater - * than 1000 will be coerced down to 1000. - * @type string $page_token - * A page token, received from a previous `ListWorkflows` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListWorkflows` must - * match the call that provided the page token. - * @type string $filter - * Filter to restrict results to specific workflows. - * @type string $order_by - * Comma-separated list of fields that that specify the order of the results. - * Default sorting order for a field is ascending. To specify descending order - * for a field, append a " desc" suffix. - * If not specified, the results will be returned in an unspecified order. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Workflows\V1Beta\Workflows::initOnce(); - parent::__construct($data); - } - - /** - * Required. Project and location from which the workflows should be listed. - * Format: projects/{project}/locations/{location} - * - * 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. Project and location from which the workflows should be listed. - * Format: projects/{project}/locations/{location} - * - * 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; - } - - /** - * Maximum number of workflows to return per call. The service may return - * fewer than this value. If the value is not specified, a default value of - * 500 will be used. The maximum permitted value is 1000 and values greater - * than 1000 will be coerced down to 1000. - * - * Generated from protobuf field int32 page_size = 2; - * @return int - */ - public function getPageSize() - { - return $this->page_size; - } - - /** - * Maximum number of workflows to return per call. The service may return - * fewer than this value. If the value is not specified, a default value of - * 500 will be used. The maximum permitted value is 1000 and values greater - * than 1000 will be coerced down 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 `ListWorkflows` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListWorkflows` 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 `ListWorkflows` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListWorkflows` 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; - } - - /** - * Filter to restrict results to specific workflows. - * - * Generated from protobuf field string filter = 4; - * @return string - */ - public function getFilter() - { - return $this->filter; - } - - /** - * Filter to restrict results to specific workflows. - * - * 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; - } - - /** - * Comma-separated list of fields that that specify the order of the results. - * Default sorting order for a field is ascending. To specify descending order - * for a field, append a " desc" suffix. - * If not specified, the results will be returned in an unspecified order. - * - * Generated from protobuf field string order_by = 5; - * @return string - */ - public function getOrderBy() - { - return $this->order_by; - } - - /** - * Comma-separated list of fields that that specify the order of the results. - * Default sorting order for a field is ascending. To specify descending order - * for a field, append a " desc" suffix. - * If not specified, the results will be returned in an unspecified order. - * - * 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/Workflows/src/V1beta/ListWorkflowsResponse.php b/Workflows/src/V1beta/ListWorkflowsResponse.php deleted file mode 100644 index ed685cd71462..000000000000 --- a/Workflows/src/V1beta/ListWorkflowsResponse.php +++ /dev/null @@ -1,141 +0,0 @@ -google.cloud.workflows.v1beta.ListWorkflowsResponse - */ -class ListWorkflowsResponse extends \Google\Protobuf\Internal\Message -{ - /** - * The workflows which match the request. - * - * Generated from protobuf field repeated .google.cloud.workflows.v1beta.Workflow workflows = 1; - */ - private $workflows; - /** - * 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; - */ - private $next_page_token = ''; - /** - * Unreachable resources. - * - * 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\Workflows\V1beta\Workflow>|\Google\Protobuf\Internal\RepeatedField $workflows - * The workflows which match the request. - * @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 - * Unreachable resources. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Workflows\V1Beta\Workflows::initOnce(); - parent::__construct($data); - } - - /** - * The workflows which match the request. - * - * Generated from protobuf field repeated .google.cloud.workflows.v1beta.Workflow workflows = 1; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getWorkflows() - { - return $this->workflows; - } - - /** - * The workflows which match the request. - * - * Generated from protobuf field repeated .google.cloud.workflows.v1beta.Workflow workflows = 1; - * @param array<\Google\Cloud\Workflows\V1beta\Workflow>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setWorkflows($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Workflows\V1beta\Workflow::class); - $this->workflows = $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; - } - - /** - * Unreachable resources. - * - * Generated from protobuf field repeated string unreachable = 3; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getUnreachable() - { - return $this->unreachable; - } - - /** - * Unreachable resources. - * - * 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/Workflows/src/V1beta/OperationMetadata.php b/Workflows/src/V1beta/OperationMetadata.php deleted file mode 100644 index 44a239a541ef..000000000000 --- a/Workflows/src/V1beta/OperationMetadata.php +++ /dev/null @@ -1,223 +0,0 @@ -google.cloud.workflows.v1beta.OperationMetadata - */ -class OperationMetadata extends \Google\Protobuf\Internal\Message -{ - /** - * The time the operation was created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 1; - */ - private $create_time = null; - /** - * The time the operation finished running. - * - * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; - */ - private $end_time = null; - /** - * Server-defined resource path for the target of the operation. - * - * Generated from protobuf field string target = 3; - */ - private $target = ''; - /** - * Name of the verb executed by the operation. - * - * Generated from protobuf field string verb = 4; - */ - private $verb = ''; - /** - * API version used to start the operation. - * - * Generated from protobuf field string api_version = 5; - */ - private $api_version = ''; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Protobuf\Timestamp $create_time - * The time the operation was created. - * @type \Google\Protobuf\Timestamp $end_time - * The time the operation finished running. - * @type string $target - * Server-defined resource path for the target of the operation. - * @type string $verb - * Name of the verb executed by the operation. - * @type string $api_version - * API version used to start the operation. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Workflows\V1Beta\Workflows::initOnce(); - parent::__construct($data); - } - - /** - * The time the 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); - } - - /** - * The time the 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; - } - - /** - * The time the operation finished running. - * - * 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 finished running. - * - * 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; - } - - /** - * Server-defined resource path for the target of the operation. - * - * Generated from protobuf field string target = 3; - * @return string - */ - public function getTarget() - { - return $this->target; - } - - /** - * Server-defined resource path for the target of the operation. - * - * Generated from protobuf field string target = 3; - * @param string $var - * @return $this - */ - public function setTarget($var) - { - GPBUtil::checkString($var, True); - $this->target = $var; - - return $this; - } - - /** - * Name of the verb executed by the operation. - * - * Generated from protobuf field string verb = 4; - * @return string - */ - public function getVerb() - { - return $this->verb; - } - - /** - * Name of the verb executed by the operation. - * - * Generated from protobuf field string verb = 4; - * @param string $var - * @return $this - */ - public function setVerb($var) - { - GPBUtil::checkString($var, True); - $this->verb = $var; - - return $this; - } - - /** - * API version used to start the operation. - * - * Generated from protobuf field string api_version = 5; - * @return string - */ - public function getApiVersion() - { - return $this->api_version; - } - - /** - * API version used to start the operation. - * - * Generated from protobuf field string api_version = 5; - * @param string $var - * @return $this - */ - public function setApiVersion($var) - { - GPBUtil::checkString($var, True); - $this->api_version = $var; - - return $this; - } - -} - diff --git a/Workflows/src/V1beta/UpdateWorkflowRequest.php b/Workflows/src/V1beta/UpdateWorkflowRequest.php deleted file mode 100644 index 0fc7db7bc170..000000000000 --- a/Workflows/src/V1beta/UpdateWorkflowRequest.php +++ /dev/null @@ -1,127 +0,0 @@ -google.cloud.workflows.v1beta.UpdateWorkflowRequest - */ -class UpdateWorkflowRequest extends \Google\Protobuf\Internal\Message -{ - /** - * Required. Workflow to be updated. - * - * Generated from protobuf field .google.cloud.workflows.v1beta.Workflow workflow = 1 [(.google.api.field_behavior) = REQUIRED]; - */ - private $workflow = null; - /** - * List of fields to be updated. If not present, the entire workflow - * will be updated. - * - * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; - */ - private $update_mask = null; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type \Google\Cloud\Workflows\V1beta\Workflow $workflow - * Required. Workflow to be updated. - * @type \Google\Protobuf\FieldMask $update_mask - * List of fields to be updated. If not present, the entire workflow - * will be updated. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Workflows\V1Beta\Workflows::initOnce(); - parent::__construct($data); - } - - /** - * Required. Workflow to be updated. - * - * Generated from protobuf field .google.cloud.workflows.v1beta.Workflow workflow = 1 [(.google.api.field_behavior) = REQUIRED]; - * @return \Google\Cloud\Workflows\V1beta\Workflow|null - */ - public function getWorkflow() - { - return $this->workflow; - } - - public function hasWorkflow() - { - return isset($this->workflow); - } - - public function clearWorkflow() - { - unset($this->workflow); - } - - /** - * Required. Workflow to be updated. - * - * Generated from protobuf field .google.cloud.workflows.v1beta.Workflow workflow = 1 [(.google.api.field_behavior) = REQUIRED]; - * @param \Google\Cloud\Workflows\V1beta\Workflow $var - * @return $this - */ - public function setWorkflow($var) - { - GPBUtil::checkMessage($var, \Google\Cloud\Workflows\V1beta\Workflow::class); - $this->workflow = $var; - - return $this; - } - - /** - * List of fields to be updated. If not present, the entire workflow - * will be updated. - * - * 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); - } - - /** - * List of fields to be updated. If not present, the entire workflow - * will be updated. - * - * 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/Workflows/src/V1beta/Workflow.php b/Workflows/src/V1beta/Workflow.php deleted file mode 100644 index 9a3de76d3147..000000000000 --- a/Workflows/src/V1beta/Workflow.php +++ /dev/null @@ -1,503 +0,0 @@ -google.cloud.workflows.v1beta.Workflow - */ -class Workflow extends \Google\Protobuf\Internal\Message -{ - /** - * The resource name of the workflow. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * - * Generated from protobuf field string name = 1; - */ - private $name = ''; - /** - * Description of the workflow provided by the user. - * Must be at most 1000 unicode characters long. - * - * Generated from protobuf field string description = 2; - */ - private $description = ''; - /** - * Output only. State of the workflow deployment. - * - * Generated from protobuf field .google.cloud.workflows.v1beta.Workflow.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $state = 0; - /** - * Output only. The revision of the workflow. - * A new revision of a workflow is created as a result of updating the - * following fields of a workflow: - * - `source_code` - * - `service_account` - * The format is "000001-a4d", where the first 6 characters define - * the zero-padded revision ordinal number. They are followed by a hyphen and - * 3 hexadecimal random characters. - * - * Generated from protobuf field string revision_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $revision_id = ''; - /** - * Output only. The timestamp of when the workflow was created. - * - * Generated from protobuf field .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $create_time = null; - /** - * Output only. The last update timestamp of the workflow. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $update_time = null; - /** - * Output only. The timestamp that the latest revision of the workflow - * was created. - * - * Generated from protobuf field .google.protobuf.Timestamp revision_create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; - */ - private $revision_create_time = null; - /** - * Labels associated with this workflow. - * Labels can contain at most 64 entries. Keys and values can be no longer - * than 63 characters and can only contain lowercase letters, numeric - * characters, underscores and dashes. Label keys must start with a letter. - * International characters are allowed. - * - * Generated from protobuf field map labels = 8; - */ - private $labels; - /** - * Name of the service account associated with the latest workflow version. - * This service account represents the identity of the workflow and determines - * what permissions the workflow has. - * Format: projects/{project}/serviceAccounts/{account} - * Using `-` as a wildcard for the `{project}` will infer the project from - * the account. The `{account}` value can be the `email` address or the - * `unique_id` of the service account. - * If not provided, workflow will use the project's default service account. - * Modifying this field for an existing workflow results in a new workflow - * revision. - * - * Generated from protobuf field string service_account = 9; - */ - private $service_account = ''; - protected $source_code; - - /** - * Constructor. - * - * @param array $data { - * Optional. Data for populating the Message object. - * - * @type string $name - * The resource name of the workflow. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * @type string $description - * Description of the workflow provided by the user. - * Must be at most 1000 unicode characters long. - * @type int $state - * Output only. State of the workflow deployment. - * @type string $revision_id - * Output only. The revision of the workflow. - * A new revision of a workflow is created as a result of updating the - * following fields of a workflow: - * - `source_code` - * - `service_account` - * The format is "000001-a4d", where the first 6 characters define - * the zero-padded revision ordinal number. They are followed by a hyphen and - * 3 hexadecimal random characters. - * @type \Google\Protobuf\Timestamp $create_time - * Output only. The timestamp of when the workflow was created. - * @type \Google\Protobuf\Timestamp $update_time - * Output only. The last update timestamp of the workflow. - * @type \Google\Protobuf\Timestamp $revision_create_time - * Output only. The timestamp that the latest revision of the workflow - * was created. - * @type array|\Google\Protobuf\Internal\MapField $labels - * Labels associated with this workflow. - * Labels can contain at most 64 entries. Keys and values can be no longer - * than 63 characters and can only contain lowercase letters, numeric - * characters, underscores and dashes. Label keys must start with a letter. - * International characters are allowed. - * @type string $service_account - * Name of the service account associated with the latest workflow version. - * This service account represents the identity of the workflow and determines - * what permissions the workflow has. - * Format: projects/{project}/serviceAccounts/{account} - * Using `-` as a wildcard for the `{project}` will infer the project from - * the account. The `{account}` value can be the `email` address or the - * `unique_id` of the service account. - * If not provided, workflow will use the project's default service account. - * Modifying this field for an existing workflow results in a new workflow - * revision. - * @type string $source_contents - * Workflow code to be executed. The size limit is 32KB. - * } - */ - public function __construct($data = NULL) { - \GPBMetadata\Google\Cloud\Workflows\V1Beta\Workflows::initOnce(); - parent::__construct($data); - } - - /** - * The resource name of the workflow. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * - * Generated from protobuf field string name = 1; - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * The resource name of the workflow. - * Format: projects/{project}/locations/{location}/workflows/{workflow} - * - * 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; - } - - /** - * Description of the workflow provided by the user. - * Must be at most 1000 unicode characters long. - * - * Generated from protobuf field string description = 2; - * @return string - */ - public function getDescription() - { - return $this->description; - } - - /** - * Description of the workflow provided by the user. - * Must be at most 1000 unicode characters long. - * - * 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. State of the workflow deployment. - * - * Generated from protobuf field .google.cloud.workflows.v1beta.Workflow.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return int - */ - public function getState() - { - return $this->state; - } - - /** - * Output only. State of the workflow deployment. - * - * Generated from protobuf field .google.cloud.workflows.v1beta.Workflow.State state = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param int $var - * @return $this - */ - public function setState($var) - { - GPBUtil::checkEnum($var, \Google\Cloud\Workflows\V1beta\Workflow\State::class); - $this->state = $var; - - return $this; - } - - /** - * Output only. The revision of the workflow. - * A new revision of a workflow is created as a result of updating the - * following fields of a workflow: - * - `source_code` - * - `service_account` - * The format is "000001-a4d", where the first 6 characters define - * the zero-padded revision ordinal number. They are followed by a hyphen and - * 3 hexadecimal random characters. - * - * Generated from protobuf field string revision_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return string - */ - public function getRevisionId() - { - return $this->revision_id; - } - - /** - * Output only. The revision of the workflow. - * A new revision of a workflow is created as a result of updating the - * following fields of a workflow: - * - `source_code` - * - `service_account` - * The format is "000001-a4d", where the first 6 characters define - * the zero-padded revision ordinal number. They are followed by a hyphen and - * 3 hexadecimal random characters. - * - * Generated from protobuf field string revision_id = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param string $var - * @return $this - */ - public function setRevisionId($var) - { - GPBUtil::checkString($var, True); - $this->revision_id = $var; - - return $this; - } - - /** - * Output only. The timestamp of when the workflow 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. The timestamp of when the workflow 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. The last update timestamp of the workflow. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 6 [(.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 last update timestamp of the workflow. - * - * Generated from protobuf field .google.protobuf.Timestamp update_time = 6 [(.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 timestamp that the latest revision of the workflow - * was created. - * - * Generated from protobuf field .google.protobuf.Timestamp revision_create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @return \Google\Protobuf\Timestamp|null - */ - public function getRevisionCreateTime() - { - return $this->revision_create_time; - } - - public function hasRevisionCreateTime() - { - return isset($this->revision_create_time); - } - - public function clearRevisionCreateTime() - { - unset($this->revision_create_time); - } - - /** - * Output only. The timestamp that the latest revision of the workflow - * was created. - * - * Generated from protobuf field .google.protobuf.Timestamp revision_create_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; - * @param \Google\Protobuf\Timestamp $var - * @return $this - */ - public function setRevisionCreateTime($var) - { - GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); - $this->revision_create_time = $var; - - return $this; - } - - /** - * Labels associated with this workflow. - * Labels can contain at most 64 entries. Keys and values can be no longer - * than 63 characters and can only contain lowercase letters, numeric - * characters, underscores and dashes. Label keys must start with a letter. - * International characters are allowed. - * - * Generated from protobuf field map labels = 8; - * @return \Google\Protobuf\Internal\MapField - */ - public function getLabels() - { - return $this->labels; - } - - /** - * Labels associated with this workflow. - * Labels can contain at most 64 entries. Keys and values can be no longer - * than 63 characters and can only contain lowercase letters, numeric - * characters, underscores and dashes. Label keys must start with a letter. - * International characters are allowed. - * - * 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; - } - - /** - * Name of the service account associated with the latest workflow version. - * This service account represents the identity of the workflow and determines - * what permissions the workflow has. - * Format: projects/{project}/serviceAccounts/{account} - * Using `-` as a wildcard for the `{project}` will infer the project from - * the account. The `{account}` value can be the `email` address or the - * `unique_id` of the service account. - * If not provided, workflow will use the project's default service account. - * Modifying this field for an existing workflow results in a new workflow - * revision. - * - * Generated from protobuf field string service_account = 9; - * @return string - */ - public function getServiceAccount() - { - return $this->service_account; - } - - /** - * Name of the service account associated with the latest workflow version. - * This service account represents the identity of the workflow and determines - * what permissions the workflow has. - * Format: projects/{project}/serviceAccounts/{account} - * Using `-` as a wildcard for the `{project}` will infer the project from - * the account. The `{account}` value can be the `email` address or the - * `unique_id` of the service account. - * If not provided, workflow will use the project's default service account. - * Modifying this field for an existing workflow results in a new workflow - * revision. - * - * Generated from protobuf field string service_account = 9; - * @param string $var - * @return $this - */ - public function setServiceAccount($var) - { - GPBUtil::checkString($var, True); - $this->service_account = $var; - - return $this; - } - - /** - * Workflow code to be executed. The size limit is 32KB. - * - * Generated from protobuf field string source_contents = 10; - * @return string - */ - public function getSourceContents() - { - return $this->readOneof(10); - } - - public function hasSourceContents() - { - return $this->hasOneof(10); - } - - /** - * Workflow code to be executed. The size limit is 32KB. - * - * Generated from protobuf field string source_contents = 10; - * @param string $var - * @return $this - */ - public function setSourceContents($var) - { - GPBUtil::checkString($var, True); - $this->writeOneof(10, $var); - - return $this; - } - - /** - * @return string - */ - public function getSourceCode() - { - return $this->whichOneof("source_code"); - } - -} - diff --git a/Workflows/src/V1beta/Workflow/State.php b/Workflows/src/V1beta/Workflow/State.php deleted file mode 100644 index 2e5b87a40b55..000000000000 --- a/Workflows/src/V1beta/Workflow/State.php +++ /dev/null @@ -1,56 +0,0 @@ -google.cloud.workflows.v1beta.Workflow.State - */ -class State -{ - /** - * Invalid state. - * - * Generated from protobuf enum STATE_UNSPECIFIED = 0; - */ - const STATE_UNSPECIFIED = 0; - /** - * The workflow has been deployed successfully and is serving. - * - * Generated from protobuf enum ACTIVE = 1; - */ - const ACTIVE = 1; - - private static $valueToName = [ - self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', - self::ACTIVE => 'ACTIVE', - ]; - - 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/Workflows/src/V1beta/WorkflowsClient.php b/Workflows/src/V1beta/WorkflowsClient.php deleted file mode 100644 index 41014011c358..000000000000 --- a/Workflows/src/V1beta/WorkflowsClient.php +++ /dev/null @@ -1,36 +0,0 @@ - [ - 'google.cloud.workflows.v1beta.Workflows' => [ - 'CreateWorkflow' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Workflows\V1beta\Workflow', - 'metadataReturnType' => '\Google\Cloud\Workflows\V1beta\OperationMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'DeleteWorkflow' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Protobuf\GPBEmpty', - 'metadataReturnType' => '\Google\Cloud\Workflows\V1beta\OperationMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'UpdateWorkflow' => [ - 'longRunning' => [ - 'operationReturnType' => '\Google\Cloud\Workflows\V1beta\Workflow', - 'metadataReturnType' => '\Google\Cloud\Workflows\V1beta\OperationMetadata', - 'initialPollDelayMillis' => '500', - 'pollDelayMultiplier' => '1.5', - 'maxPollDelayMillis' => '5000', - 'totalPollTimeoutMillis' => '300000', - ], - ], - 'ListWorkflows' => [ - 'pageStreaming' => [ - 'requestPageTokenGetMethod' => 'getPageToken', - 'requestPageTokenSetMethod' => 'setPageToken', - 'requestPageSizeGetMethod' => 'getPageSize', - 'requestPageSizeSetMethod' => 'setPageSize', - 'responsePageTokenGetMethod' => 'getNextPageToken', - 'resourcesGetMethod' => 'getWorkflows', - ], - ], - ], - ], -]; diff --git a/Workflows/src/V1beta/resources/workflows_rest_client_config.php b/Workflows/src/V1beta/resources/workflows_rest_client_config.php deleted file mode 100644 index b9161e7da9a5..000000000000 --- a/Workflows/src/V1beta/resources/workflows_rest_client_config.php +++ /dev/null @@ -1,149 +0,0 @@ - [ - '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.workflows.v1beta.Workflows' => [ - 'CreateWorkflow' => [ - 'method' => 'post', - 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*}/workflows', - 'body' => 'workflow', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - 'queryParams' => [ - 'workflow_id', - ], - ], - 'DeleteWorkflow' => [ - 'method' => 'delete', - 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/workflows/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'GetWorkflow' => [ - 'method' => 'get', - 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/workflows/*}', - 'placeholders' => [ - 'name' => [ - 'getters' => [ - 'getName', - ], - ], - ], - ], - 'ListWorkflows' => [ - 'method' => 'get', - 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*}/workflows', - 'placeholders' => [ - 'parent' => [ - 'getters' => [ - 'getParent', - ], - ], - ], - ], - 'UpdateWorkflow' => [ - 'method' => 'patch', - 'uriTemplate' => '/v1beta/{workflow.name=projects/*/locations/*/workflows/*}', - 'body' => 'workflow', - 'placeholders' => [ - 'workflow.name' => [ - 'getters' => [ - 'getWorkflow', - 'getName', - ], - ], - ], - ], - ], - 'google.longrunning.Operations' => [ - '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/Workflows/tests/Unit/Executions/V1beta/ExecutionsClientTest.php b/Workflows/tests/Unit/Executions/V1beta/ExecutionsClientTest.php deleted file mode 100644 index 734bfe264681..000000000000 --- a/Workflows/tests/Unit/Executions/V1beta/ExecutionsClientTest.php +++ /dev/null @@ -1,332 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return ExecutionsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new ExecutionsClient($options); - } - - /** @test */ - public function cancelExecutionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $argument = 'argument-1589682499'; - $result = 'result-934426595'; - $workflowRevisionId = 'workflowRevisionId-1453295745'; - $expectedResponse = new Execution(); - $expectedResponse->setName($name2); - $expectedResponse->setArgument($argument); - $expectedResponse->setResult($result); - $expectedResponse->setWorkflowRevisionId($workflowRevisionId); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[WORKFLOW]', '[EXECUTION]'); - $response = $gapicClient->cancelExecution($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.workflows.executions.v1beta.Executions/CancelExecution', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function cancelExecutionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->executionName('[PROJECT]', '[LOCATION]', '[WORKFLOW]', '[EXECUTION]'); - try { - $gapicClient->cancelExecution($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 createExecutionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name = 'name3373707'; - $argument = 'argument-1589682499'; - $result = 'result-934426595'; - $workflowRevisionId = 'workflowRevisionId-1453295745'; - $expectedResponse = new Execution(); - $expectedResponse->setName($name); - $expectedResponse->setArgument($argument); - $expectedResponse->setResult($result); - $expectedResponse->setWorkflowRevisionId($workflowRevisionId); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); - $execution = new Execution(); - $response = $gapicClient->createExecution($formattedParent, $execution); - $this->assertEquals($expectedResponse, $response); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.workflows.executions.v1beta.Executions/CreateExecution', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualRequestObject->getExecution(); - $this->assertProtobufEquals($execution, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function createExecutionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); - $execution = new Execution(); - try { - $gapicClient->createExecution($formattedParent, $execution); - // If the $gapicClient method call did not throw, fail the test - $this->fail('Expected an ApiException, but no exception was thrown.'); - } catch (ApiException $ex) { - $this->assertEquals($status->code, $ex->getCode()); - $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); - } - // Call popReceivedCalls to ensure the stub is exhausted - $transport->popReceivedCalls(); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExecutionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $argument = 'argument-1589682499'; - $result = 'result-934426595'; - $workflowRevisionId = 'workflowRevisionId-1453295745'; - $expectedResponse = new Execution(); - $expectedResponse->setName($name2); - $expectedResponse->setArgument($argument); - $expectedResponse->setResult($result); - $expectedResponse->setWorkflowRevisionId($workflowRevisionId); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[WORKFLOW]', '[EXECUTION]'); - $response = $gapicClient->getExecution($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.workflows.executions.v1beta.Executions/GetExecution', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getExecutionExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->executionName('[PROJECT]', '[LOCATION]', '[WORKFLOW]', '[EXECUTION]'); - try { - $gapicClient->getExecution($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 listExecutionsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $executionsElement = new Execution(); - $executions = [ - $executionsElement, - ]; - $expectedResponse = new ListExecutionsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setExecutions($executions); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); - $response = $gapicClient->listExecutions($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getExecutions()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.workflows.executions.v1beta.Executions/ListExecutions', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listExecutionsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); - try { - $gapicClient->listExecutions($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/Workflows/tests/Unit/V1beta/WorkflowsClientTest.php b/Workflows/tests/Unit/V1beta/WorkflowsClientTest.php deleted file mode 100644 index bafc07b33833..000000000000 --- a/Workflows/tests/Unit/V1beta/WorkflowsClientTest.php +++ /dev/null @@ -1,582 +0,0 @@ -getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock(); - } - - /** @return WorkflowsClient */ - private function createClient(array $options = []) - { - $options += [ - 'credentials' => $this->createCredentials(), - ]; - return new WorkflowsClient($options); - } - - /** @test */ - public function createWorkflowTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createWorkflowTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $revisionId = 'revisionId513861631'; - $serviceAccount = 'serviceAccount-1948028253'; - $sourceContents = 'sourceContents-1799875906'; - $expectedResponse = new Workflow(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setRevisionId($revisionId); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setSourceContents($sourceContents); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/createWorkflowTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $workflow = new Workflow(); - $workflowId = 'workflowId1712917915'; - $response = $gapicClient->createWorkflow($formattedParent, $workflow, $workflowId); - $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.workflows.v1beta.Workflows/CreateWorkflow', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $actualValue = $actualApiRequestObject->getWorkflow(); - $this->assertProtobufEquals($workflow, $actualValue); - $actualValue = $actualApiRequestObject->getWorkflowId(); - $this->assertProtobufEquals($workflowId, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createWorkflowTest'); - $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 createWorkflowExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/createWorkflowTest'); - $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]'); - $workflow = new Workflow(); - $workflowId = 'workflowId1712917915'; - $response = $gapicClient->createWorkflow($formattedParent, $workflow, $workflowId); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/createWorkflowTest'); - 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 deleteWorkflowTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteWorkflowTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $expectedResponse = new GPBEmpty(); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/deleteWorkflowTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $formattedName = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); - $response = $gapicClient->deleteWorkflow($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.workflows.v1beta.Workflows/DeleteWorkflow', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteWorkflowTest'); - $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 deleteWorkflowExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/deleteWorkflowTest'); - $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->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); - $response = $gapicClient->deleteWorkflow($formattedName); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/deleteWorkflowTest'); - 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 getWorkflowTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $name2 = 'name2-1052831874'; - $description = 'description-1724546052'; - $revisionId = 'revisionId513861631'; - $serviceAccount = 'serviceAccount-1948028253'; - $sourceContents = 'sourceContents-1799875906'; - $expectedResponse = new Workflow(); - $expectedResponse->setName($name2); - $expectedResponse->setDescription($description); - $expectedResponse->setRevisionId($revisionId); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setSourceContents($sourceContents); - $transport->addResponse($expectedResponse); - // Mock request - $formattedName = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); - $response = $gapicClient->getWorkflow($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.workflows.v1beta.Workflows/GetWorkflow', $actualFuncCall); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function getWorkflowExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]'); - try { - $gapicClient->getWorkflow($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 listWorkflowsTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - // Mock response - $nextPageToken = ''; - $workflowsElement = new Workflow(); - $workflows = [ - $workflowsElement, - ]; - $expectedResponse = new ListWorkflowsResponse(); - $expectedResponse->setNextPageToken($nextPageToken); - $expectedResponse->setWorkflows($workflows); - $transport->addResponse($expectedResponse); - // Mock request - $formattedParent = $gapicClient->locationName('[PROJECT]', '[LOCATION]'); - $response = $gapicClient->listWorkflows($formattedParent); - $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); - $resources = iterator_to_array($response->iterateAllElements()); - $this->assertSame(1, count($resources)); - $this->assertEquals($expectedResponse->getWorkflows()[0], $resources[0]); - $actualRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($actualRequests)); - $actualFuncCall = $actualRequests[0]->getFuncCall(); - $actualRequestObject = $actualRequests[0]->getRequestObject(); - $this->assertSame('/google.cloud.workflows.v1beta.Workflows/ListWorkflows', $actualFuncCall); - $actualValue = $actualRequestObject->getParent(); - $this->assertProtobufEquals($formattedParent, $actualValue); - $this->assertTrue($transport->isExhausted()); - } - - /** @test */ - public function listWorkflowsExceptionTest() - { - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - ]); - $this->assertTrue($transport->isExhausted()); - $status = new stdClass(); - $status->code = Code::DATA_LOSS; - $status->details = 'internal 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->listWorkflows($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 updateWorkflowTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateWorkflowTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $name = 'name3373707'; - $description = 'description-1724546052'; - $revisionId = 'revisionId513861631'; - $serviceAccount = 'serviceAccount-1948028253'; - $sourceContents = 'sourceContents-1799875906'; - $expectedResponse = new Workflow(); - $expectedResponse->setName($name); - $expectedResponse->setDescription($description); - $expectedResponse->setRevisionId($revisionId); - $expectedResponse->setServiceAccount($serviceAccount); - $expectedResponse->setSourceContents($sourceContents); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/updateWorkflowTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); - // Mock request - $workflow = new Workflow(); - $response = $gapicClient->updateWorkflow($workflow); - $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.workflows.v1beta.Workflows/UpdateWorkflow', $actualApiFuncCall); - $actualValue = $actualApiRequestObject->getWorkflow(); - $this->assertProtobufEquals($workflow, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateWorkflowTest'); - $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 updateWorkflowExceptionTest() - { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); - $transport = $this->createTransport(); - $gapicClient = $this->createClient([ - 'transport' => $transport, - 'operationsClient' => $operationsClient, - ]); - $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); - // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/updateWorkflowTest'); - $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 - $workflow = new Workflow(); - $response = $gapicClient->updateWorkflow($workflow); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/updateWorkflowTest'); - 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()); - } -}