Skip to content

Commit 3c0f6e6

Browse files
feat: add client library for KMS Autokey service, which enables automated KMS key provision and management (googleapis#7290)
* feat: support the ED25519 asymmetric signing algorithm PiperOrigin-RevId: 630661612 Source-Link: googleapis/googleapis@245c0f5 Source-Link: https://github.com/googleapis/googleapis-gen/commit/11beb7ec0c8ef8e8de73560365b28c7c288aa8cd Copy-Tag: eyJwIjoiS21zLy5Pd2xCb3QueWFtbCIsImgiOiIxMWJlYjdlYzBjOGVmOGU4ZGU3MzU2MDM2NWIyOGM3YzI4OGFhOGNkIn0= * feat: introduce Long-Running Operations (LRO) for KMS PiperOrigin-RevId: 631049366 Source-Link: googleapis/googleapis@abe82f8 Source-Link: https://github.com/googleapis/googleapis-gen/commit/17663bd592e37b0593058019e7ba1c8ccce2bdb5 Copy-Tag: eyJwIjoiS21zLy5Pd2xCb3QueWFtbCIsImgiOiIxNzY2M2JkNTkyZTM3YjA1OTMwNTgwMTllN2JhMWM4Y2NjZTJiZGI1In0= * feat: add client library for KMS Autokey service, which enables automated KMS key provision and management PiperOrigin-RevId: 631565226 Source-Link: googleapis/googleapis@e5b8ffa Source-Link: https://github.com/googleapis/googleapis-gen/commit/cae62d4fb1b6b7d695fe5f6de6711c85ddf0abd8 Copy-Tag: eyJwIjoiS21zLy5Pd2xCb3QueWFtbCIsImgiOiJjYWU2MmQ0ZmIxYjZiN2Q2OTVmZTVmNmRlNjcxMWM4NWRkZjBhYmQ4In0=
1 parent 9ee6613 commit 3c0f6e6

52 files changed

Lines changed: 8906 additions & 108 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Kms/metadata/V1/Autokey.php‎

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Kms/metadata/V1/AutokeyAdmin.php‎

Lines changed: 51 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Kms/metadata/V1/Resources.php‎

21 Bytes
Binary file not shown.
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
/*
3+
* Copyright 2024 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START cloudkms_v1_generated_AutokeyAdmin_GetAutokeyConfig_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Cloud\Kms\V1\AutokeyConfig;
28+
use Google\Cloud\Kms\V1\Client\AutokeyAdminClient;
29+
use Google\Cloud\Kms\V1\GetAutokeyConfigRequest;
30+
31+
/**
32+
* Returns the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig] for a
33+
* folder.
34+
*
35+
* @param string $formattedName Name of the [AutokeyConfig][google.cloud.kms.v1.AutokeyConfig]
36+
* resource, e.g. `folders/{FOLDER_NUMBER}/autokeyConfig`. Please see
37+
* {@see AutokeyAdminClient::autokeyConfigName()} for help formatting this field.
38+
*/
39+
function get_autokey_config_sample(string $formattedName): void
40+
{
41+
// Create a client.
42+
$autokeyAdminClient = new AutokeyAdminClient();
43+
44+
// Prepare the request message.
45+
$request = (new GetAutokeyConfigRequest())
46+
->setName($formattedName);
47+
48+
// Call the API and handle any network failures.
49+
try {
50+
/** @var AutokeyConfig $response */
51+
$response = $autokeyAdminClient->getAutokeyConfig($request);
52+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
53+
} catch (ApiException $ex) {
54+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
55+
}
56+
}
57+
58+
/**
59+
* Helper to execute the sample.
60+
*
61+
* This sample has been automatically generated and should be regarded as a code
62+
* template only. It will require modifications to work:
63+
* - It may require correct/in-range values for request initialization.
64+
* - It may require specifying regional endpoints when creating the service client,
65+
* please see the apiEndpoint client configuration option for more details.
66+
*/
67+
function callSample(): void
68+
{
69+
$formattedName = AutokeyAdminClient::autokeyConfigName('[FOLDER]');
70+
71+
get_autokey_config_sample($formattedName);
72+
}
73+
// [END cloudkms_v1_generated_AutokeyAdmin_GetAutokeyConfig_sync]
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?php
2+
/*
3+
* Copyright 2024 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START cloudkms_v1_generated_AutokeyAdmin_GetIamPolicy_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Cloud\Iam\V1\GetIamPolicyRequest;
28+
use Google\Cloud\Iam\V1\Policy;
29+
use Google\Cloud\Kms\V1\Client\AutokeyAdminClient;
30+
31+
/**
32+
* Gets the access control policy for a resource. Returns an empty policy
33+
if the resource exists and does not have a policy set.
34+
*
35+
* @param string $resource REQUIRED: The resource for which the policy is being requested.
36+
* See the operation documentation for the appropriate value for this field.
37+
*/
38+
function get_iam_policy_sample(string $resource): void
39+
{
40+
// Create a client.
41+
$autokeyAdminClient = new AutokeyAdminClient();
42+
43+
// Prepare the request message.
44+
$request = (new GetIamPolicyRequest())
45+
->setResource($resource);
46+
47+
// Call the API and handle any network failures.
48+
try {
49+
/** @var Policy $response */
50+
$response = $autokeyAdminClient->getIamPolicy($request);
51+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
52+
} catch (ApiException $ex) {
53+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
54+
}
55+
}
56+
57+
/**
58+
* Helper to execute the sample.
59+
*
60+
* This sample has been automatically generated and should be regarded as a code
61+
* template only. It will require modifications to work:
62+
* - It may require correct/in-range values for request initialization.
63+
* - It may require specifying regional endpoints when creating the service client,
64+
* please see the apiEndpoint client configuration option for more details.
65+
*/
66+
function callSample(): void
67+
{
68+
$resource = '[RESOURCE]';
69+
70+
get_iam_policy_sample($resource);
71+
}
72+
// [END cloudkms_v1_generated_AutokeyAdmin_GetIamPolicy_sync]
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
/*
3+
* Copyright 2024 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START cloudkms_v1_generated_AutokeyAdmin_GetLocation_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\Cloud\Kms\V1\Client\AutokeyAdminClient;
28+
use Google\Cloud\Location\GetLocationRequest;
29+
use Google\Cloud\Location\Location;
30+
31+
/**
32+
* Gets information about a location.
33+
*
34+
* This sample has been automatically generated and should be regarded as a code
35+
* template only. It will require modifications to work:
36+
* - It may require correct/in-range values for request initialization.
37+
* - It may require specifying regional endpoints when creating the service client,
38+
* please see the apiEndpoint client configuration option for more details.
39+
*/
40+
function get_location_sample(): void
41+
{
42+
// Create a client.
43+
$autokeyAdminClient = new AutokeyAdminClient();
44+
45+
// Prepare the request message.
46+
$request = new GetLocationRequest();
47+
48+
// Call the API and handle any network failures.
49+
try {
50+
/** @var Location $response */
51+
$response = $autokeyAdminClient->getLocation($request);
52+
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
53+
} catch (ApiException $ex) {
54+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
55+
}
56+
}
57+
// [END cloudkms_v1_generated_AutokeyAdmin_GetLocation_sync]
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
/*
3+
* Copyright 2024 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* https://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
/*
19+
* GENERATED CODE WARNING
20+
* This file was automatically generated - do not edit!
21+
*/
22+
23+
require_once __DIR__ . '/../../../vendor/autoload.php';
24+
25+
// [START cloudkms_v1_generated_AutokeyAdmin_ListLocations_sync]
26+
use Google\ApiCore\ApiException;
27+
use Google\ApiCore\PagedListResponse;
28+
use Google\Cloud\Kms\V1\Client\AutokeyAdminClient;
29+
use Google\Cloud\Location\ListLocationsRequest;
30+
use Google\Cloud\Location\Location;
31+
32+
/**
33+
* Lists information about the supported locations for this service.
34+
*
35+
* This sample has been automatically generated and should be regarded as a code
36+
* template only. It will require modifications to work:
37+
* - It may require correct/in-range values for request initialization.
38+
* - It may require specifying regional endpoints when creating the service client,
39+
* please see the apiEndpoint client configuration option for more details.
40+
*/
41+
function list_locations_sample(): void
42+
{
43+
// Create a client.
44+
$autokeyAdminClient = new AutokeyAdminClient();
45+
46+
// Prepare the request message.
47+
$request = new ListLocationsRequest();
48+
49+
// Call the API and handle any network failures.
50+
try {
51+
/** @var PagedListResponse $response */
52+
$response = $autokeyAdminClient->listLocations($request);
53+
54+
/** @var Location $element */
55+
foreach ($response as $element) {
56+
printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
57+
}
58+
} catch (ApiException $ex) {
59+
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
60+
}
61+
}
62+
// [END cloudkms_v1_generated_AutokeyAdmin_ListLocations_sync]

0 commit comments

Comments
 (0)