Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Workflows/owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,17 @@
r"(.{0,})\]\((/.{0,})\)",
r"\1](https://cloud.google.com\2)"
)

# format generated clients
subprocess.run([
'npm',
'exec',
'--yes',
'--package=@prettier/plugin-php@^0.19',
'--',
'prettier',
'**/Client/*',
'--write',
'--parser=php',
'--single-quote',
'--print-width=120'])
4 changes: 1 addition & 3 deletions Workflows/src/Executions/V1/Client/ExecutionsClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ final class ExecutionsClient
*
* @internal
*/
public static $serviceScopes = [
'https://www.googleapis.com/auth/cloud-platform',
];
public static $serviceScopes = ['https://www.googleapis.com/auth/cloud-platform'];

private static function getClientDefaults()
{
Expand Down
24 changes: 16 additions & 8 deletions Workflows/src/V1/Client/WorkflowsClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ final class WorkflowsClient
*
* @internal
*/
public static $serviceScopes = [
'https://www.googleapis.com/auth/cloud-platform',
];
public static $serviceScopes = ['https://www.googleapis.com/auth/cloud-platform'];

private $operationsClient;

Expand Down Expand Up @@ -149,7 +147,10 @@ public function getOperationsClient()
*/
public function resumeOperation($operationName, $methodName = null)
{
$options = $methodName && isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : [];
$options =
$methodName && isset($this->descriptors[$methodName]['longRunning'])
? $this->descriptors[$methodName]['longRunning']
: [];
$operation = new OperationResponse($operationName, $this->getOperationsClient(), $options);
$operation->reload();
return $operation;
Expand Down Expand Up @@ -207,8 +208,13 @@ public static function cryptoKeyName(string $project, string $location, string $
*
* @return string The formatted crypto_key_version resource.
*/
public static function cryptoKeyVersionName(string $project, string $location, string $keyRing, string $cryptoKey, string $cryptoKeyVersion): string
{
public static function cryptoKeyVersionName(
string $project,
string $location,
string $keyRing,
string $cryptoKey,
string $cryptoKeyVersion
): string {
return self::getPathTemplate('cryptoKeyVersion')->render([
'project' => $project,
'location' => $location,
Expand Down Expand Up @@ -470,8 +476,10 @@ public function getWorkflow(GetWorkflowRequest $request, array $callOptions = []
*
* @throws ApiException Thrown if the API call fails.
*/
public function listWorkflowRevisions(ListWorkflowRevisionsRequest $request, array $callOptions = []): PagedListResponse
{
public function listWorkflowRevisions(
ListWorkflowRevisionsRequest $request,
array $callOptions = []
): PagedListResponse {
return $this->startApiCall('ListWorkflowRevisions', $request, $callOptions);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ private function createTransport($deserialize = null)
/** @return CredentialsWrapper */
private function createCredentials()
{
return $this->getMockBuilder(CredentialsWrapper::class)->disableOriginalConstructor()->getMock();
return $this->getMockBuilder(CredentialsWrapper::class)
->disableOriginalConstructor()
->getMock();
}

/** @return ExecutionsClient */
Expand Down Expand Up @@ -85,8 +87,7 @@ public function cancelExecutionTest()
$transport->addResponse($expectedResponse);
// Mock request
$formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[WORKFLOW]', '[EXECUTION]');
$request = (new CancelExecutionRequest())
->setName($formattedName);
$request = (new CancelExecutionRequest())->setName($formattedName);
$response = $gapicClient->cancelExecution($request);
$this->assertEquals($expectedResponse, $response);
$actualRequests = $transport->popReceivedCalls();
Expand All @@ -110,17 +111,19 @@ public function cancelExecutionExceptionTest()
$status = new stdClass();
$status->code = Code::DATA_LOSS;
$status->details = 'internal error';
$expectedExceptionMessage = json_encode([
'message' => 'internal error',
'code' => Code::DATA_LOSS,
'status' => 'DATA_LOSS',
'details' => [],
], JSON_PRETTY_PRINT);
$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]');
$request = (new CancelExecutionRequest())
->setName($formattedName);
$request = (new CancelExecutionRequest())->setName($formattedName);
try {
$gapicClient->cancelExecution($request);
// If the $gapicClient method call did not throw, fail the test
Expand Down Expand Up @@ -156,9 +159,7 @@ public function createExecutionTest()
// Mock request
$formattedParent = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]');
$execution = new Execution();
$request = (new CreateExecutionRequest())
->setParent($formattedParent)
->setExecution($execution);
$request = (new CreateExecutionRequest())->setParent($formattedParent)->setExecution($execution);
$response = $gapicClient->createExecution($request);
$this->assertEquals($expectedResponse, $response);
$actualRequests = $transport->popReceivedCalls();
Expand All @@ -184,19 +185,20 @@ public function createExecutionExceptionTest()
$status = new stdClass();
$status->code = Code::DATA_LOSS;
$status->details = 'internal error';
$expectedExceptionMessage = json_encode([
'message' => 'internal error',
'code' => Code::DATA_LOSS,
'status' => 'DATA_LOSS',
'details' => [],
], JSON_PRETTY_PRINT);
$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();
$request = (new CreateExecutionRequest())
->setParent($formattedParent)
->setExecution($execution);
$request = (new CreateExecutionRequest())->setParent($formattedParent)->setExecution($execution);
try {
$gapicClient->createExecution($request);
// If the $gapicClient method call did not throw, fail the test
Expand Down Expand Up @@ -231,8 +233,7 @@ public function getExecutionTest()
$transport->addResponse($expectedResponse);
// Mock request
$formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[WORKFLOW]', '[EXECUTION]');
$request = (new GetExecutionRequest())
->setName($formattedName);
$request = (new GetExecutionRequest())->setName($formattedName);
$response = $gapicClient->getExecution($request);
$this->assertEquals($expectedResponse, $response);
$actualRequests = $transport->popReceivedCalls();
Expand All @@ -256,17 +257,19 @@ public function getExecutionExceptionTest()
$status = new stdClass();
$status->code = Code::DATA_LOSS;
$status->details = 'internal error';
$expectedExceptionMessage = json_encode([
'message' => 'internal error',
'code' => Code::DATA_LOSS,
'status' => 'DATA_LOSS',
'details' => [],
], JSON_PRETTY_PRINT);
$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]');
$request = (new GetExecutionRequest())
->setName($formattedName);
$request = (new GetExecutionRequest())->setName($formattedName);
try {
$gapicClient->getExecution($request);
// If the $gapicClient method call did not throw, fail the test
Expand All @@ -291,17 +294,14 @@ public function listExecutionsTest()
// Mock response
$nextPageToken = '';
$executionsElement = new Execution();
$executions = [
$executionsElement,
];
$executions = [$executionsElement];
$expectedResponse = new ListExecutionsResponse();
$expectedResponse->setNextPageToken($nextPageToken);
$expectedResponse->setExecutions($executions);
$transport->addResponse($expectedResponse);
// Mock request
$formattedParent = $gapicClient->workflowName('[PROJECT]', '[LOCATION]', '[WORKFLOW]');
$request = (new ListExecutionsRequest())
->setParent($formattedParent);
$request = (new ListExecutionsRequest())->setParent($formattedParent);
$response = $gapicClient->listExecutions($request);
$this->assertEquals($expectedResponse, $response->getPage()->getResponseObject());
$resources = iterator_to_array($response->iterateAllElements());
Expand All @@ -328,17 +328,19 @@ public function listExecutionsExceptionTest()
$status = new stdClass();
$status->code = Code::DATA_LOSS;
$status->details = 'internal error';
$expectedExceptionMessage = json_encode([
'message' => 'internal error',
'code' => Code::DATA_LOSS,
'status' => 'DATA_LOSS',
'details' => [],
], JSON_PRETTY_PRINT);
$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]');
$request = (new ListExecutionsRequest())
->setParent($formattedParent);
$request = (new ListExecutionsRequest())->setParent($formattedParent);
try {
$gapicClient->listExecutions($request);
// If the $gapicClient method call did not throw, fail the test
Expand Down Expand Up @@ -373,8 +375,7 @@ public function cancelExecutionAsyncTest()
$transport->addResponse($expectedResponse);
// Mock request
$formattedName = $gapicClient->executionName('[PROJECT]', '[LOCATION]', '[WORKFLOW]', '[EXECUTION]');
$request = (new CancelExecutionRequest())
->setName($formattedName);
$request = (new CancelExecutionRequest())->setName($formattedName);
$response = $gapicClient->cancelExecutionAsync($request)->wait();
$this->assertEquals($expectedResponse, $response);
$actualRequests = $transport->popReceivedCalls();
Expand Down
Loading
Loading