-
Notifications
You must be signed in to change notification settings - Fork 427
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added Trust Configs and DnsAuthorization.Type to Certificate Ma…
…nager (#7160) PiperOrigin-RevId: 616824423 Source-Link: googleapis/googleapis@fc30fdd Source-Link: googleapis/googleapis-gen@dae6c88 Copy-Tag: eyJwIjoiQ2VydGlmaWNhdGVNYW5hZ2VyLy5Pd2xCb3QueWFtbCIsImgiOiJkYWU2Yzg4Y2UwYTU3ZDE0OTVlMzRmMGY1YmZiZjZhYjBkZDVlOGVmIn0=
- Loading branch information
1 parent
5541f21
commit 54b8682
Showing
34 changed files
with
3,900 additions
and
28 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
90 changes: 90 additions & 0 deletions
90
CertificateManager/samples/V1/CertificateManagerClient/create_trust_config.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,90 @@ | ||
<?php | ||
/* | ||
* Copyright 2024 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 certificatemanager_v1_generated_CertificateManager_CreateTrustConfig_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\ApiCore\OperationResponse; | ||
use Google\Cloud\CertificateManager\V1\Client\CertificateManagerClient; | ||
use Google\Cloud\CertificateManager\V1\CreateTrustConfigRequest; | ||
use Google\Cloud\CertificateManager\V1\TrustConfig; | ||
use Google\Rpc\Status; | ||
|
||
/** | ||
* Creates a new TrustConfig in a given project and location. | ||
* | ||
* @param string $formattedParent The parent resource of the TrustConfig. Must be in the format | ||
* `projects/*/locations/*`. Please see | ||
* {@see CertificateManagerClient::locationName()} for help formatting this field. | ||
* @param string $trustConfigId A user-provided name of the TrustConfig. Must match the regexp | ||
* `[a-z0-9-]{1,63}`. | ||
*/ | ||
function create_trust_config_sample(string $formattedParent, string $trustConfigId): void | ||
{ | ||
// Create a client. | ||
$certificateManagerClient = new CertificateManagerClient(); | ||
|
||
// Prepare the request message. | ||
$trustConfig = new TrustConfig(); | ||
$request = (new CreateTrustConfigRequest()) | ||
->setParent($formattedParent) | ||
->setTrustConfigId($trustConfigId) | ||
->setTrustConfig($trustConfig); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var OperationResponse $response */ | ||
$response = $certificateManagerClient->createTrustConfig($request); | ||
$response->pollUntilComplete(); | ||
|
||
if ($response->operationSucceeded()) { | ||
/** @var TrustConfig $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 = CertificateManagerClient::locationName('[PROJECT]', '[LOCATION]'); | ||
$trustConfigId = '[TRUST_CONFIG_ID]'; | ||
|
||
create_trust_config_sample($formattedParent, $trustConfigId); | ||
} | ||
// [END certificatemanager_v1_generated_CertificateManager_CreateTrustConfig_sync] |
85 changes: 85 additions & 0 deletions
85
CertificateManager/samples/V1/CertificateManagerClient/delete_trust_config.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 2024 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 certificatemanager_v1_generated_CertificateManager_DeleteTrustConfig_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\ApiCore\OperationResponse; | ||
use Google\Cloud\CertificateManager\V1\Client\CertificateManagerClient; | ||
use Google\Cloud\CertificateManager\V1\DeleteTrustConfigRequest; | ||
use Google\Rpc\Status; | ||
|
||
/** | ||
* Deletes a single TrustConfig. | ||
* | ||
* @param string $formattedName A name of the TrustConfig to delete. Must be in the format | ||
* `projects/*/locations/*/trustConfigs/*`. Please see | ||
* {@see CertificateManagerClient::trustConfigName()} for help formatting this field. | ||
*/ | ||
function delete_trust_config_sample(string $formattedName): void | ||
{ | ||
// Create a client. | ||
$certificateManagerClient = new CertificateManagerClient(); | ||
|
||
// Prepare the request message. | ||
$request = (new DeleteTrustConfigRequest()) | ||
->setName($formattedName); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var OperationResponse $response */ | ||
$response = $certificateManagerClient->deleteTrustConfig($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 = CertificateManagerClient::trustConfigName( | ||
'[PROJECT]', | ||
'[LOCATION]', | ||
'[TRUST_CONFIG]' | ||
); | ||
|
||
delete_trust_config_sample($formattedName); | ||
} | ||
// [END certificatemanager_v1_generated_CertificateManager_DeleteTrustConfig_sync] |
76 changes: 76 additions & 0 deletions
76
CertificateManager/samples/V1/CertificateManagerClient/get_trust_config.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 2024 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 certificatemanager_v1_generated_CertificateManager_GetTrustConfig_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\Cloud\CertificateManager\V1\Client\CertificateManagerClient; | ||
use Google\Cloud\CertificateManager\V1\GetTrustConfigRequest; | ||
use Google\Cloud\CertificateManager\V1\TrustConfig; | ||
|
||
/** | ||
* Gets details of a single TrustConfig. | ||
* | ||
* @param string $formattedName A name of the TrustConfig to describe. Must be in the format | ||
* `projects/*/locations/*/trustConfigs/*`. Please see | ||
* {@see CertificateManagerClient::trustConfigName()} for help formatting this field. | ||
*/ | ||
function get_trust_config_sample(string $formattedName): void | ||
{ | ||
// Create a client. | ||
$certificateManagerClient = new CertificateManagerClient(); | ||
|
||
// Prepare the request message. | ||
$request = (new GetTrustConfigRequest()) | ||
->setName($formattedName); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var TrustConfig $response */ | ||
$response = $certificateManagerClient->getTrustConfig($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 = CertificateManagerClient::trustConfigName( | ||
'[PROJECT]', | ||
'[LOCATION]', | ||
'[TRUST_CONFIG]' | ||
); | ||
|
||
get_trust_config_sample($formattedName); | ||
} | ||
// [END certificatemanager_v1_generated_CertificateManager_GetTrustConfig_sync] |
77 changes: 77 additions & 0 deletions
77
CertificateManager/samples/V1/CertificateManagerClient/list_trust_configs.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 2024 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 certificatemanager_v1_generated_CertificateManager_ListTrustConfigs_sync] | ||
use Google\ApiCore\ApiException; | ||
use Google\ApiCore\PagedListResponse; | ||
use Google\Cloud\CertificateManager\V1\Client\CertificateManagerClient; | ||
use Google\Cloud\CertificateManager\V1\ListTrustConfigsRequest; | ||
use Google\Cloud\CertificateManager\V1\TrustConfig; | ||
|
||
/** | ||
* Lists TrustConfigs in a given project and location. | ||
* | ||
* @param string $formattedParent The project and location from which the TrustConfigs should be | ||
* listed, specified in the format `projects/*/locations/*`. Please see | ||
* {@see CertificateManagerClient::locationName()} for help formatting this field. | ||
*/ | ||
function list_trust_configs_sample(string $formattedParent): void | ||
{ | ||
// Create a client. | ||
$certificateManagerClient = new CertificateManagerClient(); | ||
|
||
// Prepare the request message. | ||
$request = (new ListTrustConfigsRequest()) | ||
->setParent($formattedParent); | ||
|
||
// Call the API and handle any network failures. | ||
try { | ||
/** @var PagedListResponse $response */ | ||
$response = $certificateManagerClient->listTrustConfigs($request); | ||
|
||
/** @var TrustConfig $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 = CertificateManagerClient::locationName('[PROJECT]', '[LOCATION]'); | ||
|
||
list_trust_configs_sample($formattedParent); | ||
} | ||
// [END certificatemanager_v1_generated_CertificateManager_ListTrustConfigs_sync] |
Oops, something went wrong.