Skip to content

Commit e2f614b

Browse files
authored
feat(kms): add autokey clients (#14297)
1 parent 181ee8c commit e2f614b

File tree

66 files changed

+5390
-0
lines changed

Some content is hidden

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

66 files changed

+5390
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ the APIs in these libraries are stable, and are ready for production use.
1313

1414
- [Public Certificate Authority API](/google/cloud/publicca/README.md)
1515

16+
### Updated Libraries
17+
18+
- [KMS](/google/cloud/kms/README.md) - new `AutokeyClient` and
19+
`AutokeyAdminClient`
20+
1621
## v2.24.0 - 2024-05
1722

1823
### No longer testing with MSVC 2019
138 KB
Binary file not shown.

generator/generator_config.textproto

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2480,6 +2480,20 @@ service {
24802480
}
24812481
24822482
# KMS
2483+
service {
2484+
service_proto_path: "google/cloud/kms/v1/autokey.proto"
2485+
product_path: "google/cloud/kms/v1"
2486+
initial_copyright_year: "2024"
2487+
retryable_status_codes: ["kUnavailable"]
2488+
}
2489+
2490+
service {
2491+
service_proto_path: "google/cloud/kms/v1/autokey_admin.proto"
2492+
product_path: "google/cloud/kms/v1"
2493+
initial_copyright_year: "2024"
2494+
retryable_status_codes: ["kUnavailable"]
2495+
}
2496+
24832497
service {
24842498
service_proto_path: "google/cloud/kms/v1/service.proto"
24852499
product_path: "google/cloud/kms/v1"

google/cloud/kms/doc/environment-variables.dox

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ environment variables are convenient when troubleshooting problems.
1010

1111
<!-- inject-endpoint-env-vars-start -->
1212

13+
- `GOOGLE_CLOUD_CPP_AUTOKEY_ADMIN_ENDPOINT=...` overrides the
14+
`EndpointOption` (which defaults to "cloudkms.googleapis.com")
15+
used by `MakeAutokeyAdminConnection()`.
16+
17+
- `GOOGLE_CLOUD_CPP_AUTOKEY_ENDPOINT=...` overrides the
18+
`EndpointOption` (which defaults to "cloudkms.googleapis.com")
19+
used by `MakeAutokeyConnection()`.
20+
1321
- `GOOGLE_CLOUD_CPP_EKM_SERVICE_ENDPOINT=...` overrides the
1422
`EndpointOption` (which defaults to "cloudkms.googleapis.com")
1523
used by `MakeEkmServiceConnection()`.

google/cloud/kms/doc/main.dox

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ application.
3434

3535
- [\c kms_inventory_v1::KeyDashboardServiceClient](@ref google::cloud::kms_inventory_v1::KeyDashboardServiceClient)
3636
- [\c kms_inventory_v1::KeyTrackingServiceClient](@ref google::cloud::kms_inventory_v1::KeyTrackingServiceClient)
37+
- [\c kms_v1::AutokeyAdminClient](@ref google::cloud::kms_v1::AutokeyAdminClient)
38+
- [\c kms_v1::AutokeyClient](@ref google::cloud::kms_v1::AutokeyClient)
3739
- [\c kms_v1::EkmServiceClient](@ref google::cloud::kms_v1::EkmServiceClient)
3840
- [\c kms_v1::KeyManagementServiceClient](@ref google::cloud::kms_v1::KeyManagementServiceClient)
3941
<!-- inject-client-list-end -->

google/cloud/kms/doc/override-authentication.dox

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Follow these links to find examples for other \c *Client classes:
1515

1616
- [\c kms_inventory_v1::KeyDashboardServiceClient](@ref kms_inventory_v1::KeyDashboardServiceClient-service-account-snippet)
1717
- [\c kms_inventory_v1::KeyTrackingServiceClient](@ref kms_inventory_v1::KeyTrackingServiceClient-service-account-snippet)
18+
- [\c kms_v1::AutokeyAdminClient](@ref kms_v1::AutokeyAdminClient-service-account-snippet)
19+
- [\c kms_v1::AutokeyClient](@ref kms_v1::AutokeyClient-service-account-snippet)
1820
- [\c kms_v1::EkmServiceClient](@ref kms_v1::EkmServiceClient-service-account-snippet)
1921
- [\c kms_v1::KeyManagementServiceClient](@ref kms_v1::KeyManagementServiceClient-service-account-snippet)
2022

@@ -46,6 +48,18 @@ guide for more details.
4648

4749
*/
4850

51+
/*! @page kms_v1::AutokeyAdminClient-service-account-snippet Override kms_v1::AutokeyAdminClient Authentication Defaults
52+
53+
@snippet google/cloud/kms/v1/samples/autokey_admin_client_samples.cc with-service-account
54+
55+
*/
56+
57+
/*! @page kms_v1::AutokeyClient-service-account-snippet Override kms_v1::AutokeyClient Authentication Defaults
58+
59+
@snippet google/cloud/kms/v1/samples/autokey_client_samples.cc with-service-account
60+
61+
*/
62+
4963
/*! @page kms_v1::EkmServiceClient-service-account-snippet Override kms_v1::EkmServiceClient Authentication Defaults
5064

5165
@snippet google/cloud/kms/v1/samples/ekm_client_samples.cc with-service-account

google/cloud/kms/doc/override-endpoint.dox

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Follow these links to find examples for other \c *Client classes:
1515

1616
- [\c kms_inventory_v1::KeyDashboardServiceClient](@ref kms_inventory_v1::KeyDashboardServiceClient-endpoint-snippet)
1717
- [\c kms_inventory_v1::KeyTrackingServiceClient](@ref kms_inventory_v1::KeyTrackingServiceClient-endpoint-snippet)
18+
- [\c kms_v1::AutokeyAdminClient](@ref kms_v1::AutokeyAdminClient-endpoint-snippet)
19+
- [\c kms_v1::AutokeyClient](@ref kms_v1::AutokeyClient-endpoint-snippet)
1820
- [\c kms_v1::EkmServiceClient](@ref kms_v1::EkmServiceClient-endpoint-snippet)
1921
- [\c kms_v1::KeyManagementServiceClient](@ref kms_v1::KeyManagementServiceClient-endpoint-snippet)
2022

@@ -36,6 +38,18 @@ Follow these links to find examples for other \c *Client classes:
3638

3739
*/
3840

41+
/*! @page kms_v1::AutokeyAdminClient-endpoint-snippet Override kms_v1::AutokeyAdminClient Endpoint Configuration
42+
43+
@snippet google/cloud/kms/v1/samples/autokey_admin_client_samples.cc set-client-endpoint
44+
45+
*/
46+
47+
/*! @page kms_v1::AutokeyClient-endpoint-snippet Override kms_v1::AutokeyClient Endpoint Configuration
48+
49+
@snippet google/cloud/kms/v1/samples/autokey_client_samples.cc set-client-endpoint
50+
51+
*/
52+
3953
/*! @page kms_v1::EkmServiceClient-endpoint-snippet Override kms_v1::EkmServiceClient Endpoint Configuration
4054

4155
@snippet google/cloud/kms/v1/samples/ekm_client_samples.cc set-client-endpoint

google/cloud/kms/doc/override-retry-policies.dox

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ Follow these links to find examples for other \c *Client classes:
8181

8282
- [\c kms_inventory_v1::KeyDashboardServiceClient](@ref kms_inventory_v1::KeyDashboardServiceClient-retry-snippet)
8383
- [\c kms_inventory_v1::KeyTrackingServiceClient](@ref kms_inventory_v1::KeyTrackingServiceClient-retry-snippet)
84+
- [\c kms_v1::AutokeyAdminClient](@ref kms_v1::AutokeyAdminClient-retry-snippet)
85+
- [\c kms_v1::AutokeyClient](@ref kms_v1::AutokeyClient-retry-snippet)
8486
- [\c kms_v1::EkmServiceClient](@ref kms_v1::EkmServiceClient-retry-snippet)
8587
- [\c kms_v1::KeyManagementServiceClient](@ref kms_v1::KeyManagementServiceClient-retry-snippet)
8688

@@ -122,6 +124,30 @@ Assuming you have created a custom idempotency policy. Such as:
122124

123125
*/
124126

127+
/*! @page kms_v1::AutokeyAdminClient-retry-snippet Override kms_v1::AutokeyAdminClient Retry Policies
128+
129+
This shows how to override the retry policies for kms_v1::AutokeyAdminClient:
130+
131+
@snippet google/cloud/kms/v1/samples/autokey_admin_client_samples.cc set-retry-policy
132+
133+
Assuming you have created a custom idempotency policy. Such as:
134+
135+
@snippet google/cloud/kms/v1/samples/autokey_admin_client_samples.cc custom-idempotency-policy
136+
137+
*/
138+
139+
/*! @page kms_v1::AutokeyClient-retry-snippet Override kms_v1::AutokeyClient Retry Policies
140+
141+
This shows how to override the retry policies for kms_v1::AutokeyClient:
142+
143+
@snippet google/cloud/kms/v1/samples/autokey_client_samples.cc set-retry-policy
144+
145+
Assuming you have created a custom idempotency policy. Such as:
146+
147+
@snippet google/cloud/kms/v1/samples/autokey_client_samples.cc custom-idempotency-policy
148+
149+
*/
150+
125151
/*! @page kms_v1::EkmServiceClient-retry-snippet Override kms_v1::EkmServiceClient Retry Policies
126152

127153
This shows how to override the retry policies for kms_v1::EkmServiceClient:
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
// Copyright 2024 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// Generated by the Codegen C++ plugin.
16+
// If you make any local changes, they will be lost.
17+
// source: google/cloud/kms/v1/autokey_admin.proto
18+
19+
#include "google/cloud/kms/v1/autokey_admin_client.h"
20+
#include <memory>
21+
#include <utility>
22+
23+
namespace google {
24+
namespace cloud {
25+
namespace kms_v1 {
26+
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
27+
28+
AutokeyAdminClient::AutokeyAdminClient(
29+
std::shared_ptr<AutokeyAdminConnection> connection, Options opts)
30+
: connection_(std::move(connection)),
31+
options_(
32+
internal::MergeOptions(std::move(opts), connection_->options())) {}
33+
AutokeyAdminClient::~AutokeyAdminClient() = default;
34+
35+
StatusOr<google::cloud::kms::v1::AutokeyConfig>
36+
AutokeyAdminClient::UpdateAutokeyConfig(
37+
google::cloud::kms::v1::AutokeyConfig const& autokey_config,
38+
google::protobuf::FieldMask const& update_mask, Options opts) {
39+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
40+
google::cloud::kms::v1::UpdateAutokeyConfigRequest request;
41+
*request.mutable_autokey_config() = autokey_config;
42+
*request.mutable_update_mask() = update_mask;
43+
return connection_->UpdateAutokeyConfig(request);
44+
}
45+
46+
StatusOr<google::cloud::kms::v1::AutokeyConfig>
47+
AutokeyAdminClient::UpdateAutokeyConfig(
48+
google::cloud::kms::v1::UpdateAutokeyConfigRequest const& request,
49+
Options opts) {
50+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
51+
return connection_->UpdateAutokeyConfig(request);
52+
}
53+
54+
StatusOr<google::cloud::kms::v1::AutokeyConfig>
55+
AutokeyAdminClient::GetAutokeyConfig(std::string const& name, Options opts) {
56+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
57+
google::cloud::kms::v1::GetAutokeyConfigRequest request;
58+
request.set_name(name);
59+
return connection_->GetAutokeyConfig(request);
60+
}
61+
62+
StatusOr<google::cloud::kms::v1::AutokeyConfig>
63+
AutokeyAdminClient::GetAutokeyConfig(
64+
google::cloud::kms::v1::GetAutokeyConfigRequest const& request,
65+
Options opts) {
66+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
67+
return connection_->GetAutokeyConfig(request);
68+
}
69+
70+
StatusOr<google::cloud::kms::v1::ShowEffectiveAutokeyConfigResponse>
71+
AutokeyAdminClient::ShowEffectiveAutokeyConfig(std::string const& parent,
72+
Options opts) {
73+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
74+
google::cloud::kms::v1::ShowEffectiveAutokeyConfigRequest request;
75+
request.set_parent(parent);
76+
return connection_->ShowEffectiveAutokeyConfig(request);
77+
}
78+
79+
StatusOr<google::cloud::kms::v1::ShowEffectiveAutokeyConfigResponse>
80+
AutokeyAdminClient::ShowEffectiveAutokeyConfig(
81+
google::cloud::kms::v1::ShowEffectiveAutokeyConfigRequest const& request,
82+
Options opts) {
83+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
84+
return connection_->ShowEffectiveAutokeyConfig(request);
85+
}
86+
87+
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
88+
} // namespace kms_v1
89+
} // namespace cloud
90+
} // namespace google

0 commit comments

Comments
 (0)