Skip to content

Commit ce02666

Browse files
authored
feat(mixin): generate mixins for libraries (#14766)
* Add mixin for data_migration * Add mixin for the rest of libraries * cmake build * cmake build * cmake build * cmake install expectation
1 parent 2c51793 commit ce02666

File tree

5,248 files changed

+249160
-573
lines changed

Some content is hidden

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

5,248 files changed

+249160
-573
lines changed

ci/cloudbuild/builds/cmake-install.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ expected_dirs+=(
9898
./include/google/cloud/grpc_utils
9999
./include/google/cloud/internal
100100
./include/google/cloud/internal/win32
101+
./include/google/cloud/location
101102
# no RPC services in google/cloud/metastore/logging
102103
./include/google/cloud/metastore/logging
103104
./include/google/cloud/metastore/logging/v1

external/googleapis/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ set(EXTERNAL_GOOGLEAPIS_PROTO_FILES
7171
"google/api/usage.proto"
7272
"google/api/visibility.proto"
7373
"google/cloud/extended_operations.proto"
74+
"google/cloud/location/locations.proto"
7475
# orgpolicy/v**1** is used *indirectly* by google/cloud/asset, therefore it
7576
# does not appear in protolists/asset.list. In addition, it is not compiled
7677
# by any other library. So, added manually.
@@ -248,6 +249,7 @@ set(PROTO_FILES_WITH_DEPENDENCIES
248249
"google/api/quota.proto"
249250
"google/api/service.proto"
250251
"google/api/usage.proto"
252+
"google/cloud/location/locations.proto"
251253
"google/rpc/status.proto")
252254

253255
# For some directories *most* (but not all) the proto files are simple enough
@@ -315,6 +317,9 @@ external_googleapis_add_library(
315317
api_system_parameter_protos
316318
api_usage_protos)
317319

320+
external_googleapis_add_library("google/cloud/location/locations.proto"
321+
api_annotations_protos api_client_protos)
322+
318323
external_googleapis_add_library("google/iam/v1/options.proto"
319324
api_annotations_protos)
320325
external_googleapis_add_library("google/iam/v1/policy.proto"

generator/internal/make_generators.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,8 @@ std::vector<std::unique_ptr<GeneratorInterface>> MakeGenerators(
6060
google::protobuf::compiler::GeneratorContext* context,
6161
YAML::Node const& service_config,
6262
std::vector<std::pair<std::string, std::string>> const& vars) {
63-
std::vector<MixinMethod> mixin_methods;
64-
if (service->file()->name() == "google/pubsub/v1/pubsub.proto") {
65-
mixin_methods = GetMixinMethods(service_config, *service);
66-
}
63+
std::vector<MixinMethod> mixin_methods =
64+
GetMixinMethods(service_config, *service);
6765
std::vector<std::string> sources;
6866
std::vector<std::unique_ptr<GeneratorInterface>> code_generators;
6967
VarsDictionary service_vars =

google/cloud/accesscontextmanager/v1/access_context_manager_client.cc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,22 @@ AccessContextManagerClient::TestIamPermissions(
861861
return connection_->TestIamPermissions(request);
862862
}
863863

864+
StatusOr<google::longrunning::Operation>
865+
AccessContextManagerClient::GetOperation(std::string const& name,
866+
Options opts) {
867+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
868+
google::longrunning::GetOperationRequest request;
869+
request.set_name(name);
870+
return connection_->GetOperation(request);
871+
}
872+
873+
StatusOr<google::longrunning::Operation>
874+
AccessContextManagerClient::GetOperation(
875+
google::longrunning::GetOperationRequest const& request, Options opts) {
876+
internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_));
877+
return connection_->GetOperation(request);
878+
}
879+
864880
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
865881
} // namespace accesscontextmanager_v1
866882
} // namespace cloud

google/cloud/accesscontextmanager/v1/access_context_manager_client.h

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2575,6 +2575,66 @@ class AccessContextManagerClient {
25752575
google::iam::v1::TestIamPermissionsRequest const& request,
25762576
Options opts = {});
25772577

2578+
// clang-format off
2579+
///
2580+
/// Gets the latest state of a long-running operation. Clients can use this
2581+
/// method to poll the operation result at intervals as recommended by the API
2582+
/// service.
2583+
///
2584+
/// @param name The name of the operation resource.
2585+
/// @param opts Optional. Override the class-level options, such as retry and
2586+
/// backoff policies.
2587+
/// @return the result of the RPC. The response message type
2588+
/// ([google.longrunning.Operation])
2589+
/// is mapped to a C++ class using the [Protobuf mapping rules].
2590+
/// If the request fails, the [`StatusOr`] contains the error details.
2591+
///
2592+
/// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/
2593+
/// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator
2594+
/// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string
2595+
/// [`future`]: @ref google::cloud::future
2596+
/// [`StatusOr`]: @ref google::cloud::StatusOr
2597+
/// [`Status`]: @ref google::cloud::Status
2598+
/// [google.longrunning.GetOperationRequest]: @googleapis_reference_link{google/longrunning/operations.proto#L165}
2599+
/// [google.longrunning.Operation]: @googleapis_reference_link{google/longrunning/operations.proto#L128}
2600+
///
2601+
// clang-format on
2602+
StatusOr<google::longrunning::Operation> GetOperation(std::string const& name,
2603+
Options opts = {});
2604+
2605+
// clang-format off
2606+
///
2607+
/// Gets the latest state of a long-running operation. Clients can use this
2608+
/// method to poll the operation result at intervals as recommended by the API
2609+
/// service.
2610+
///
2611+
/// @param request Unary RPCs, such as the one wrapped by this
2612+
/// function, receive a single `request` proto message which includes all
2613+
/// the inputs for the RPC. In this case, the proto message is a
2614+
/// [google.longrunning.GetOperationRequest].
2615+
/// Proto messages are converted to C++ classes by Protobuf, using the
2616+
/// [Protobuf mapping rules].
2617+
/// @param opts Optional. Override the class-level options, such as retry and
2618+
/// backoff policies.
2619+
/// @return the result of the RPC. The response message type
2620+
/// ([google.longrunning.Operation])
2621+
/// is mapped to a C++ class using the [Protobuf mapping rules].
2622+
/// If the request fails, the [`StatusOr`] contains the error details.
2623+
///
2624+
/// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/
2625+
/// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator
2626+
/// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string
2627+
/// [`future`]: @ref google::cloud::future
2628+
/// [`StatusOr`]: @ref google::cloud::StatusOr
2629+
/// [`Status`]: @ref google::cloud::Status
2630+
/// [google.longrunning.GetOperationRequest]: @googleapis_reference_link{google/longrunning/operations.proto#L165}
2631+
/// [google.longrunning.Operation]: @googleapis_reference_link{google/longrunning/operations.proto#L128}
2632+
///
2633+
// clang-format on
2634+
StatusOr<google::longrunning::Operation> GetOperation(
2635+
google::longrunning::GetOperationRequest const& request,
2636+
Options opts = {});
2637+
25782638
private:
25792639
std::shared_ptr<AccessContextManagerConnection> connection_;
25802640
Options options_;

google/cloud/accesscontextmanager/v1/access_context_manager_connection.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,12 @@ AccessContextManagerConnection::TestIamPermissions(
516516
return Status(StatusCode::kUnimplemented, "not implemented");
517517
}
518518

519+
StatusOr<google::longrunning::Operation>
520+
AccessContextManagerConnection::GetOperation(
521+
google::longrunning::GetOperationRequest const&) {
522+
return Status(StatusCode::kUnimplemented, "not implemented");
523+
}
524+
519525
std::shared_ptr<AccessContextManagerConnection>
520526
MakeAccessContextManagerConnection(Options options) {
521527
internal::CheckExpectedOptions<CommonOptionList, GrpcOptionList,

google/cloud/accesscontextmanager/v1/access_context_manager_connection.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,9 @@ class AccessContextManagerConnection {
437437

438438
virtual StatusOr<google::iam::v1::TestIamPermissionsResponse>
439439
TestIamPermissions(google::iam::v1::TestIamPermissionsRequest const& request);
440+
441+
virtual StatusOr<google::longrunning::Operation> GetOperation(
442+
google::longrunning::GetOperationRequest const& request);
440443
};
441444

442445
/**

google/cloud/accesscontextmanager/v1/access_context_manager_connection_idempotency_policy.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@ Idempotency AccessContextManagerConnectionIdempotencyPolicy::TestIamPermissions(
199199
return Idempotency::kIdempotent;
200200
}
201201

202+
Idempotency AccessContextManagerConnectionIdempotencyPolicy::GetOperation(
203+
google::longrunning::GetOperationRequest const&) {
204+
return Idempotency::kIdempotent;
205+
}
206+
202207
std::unique_ptr<AccessContextManagerConnectionIdempotencyPolicy>
203208
MakeDefaultAccessContextManagerConnectionIdempotencyPolicy() {
204209
return std::make_unique<AccessContextManagerConnectionIdempotencyPolicy>();

google/cloud/accesscontextmanager/v1/access_context_manager_connection_idempotency_policy.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "google/cloud/idempotency.h"
2323
#include "google/cloud/version.h"
2424
#include <google/identity/accesscontextmanager/v1/access_context_manager.grpc.pb.h>
25+
#include <google/longrunning/operations.grpc.pb.h>
2526
#include <memory>
2627

2728
namespace google {
@@ -136,6 +137,9 @@ class AccessContextManagerConnectionIdempotencyPolicy {
136137

137138
virtual google::cloud::Idempotency TestIamPermissions(
138139
google::iam::v1::TestIamPermissionsRequest const& request);
140+
141+
virtual google::cloud::Idempotency GetOperation(
142+
google::longrunning::GetOperationRequest const& request);
139143
};
140144

141145
std::unique_ptr<AccessContextManagerConnectionIdempotencyPolicy>

google/cloud/accesscontextmanager/v1/internal/access_context_manager_auth_decorator.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,14 @@ AccessContextManagerAuth::TestIamPermissions(
601601
return child_->TestIamPermissions(context, options, request);
602602
}
603603

604+
StatusOr<google::longrunning::Operation> AccessContextManagerAuth::GetOperation(
605+
grpc::ClientContext& context, Options const& options,
606+
google::longrunning::GetOperationRequest const& request) {
607+
auto status = auth_->ConfigureContext(context);
608+
if (!status.ok()) return status;
609+
return child_->GetOperation(context, options, request);
610+
}
611+
604612
future<StatusOr<google::longrunning::Operation>>
605613
AccessContextManagerAuth::AsyncGetOperation(
606614
google::cloud::CompletionQueue& cq,

0 commit comments

Comments
 (0)