-
Notifications
You must be signed in to change notification settings - Fork 438
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add custom target type support (#6841)
feat: Add revision tagging for one of the Cloud Run deployment strategies docs: Fixed a number of comments. PiperOrigin-RevId: 587671915 Source-Link: googleapis/googleapis@1523043 Source-Link: googleapis/googleapis-gen@d0ab47d Copy-Tag: eyJwIjoiRGVwbG95Ly5Pd2xCb3QueWFtbCIsImgiOiJkMGFiNDdkZTU4NzQxZGJhN2EyYTQzMDBmMTBiZDJiODUzZjBhNmNmIn0=
- Loading branch information
1 parent
fd2ee1a
commit c053e8e
Showing
51 changed files
with
5,408 additions
and
90 deletions.
There are no files selected for viewing
Binary file not shown.
92 changes: 92 additions & 0 deletions
92
Deploy/samples/V1/CloudDeployClient/create_custom_target_type.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<?php | ||
/* | ||
* Copyright 2023 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/* | ||
* GENERATED CODE WARNING | ||
* This file was automatically generated - do not edit! | ||
*/ | ||
|
||
require_once __DIR__ . '/../../../vendor/autoload.php'; | ||
|
||
// [START clouddeploy_v1_generated_CloudDeploy_CreateCustomTargetType_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\ApiCore\OperationResponse; | ||
use Google\Cloud\Deploy\V1\Client\CloudDeployClient; | ||
use Google\Cloud\Deploy\V1\CreateCustomTargetTypeRequest; | ||
use Google\Cloud\Deploy\V1\CustomTargetType; | ||
use Google\Rpc\Status; | ||
|
||
/** | ||
* Creates a new CustomTargetType in a given project and location. | ||
* | ||
* @param string $formattedParent The parent collection in which the `CustomTargetType` should be | ||
* created in. Format should be | ||
* `projects/{project_id}/locations/{location_name}`. Please see | ||
* {@see CloudDeployClient::locationName()} for help formatting this field. | ||
* @param string $customTargetTypeId ID of the `CustomTargetType`. | ||
*/ | ||
function create_custom_target_type_sample( | ||
string $formattedParent, | ||
string $customTargetTypeId | ||
): void { | ||
// Create a client. | ||
$cloudDeployClient = new CloudDeployClient(); | ||
|
||
// Prepare the request message. | ||
$customTargetType = new CustomTargetType(); | ||
$request = (new CreateCustomTargetTypeRequest()) | ||
->setParent($formattedParent) | ||
->setCustomTargetTypeId($customTargetTypeId) | ||
->setCustomTargetType($customTargetType); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var OperationResponse $response */ | ||
$response = $cloudDeployClient->createCustomTargetType($request); | ||
$response->pollUntilComplete(); | ||
|
||
if ($response->operationSucceeded()) { | ||
/** @var CustomTargetType $result */ | ||
$result = $response->getResult(); | ||
printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); | ||
} else { | ||
/** @var Status $error */ | ||
$error = $response->getError(); | ||
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); | ||
} | ||
} catch (ApiException $ex) { | ||
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); | ||
} | ||
} | ||
|
||
/** | ||
* Helper to execute the sample. | ||
* | ||
* This sample has been automatically generated and should be regarded as a code | ||
* template only. It will require modifications to work: | ||
* - It may require correct/in-range values for request initialization. | ||
* - It may require specifying regional endpoints when creating the service client, | ||
* please see the apiEndpoint client configuration option for more details. | ||
*/ | ||
function callSample(): void | ||
{ | ||
$formattedParent = CloudDeployClient::locationName('[PROJECT]', '[LOCATION]'); | ||
$customTargetTypeId = '[CUSTOM_TARGET_TYPE_ID]'; | ||
|
||
create_custom_target_type_sample($formattedParent, $customTargetTypeId); | ||
} | ||
// [END clouddeploy_v1_generated_CloudDeploy_CreateCustomTargetType_sync] |
85 changes: 85 additions & 0 deletions
85
Deploy/samples/V1/CloudDeployClient/delete_custom_target_type.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?php | ||
/* | ||
* Copyright 2023 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/* | ||
* GENERATED CODE WARNING | ||
* This file was automatically generated - do not edit! | ||
*/ | ||
|
||
require_once __DIR__ . '/../../../vendor/autoload.php'; | ||
|
||
// [START clouddeploy_v1_generated_CloudDeploy_DeleteCustomTargetType_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\ApiCore\OperationResponse; | ||
use Google\Cloud\Deploy\V1\Client\CloudDeployClient; | ||
use Google\Cloud\Deploy\V1\DeleteCustomTargetTypeRequest; | ||
use Google\Rpc\Status; | ||
|
||
/** | ||
* Deletes a single CustomTargetType. | ||
* | ||
* @param string $formattedName The name of the `CustomTargetType` to delete. Format must be | ||
* `projects/{project_id}/locations/{location_name}/customTargetTypes/{custom_target_type}`. Please see | ||
* {@see CloudDeployClient::customTargetTypeName()} for help formatting this field. | ||
*/ | ||
function delete_custom_target_type_sample(string $formattedName): void | ||
{ | ||
// Create a client. | ||
$cloudDeployClient = new CloudDeployClient(); | ||
|
||
// Prepare the request message. | ||
$request = (new DeleteCustomTargetTypeRequest()) | ||
->setName($formattedName); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var OperationResponse $response */ | ||
$response = $cloudDeployClient->deleteCustomTargetType($request); | ||
$response->pollUntilComplete(); | ||
|
||
if ($response->operationSucceeded()) { | ||
printf('Operation completed successfully.' . PHP_EOL); | ||
} else { | ||
/** @var Status $error */ | ||
$error = $response->getError(); | ||
printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); | ||
} | ||
} catch (ApiException $ex) { | ||
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); | ||
} | ||
} | ||
|
||
/** | ||
* Helper to execute the sample. | ||
* | ||
* This sample has been automatically generated and should be regarded as a code | ||
* template only. It will require modifications to work: | ||
* - It may require correct/in-range values for request initialization. | ||
* - It may require specifying regional endpoints when creating the service client, | ||
* please see the apiEndpoint client configuration option for more details. | ||
*/ | ||
function callSample(): void | ||
{ | ||
$formattedName = CloudDeployClient::customTargetTypeName( | ||
'[PROJECT]', | ||
'[LOCATION]', | ||
'[CUSTOM_TARGET_TYPE]' | ||
); | ||
|
||
delete_custom_target_type_sample($formattedName); | ||
} | ||
// [END clouddeploy_v1_generated_CloudDeploy_DeleteCustomTargetType_sync] |
76 changes: 76 additions & 0 deletions
76
Deploy/samples/V1/CloudDeployClient/get_custom_target_type.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?php | ||
/* | ||
* Copyright 2023 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/* | ||
* GENERATED CODE WARNING | ||
* This file was automatically generated - do not edit! | ||
*/ | ||
|
||
require_once __DIR__ . '/../../../vendor/autoload.php'; | ||
|
||
// [START clouddeploy_v1_generated_CloudDeploy_GetCustomTargetType_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\Cloud\Deploy\V1\Client\CloudDeployClient; | ||
use Google\Cloud\Deploy\V1\CustomTargetType; | ||
use Google\Cloud\Deploy\V1\GetCustomTargetTypeRequest; | ||
|
||
/** | ||
* Gets details of a single CustomTargetType. | ||
* | ||
* @param string $formattedName Name of the `CustomTargetType`. Format must be | ||
* `projects/{project_id}/locations/{location_name}/customTargetTypes/{custom_target_type}`. Please see | ||
* {@see CloudDeployClient::customTargetTypeName()} for help formatting this field. | ||
*/ | ||
function get_custom_target_type_sample(string $formattedName): void | ||
{ | ||
// Create a client. | ||
$cloudDeployClient = new CloudDeployClient(); | ||
|
||
// Prepare the request message. | ||
$request = (new GetCustomTargetTypeRequest()) | ||
->setName($formattedName); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var CustomTargetType $response */ | ||
$response = $cloudDeployClient->getCustomTargetType($request); | ||
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); | ||
} catch (ApiException $ex) { | ||
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); | ||
} | ||
} | ||
|
||
/** | ||
* Helper to execute the sample. | ||
* | ||
* This sample has been automatically generated and should be regarded as a code | ||
* template only. It will require modifications to work: | ||
* - It may require correct/in-range values for request initialization. | ||
* - It may require specifying regional endpoints when creating the service client, | ||
* please see the apiEndpoint client configuration option for more details. | ||
*/ | ||
function callSample(): void | ||
{ | ||
$formattedName = CloudDeployClient::customTargetTypeName( | ||
'[PROJECT]', | ||
'[LOCATION]', | ||
'[CUSTOM_TARGET_TYPE]' | ||
); | ||
|
||
get_custom_target_type_sample($formattedName); | ||
} | ||
// [END clouddeploy_v1_generated_CloudDeploy_GetCustomTargetType_sync] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
Deploy/samples/V1/CloudDeployClient/list_custom_target_types.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?php | ||
/* | ||
* Copyright 2023 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/* | ||
* GENERATED CODE WARNING | ||
* This file was automatically generated - do not edit! | ||
*/ | ||
|
||
require_once __DIR__ . '/../../../vendor/autoload.php'; | ||
|
||
// [START clouddeploy_v1_generated_CloudDeploy_ListCustomTargetTypes_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\ApiCore\PagedListResponse; | ||
use Google\Cloud\Deploy\V1\Client\CloudDeployClient; | ||
use Google\Cloud\Deploy\V1\CustomTargetType; | ||
use Google\Cloud\Deploy\V1\ListCustomTargetTypesRequest; | ||
|
||
/** | ||
* Lists CustomTargetTypes in a given project and location. | ||
* | ||
* @param string $formattedParent The parent that owns this collection of custom target types. | ||
* Format must be `projects/{project_id}/locations/{location_name}`. Please see | ||
* {@see CloudDeployClient::locationName()} for help formatting this field. | ||
*/ | ||
function list_custom_target_types_sample(string $formattedParent): void | ||
{ | ||
// Create a client. | ||
$cloudDeployClient = new CloudDeployClient(); | ||
|
||
// Prepare the request message. | ||
$request = (new ListCustomTargetTypesRequest()) | ||
->setParent($formattedParent); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var PagedListResponse $response */ | ||
$response = $cloudDeployClient->listCustomTargetTypes($request); | ||
|
||
/** @var CustomTargetType $element */ | ||
foreach ($response as $element) { | ||
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); | ||
} | ||
} catch (ApiException $ex) { | ||
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); | ||
} | ||
} | ||
|
||
/** | ||
* Helper to execute the sample. | ||
* | ||
* This sample has been automatically generated and should be regarded as a code | ||
* template only. It will require modifications to work: | ||
* - It may require correct/in-range values for request initialization. | ||
* - It may require specifying regional endpoints when creating the service client, | ||
* please see the apiEndpoint client configuration option for more details. | ||
*/ | ||
function callSample(): void | ||
{ | ||
$formattedParent = CloudDeployClient::locationName('[PROJECT]', '[LOCATION]'); | ||
|
||
list_custom_target_types_sample($formattedParent); | ||
} | ||
// [END clouddeploy_v1_generated_CloudDeploy_ListCustomTargetTypes_sync] |
Oops, something went wrong.