diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c250480bfcdb..e2e9c1dfc01b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,13 @@ for details on updating existing applications using v1.x.y or v2.x.y. ## v3.8.0 - TBD +### New Libraries + +We are happy to announce the following GA libraries. Unless specifically noted, +the APIs in these libraries are stable, and are ready for production use. + +- [Agent Identity API](/google/cloud/agentidentity/README.md) + ## v3.7.0 - 2026-07 ### Removed Libraries diff --git a/README.md b/README.md index 62963363b11f3..8c86b4f68bee1 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,9 @@ See each library's `README.md` file for more information about: - [Advisory Notifications API](google/cloud/advisorynotifications/README.md) [[quickstart]](google/cloud/advisorynotifications/quickstart/README.md) [[reference]](https://cloud.google.com/cpp/docs/reference/advisorynotifications/latest) +- [Agent Identity API](google/cloud/agentidentity/README.md) + [[quickstart]](google/cloud/agentidentity/quickstart/README.md) + [[reference]](https://cloud.google.com/cpp/docs/reference/agentidentity/latest) - [Agent Registry API](google/cloud/agentregistry/README.md) [[quickstart]](google/cloud/agentregistry/quickstart/README.md) [[reference]](https://cloud.google.com/cpp/docs/reference/agentregistry/latest) diff --git a/ci/abi-dumps/google_cloud_cpp_agentidentity.expected.abi.dump.gz b/ci/abi-dumps/google_cloud_cpp_agentidentity.expected.abi.dump.gz new file mode 100644 index 0000000000000..d4c0f30d16642 Binary files /dev/null and b/ci/abi-dumps/google_cloud_cpp_agentidentity.expected.abi.dump.gz differ diff --git a/ci/etc/expected_install_directories b/ci/etc/expected_install_directories index 971517611c477..c9e1d3dfc64eb 100644 --- a/ci/etc/expected_install_directories +++ b/ci/etc/expected_install_directories @@ -32,6 +32,10 @@ ./include/google/cloud/advisorynotifications/v1 ./include/google/cloud/advisorynotifications/v1/internal ./include/google/cloud/advisorynotifications/v1/mocks +./include/google/cloud/agentidentity +./include/google/cloud/agentidentity/v1 +./include/google/cloud/agentidentity/v1/internal +./include/google/cloud/agentidentity/v1/mocks ./include/google/cloud/agentregistry ./include/google/cloud/agentregistry/v1 ./include/google/cloud/agentregistry/v1/internal @@ -1304,6 +1308,8 @@ ./lib64/cmake/google_cloud_cpp_accesscontextmanager_mocks ./lib64/cmake/google_cloud_cpp_advisorynotifications ./lib64/cmake/google_cloud_cpp_advisorynotifications_mocks +./lib64/cmake/google_cloud_cpp_agentidentity +./lib64/cmake/google_cloud_cpp_agentidentity_mocks ./lib64/cmake/google_cloud_cpp_agentregistry ./lib64/cmake/google_cloud_cpp_agentregistry_mocks ./lib64/cmake/google_cloud_cpp_aiplatform diff --git a/cmake/GoogleCloudCppFeatures.cmake b/cmake/GoogleCloudCppFeatures.cmake index 934886cf6e432..871c2b8d23142 100644 --- a/cmake/GoogleCloudCppFeatures.cmake +++ b/cmake/GoogleCloudCppFeatures.cmake @@ -42,7 +42,8 @@ set(GOOGLE_CLOUD_CPP_GA_LIBRARIES "accessapproval" "accesscontextmanager" "advisorynotifications" - "agentregistry" # Generated 2026-06-26 + "agentidentity" + "agentregistry" "aiplatform" "alloydb" "apigateway" diff --git a/external/googleapis/protodeps/agentidentity.deps b/external/googleapis/protodeps/agentidentity.deps new file mode 100644 index 0000000000000..215c8fb2926ff --- /dev/null +++ b/external/googleapis/protodeps/agentidentity.deps @@ -0,0 +1,8 @@ +@googleapis//google/api:annotations_proto +@googleapis//google/api:client_proto +@googleapis//google/api:field_behavior_proto +@googleapis//google/api:field_info_proto +@googleapis//google/api:http_proto +@googleapis//google/api:launch_stage_proto +@googleapis//google/api:resource_proto +@googleapis//google/rpc:status_proto diff --git a/external/googleapis/protolists/agentidentity.list b/external/googleapis/protolists/agentidentity.list new file mode 100644 index 0000000000000..f0594e7c014da --- /dev/null +++ b/external/googleapis/protolists/agentidentity.list @@ -0,0 +1 @@ +@googleapis//google/cloud/agentidentity/v1:auth_provider_service.proto diff --git a/external/googleapis/update_libraries.sh b/external/googleapis/update_libraries.sh index 419d7135c3767..ca759de1dce92 100755 --- a/external/googleapis/update_libraries.sh +++ b/external/googleapis/update_libraries.sh @@ -17,6 +17,7 @@ set -euo pipefail declare -A -r LIBRARIES=( ["accessapproval"]="@googleapis//google/cloud/accessapproval/v1:accessapproval_cc_grpc" + ["agentidentity"]="@googleapis//google/cloud/agentidentity/v1:agentidentity_cc_grpc" ["agentregistry"]="@googleapis//google/cloud/agentregistry/v1:agentregistry_cc_grpc" ["accesscontextmanager"]="$( printf ",%s" \ diff --git a/generator/generator_config.textproto b/generator/generator_config.textproto index c62acf5c64025..72fd104d4633e 100644 --- a/generator/generator_config.textproto +++ b/generator/generator_config.textproto @@ -22,6 +22,14 @@ service { retryable_status_codes: ["kUnavailable"] } +# Agent Identity +service { + service_proto_path: "google/cloud/agentidentity/v1/auth_provider_service.proto" + product_path: "google/cloud/agentidentity/v1" + initial_copyright_year: "2026" + retryable_status_codes: ["kUnavailable"] +} + # Agent Registry service { service_proto_path: "google/cloud/agentregistry/v1/agentregistry_service.proto" diff --git a/google/cloud/agentidentity/BUILD.bazel b/google/cloud/agentidentity/BUILD.bazel new file mode 100644 index 0000000000000..3e39dbe44dc08 --- /dev/null +++ b/google/cloud/agentidentity/BUILD.bazel @@ -0,0 +1,31 @@ +# Copyright 2026 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. + +load("//bazel:gapic.bzl", "cc_gapic_library") + +package(default_visibility = ["//visibility:private"]) + +licenses(["notice"]) # Apache 2.0 + +service_dirs = ["v1/"] + +googleapis_deps = [ + "@googleapis//google/cloud/agentidentity/v1:agentidentity_cc_grpc", +] + +cc_gapic_library( + name = "agentidentity", + googleapis_deps = googleapis_deps, + service_dirs = service_dirs, +) diff --git a/google/cloud/agentidentity/CMakeLists.txt b/google/cloud/agentidentity/CMakeLists.txt new file mode 100644 index 0000000000000..a30ea0999804c --- /dev/null +++ b/google/cloud/agentidentity/CMakeLists.txt @@ -0,0 +1,38 @@ +# ~~~ +# Copyright 2026 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. +# ~~~ + +include(GoogleCloudCppLibrary) + +google_cloud_cpp_add_gapic_library(agentidentity "Agent Identity API" + SERVICE_DIRS "v1/") + +if (BUILD_TESTING AND GOOGLE_CLOUD_CPP_ENABLE_CXX_EXCEPTIONS) + add_executable(agentidentity_quickstart "quickstart/quickstart.cc") + target_link_libraries(agentidentity_quickstart + PRIVATE google-cloud-cpp::agentidentity) + google_cloud_cpp_add_common_options(agentidentity_quickstart) + add_test( + NAME agentidentity_quickstart + COMMAND + cmake -P "${PROJECT_SOURCE_DIR}/cmake/quickstart-runner.cmake" + $ GOOGLE_CLOUD_PROJECT + GOOGLE_CLOUD_CPP_TEST_REGION) + set_tests_properties( + agentidentity_quickstart + PROPERTIES + LABELS "integration-test;quickstart" PASS_REGULAR_EXPRESSION + "Permanent error.*gcloud-cpp.retry.function=ListAuthProviders") +endif () diff --git a/google/cloud/agentidentity/README.md b/google/cloud/agentidentity/README.md new file mode 100644 index 0000000000000..3f23c0d3d8b7d --- /dev/null +++ b/google/cloud/agentidentity/README.md @@ -0,0 +1,59 @@ +# Agent Identity API C++ Client Library + +This directory contains an idiomatic C++ client library for the +[Agent Identity API][cloud-service-docs]. + +While this library is **GA**, please note that the Google Cloud C++ client +libraries do **not** follow [Semantic Versioning](https://semver.org/). + +## Quickstart + +The [quickstart/](quickstart/README.md) directory contains a minimal environment +to get started using this client library in a larger project. The following +"Hello World" program is used in this quickstart, and should give you a taste of +this library. + + + +```cc +#include "google/cloud/agentidentity/v1/auth_provider_client.h" +#include "google/cloud/location.h" +#include + +int main(int argc, char* argv[]) try { + if (argc != 3) { + std::cerr << "Usage: " << argv[0] << " project-id location-id\n"; + return 1; + } + + auto const location = google::cloud::Location(argv[1], argv[2]); + + namespace agentidentity = ::google::cloud::agentidentity_v1; + auto client = agentidentity::AuthProviderServiceClient( + agentidentity::MakeAuthProviderServiceConnection()); + + for (auto r : client.ListAuthProviders(location.FullName())) { + if (!r) throw std::move(r).status(); + std::cout << r->DebugString() << "\n"; + } + + return 0; +} catch (google::cloud::Status const& status) { + std::cerr << "google::cloud::Status thrown: " << status << "\n"; + return 1; +} +``` + + + +## More Information + +- Official documentation about the [Agent Identity API][cloud-service-docs] + service +- [Reference doxygen documentation][doxygen-link] for each release of this + client library +- Detailed header comments in our [public `.h`][source-link] files + +[cloud-service-docs]: https://cloud.google.com/agentidentity/docs/overview +[doxygen-link]: https://cloud.google.com/cpp/docs/reference/agentidentity/latest/ +[source-link]: https://github.com/googleapis/google-cloud-cpp/tree/main/google/cloud/agentidentity diff --git a/google/cloud/agentidentity/doc/environment-variables.dox b/google/cloud/agentidentity/doc/environment-variables.dox new file mode 100644 index 0000000000000..9081ceac5b651 --- /dev/null +++ b/google/cloud/agentidentity/doc/environment-variables.dox @@ -0,0 +1,49 @@ +/*! +@page agentidentity-env Environment Variables + +A number of environment variables can be used to configure the behavior of +the library. There are also functions to configure this behavior in code. The +environment variables are convenient when troubleshooting problems. + +@section agentidentity-env-endpoint Endpoint Overrides + + + +- `GOOGLE_CLOUD_CPP_AUTH_PROVIDER_SERVICE_ENDPOINT=...` overrides the + `EndpointOption` (which defaults to "agentidentity.googleapis.com") + used by `MakeAuthProviderServiceConnection()`. + + + +@see google::cloud::EndpointOption + +@section agentidentity-env-logging Logging + +`GOOGLE_CLOUD_CPP_ENABLE_TRACING=rpc`: turns on tracing for most gRPC +calls. The library injects an additional Stub decorator that prints each gRPC +request and response. Unless you have configured your own logging backend, +you should also set `GOOGLE_CLOUD_CPP_ENABLE_CLOG` to produce any output on +the program's console. + +@see google::cloud::LoggingComponentsOption + +`GOOGLE_CLOUD_CPP_TRACING_OPTIONS=...`: modifies the behavior of gRPC tracing, +including whether messages will be output on multiple lines, or whether +string/bytes fields will be truncated. + +@see google::cloud::GrpcTracingOptionsOption + +`GOOGLE_CLOUD_CPP_ENABLE_CLOG=yes`: turns on logging in the library, basically +the library always "logs" but the logging infrastructure has no backend to +actually print anything until the application sets a backend or they set this +environment variable. + +@see google::cloud::LogBackend +@see google::cloud::LogSink + +@section agentidentity-env-project Setting the Default Project + +`GOOGLE_CLOUD_PROJECT=...`: is used in examples and integration tests to +configure the GCP project. This has no effect in the library. + +*/ diff --git a/google/cloud/agentidentity/doc/main.dox b/google/cloud/agentidentity/doc/main.dox new file mode 100644 index 0000000000000..6df66c72c29b3 --- /dev/null +++ b/google/cloud/agentidentity/doc/main.dox @@ -0,0 +1,48 @@ +/*! + +@mainpage Agent Identity API C++ Client Library + +An idiomatic C++ client library for the [Agent Identity API][cloud-service-docs]. + + + +While this library is **GA**, please note that the Google Cloud C++ client libraries do **not** follow +[Semantic Versioning](https://semver.org/). + +@tableofcontents{HTML:2} + +## Quickstart + +The following shows the code that you'll run in the +`google/cloud/agentidentity/quickstart/` directory, +which should give you a taste of the Agent Identity API C++ client library API. + +@snippet quickstart.cc all + +## Main classes + + +The main class in this library is +[`agentidentity_v1::AuthProviderServiceClient`](@ref google::cloud::agentidentity_v1::AuthProviderServiceClient). All RPCs are exposed +as member functions of this class. Other classes provide helpers, configuration +parameters, and infrastructure to mock +[`agentidentity_v1::AuthProviderServiceClient`](@ref google::cloud::agentidentity_v1::AuthProviderServiceClient) when testing your +application. + + +## More Information + +- @ref common-error-handling - describes how the library reports errors. +- @ref agentidentity-override-endpoint - describes how to override the default + endpoint. +- @ref agentidentity-override-authentication - describes how to change the + authentication credentials used by the library. +- @ref agentidentity-override-retry - describes how to change the default retry + policies. +- @ref agentidentity-env - describes environment variables that can configure the + behavior of the library. +- @ref agentidentity-override-universe-domain - describes how to override the default universe domain. + +[cloud-service-docs]: https://cloud.google.com/agentidentity/docs/overview + +*/ diff --git a/google/cloud/agentidentity/doc/options.dox b/google/cloud/agentidentity/doc/options.dox new file mode 100644 index 0000000000000..42ba8cf482f83 --- /dev/null +++ b/google/cloud/agentidentity/doc/options.dox @@ -0,0 +1,10 @@ +/*! +@defgroup google-cloud-agentidentity-options Agent Identity API Configuration Options + +This library uses the same mechanism (`google::cloud::Options`) and the common +[options](@ref options) as all other C++ client libraries for its configuration. +Some `*Option` classes, which are only used in this library, are documented in +this page. + +@see @ref options - for an overview of client library configuration. +*/ diff --git a/google/cloud/agentidentity/doc/override-authentication.dox b/google/cloud/agentidentity/doc/override-authentication.dox new file mode 100644 index 0000000000000..5b24bf981dca3 --- /dev/null +++ b/google/cloud/agentidentity/doc/override-authentication.dox @@ -0,0 +1,35 @@ +/*! +@page agentidentity-override-authentication How to Override the Authentication Credentials + +Unless otherwise configured, the client libraries use +[Application Default Credentials] to authenticate with Google Cloud Services. +While this works for most applications, in some cases you may need to override +this default. You can do so by providing the +[UnifiedCredentialsOption](@ref google::cloud::UnifiedCredentialsOption) +The following example shows how to explicitly load a service account key file: + + +@snippet auth_provider_client_samples.cc with-service-account + + + +Keep in mind that we chose this as an example because it is relatively easy to +understand. Consult the [Best practices for managing service account keys] +guide for more details. + +@see @ref guac - for more information on the factory functions to create +`google::cloud::Credentials` objects. + +[Best practices for managing service account keys]: https://cloud.google.com/iam/docs/best-practices-for-managing-service-account-keys +[Application Default Credentials]: https://cloud.google.com/docs/authentication#adc + +*/ + +// + +/*! @page agentidentity_v1::AuthProviderServiceClient-service-account-snippet Override agentidentity_v1::AuthProviderServiceClient Authentication Defaults + +@snippet google/cloud/agentidentity/v1/samples/auth_provider_client_samples.cc with-service-account + +*/ +// diff --git a/google/cloud/agentidentity/doc/override-endpoint.dox b/google/cloud/agentidentity/doc/override-endpoint.dox new file mode 100644 index 0000000000000..caff083b85b4b --- /dev/null +++ b/google/cloud/agentidentity/doc/override-endpoint.dox @@ -0,0 +1,25 @@ +/*! +@page agentidentity-override-endpoint How to Override the Default Endpoint + +In some cases, you may need to override the default endpoint used by the client +library. Use the +[EndpointOption](@ref google::cloud::EndpointOption) when initializing the +client library to change this default. + + +For example, this will override the default endpoint for `agentidentity_v1::AuthProviderServiceClient`: + +@snippet auth_provider_client_samples.cc set-client-endpoint + + + +*/ + +// + +/*! @page agentidentity_v1::AuthProviderServiceClient-endpoint-snippet Override agentidentity_v1::AuthProviderServiceClient Endpoint Configuration + +@snippet google/cloud/agentidentity/v1/samples/auth_provider_client_samples.cc set-client-endpoint + +*/ +// diff --git a/google/cloud/agentidentity/doc/override-retry-policies.dox b/google/cloud/agentidentity/doc/override-retry-policies.dox new file mode 100644 index 0000000000000..8d20ccec53b8b --- /dev/null +++ b/google/cloud/agentidentity/doc/override-retry-policies.dox @@ -0,0 +1,104 @@ +/*! +@page agentidentity-override-retry Override Retry, Backoff, and Idempotency Policies + +When it is safe to do so, the library automatically retries requests that fail +due to a transient error. The library then uses [exponential backoff] to backoff +before trying again. Which operations are considered safe to retry, which +errors are treated as transient failures, the details of the exponential backoff +algorithm, and for how long the library retries are all configurable via +policies. + +This document provides examples showing how to override the default policies. + +The policies can be set when the `*Connection` object is created. The library +provides default policies for any policy that is not set. The application can +also override some (or all) policies when the `*Client` object is created. This +can be useful if multiple `*Client` objects share the same `*Connection` object, +but you want different retry behavior in some of the clients. Finally, the +application can override some retry policies when calling a specific member +function. + +The library uses three different options to control the retry loop. The options +have per-client names. + +@section agentidentity-override-retry-retry-policy Configuring the transient errors and retry duration + +The `*RetryPolicyOption` controls: + +- Which errors are to be treated as transient errors. +- How long the library will keep retrying transient errors. + +You can provide your own class for this option. The library also provides two +built-in policies: + +- `*LimitedErrorCountRetryPolicy`: stops retrying after a specified number + of transient errors. +- `*LimitedTimeRetryPolicy`: stops retrying after a specified time. + +Note that a library may have more than one version of these classes. Their name +match the `*Client` and `*Connection` object they are intended to be used +with. Some `*Client` objects treat different error codes as transient errors. +In most cases, only [kUnavailable](@ref google::cloud::StatusCode) is treated +as a transient error. + +@section agentidentity-override-retry-backoff-policy Controlling the backoff algorithm + +The `*BackoffPolicyOption` controls how long the client library will wait +before retrying a request that failed with a transient error. You can provide +your own class for this option. + +The only built-in backoff policy is +[`ExponentialBackoffPolicy`](@ref google::cloud::ExponentialBackoffPolicy). +This class implements a truncated exponential backoff algorithm, with jitter. +In summary, it doubles the current backoff time after each failure. The actual +backoff time for an RPC is chosen at random, but never exceeds the current +backoff. The current backoff is doubled after each failure, but never exceeds +(or is "truncated") if it reaches a prescribed maximum. + +@section agentidentity-override-retry-idempotency-policy Controlling which operations are retryable + +The `*IdempotencyPolicyOption` controls which requests are retryable, as some +requests are never safe to retry. + +Only one built-in idempotency policy is provided by the library. The name +matches the name of the client it is intended for. For example, `FooBarClient` +will use `FooBarIdempotencyPolicy`. This policy is very conservative. + +@section agentidentity-override-retry-example Example + + +For example, this will override the retry policies for `agentidentity_v1::AuthProviderServiceClient`: + +@snippet auth_provider_client_samples.cc set-retry-policy + +This assumes you have created a custom idempotency policy. Such as: + +@snippet auth_provider_client_samples.cc custom-idempotency-policy + + + + +@section agentidentity-override-retry-more-information More Information + +@see google::cloud::Options +@see google::cloud::BackoffPolicy +@see google::cloud::ExponentialBackoffPolicy + +[exponential backoff]: https://en.wikipedia.org/wiki/Exponential_backoff + +*/ + +// + +/*! @page agentidentity_v1::AuthProviderServiceClient-retry-snippet Override agentidentity_v1::AuthProviderServiceClient Retry Policies + +This shows how to override the retry policies for agentidentity_v1::AuthProviderServiceClient: + +@snippet google/cloud/agentidentity/v1/samples/auth_provider_client_samples.cc set-retry-policy + +Assuming you have created a custom idempotency policy. Such as: + +@snippet google/cloud/agentidentity/v1/samples/auth_provider_client_samples.cc custom-idempotency-policy + +*/ +// diff --git a/google/cloud/agentidentity/doc/override-universe-domain.dox b/google/cloud/agentidentity/doc/override-universe-domain.dox new file mode 100644 index 0000000000000..4a5debdd6051d --- /dev/null +++ b/google/cloud/agentidentity/doc/override-universe-domain.dox @@ -0,0 +1,24 @@ +/*! +@page agentidentity-override-universe-domain How to Override the Default Universe Domain + +In some cases, you may need to override the default universe domain used by the +client library. Use `AddUniverseDomainOption` when initializing the client +library to change this default. + + +For example, this will override the default universe domain for `agentidentity_v1::AuthProviderServiceClient`: + +@snippet auth_provider_client_samples.cc set-client-universe-domain + + + +*/ + +// + +/*! @page agentidentity_v1::AuthProviderServiceClient-universe-domain-snippet Override agentidentity_v1::AuthProviderServiceClient Universe Domain + +@snippet google/cloud/agentidentity/v1/samples/auth_provider_client_samples.cc set-client-universe-domain + +*/ +// diff --git a/google/cloud/agentidentity/quickstart/.bazelrc b/google/cloud/agentidentity/quickstart/.bazelrc new file mode 100644 index 0000000000000..e88672558bca1 --- /dev/null +++ b/google/cloud/agentidentity/quickstart/.bazelrc @@ -0,0 +1,29 @@ +# Copyright 2026 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. + +# Use host-OS-specific config lines from bazelrc files. +build --enable_platform_specific_config=true + +# The project requires C++ >= 17. +build:linux --cxxopt=-std=c++17 +build:macos --cxxopt=-std=c++17 +# Protobuf and gRPC require (or soon will require) C++17 to compile the "host" +# targets, such as protoc and the grpc plugin. +build:linux --host_cxxopt=-std=c++17 +build:macos --host_cxxopt=-std=c++17 + +# Do not create the convenience links. They are inconvenient when the build +# runs inside a docker image or if one builds a quickstart and then builds +# the project separately. +build --experimental_convenience_symlinks=ignore diff --git a/google/cloud/agentidentity/quickstart/BUILD.bazel b/google/cloud/agentidentity/quickstart/BUILD.bazel new file mode 100644 index 0000000000000..684a5a7efcbe1 --- /dev/null +++ b/google/cloud/agentidentity/quickstart/BUILD.bazel @@ -0,0 +1,25 @@ +# Copyright 2026 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. + +licenses(["notice"]) # Apache 2.0 + +cc_binary( + name = "quickstart", + srcs = [ + "quickstart.cc", + ], + deps = [ + "@google_cloud_cpp//:agentidentity", + ], +) diff --git a/google/cloud/agentidentity/quickstart/CMakeLists.txt b/google/cloud/agentidentity/quickstart/CMakeLists.txt new file mode 100644 index 0000000000000..5f4ca13176833 --- /dev/null +++ b/google/cloud/agentidentity/quickstart/CMakeLists.txt @@ -0,0 +1,35 @@ +# Copyright 2026 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. + +# This file shows how to use the Agent Identity API C++ client library from a +# larger CMake project. + +cmake_minimum_required(VERSION 3.22...3.31) +project(google-cloud-cpp-agentidentity-quickstart CXX) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +find_package(google_cloud_cpp_agentidentity REQUIRED) + +# MSVC requires some additional code to select the correct runtime library +if (VCPKG_TARGET_TRIPLET MATCHES "-static$") + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") +else () + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>DLL") +endif () + +# Define your targets. +add_executable(quickstart quickstart.cc) +target_link_libraries(quickstart google-cloud-cpp::agentidentity) diff --git a/google/cloud/agentidentity/quickstart/Makefile b/google/cloud/agentidentity/quickstart/Makefile new file mode 100644 index 0000000000000..94099a53ae3a2 --- /dev/null +++ b/google/cloud/agentidentity/quickstart/Makefile @@ -0,0 +1,35 @@ +# Copyright 2026 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. + +# This is a minimal Makefile to show how to use the Agent Identity API C++ client +# for developers who use make(1) as their build system. + +# The CXX, CXXFLAGS and CXXLD variables are hard-coded. These values work for +# our tests, but applications would typically make them configurable parameters. +CXX=g++ +CXXFLAGS=-std=c++17 +CXXLD=$(CXX) +BIN=. + +all: $(BIN)/quickstart + +# Configuration variables to compile and link against the Agent Identity API C++ +# client library. +CLIENT_MODULE := google_cloud_cpp_agentidentity +CLIENT_CXXFLAGS := $(shell pkg-config $(CLIENT_MODULE) --cflags) +CLIENT_CXXLDFLAGS := $(shell pkg-config $(CLIENT_MODULE) --libs-only-L) +CLIENT_LIBS := $(shell pkg-config $(CLIENT_MODULE) --libs-only-l) + +$(BIN)/quickstart: quickstart.cc + $(CXXLD) $(CXXFLAGS) $(CLIENT_CXXFLAGS) $(CLIENT_CXXLDFLAGS) -o $@ $^ $(CLIENT_LIBS) diff --git a/google/cloud/agentidentity/quickstart/README.md b/google/cloud/agentidentity/quickstart/README.md new file mode 100644 index 0000000000000..29961f2e67063 --- /dev/null +++ b/google/cloud/agentidentity/quickstart/README.md @@ -0,0 +1,135 @@ +# HOWTO: using the Agent Identity API C++ client in your project + +This directory contains small examples showing how to use the Agent Identity API +C++ client library in your own project. These instructions assume that you have +some experience as a C++ developer and that you have a working C++ toolchain +(compiler, linker, etc.) installed on your platform. + +- Packaging maintainers or developers who prefer to install the library in a + fixed directory (such as `/usr/local` or `/opt`) should consult the + [packaging guide](/doc/packaging.md). +- Developers who prefer using a package manager such as + [vcpkg](https://vcpkg.io), or [Conda](https://conda.io), should follow the + instructions for their package manager. +- Developers wanting to use the libraries as part of a larger CMake or Bazel + project should consult the current document. Note that there are similar + documents for each library in their corresponding directories. +- Developers wanting to compile the library just to run some examples or tests + should consult the + [building and installing](/README.md#building-and-installing) section of the + top-level README file. +- Contributors and developers to `google-cloud-cpp` should consult the guide to + [set up a development workstation][howto-setup-dev-workstation]. + +## Before you begin + +To run the quickstart examples you will need a working Google Cloud Platform +(GCP) project. + +## Configuring authentication for the C++ Client Library + +Like most Google Cloud Platform (GCP) services, Agent Identity API requires that +your application authenticates with the service before accessing any data. If +you are not familiar with GCP authentication please take this opportunity to +review the [Authentication methods at Google][authentication-quickstart]. + +## Using with Bazel + +> :warning: If you are using Windows or macOS there are additional instructions +> at the end of this document. + +1. Install Bazel using [the instructions][bazel-install] from the `bazel.build` + website. + +1. Compile this example using Bazel: + + ```bash + cd $HOME/google-cloud-cpp/google/cloud/agentidentity/quickstart + bazel build ... + ``` + + Note that Bazel automatically downloads and compiles all dependencies of the + project. As it is often the case with C++ libraries, compiling these + dependencies may take several minutes. + +1. Run the example, changing the placeholder(s) to appropriate values: + + ```bash + bazel run :quickstart -- [...] + ``` + +## Using with CMake + +> :warning: If you are using Windows or macOS there are additional instructions +> at the end of this document. + +1. Install CMake. The package managers for most Linux distributions include a + package for CMake. Likewise, you can install CMake on Windows using a package + manager such as [chocolatey][choco-cmake-link], and on macOS using + [homebrew][homebrew-cmake-link]. You can also obtain the software directly + from the [cmake.org](https://cmake.org/download/). + +1. Install the dependencies with your favorite tools. As an example, if you use + [vcpkg](https://github.com/Microsoft/vcpkg.git): + + ```bash + cd $HOME/vcpkg + ./vcpkg install google-cloud-cpp[core,agentidentity] + ``` + + Note that, as it is often the case with C++ libraries, compiling these + dependencies may take several minutes. + +1. Configure CMake, if necessary, configure the directory where you installed + the dependencies: + + ```bash + cd $HOME/google-cloud-cpp/google/cloud/agentidentity/quickstart + cmake -S . -B .build -DCMAKE_TOOLCHAIN_FILE=$HOME/vcpkg/scripts/buildsystems/vcpkg.cmake + cmake --build .build + ``` + +1. Run the example, changing the placeholder(s) to appropriate values: + + ```bash + .build/quickstart [...] + ``` + +## Platform Specific Notes + +### macOS + +gRPC [requires][grpc-roots-pem-bug] an environment variable to configure the +trust store for SSL certificates, you can download and configure this using: + +```bash +curl -Lo roots.pem https://pki.google.com/roots.pem +export GRPC_DEFAULT_SSL_ROOTS_FILE_PATH="$PWD/roots.pem" +``` + +### Windows + +Bazel tends to create very long file names and paths. You may need to use a +short directory to store the build output, such as `c:\b`, and instruct Bazel to +use it via: + +```shell +bazel --output_user_root=c:\b build ... +``` + +gRPC [requires][grpc-roots-pem-bug] an environment variable to configure the +trust store for SSL certificates, you can download and configure this using: + +```console +@powershell -NoProfile -ExecutionPolicy unrestricted -Command ^ + (new-object System.Net.WebClient).Downloadfile( ^ + 'https://pki.google.com/roots.pem', 'roots.pem') +set GRPC_DEFAULT_SSL_ROOTS_FILE_PATH=%cd%\roots.pem +``` + +[authentication-quickstart]: https://cloud.google.com/docs/authentication/client-libraries "Authenticate for using client libraries" +[bazel-install]: https://docs.bazel.build/versions/main/install.html +[choco-cmake-link]: https://chocolatey.org/packages/cmake +[grpc-roots-pem-bug]: https://github.com/grpc/grpc/issues/16571 +[homebrew-cmake-link]: https://formulae.brew.sh/formula/cmake +[howto-setup-dev-workstation]: /doc/contributor/howto-guide-setup-development-workstation.md diff --git a/google/cloud/agentidentity/quickstart/WORKSPACE.bazel b/google/cloud/agentidentity/quickstart/WORKSPACE.bazel new file mode 100644 index 0000000000000..3b6b9c22fdfde --- /dev/null +++ b/google/cloud/agentidentity/quickstart/WORKSPACE.bazel @@ -0,0 +1,53 @@ +# Copyright 2026 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. + +# A minimal WORKSPACE file showing how to use the Agent Identity API +# C++ client library in Bazel-based projects. +workspace(name = "qs") + +# Add the necessary Starlark functions to fetch google-cloud-cpp. +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +# Fetch the Google Cloud C++ libraries. +# NOTE: Update this version and SHA256 as needed. +http_archive( + name = "google_cloud_cpp", + sha256 = "821367f21ec536431bf4fb5dc709a42794465506d7d3f8be40d52d493bcfdd06", + strip_prefix = "google-cloud-cpp-3.7.0", + url = "https://github.com/googleapis/google-cloud-cpp/archive/v3.7.0.tar.gz", +) + +load("@google_cloud_cpp//bazel:workspace0.bzl", "gl_cpp_workspace0") + +gl_cpp_workspace0() + +load("@google_cloud_cpp//bazel:workspace1.bzl", "gl_cpp_workspace1") + +gl_cpp_workspace1() + +load("@google_cloud_cpp//bazel:workspace2.bzl", "gl_cpp_workspace2") + +gl_cpp_workspace2() + +load("@google_cloud_cpp//bazel:workspace3.bzl", "gl_cpp_workspace3") + +gl_cpp_workspace3() + +load("@google_cloud_cpp//bazel:workspace4.bzl", "gl_cpp_workspace4") + +gl_cpp_workspace4() + +load("@google_cloud_cpp//bazel:workspace5.bzl", "gl_cpp_workspace5") + +gl_cpp_workspace5() diff --git a/google/cloud/agentidentity/quickstart/quickstart.cc b/google/cloud/agentidentity/quickstart/quickstart.cc new file mode 100644 index 0000000000000..c97a8678653b3 --- /dev/null +++ b/google/cloud/agentidentity/quickstart/quickstart.cc @@ -0,0 +1,42 @@ +// Copyright 2026 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. + +//! [all] +#include "google/cloud/agentidentity/v1/auth_provider_client.h" +#include "google/cloud/location.h" +#include + +int main(int argc, char* argv[]) try { + if (argc != 3) { + std::cerr << "Usage: " << argv[0] << " project-id location-id\n"; + return 1; + } + + auto const location = google::cloud::Location(argv[1], argv[2]); + + namespace agentidentity = ::google::cloud::agentidentity_v1; + auto client = agentidentity::AuthProviderServiceClient( + agentidentity::MakeAuthProviderServiceConnection()); + + for (auto r : client.ListAuthProviders(location.FullName())) { + if (!r) throw std::move(r).status(); + std::cout << r->DebugString() << "\n"; + } + + return 0; +} catch (google::cloud::Status const& status) { + std::cerr << "google::cloud::Status thrown: " << status << "\n"; + return 1; +} +//! [all] diff --git a/google/cloud/agentidentity/v1/.repo-metadata.json b/google/cloud/agentidentity/v1/.repo-metadata.json new file mode 100644 index 0000000000000..9b686daa5417e --- /dev/null +++ b/google/cloud/agentidentity/v1/.repo-metadata.json @@ -0,0 +1,14 @@ +{ + "api_id": "agentidentity.googleapis.com", + "api_shortname": "agentidentity", + "client_documentation": "https://cloud.google.com/cpp/docs/reference/agentidentity/latest", + "distribution_name": "google-cloud-cpp", + "issue_tracker": "https://issuetracker.google.com/issues?q=componentid:961386%20status=open", + "language": "cpp", + "library_type": "GAPIC_AUTO", + "name_pretty": "Agent Identity API", + "product_documentation": "https://cloud.google.com/agentidentity/docs/overview", + "release_level": "stable", + "repo": "googleapis/google-cloud-cpp", + "requires_billing": true +} diff --git a/google/cloud/agentidentity/v1/auth_provider_client.cc b/google/cloud/agentidentity/v1/auth_provider_client.cc new file mode 100644 index 0000000000000..3f88072cdeca6 --- /dev/null +++ b/google/cloud/agentidentity/v1/auth_provider_client.cc @@ -0,0 +1,345 @@ +// Copyright 2026 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 by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/cloud/agentidentity/v1/auth_provider_service.proto + +#include "google/cloud/agentidentity/v1/auth_provider_client.h" +#include +#include + +namespace google { +namespace cloud { +namespace agentidentity_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +AuthProviderServiceClient::AuthProviderServiceClient( + std::shared_ptr connection, Options opts) + : connection_(std::move(connection)), + options_( + internal::MergeOptions(std::move(opts), connection_->options())) {} +AuthProviderServiceClient::~AuthProviderServiceClient() = default; + +StreamRange +AuthProviderServiceClient::ListAuthProviders(std::string const& parent, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentidentity::v1::ListAuthProvidersRequest request; + request.set_parent(parent); + return connection_->ListAuthProviders(request); +} + +StreamRange +AuthProviderServiceClient::ListAuthProviders( + google::cloud::agentidentity::v1::ListAuthProvidersRequest request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->ListAuthProviders(std::move(request)); +} + +StatusOr +AuthProviderServiceClient::GetAuthProvider(std::string const& name, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentidentity::v1::GetAuthProviderRequest request; + request.set_name(name); + return connection_->GetAuthProvider(request); +} + +StatusOr +AuthProviderServiceClient::GetAuthProvider( + google::cloud::agentidentity::v1::GetAuthProviderRequest const& request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->GetAuthProvider(request); +} + +StatusOr +AuthProviderServiceClient::CreateAuthProvider( + std::string const& parent, + google::cloud::agentidentity::v1::AuthProvider const& auth_provider, + std::string const& auth_provider_id, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentidentity::v1::CreateAuthProviderRequest request; + request.set_parent(parent); + *request.mutable_auth_provider() = auth_provider; + request.set_auth_provider_id(auth_provider_id); + return connection_->CreateAuthProvider(request); +} + +StatusOr +AuthProviderServiceClient::CreateAuthProvider( + google::cloud::agentidentity::v1::CreateAuthProviderRequest const& request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->CreateAuthProvider(request); +} + +StatusOr +AuthProviderServiceClient::UpdateAuthProvider( + google::cloud::agentidentity::v1::AuthProvider const& auth_provider, + google::protobuf::FieldMask const& update_mask, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentidentity::v1::UpdateAuthProviderRequest request; + *request.mutable_auth_provider() = auth_provider; + *request.mutable_update_mask() = update_mask; + return connection_->UpdateAuthProvider(request); +} + +StatusOr +AuthProviderServiceClient::UpdateAuthProvider( + google::cloud::agentidentity::v1::UpdateAuthProviderRequest const& request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->UpdateAuthProvider(request); +} + +Status AuthProviderServiceClient::DeleteAuthProvider(std::string const& name, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentidentity::v1::DeleteAuthProviderRequest request; + request.set_name(name); + return connection_->DeleteAuthProvider(request); +} + +Status AuthProviderServiceClient::DeleteAuthProvider( + google::cloud::agentidentity::v1::DeleteAuthProviderRequest const& request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->DeleteAuthProvider(request); +} + +StatusOr +AuthProviderServiceClient::UndeleteAuthProvider(std::string const& name, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentidentity::v1::UndeleteAuthProviderRequest request; + request.set_name(name); + return connection_->UndeleteAuthProvider(request); +} + +StatusOr +AuthProviderServiceClient::UndeleteAuthProvider( + google::cloud::agentidentity::v1::UndeleteAuthProviderRequest const& + request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->UndeleteAuthProvider(request); +} + +StreamRange AuthProviderServiceClient::QueryAuthProviders( + std::string const& parent, std::string const& workload_id, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentidentity::v1::QueryAuthProvidersRequest request; + request.set_parent(parent); + request.set_workload_id(workload_id); + return connection_->QueryAuthProviders(request); +} + +StreamRange AuthProviderServiceClient::QueryAuthProviders( + google::cloud::agentidentity::v1::QueryAuthProvidersRequest request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->QueryAuthProviders(std::move(request)); +} + +StreamRange AuthProviderServiceClient::QueryWorkloads( + std::string const& name, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentidentity::v1::QueryWorkloadsRequest request; + request.set_name(name); + return connection_->QueryWorkloads(request); +} + +StreamRange AuthProviderServiceClient::QueryWorkloads( + google::cloud::agentidentity::v1::QueryWorkloadsRequest request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->QueryWorkloads(std::move(request)); +} + +StreamRange +AuthProviderServiceClient::ListAuthorizations(std::string const& parent, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentidentity::v1::ListAuthorizationsRequest request; + request.set_parent(parent); + return connection_->ListAuthorizations(request); +} + +StreamRange +AuthProviderServiceClient::ListAuthorizations( + google::cloud::agentidentity::v1::ListAuthorizationsRequest request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->ListAuthorizations(std::move(request)); +} + +StatusOr +AuthProviderServiceClient::GetAuthorization(std::string const& name, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentidentity::v1::GetAuthorizationRequest request; + request.set_name(name); + return connection_->GetAuthorization(request); +} + +StatusOr +AuthProviderServiceClient::GetAuthorization( + google::cloud::agentidentity::v1::GetAuthorizationRequest const& request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->GetAuthorization(request); +} + +Status AuthProviderServiceClient::DeleteAuthorization(std::string const& name, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentidentity::v1::DeleteAuthorizationRequest request; + request.set_name(name); + return connection_->DeleteAuthorization(request); +} + +Status AuthProviderServiceClient::DeleteAuthorization( + google::cloud::agentidentity::v1::DeleteAuthorizationRequest const& request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->DeleteAuthorization(request); +} + +StreamRange +AuthProviderServiceClient::ListAccessSummaries(std::string const& parent, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentidentity::v1::ListAccessSummariesRequest request; + request.set_parent(parent); + return connection_->ListAccessSummaries(request); +} + +StreamRange +AuthProviderServiceClient::ListAccessSummaries( + google::cloud::agentidentity::v1::ListAccessSummariesRequest request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->ListAccessSummaries(std::move(request)); +} + +StatusOr +AuthProviderServiceClient::GetAccessSummary(std::string const& name, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentidentity::v1::GetAccessSummaryRequest request; + request.set_name(name); + return connection_->GetAccessSummary(request); +} + +StatusOr +AuthProviderServiceClient::GetAccessSummary( + google::cloud::agentidentity::v1::GetAccessSummaryRequest const& request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->GetAccessSummary(request); +} + +StatusOr +AuthProviderServiceClient::RevokeAuthorization(std::string const& name, + std::string const& user_id, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentidentity::v1::RevokeAuthorizationRequest request; + request.set_name(name); + request.set_user_id(user_id); + return connection_->RevokeAuthorization(request); +} + +StatusOr +AuthProviderServiceClient::RevokeAuthorization( + google::cloud::agentidentity::v1::RevokeAuthorizationRequest const& request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->RevokeAuthorization(request); +} + +StatusOr +AuthProviderServiceClient::EnableAuthProvider(std::string const& name, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentidentity::v1::EnableAuthProviderRequest request; + request.set_name(name); + return connection_->EnableAuthProvider(request); +} + +StatusOr +AuthProviderServiceClient::EnableAuthProvider( + google::cloud::agentidentity::v1::EnableAuthProviderRequest const& request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->EnableAuthProvider(request); +} + +StatusOr +AuthProviderServiceClient::DisableAuthProvider(std::string const& name, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentidentity::v1::DisableAuthProviderRequest request; + request.set_name(name); + return connection_->DisableAuthProvider(request); +} + +StatusOr +AuthProviderServiceClient::DisableAuthProvider( + google::cloud::agentidentity::v1::DisableAuthProviderRequest const& request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->DisableAuthProvider(request); +} + +StreamRange +AuthProviderServiceClient::ListLocations( + google::cloud::location::ListLocationsRequest request, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->ListLocations(std::move(request)); +} + +StatusOr +AuthProviderServiceClient::GetLocation( + google::cloud::location::GetLocationRequest const& request, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->GetLocation(request); +} + +StatusOr AuthProviderServiceClient::SetIamPolicy( + google::iam::v1::SetIamPolicyRequest const& request, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->SetIamPolicy(request); +} + +StatusOr AuthProviderServiceClient::GetIamPolicy( + google::iam::v1::GetIamPolicyRequest const& request, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->GetIamPolicy(request); +} + +StatusOr +AuthProviderServiceClient::TestIamPermissions( + google::iam::v1::TestIamPermissionsRequest const& request, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->TestIamPermissions(request); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentidentity_v1 +} // namespace cloud +} // namespace google diff --git a/google/cloud/agentidentity/v1/auth_provider_client.h b/google/cloud/agentidentity/v1/auth_provider_client.h new file mode 100644 index 0000000000000..4e23b44fc14b4 --- /dev/null +++ b/google/cloud/agentidentity/v1/auth_provider_client.h @@ -0,0 +1,1292 @@ +// Copyright 2026 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 by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/cloud/agentidentity/v1/auth_provider_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_AUTH_PROVIDER_CLIENT_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_AUTH_PROVIDER_CLIENT_H + +#include "google/cloud/agentidentity/v1/auth_provider_connection.h" +#include "google/cloud/future.h" +#include "google/cloud/options.h" +#include "google/cloud/polling_policy.h" +#include "google/cloud/status_or.h" +#include "google/cloud/version.h" +#include +#include +#include + +namespace google { +namespace cloud { +namespace agentidentity_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +/// +/// Service describing handlers for resources +/// +/// @par Equality +/// +/// Instances of this class created via copy-construction or copy-assignment +/// always compare equal. Instances created with equal +/// `std::shared_ptr<*Connection>` objects compare equal. Objects that compare +/// equal share the same underlying resources. +/// +/// @par Performance +/// +/// Creating a new instance of this class is a relatively expensive operation, +/// new objects establish new connections to the service. In contrast, +/// copy-construction, move-construction, and the corresponding assignment +/// operations are relatively efficient as the copies share all underlying +/// resources. +/// +/// @par Thread Safety +/// +/// Concurrent access to different instances of this class, even if they compare +/// equal, is guaranteed to work. Two or more threads operating on the same +/// instance of this class is not guaranteed to work. Since copy-construction +/// and move-construction is a relatively efficient operation, consider using +/// such a copy when using this class from multiple threads. +/// +class AuthProviderServiceClient { + public: + explicit AuthProviderServiceClient( + std::shared_ptr connection, + Options opts = {}); + ~AuthProviderServiceClient(); + + ///@{ + /// @name Copy and move support + AuthProviderServiceClient(AuthProviderServiceClient const&) = default; + AuthProviderServiceClient& operator=(AuthProviderServiceClient const&) = + default; + AuthProviderServiceClient(AuthProviderServiceClient&&) = default; + AuthProviderServiceClient& operator=(AuthProviderServiceClient&&) = default; + ///@} + + ///@{ + /// @name Equality + friend bool operator==(AuthProviderServiceClient const& a, + AuthProviderServiceClient const& b) { + return a.connection_ == b.connection_; + } + friend bool operator!=(AuthProviderServiceClient const& a, + AuthProviderServiceClient const& b) { + return !(a == b); + } + ///@} + + // clang-format off + /// + /// Lists AuthProviders in a given project and location. + /// + /// @param parent Required. The parent resource where the search is performed. + /// Format: projects/{project}/locations/{location} + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return a [StreamRange](@ref google::cloud::StreamRange) + /// to iterate of the results. See the documentation of this type for + /// details. In brief, this class has `begin()` and `end()` member + /// functions returning a iterator class meeting the + /// [input iterator requirements]. The value type for this iterator is a + /// [`StatusOr`] as the iteration may fail even after some values are + /// retrieved successfully, for example, if there is a network disconnect. + /// An empty set of results does not indicate an error, it indicates + /// that there are no resources meeting the request criteria. + /// On a successful iteration the `StatusOr` contains elements of type + /// [google.cloud.agentidentity.v1.AuthProvider], or rather, + /// the C++ class generated by Protobuf from that type. Please consult the + /// Protobuf documentation for details on the [Protobuf mapping rules]. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.AuthProvider]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L206} + /// [google.cloud.agentidentity.v1.ListAuthProvidersRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L363} + /// + // clang-format on + StreamRange ListAuthProviders( + std::string const& parent, Options opts = {}); + + // clang-format off + /// + /// Lists AuthProviders in a given project and location. + /// + /// @param request Unary RPCs, such as the one wrapped by this + /// function, receive a single `request` proto message which includes all + /// the inputs for the RPC. In this case, the proto message is a + /// [google.cloud.agentidentity.v1.ListAuthProvidersRequest]. + /// Proto messages are converted to C++ classes by Protobuf, using the + /// [Protobuf mapping rules]. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return a [StreamRange](@ref google::cloud::StreamRange) + /// to iterate of the results. See the documentation of this type for + /// details. In brief, this class has `begin()` and `end()` member + /// functions returning a iterator class meeting the + /// [input iterator requirements]. The value type for this iterator is a + /// [`StatusOr`] as the iteration may fail even after some values are + /// retrieved successfully, for example, if there is a network disconnect. + /// An empty set of results does not indicate an error, it indicates + /// that there are no resources meeting the request criteria. + /// On a successful iteration the `StatusOr` contains elements of type + /// [google.cloud.agentidentity.v1.AuthProvider], or rather, + /// the C++ class generated by Protobuf from that type. Please consult the + /// Protobuf documentation for details on the [Protobuf mapping rules]. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.AuthProvider]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L206} + /// [google.cloud.agentidentity.v1.ListAuthProvidersRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L363} + /// + // clang-format on + StreamRange ListAuthProviders( + google::cloud::agentidentity::v1::ListAuthProvidersRequest request, + Options opts = {}); + + // clang-format off + /// + /// Gets details of a single AuthProvider. + /// + /// @param name Required. Name of the resource + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return the result of the RPC. The response message type + /// ([google.cloud.agentidentity.v1.AuthProvider]) + /// is mapped to a C++ class using the [Protobuf mapping rules]. + /// If the request fails, the [`StatusOr`] contains the error details. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.AuthProvider]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L206} + /// [google.cloud.agentidentity.v1.GetAuthProviderRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L409} + /// + // clang-format on + StatusOr GetAuthProvider( + std::string const& name, Options opts = {}); + + // clang-format off + /// + /// Gets details of a single AuthProvider. + /// + /// @param request Unary RPCs, such as the one wrapped by this + /// function, receive a single `request` proto message which includes all + /// the inputs for the RPC. In this case, the proto message is a + /// [google.cloud.agentidentity.v1.GetAuthProviderRequest]. + /// Proto messages are converted to C++ classes by Protobuf, using the + /// [Protobuf mapping rules]. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return the result of the RPC. The response message type + /// ([google.cloud.agentidentity.v1.AuthProvider]) + /// is mapped to a C++ class using the [Protobuf mapping rules]. + /// If the request fails, the [`StatusOr`] contains the error details. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.AuthProvider]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L206} + /// [google.cloud.agentidentity.v1.GetAuthProviderRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L409} + /// + // clang-format on + StatusOr GetAuthProvider( + google::cloud::agentidentity::v1::GetAuthProviderRequest const& request, + Options opts = {}); + + // clang-format off + /// + /// Creates a new AuthProvider in a given project and location. + /// + /// @param parent Required. The parent resource where the AuthProvider is created. + /// Format: projects/{project}/locations/{location} + /// @param auth_provider Required. The AuthProvider to create. + /// @param auth_provider_id Required. The ID to use for the AuthProvider, which will become the final + /// segment of the AuthProvider's resource name. This value should be 1-63 + /// characters, and valid characters are /[a-z][0-9]-/. The first character + /// must be a lowercase letter, and the last character must be a lowercase + /// letter or a number. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return the result of the RPC. The response message type + /// ([google.cloud.agentidentity.v1.AuthProvider]) + /// is mapped to a C++ class using the [Protobuf mapping rules]. + /// If the request fails, the [`StatusOr`] contains the error details. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.AuthProvider]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L206} + /// [google.cloud.agentidentity.v1.CreateAuthProviderRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L420} + /// + // clang-format on + StatusOr CreateAuthProvider( + std::string const& parent, + google::cloud::agentidentity::v1::AuthProvider const& auth_provider, + std::string const& auth_provider_id, Options opts = {}); + + // clang-format off + /// + /// Creates a new AuthProvider in a given project and location. + /// + /// @param request Unary RPCs, such as the one wrapped by this + /// function, receive a single `request` proto message which includes all + /// the inputs for the RPC. In this case, the proto message is a + /// [google.cloud.agentidentity.v1.CreateAuthProviderRequest]. + /// Proto messages are converted to C++ classes by Protobuf, using the + /// [Protobuf mapping rules]. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return the result of the RPC. The response message type + /// ([google.cloud.agentidentity.v1.AuthProvider]) + /// is mapped to a C++ class using the [Protobuf mapping rules]. + /// If the request fails, the [`StatusOr`] contains the error details. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.AuthProvider]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L206} + /// [google.cloud.agentidentity.v1.CreateAuthProviderRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L420} + /// + // clang-format on + StatusOr CreateAuthProvider( + google::cloud::agentidentity::v1::CreateAuthProviderRequest const& + request, + Options opts = {}); + + // clang-format off + /// + /// Updates the parameters of a single AuthProvider. + /// + /// @param auth_provider Required. The AuthProvider resource which replaces the resource on the + /// server. + /// @param update_mask Optional. Field mask is used to specify the fields to be overwritten in the + /// AuthProvider resource by the update. + /// The fields specified in the update_mask are relative to the resource, not + /// the full request. A field will be overwritten if it is in the mask. If the + /// user does not provide a mask then all fields present in the request will be + /// overwritten. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return the result of the RPC. The response message type + /// ([google.cloud.agentidentity.v1.AuthProvider]) + /// is mapped to a C++ class using the [Protobuf mapping rules]. + /// If the request fails, the [`StatusOr`] contains the error details. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.AuthProvider]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L206} + /// [google.cloud.agentidentity.v1.UpdateAuthProviderRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L460} + /// + // clang-format on + StatusOr UpdateAuthProvider( + google::cloud::agentidentity::v1::AuthProvider const& auth_provider, + google::protobuf::FieldMask const& update_mask, Options opts = {}); + + // clang-format off + /// + /// Updates the parameters of a single AuthProvider. + /// + /// @param request Unary RPCs, such as the one wrapped by this + /// function, receive a single `request` proto message which includes all + /// the inputs for the RPC. In this case, the proto message is a + /// [google.cloud.agentidentity.v1.UpdateAuthProviderRequest]. + /// Proto messages are converted to C++ classes by Protobuf, using the + /// [Protobuf mapping rules]. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return the result of the RPC. The response message type + /// ([google.cloud.agentidentity.v1.AuthProvider]) + /// is mapped to a C++ class using the [Protobuf mapping rules]. + /// If the request fails, the [`StatusOr`] contains the error details. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.AuthProvider]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L206} + /// [google.cloud.agentidentity.v1.UpdateAuthProviderRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L460} + /// + // clang-format on + StatusOr UpdateAuthProvider( + google::cloud::agentidentity::v1::UpdateAuthProviderRequest const& + request, + Options opts = {}); + + // clang-format off + /// + /// Deletes a single AuthProvider. + /// + /// @param name Required. Name of the resource + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return a [`Status`] object. If the request failed, the + /// status contains the details of the failure. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.DeleteAuthProviderRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L494} + /// + // clang-format on + Status DeleteAuthProvider(std::string const& name, Options opts = {}); + + // clang-format off + /// + /// Deletes a single AuthProvider. + /// + /// @param request Unary RPCs, such as the one wrapped by this + /// function, receive a single `request` proto message which includes all + /// the inputs for the RPC. In this case, the proto message is a + /// [google.cloud.agentidentity.v1.DeleteAuthProviderRequest]. + /// Proto messages are converted to C++ classes by Protobuf, using the + /// [Protobuf mapping rules]. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return a [`Status`] object. If the request failed, the + /// status contains the details of the failure. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.DeleteAuthProviderRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L494} + /// + // clang-format on + Status DeleteAuthProvider( + google::cloud::agentidentity::v1::DeleteAuthProviderRequest const& + request, + Options opts = {}); + + // clang-format off + /// + /// Undeletes a single AuthProvider. + /// + /// @param name Required. Name of the resource + /// Format: + /// projects/{project}/locations/{location}/authProviders/{auth_provider} + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return the result of the RPC. The response message type + /// ([google.cloud.agentidentity.v1.AuthProvider]) + /// is mapped to a C++ class using the [Protobuf mapping rules]. + /// If the request fails, the [`StatusOr`] contains the error details. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.AuthProvider]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L206} + /// [google.cloud.agentidentity.v1.UndeleteAuthProviderRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L523} + /// + // clang-format on + StatusOr UndeleteAuthProvider( + std::string const& name, Options opts = {}); + + // clang-format off + /// + /// Undeletes a single AuthProvider. + /// + /// @param request Unary RPCs, such as the one wrapped by this + /// function, receive a single `request` proto message which includes all + /// the inputs for the RPC. In this case, the proto message is a + /// [google.cloud.agentidentity.v1.UndeleteAuthProviderRequest]. + /// Proto messages are converted to C++ classes by Protobuf, using the + /// [Protobuf mapping rules]. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return the result of the RPC. The response message type + /// ([google.cloud.agentidentity.v1.AuthProvider]) + /// is mapped to a C++ class using the [Protobuf mapping rules]. + /// If the request fails, the [`StatusOr`] contains the error details. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.AuthProvider]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L206} + /// [google.cloud.agentidentity.v1.UndeleteAuthProviderRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L523} + /// + // clang-format on + StatusOr UndeleteAuthProvider( + google::cloud::agentidentity::v1::UndeleteAuthProviderRequest const& + request, + Options opts = {}); + + // clang-format off + /// + /// Queries what all auth_providers are used by a given workload_id. + /// + /// @param parent Required. The parent resource where the search is performed. + /// Format: projects/{project}/locations/{location} + /// @param workload_id Required. The workload identifier to filter by. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return a [StreamRange](@ref google::cloud::StreamRange) + /// to iterate of the results. See the documentation of this type for + /// details. In brief, this class has `begin()` and `end()` member + /// functions returning a iterator class meeting the + /// [input iterator requirements]. The value type for this iterator is a + /// [`StatusOr`] as the iteration may fail even after some values are + /// retrieved successfully, for example, if there is a network disconnect. + /// An empty set of results does not indicate an error, it indicates + /// that there are no resources meeting the request criteria. + /// On a successful iteration the `StatusOr` contains a + /// [`std::string`]. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.QueryAuthProvidersRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L845} + /// + // clang-format on + StreamRange QueryAuthProviders(std::string const& parent, + std::string const& workload_id, + Options opts = {}); + + // clang-format off + /// + /// Queries what all auth_providers are used by a given workload_id. + /// + /// @param request Unary RPCs, such as the one wrapped by this + /// function, receive a single `request` proto message which includes all + /// the inputs for the RPC. In this case, the proto message is a + /// [google.cloud.agentidentity.v1.QueryAuthProvidersRequest]. + /// Proto messages are converted to C++ classes by Protobuf, using the + /// [Protobuf mapping rules]. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return a [StreamRange](@ref google::cloud::StreamRange) + /// to iterate of the results. See the documentation of this type for + /// details. In brief, this class has `begin()` and `end()` member + /// functions returning a iterator class meeting the + /// [input iterator requirements]. The value type for this iterator is a + /// [`StatusOr`] as the iteration may fail even after some values are + /// retrieved successfully, for example, if there is a network disconnect. + /// An empty set of results does not indicate an error, it indicates + /// that there are no resources meeting the request criteria. + /// On a successful iteration the `StatusOr` contains a + /// [`std::string`]. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.QueryAuthProvidersRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L845} + /// + // clang-format on + StreamRange QueryAuthProviders( + google::cloud::agentidentity::v1::QueryAuthProvidersRequest request, + Options opts = {}); + + // clang-format off + /// + /// Queries what all workloads are using a given auth_provider. + /// + /// @param name Required. The name of the auth_provider to query. + /// Format: + /// projects/{project}/locations/{location}/authProviders/{auth_provider} + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return a [StreamRange](@ref google::cloud::StreamRange) + /// to iterate of the results. See the documentation of this type for + /// details. In brief, this class has `begin()` and `end()` member + /// functions returning a iterator class meeting the + /// [input iterator requirements]. The value type for this iterator is a + /// [`StatusOr`] as the iteration may fail even after some values are + /// retrieved successfully, for example, if there is a network disconnect. + /// An empty set of results does not indicate an error, it indicates + /// that there are no resources meeting the request criteria. + /// On a successful iteration the `StatusOr` contains a + /// [`std::string`]. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.QueryWorkloadsRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L884} + /// + // clang-format on + StreamRange QueryWorkloads(std::string const& name, + Options opts = {}); + + // clang-format off + /// + /// Queries what all workloads are using a given auth_provider. + /// + /// @param request Unary RPCs, such as the one wrapped by this + /// function, receive a single `request` proto message which includes all + /// the inputs for the RPC. In this case, the proto message is a + /// [google.cloud.agentidentity.v1.QueryWorkloadsRequest]. + /// Proto messages are converted to C++ classes by Protobuf, using the + /// [Protobuf mapping rules]. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return a [StreamRange](@ref google::cloud::StreamRange) + /// to iterate of the results. See the documentation of this type for + /// details. In brief, this class has `begin()` and `end()` member + /// functions returning a iterator class meeting the + /// [input iterator requirements]. The value type for this iterator is a + /// [`StatusOr`] as the iteration may fail even after some values are + /// retrieved successfully, for example, if there is a network disconnect. + /// An empty set of results does not indicate an error, it indicates + /// that there are no resources meeting the request criteria. + /// On a successful iteration the `StatusOr` contains a + /// [`std::string`]. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.QueryWorkloadsRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L884} + /// + // clang-format on + StreamRange QueryWorkloads( + google::cloud::agentidentity::v1::QueryWorkloadsRequest request, + Options opts = {}); + + // clang-format off + /// + /// Lists Authorizations in a given project and location. + /// + /// @param parent Required. The parent resource where the search is performed. + /// Format: + /// projects/{project}/locations/{location}/authProviders/{auth_provider} + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return a [StreamRange](@ref google::cloud::StreamRange) + /// to iterate of the results. See the documentation of this type for + /// details. In brief, this class has `begin()` and `end()` member + /// functions returning a iterator class meeting the + /// [input iterator requirements]. The value type for this iterator is a + /// [`StatusOr`] as the iteration may fail even after some values are + /// retrieved successfully, for example, if there is a network disconnect. + /// An empty set of results does not indicate an error, it indicates + /// that there are no resources meeting the request criteria. + /// On a successful iteration the `StatusOr` contains elements of type + /// [google.cloud.agentidentity.v1.Authorization], or rather, + /// the C++ class generated by Protobuf from that type. Please consult the + /// Protobuf documentation for details on the [Protobuf mapping rules]. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.Authorization]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L598} + /// [google.cloud.agentidentity.v1.ListAuthorizationsRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L642} + /// + // clang-format on + StreamRange + ListAuthorizations(std::string const& parent, Options opts = {}); + + // clang-format off + /// + /// Lists Authorizations in a given project and location. + /// + /// @param request Unary RPCs, such as the one wrapped by this + /// function, receive a single `request` proto message which includes all + /// the inputs for the RPC. In this case, the proto message is a + /// [google.cloud.agentidentity.v1.ListAuthorizationsRequest]. + /// Proto messages are converted to C++ classes by Protobuf, using the + /// [Protobuf mapping rules]. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return a [StreamRange](@ref google::cloud::StreamRange) + /// to iterate of the results. See the documentation of this type for + /// details. In brief, this class has `begin()` and `end()` member + /// functions returning a iterator class meeting the + /// [input iterator requirements]. The value type for this iterator is a + /// [`StatusOr`] as the iteration may fail even after some values are + /// retrieved successfully, for example, if there is a network disconnect. + /// An empty set of results does not indicate an error, it indicates + /// that there are no resources meeting the request criteria. + /// On a successful iteration the `StatusOr` contains elements of type + /// [google.cloud.agentidentity.v1.Authorization], or rather, + /// the C++ class generated by Protobuf from that type. Please consult the + /// Protobuf documentation for details on the [Protobuf mapping rules]. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.Authorization]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L598} + /// [google.cloud.agentidentity.v1.ListAuthorizationsRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L642} + /// + // clang-format on + StreamRange + ListAuthorizations( + google::cloud::agentidentity::v1::ListAuthorizationsRequest request, + Options opts = {}); + + // clang-format off + /// + /// Gets details of a single Authorization. + /// + /// @param name Required. Name of the resource + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return the result of the RPC. The response message type + /// ([google.cloud.agentidentity.v1.Authorization]) + /// is mapped to a C++ class using the [Protobuf mapping rules]. + /// If the request fails, the [`StatusOr`] contains the error details. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.Authorization]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L598} + /// [google.cloud.agentidentity.v1.GetAuthorizationRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L687} + /// + // clang-format on + StatusOr GetAuthorization( + std::string const& name, Options opts = {}); + + // clang-format off + /// + /// Gets details of a single Authorization. + /// + /// @param request Unary RPCs, such as the one wrapped by this + /// function, receive a single `request` proto message which includes all + /// the inputs for the RPC. In this case, the proto message is a + /// [google.cloud.agentidentity.v1.GetAuthorizationRequest]. + /// Proto messages are converted to C++ classes by Protobuf, using the + /// [Protobuf mapping rules]. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return the result of the RPC. The response message type + /// ([google.cloud.agentidentity.v1.Authorization]) + /// is mapped to a C++ class using the [Protobuf mapping rules]. + /// If the request fails, the [`StatusOr`] contains the error details. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.Authorization]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L598} + /// [google.cloud.agentidentity.v1.GetAuthorizationRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L687} + /// + // clang-format on + StatusOr GetAuthorization( + google::cloud::agentidentity::v1::GetAuthorizationRequest const& request, + Options opts = {}); + + // clang-format off + /// + /// Deletes a single Authorization. + /// + /// @param name Required. The name of the Authorization to delete. + /// Format: + /// projects/{project}/locations/{location}/authProviders/{auth_provider}/authorizations/{authorization} + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return a [`Status`] object. If the request failed, the + /// status contains the details of the failure. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.DeleteAuthorizationRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L698} + /// + // clang-format on + Status DeleteAuthorization(std::string const& name, Options opts = {}); + + // clang-format off + /// + /// Deletes a single Authorization. + /// + /// @param request Unary RPCs, such as the one wrapped by this + /// function, receive a single `request` proto message which includes all + /// the inputs for the RPC. In this case, the proto message is a + /// [google.cloud.agentidentity.v1.DeleteAuthorizationRequest]. + /// Proto messages are converted to C++ classes by Protobuf, using the + /// [Protobuf mapping rules]. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return a [`Status`] object. If the request failed, the + /// status contains the details of the failure. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.DeleteAuthorizationRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L698} + /// + // clang-format on + Status DeleteAuthorization( + google::cloud::agentidentity::v1::DeleteAuthorizationRequest const& + request, + Options opts = {}); + + // clang-format off + /// + /// Lists AccessSummaries in a given project and location. + /// Supported Filters: + /// - `workload_id`: Filter by the SPIFFE ID of the agent. + /// Example: `workload_id="spiffe://example.com/ns/default/sa/my-agent"` + /// + /// @param parent Required. The parent resource where the search is performed. + /// Format: projects/{project}/locations/{location} + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return a [StreamRange](@ref google::cloud::StreamRange) + /// to iterate of the results. See the documentation of this type for + /// details. In brief, this class has `begin()` and `end()` member + /// functions returning a iterator class meeting the + /// [input iterator requirements]. The value type for this iterator is a + /// [`StatusOr`] as the iteration may fail even after some values are + /// retrieved successfully, for example, if there is a network disconnect. + /// An empty set of results does not indicate an error, it indicates + /// that there are no resources meeting the request criteria. + /// On a successful iteration the `StatusOr` contains elements of type + /// [google.cloud.agentidentity.v1.AccessSummary], or rather, + /// the C++ class generated by Protobuf from that type. Please consult the + /// Protobuf documentation for details on the [Protobuf mapping rules]. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.AccessSummary]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L729} + /// [google.cloud.agentidentity.v1.ListAccessSummariesRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L790} + /// + // clang-format on + StreamRange + ListAccessSummaries(std::string const& parent, Options opts = {}); + + // clang-format off + /// + /// Lists AccessSummaries in a given project and location. + /// Supported Filters: + /// - `workload_id`: Filter by the SPIFFE ID of the agent. + /// Example: `workload_id="spiffe://example.com/ns/default/sa/my-agent"` + /// + /// @param request Unary RPCs, such as the one wrapped by this + /// function, receive a single `request` proto message which includes all + /// the inputs for the RPC. In this case, the proto message is a + /// [google.cloud.agentidentity.v1.ListAccessSummariesRequest]. + /// Proto messages are converted to C++ classes by Protobuf, using the + /// [Protobuf mapping rules]. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return a [StreamRange](@ref google::cloud::StreamRange) + /// to iterate of the results. See the documentation of this type for + /// details. In brief, this class has `begin()` and `end()` member + /// functions returning a iterator class meeting the + /// [input iterator requirements]. The value type for this iterator is a + /// [`StatusOr`] as the iteration may fail even after some values are + /// retrieved successfully, for example, if there is a network disconnect. + /// An empty set of results does not indicate an error, it indicates + /// that there are no resources meeting the request criteria. + /// On a successful iteration the `StatusOr` contains elements of type + /// [google.cloud.agentidentity.v1.AccessSummary], or rather, + /// the C++ class generated by Protobuf from that type. Please consult the + /// Protobuf documentation for details on the [Protobuf mapping rules]. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.AccessSummary]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L729} + /// [google.cloud.agentidentity.v1.ListAccessSummariesRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L790} + /// + // clang-format on + StreamRange + ListAccessSummaries( + google::cloud::agentidentity::v1::ListAccessSummariesRequest request, + Options opts = {}); + + // clang-format off + /// + /// Gets details of a single AccessSummary. + /// + /// @param name Required. Name of the resource + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return the result of the RPC. The response message type + /// ([google.cloud.agentidentity.v1.AccessSummary]) + /// is mapped to a C++ class using the [Protobuf mapping rules]. + /// If the request fails, the [`StatusOr`] contains the error details. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.AccessSummary]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L729} + /// [google.cloud.agentidentity.v1.GetAccessSummaryRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L834} + /// + // clang-format on + StatusOr GetAccessSummary( + std::string const& name, Options opts = {}); + + // clang-format off + /// + /// Gets details of a single AccessSummary. + /// + /// @param request Unary RPCs, such as the one wrapped by this + /// function, receive a single `request` proto message which includes all + /// the inputs for the RPC. In this case, the proto message is a + /// [google.cloud.agentidentity.v1.GetAccessSummaryRequest]. + /// Proto messages are converted to C++ classes by Protobuf, using the + /// [Protobuf mapping rules]. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return the result of the RPC. The response message type + /// ([google.cloud.agentidentity.v1.AccessSummary]) + /// is mapped to a C++ class using the [Protobuf mapping rules]. + /// If the request fails, the [`StatusOr`] contains the error details. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.AccessSummary]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L729} + /// [google.cloud.agentidentity.v1.GetAccessSummaryRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L834} + /// + // clang-format on + StatusOr GetAccessSummary( + google::cloud::agentidentity::v1::GetAccessSummaryRequest const& request, + Options opts = {}); + + // clang-format off + /// + /// Revokes all authorizations for a specific user on an AuthProvider. + /// This deletes all authorization records associated with the user and + /// AuthProvider, effectively revoking access across all agents. + /// + /// @param name Required. The resource name of the AuthProvider. + /// Format: + /// projects/{project}/locations/{location}/authProviders/{auth_provider} + /// @param user_id Required. The identity of the user to revoke authorization for. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return the result of the RPC. The response message type + /// ([google.cloud.agentidentity.v1.RevokeAuthorizationResponse]) + /// is mapped to a C++ class using the [Protobuf mapping rules]. + /// If the request fails, the [`StatusOr`] contains the error details. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.RevokeAuthorizationRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L917} + /// [google.cloud.agentidentity.v1.RevokeAuthorizationResponse]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L933} + /// + // clang-format on + StatusOr + RevokeAuthorization(std::string const& name, std::string const& user_id, + Options opts = {}); + + // clang-format off + /// + /// Revokes all authorizations for a specific user on an AuthProvider. + /// This deletes all authorization records associated with the user and + /// AuthProvider, effectively revoking access across all agents. + /// + /// @param request Unary RPCs, such as the one wrapped by this + /// function, receive a single `request` proto message which includes all + /// the inputs for the RPC. In this case, the proto message is a + /// [google.cloud.agentidentity.v1.RevokeAuthorizationRequest]. + /// Proto messages are converted to C++ classes by Protobuf, using the + /// [Protobuf mapping rules]. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return the result of the RPC. The response message type + /// ([google.cloud.agentidentity.v1.RevokeAuthorizationResponse]) + /// is mapped to a C++ class using the [Protobuf mapping rules]. + /// If the request fails, the [`StatusOr`] contains the error details. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.RevokeAuthorizationRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L917} + /// [google.cloud.agentidentity.v1.RevokeAuthorizationResponse]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L933} + /// + // clang-format on + StatusOr + RevokeAuthorization( + google::cloud::agentidentity::v1::RevokeAuthorizationRequest const& + request, + Options opts = {}); + + // clang-format off + /// + /// Enables a single AuthProvider. + /// + /// @param name Required. Name of the resource + /// Format: + /// projects/{project}/locations/{location}/authProviders/{auth_provider} + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return the result of the RPC. The response message type + /// ([google.cloud.agentidentity.v1.AuthProvider]) + /// is mapped to a C++ class using the [Protobuf mapping rules]. + /// If the request fails, the [`StatusOr`] contains the error details. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.AuthProvider]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L206} + /// [google.cloud.agentidentity.v1.EnableAuthProviderRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L548} + /// + // clang-format on + StatusOr EnableAuthProvider( + std::string const& name, Options opts = {}); + + // clang-format off + /// + /// Enables a single AuthProvider. + /// + /// @param request Unary RPCs, such as the one wrapped by this + /// function, receive a single `request` proto message which includes all + /// the inputs for the RPC. In this case, the proto message is a + /// [google.cloud.agentidentity.v1.EnableAuthProviderRequest]. + /// Proto messages are converted to C++ classes by Protobuf, using the + /// [Protobuf mapping rules]. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return the result of the RPC. The response message type + /// ([google.cloud.agentidentity.v1.AuthProvider]) + /// is mapped to a C++ class using the [Protobuf mapping rules]. + /// If the request fails, the [`StatusOr`] contains the error details. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.AuthProvider]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L206} + /// [google.cloud.agentidentity.v1.EnableAuthProviderRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L548} + /// + // clang-format on + StatusOr EnableAuthProvider( + google::cloud::agentidentity::v1::EnableAuthProviderRequest const& + request, + Options opts = {}); + + // clang-format off + /// + /// Disables a single AuthProvider. + /// + /// @param name Required. Name of the resource + /// Format: + /// projects/{project}/locations/{location}/authProviders/{auth_provider} + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return the result of the RPC. The response message type + /// ([google.cloud.agentidentity.v1.AuthProvider]) + /// is mapped to a C++ class using the [Protobuf mapping rules]. + /// If the request fails, the [`StatusOr`] contains the error details. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.AuthProvider]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L206} + /// [google.cloud.agentidentity.v1.DisableAuthProviderRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L573} + /// + // clang-format on + StatusOr DisableAuthProvider( + std::string const& name, Options opts = {}); + + // clang-format off + /// + /// Disables a single AuthProvider. + /// + /// @param request Unary RPCs, such as the one wrapped by this + /// function, receive a single `request` proto message which includes all + /// the inputs for the RPC. In this case, the proto message is a + /// [google.cloud.agentidentity.v1.DisableAuthProviderRequest]. + /// Proto messages are converted to C++ classes by Protobuf, using the + /// [Protobuf mapping rules]. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return the result of the RPC. The response message type + /// ([google.cloud.agentidentity.v1.AuthProvider]) + /// is mapped to a C++ class using the [Protobuf mapping rules]. + /// If the request fails, the [`StatusOr`] contains the error details. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.agentidentity.v1.AuthProvider]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L206} + /// [google.cloud.agentidentity.v1.DisableAuthProviderRequest]: @googleapis_reference_link{google/cloud/agentidentity/v1/auth_provider_service.proto#L573} + /// + // clang-format on + StatusOr DisableAuthProvider( + google::cloud::agentidentity::v1::DisableAuthProviderRequest const& + request, + Options opts = {}); + + // clang-format off + /// + /// Lists information about the supported locations for this service. + /// + /// @param request Unary RPCs, such as the one wrapped by this + /// function, receive a single `request` proto message which includes all + /// the inputs for the RPC. In this case, the proto message is a + /// [google.cloud.location.ListLocationsRequest]. + /// Proto messages are converted to C++ classes by Protobuf, using the + /// [Protobuf mapping rules]. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return a [StreamRange](@ref google::cloud::StreamRange) + /// to iterate of the results. See the documentation of this type for + /// details. In brief, this class has `begin()` and `end()` member + /// functions returning a iterator class meeting the + /// [input iterator requirements]. The value type for this iterator is a + /// [`StatusOr`] as the iteration may fail even after some values are + /// retrieved successfully, for example, if there is a network disconnect. + /// An empty set of results does not indicate an error, it indicates + /// that there are no resources meeting the request criteria. + /// On a successful iteration the `StatusOr` contains elements of type + /// [google.cloud.location.Location], or rather, + /// the C++ class generated by Protobuf from that type. Please consult the + /// Protobuf documentation for details on the [Protobuf mapping rules]. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.location.ListLocationsRequest]: @googleapis_reference_link{google/cloud/location/locations.proto#L58} + /// [google.cloud.location.Location]: @googleapis_reference_link{google/cloud/location/locations.proto#L88} + /// + // clang-format on + StreamRange ListLocations( + google::cloud::location::ListLocationsRequest request, Options opts = {}); + + // clang-format off + /// + /// Gets information about a location. + /// + /// @param request Unary RPCs, such as the one wrapped by this + /// function, receive a single `request` proto message which includes all + /// the inputs for the RPC. In this case, the proto message is a + /// [google.cloud.location.GetLocationRequest]. + /// Proto messages are converted to C++ classes by Protobuf, using the + /// [Protobuf mapping rules]. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return the result of the RPC. The response message type + /// ([google.cloud.location.Location]) + /// is mapped to a C++ class using the [Protobuf mapping rules]. + /// If the request fails, the [`StatusOr`] contains the error details. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.cloud.location.GetLocationRequest]: @googleapis_reference_link{google/cloud/location/locations.proto#L82} + /// [google.cloud.location.Location]: @googleapis_reference_link{google/cloud/location/locations.proto#L88} + /// + // clang-format on + StatusOr GetLocation( + google::cloud::location::GetLocationRequest const& request, + Options opts = {}); + + // clang-format off + /// + /// Sets the access control policy on the specified resource. Replaces any + /// existing policy. + /// + /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors. + /// + /// @param request Unary RPCs, such as the one wrapped by this + /// function, receive a single `request` proto message which includes all + /// the inputs for the RPC. In this case, the proto message is a + /// [google.iam.v1.SetIamPolicyRequest]. + /// Proto messages are converted to C++ classes by Protobuf, using the + /// [Protobuf mapping rules]. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return the result of the RPC. The response message type + /// ([google.iam.v1.Policy]) + /// is mapped to a C++ class using the [Protobuf mapping rules]. + /// If the request fails, the [`StatusOr`] contains the error details. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.iam.v1.Policy]: @googleapis_reference_link{google/iam/v1/policy.proto#L102} + /// [google.iam.v1.SetIamPolicyRequest]: @googleapis_reference_link{google/iam/v1/iam_policy.proto#L100} + /// + // clang-format on + StatusOr SetIamPolicy( + google::iam::v1::SetIamPolicyRequest const& request, Options opts = {}); + + // clang-format off + /// + /// Gets the access control policy for a resource. + /// Returns an empty policy if the resource exists and does not have a policy + /// set. + /// + /// @param request Unary RPCs, such as the one wrapped by this + /// function, receive a single `request` proto message which includes all + /// the inputs for the RPC. In this case, the proto message is a + /// [google.iam.v1.GetIamPolicyRequest]. + /// Proto messages are converted to C++ classes by Protobuf, using the + /// [Protobuf mapping rules]. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return the result of the RPC. The response message type + /// ([google.iam.v1.Policy]) + /// is mapped to a C++ class using the [Protobuf mapping rules]. + /// If the request fails, the [`StatusOr`] contains the error details. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.iam.v1.GetIamPolicyRequest]: @googleapis_reference_link{google/iam/v1/iam_policy.proto#L123} + /// [google.iam.v1.Policy]: @googleapis_reference_link{google/iam/v1/policy.proto#L102} + /// + // clang-format on + StatusOr GetIamPolicy( + google::iam::v1::GetIamPolicyRequest const& request, Options opts = {}); + + // clang-format off + /// + /// Returns permissions that a caller has on the specified resource. + /// If the resource does not exist, this will return an empty set of + /// permissions, not a `NOT_FOUND` error. + /// + /// Note: This operation is designed to be used for building permission-aware + /// UIs and command-line tools, not for authorization checking. This operation + /// may "fail open" without warning. + /// + /// @param request Unary RPCs, such as the one wrapped by this + /// function, receive a single `request` proto message which includes all + /// the inputs for the RPC. In this case, the proto message is a + /// [google.iam.v1.TestIamPermissionsRequest]. + /// Proto messages are converted to C++ classes by Protobuf, using the + /// [Protobuf mapping rules]. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return the result of the RPC. The response message type + /// ([google.iam.v1.TestIamPermissionsResponse]) + /// is mapped to a C++ class using the [Protobuf mapping rules]. + /// If the request fails, the [`StatusOr`] contains the error details. + /// + /// [Protobuf mapping rules]: https://protobuf.dev/reference/cpp/cpp-generated/ + /// [input iterator requirements]: https://en.cppreference.com/w/cpp/named_req/InputIterator + /// [`std::string`]: https://en.cppreference.com/w/cpp/string/basic_string + /// [`future`]: @ref google::cloud::future + /// [`StatusOr`]: @ref google::cloud::StatusOr + /// [`Status`]: @ref google::cloud::Status + /// [google.iam.v1.TestIamPermissionsRequest]: @googleapis_reference_link{google/iam/v1/iam_policy.proto#L137} + /// [google.iam.v1.TestIamPermissionsResponse]: @googleapis_reference_link{google/iam/v1/iam_policy.proto#L153} + /// + // clang-format on + StatusOr TestIamPermissions( + google::iam::v1::TestIamPermissionsRequest const& request, + Options opts = {}); + + private: + std::shared_ptr connection_; + Options options_; +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentidentity_v1 +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_AUTH_PROVIDER_CLIENT_H diff --git a/google/cloud/agentidentity/v1/auth_provider_connection.cc b/google/cloud/agentidentity/v1/auth_provider_connection.cc new file mode 100644 index 0000000000000..4baceae45f5f0 --- /dev/null +++ b/google/cloud/agentidentity/v1/auth_provider_connection.cc @@ -0,0 +1,194 @@ +// Copyright 2026 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 by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/cloud/agentidentity/v1/auth_provider_service.proto + +#include "google/cloud/agentidentity/v1/auth_provider_connection.h" +#include "google/cloud/agentidentity/v1/auth_provider_options.h" +#include "google/cloud/agentidentity/v1/internal/auth_provider_connection_impl.h" +#include "google/cloud/agentidentity/v1/internal/auth_provider_option_defaults.h" +#include "google/cloud/agentidentity/v1/internal/auth_provider_stub_factory.h" +#include "google/cloud/agentidentity/v1/internal/auth_provider_tracing_connection.h" +#include "google/cloud/background_threads.h" +#include "google/cloud/common_options.h" +#include "google/cloud/credentials.h" +#include "google/cloud/grpc_options.h" +#include "google/cloud/internal/pagination_range.h" +#include "google/cloud/internal/unified_grpc_credentials.h" +#include +#include + +namespace google { +namespace cloud { +namespace agentidentity_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +AuthProviderServiceConnection::~AuthProviderServiceConnection() = default; + +StreamRange +AuthProviderServiceConnection::ListAuthProviders( + google::cloud::agentidentity::v1:: + ListAuthProvidersRequest) { // NOLINT(performance-unnecessary-value-param) + return google::cloud::internal::MakeUnimplementedPaginationRange< + StreamRange>(); +} + +StatusOr +AuthProviderServiceConnection::GetAuthProvider( + google::cloud::agentidentity::v1::GetAuthProviderRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +StatusOr +AuthProviderServiceConnection::CreateAuthProvider( + google::cloud::agentidentity::v1::CreateAuthProviderRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +StatusOr +AuthProviderServiceConnection::UpdateAuthProvider( + google::cloud::agentidentity::v1::UpdateAuthProviderRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +Status AuthProviderServiceConnection::DeleteAuthProvider( + google::cloud::agentidentity::v1::DeleteAuthProviderRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +StatusOr +AuthProviderServiceConnection::UndeleteAuthProvider( + google::cloud::agentidentity::v1::UndeleteAuthProviderRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +StreamRange AuthProviderServiceConnection::QueryAuthProviders( + google::cloud::agentidentity::v1:: + QueryAuthProvidersRequest) { // NOLINT(performance-unnecessary-value-param) + return google::cloud::internal::MakeUnimplementedPaginationRange< + StreamRange>(); +} + +StreamRange AuthProviderServiceConnection::QueryWorkloads( + google::cloud::agentidentity::v1:: + QueryWorkloadsRequest) { // NOLINT(performance-unnecessary-value-param) + return google::cloud::internal::MakeUnimplementedPaginationRange< + StreamRange>(); +} + +StreamRange +AuthProviderServiceConnection::ListAuthorizations( + google::cloud::agentidentity::v1:: + ListAuthorizationsRequest) { // NOLINT(performance-unnecessary-value-param) + return google::cloud::internal::MakeUnimplementedPaginationRange< + StreamRange>(); +} + +StatusOr +AuthProviderServiceConnection::GetAuthorization( + google::cloud::agentidentity::v1::GetAuthorizationRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +Status AuthProviderServiceConnection::DeleteAuthorization( + google::cloud::agentidentity::v1::DeleteAuthorizationRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +StreamRange +AuthProviderServiceConnection::ListAccessSummaries( + google::cloud::agentidentity::v1:: + ListAccessSummariesRequest) { // NOLINT(performance-unnecessary-value-param) + return google::cloud::internal::MakeUnimplementedPaginationRange< + StreamRange>(); +} + +StatusOr +AuthProviderServiceConnection::GetAccessSummary( + google::cloud::agentidentity::v1::GetAccessSummaryRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +StatusOr +AuthProviderServiceConnection::RevokeAuthorization( + google::cloud::agentidentity::v1::RevokeAuthorizationRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +StatusOr +AuthProviderServiceConnection::EnableAuthProvider( + google::cloud::agentidentity::v1::EnableAuthProviderRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +StatusOr +AuthProviderServiceConnection::DisableAuthProvider( + google::cloud::agentidentity::v1::DisableAuthProviderRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +StreamRange +AuthProviderServiceConnection::ListLocations( + google::cloud::location:: + ListLocationsRequest) { // NOLINT(performance-unnecessary-value-param) + return google::cloud::internal::MakeUnimplementedPaginationRange< + StreamRange>(); +} + +StatusOr +AuthProviderServiceConnection::GetLocation( + google::cloud::location::GetLocationRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +StatusOr AuthProviderServiceConnection::SetIamPolicy( + google::iam::v1::SetIamPolicyRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +StatusOr AuthProviderServiceConnection::GetIamPolicy( + google::iam::v1::GetIamPolicyRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +StatusOr +AuthProviderServiceConnection::TestIamPermissions( + google::iam::v1::TestIamPermissionsRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +std::shared_ptr +MakeAuthProviderServiceConnection(Options options) { + internal::CheckExpectedOptions(options, + __func__); + options = agentidentity_v1_internal::AuthProviderServiceDefaultOptions( + std::move(options)); + auto background = internal::MakeBackgroundThreadsFactory(options)(); + auto auth = internal::CreateAuthenticationStrategy(background->cq(), options); + auto stub = agentidentity_v1_internal::CreateDefaultAuthProviderServiceStub( + std::move(auth), options); + return agentidentity_v1_internal::MakeAuthProviderServiceTracingConnection( + std::make_shared< + agentidentity_v1_internal::AuthProviderServiceConnectionImpl>( + std::move(background), std::move(stub), std::move(options))); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentidentity_v1 +} // namespace cloud +} // namespace google diff --git a/google/cloud/agentidentity/v1/auth_provider_connection.h b/google/cloud/agentidentity/v1/auth_provider_connection.h new file mode 100644 index 0000000000000..5ee13a8924607 --- /dev/null +++ b/google/cloud/agentidentity/v1/auth_provider_connection.h @@ -0,0 +1,304 @@ +// Copyright 2026 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 by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/cloud/agentidentity/v1/auth_provider_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_AUTH_PROVIDER_CONNECTION_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_AUTH_PROVIDER_CONNECTION_H + +#include "google/cloud/agentidentity/v1/auth_provider_connection_idempotency_policy.h" +#include "google/cloud/agentidentity/v1/auth_provider_service.pb.h" +#include "google/cloud/agentidentity/v1/internal/auth_provider_retry_traits.h" +#include "google/cloud/backoff_policy.h" +#include "google/cloud/internal/retry_policy_impl.h" +#include "google/cloud/options.h" +#include "google/cloud/status_or.h" +#include "google/cloud/stream_range.h" +#include "google/cloud/version.h" +#include + +namespace google { +namespace cloud { +namespace agentidentity_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +/// The retry policy for `AuthProviderServiceConnection`. +class AuthProviderServiceRetryPolicy : public ::google::cloud::RetryPolicy { + public: + /// Creates a new instance of the policy, reset to the initial state. + virtual std::unique_ptr clone() const = 0; +}; + +/** + * A retry policy for `AuthProviderServiceConnection` based on counting errors. + * + * This policy stops retrying if: + * - An RPC returns a non-transient error. + * - More than a prescribed number of transient failures is detected. + * + * In this class the following status codes are treated as transient errors: + * - [`kUnavailable`](@ref google::cloud::StatusCode) + */ +class AuthProviderServiceLimitedErrorCountRetryPolicy + : public AuthProviderServiceRetryPolicy { + public: + /** + * Create an instance that tolerates up to @p maximum_failures transient + * errors. + * + * @note Disable the retry loop by providing an instance of this policy with + * @p maximum_failures == 0. + */ + explicit AuthProviderServiceLimitedErrorCountRetryPolicy(int maximum_failures) + : impl_(maximum_failures) {} + + AuthProviderServiceLimitedErrorCountRetryPolicy( + AuthProviderServiceLimitedErrorCountRetryPolicy&& rhs) noexcept + : AuthProviderServiceLimitedErrorCountRetryPolicy( + rhs.maximum_failures()) {} + AuthProviderServiceLimitedErrorCountRetryPolicy( + AuthProviderServiceLimitedErrorCountRetryPolicy const& rhs) noexcept + : AuthProviderServiceLimitedErrorCountRetryPolicy( + rhs.maximum_failures()) {} + + int maximum_failures() const { return impl_.maximum_failures(); } + + bool OnFailure(Status const& status) override { + return impl_.OnFailure(status); + } + bool IsExhausted() const override { return impl_.IsExhausted(); } + bool IsPermanentFailure(Status const& status) const override { + return impl_.IsPermanentFailure(status); + } + std::unique_ptr clone() const override { + return std::make_unique( + maximum_failures()); + } + + // This is provided only for backwards compatibility. + using BaseType = AuthProviderServiceRetryPolicy; + + private: + google::cloud::internal::LimitedErrorCountRetryPolicy< + agentidentity_v1_internal::AuthProviderServiceRetryTraits> + impl_; +}; + +/** + * A retry policy for `AuthProviderServiceConnection` based on elapsed time. + * + * This policy stops retrying if: + * - An RPC returns a non-transient error. + * - The elapsed time in the retry loop exceeds a prescribed duration. + * + * In this class the following status codes are treated as transient errors: + * - [`kUnavailable`](@ref google::cloud::StatusCode) + */ +class AuthProviderServiceLimitedTimeRetryPolicy + : public AuthProviderServiceRetryPolicy { + public: + /** + * Constructor given a `std::chrono::duration<>` object. + * + * @tparam DurationRep a placeholder to match the `Rep` tparam for @p + * duration's type. The semantics of this template parameter are + * documented in `std::chrono::duration<>`. In brief, the underlying + * arithmetic type used to store the number of ticks. For our purposes it + * is simply a formal parameter. + * @tparam DurationPeriod a placeholder to match the `Period` tparam for @p + * duration's type. The semantics of this template parameter are + * documented in `std::chrono::duration<>`. In brief, the length of the + * tick in seconds, expressed as a `std::ratio<>`. For our purposes it is + * simply a formal parameter. + * @param maximum_duration the maximum time allowed before the policy expires. + * While the application can express this time in any units they desire, + * the class truncates to milliseconds. + * + * @see https://en.cppreference.com/w/cpp/chrono/duration for more information + * about `std::chrono::duration`. + */ + template + explicit AuthProviderServiceLimitedTimeRetryPolicy( + std::chrono::duration maximum_duration) + : impl_(maximum_duration) {} + + AuthProviderServiceLimitedTimeRetryPolicy( + AuthProviderServiceLimitedTimeRetryPolicy&& rhs) noexcept + : AuthProviderServiceLimitedTimeRetryPolicy(rhs.maximum_duration()) {} + AuthProviderServiceLimitedTimeRetryPolicy( + AuthProviderServiceLimitedTimeRetryPolicy const& rhs) noexcept + : AuthProviderServiceLimitedTimeRetryPolicy(rhs.maximum_duration()) {} + + std::chrono::milliseconds maximum_duration() const { + return impl_.maximum_duration(); + } + + bool OnFailure(Status const& status) override { + return impl_.OnFailure(status); + } + bool IsExhausted() const override { return impl_.IsExhausted(); } + bool IsPermanentFailure(Status const& status) const override { + return impl_.IsPermanentFailure(status); + } + std::unique_ptr clone() const override { + return std::make_unique( + maximum_duration()); + } + + // This is provided only for backwards compatibility. + using BaseType = AuthProviderServiceRetryPolicy; + + private: + google::cloud::internal::LimitedTimeRetryPolicy< + agentidentity_v1_internal::AuthProviderServiceRetryTraits> + impl_; +}; + +/** + * The `AuthProviderServiceConnection` object for `AuthProviderServiceClient`. + * + * This interface defines virtual methods for each of the user-facing overload + * sets in `AuthProviderServiceClient`. This allows users to inject custom + * behavior (e.g., with a Google Mock object) when writing tests that use + * objects of type `AuthProviderServiceClient`. + * + * To create a concrete instance, see `MakeAuthProviderServiceConnection()`. + * + * For mocking, see `agentidentity_v1_mocks::MockAuthProviderServiceConnection`. + */ +class AuthProviderServiceConnection { + public: + virtual ~AuthProviderServiceConnection() = 0; + + virtual Options options() { return Options{}; } + + virtual StreamRange + ListAuthProviders( + google::cloud::agentidentity::v1::ListAuthProvidersRequest request); + + virtual StatusOr + GetAuthProvider( + google::cloud::agentidentity::v1::GetAuthProviderRequest const& request); + + virtual StatusOr + CreateAuthProvider( + google::cloud::agentidentity::v1::CreateAuthProviderRequest const& + request); + + virtual StatusOr + UpdateAuthProvider( + google::cloud::agentidentity::v1::UpdateAuthProviderRequest const& + request); + + virtual Status DeleteAuthProvider( + google::cloud::agentidentity::v1::DeleteAuthProviderRequest const& + request); + + virtual StatusOr + UndeleteAuthProvider( + google::cloud::agentidentity::v1::UndeleteAuthProviderRequest const& + request); + + virtual StreamRange QueryAuthProviders( + google::cloud::agentidentity::v1::QueryAuthProvidersRequest request); + + virtual StreamRange QueryWorkloads( + google::cloud::agentidentity::v1::QueryWorkloadsRequest request); + + virtual StreamRange + ListAuthorizations( + google::cloud::agentidentity::v1::ListAuthorizationsRequest request); + + virtual StatusOr + GetAuthorization( + google::cloud::agentidentity::v1::GetAuthorizationRequest const& request); + + virtual Status DeleteAuthorization( + google::cloud::agentidentity::v1::DeleteAuthorizationRequest const& + request); + + virtual StreamRange + ListAccessSummaries( + google::cloud::agentidentity::v1::ListAccessSummariesRequest request); + + virtual StatusOr + GetAccessSummary( + google::cloud::agentidentity::v1::GetAccessSummaryRequest const& request); + + virtual StatusOr< + google::cloud::agentidentity::v1::RevokeAuthorizationResponse> + RevokeAuthorization( + google::cloud::agentidentity::v1::RevokeAuthorizationRequest const& + request); + + virtual StatusOr + EnableAuthProvider( + google::cloud::agentidentity::v1::EnableAuthProviderRequest const& + request); + + virtual StatusOr + DisableAuthProvider( + google::cloud::agentidentity::v1::DisableAuthProviderRequest const& + request); + + virtual StreamRange ListLocations( + google::cloud::location::ListLocationsRequest request); + + virtual StatusOr GetLocation( + google::cloud::location::GetLocationRequest const& request); + + virtual StatusOr SetIamPolicy( + google::iam::v1::SetIamPolicyRequest const& request); + + virtual StatusOr GetIamPolicy( + google::iam::v1::GetIamPolicyRequest const& request); + + virtual StatusOr + TestIamPermissions(google::iam::v1::TestIamPermissionsRequest const& request); +}; + +/** + * A factory function to construct an object of type + * `AuthProviderServiceConnection`. + * + * The returned connection object should not be used directly; instead it + * should be passed as an argument to the constructor of + * AuthProviderServiceClient. + * + * The optional @p options argument may be used to configure aspects of the + * returned `AuthProviderServiceConnection`. Expected options are any of the + * types in the following option lists: + * + * - `google::cloud::CommonOptionList` + * - `google::cloud::GrpcOptionList` + * - `google::cloud::UnifiedCredentialsOptionList` + * - `google::cloud::agentidentity_v1::AuthProviderServicePolicyOptionList` + * + * @note Unexpected options will be ignored. To log unexpected options instead, + * set `GOOGLE_CLOUD_CPP_ENABLE_CLOG=yes` in the environment. + * + * @param options (optional) Configure the `AuthProviderServiceConnection` + * created by this function. + */ +std::shared_ptr +MakeAuthProviderServiceConnection(Options options = {}); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentidentity_v1 +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_AUTH_PROVIDER_CONNECTION_H diff --git a/google/cloud/agentidentity/v1/auth_provider_connection_idempotency_policy.cc b/google/cloud/agentidentity/v1/auth_provider_connection_idempotency_policy.cc new file mode 100644 index 0000000000000..f052318dafe05 --- /dev/null +++ b/google/cloud/agentidentity/v1/auth_provider_connection_idempotency_policy.cc @@ -0,0 +1,153 @@ +// Copyright 2026 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 by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/cloud/agentidentity/v1/auth_provider_service.proto + +#include "google/cloud/agentidentity/v1/auth_provider_connection_idempotency_policy.h" +#include + +namespace google { +namespace cloud { +namespace agentidentity_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +using ::google::cloud::Idempotency; + +AuthProviderServiceConnectionIdempotencyPolicy:: + ~AuthProviderServiceConnectionIdempotencyPolicy() = default; + +std::unique_ptr +AuthProviderServiceConnectionIdempotencyPolicy::clone() const { + return std::make_unique( + *this); +} + +Idempotency AuthProviderServiceConnectionIdempotencyPolicy::ListAuthProviders( + google::cloud::agentidentity::v1::ListAuthProvidersRequest) { // NOLINT + return Idempotency::kIdempotent; +} + +Idempotency AuthProviderServiceConnectionIdempotencyPolicy::GetAuthProvider( + google::cloud::agentidentity::v1::GetAuthProviderRequest const&) { + return Idempotency::kIdempotent; +} + +Idempotency AuthProviderServiceConnectionIdempotencyPolicy::CreateAuthProvider( + google::cloud::agentidentity::v1::CreateAuthProviderRequest const&) { + return Idempotency::kNonIdempotent; +} + +Idempotency AuthProviderServiceConnectionIdempotencyPolicy::UpdateAuthProvider( + google::cloud::agentidentity::v1::UpdateAuthProviderRequest const&) { + return Idempotency::kNonIdempotent; +} + +Idempotency AuthProviderServiceConnectionIdempotencyPolicy::DeleteAuthProvider( + google::cloud::agentidentity::v1::DeleteAuthProviderRequest const&) { + return Idempotency::kNonIdempotent; +} + +Idempotency +AuthProviderServiceConnectionIdempotencyPolicy::UndeleteAuthProvider( + google::cloud::agentidentity::v1::UndeleteAuthProviderRequest const&) { + return Idempotency::kNonIdempotent; +} + +Idempotency AuthProviderServiceConnectionIdempotencyPolicy::QueryAuthProviders( + google::cloud::agentidentity::v1::QueryAuthProvidersRequest) { // NOLINT + return Idempotency::kIdempotent; +} + +Idempotency AuthProviderServiceConnectionIdempotencyPolicy::QueryWorkloads( + google::cloud::agentidentity::v1::QueryWorkloadsRequest) { // NOLINT + return Idempotency::kIdempotent; +} + +Idempotency AuthProviderServiceConnectionIdempotencyPolicy::ListAuthorizations( + google::cloud::agentidentity::v1::ListAuthorizationsRequest) { // NOLINT + return Idempotency::kIdempotent; +} + +Idempotency AuthProviderServiceConnectionIdempotencyPolicy::GetAuthorization( + google::cloud::agentidentity::v1::GetAuthorizationRequest const&) { + return Idempotency::kIdempotent; +} + +Idempotency AuthProviderServiceConnectionIdempotencyPolicy::DeleteAuthorization( + google::cloud::agentidentity::v1::DeleteAuthorizationRequest const&) { + return Idempotency::kNonIdempotent; +} + +Idempotency AuthProviderServiceConnectionIdempotencyPolicy::ListAccessSummaries( + google::cloud::agentidentity::v1::ListAccessSummariesRequest) { // NOLINT + return Idempotency::kIdempotent; +} + +Idempotency AuthProviderServiceConnectionIdempotencyPolicy::GetAccessSummary( + google::cloud::agentidentity::v1::GetAccessSummaryRequest const&) { + return Idempotency::kIdempotent; +} + +Idempotency AuthProviderServiceConnectionIdempotencyPolicy::RevokeAuthorization( + google::cloud::agentidentity::v1::RevokeAuthorizationRequest const&) { + return Idempotency::kNonIdempotent; +} + +Idempotency AuthProviderServiceConnectionIdempotencyPolicy::EnableAuthProvider( + google::cloud::agentidentity::v1::EnableAuthProviderRequest const&) { + return Idempotency::kNonIdempotent; +} + +Idempotency AuthProviderServiceConnectionIdempotencyPolicy::DisableAuthProvider( + google::cloud::agentidentity::v1::DisableAuthProviderRequest const&) { + return Idempotency::kNonIdempotent; +} + +Idempotency AuthProviderServiceConnectionIdempotencyPolicy::ListLocations( + google::cloud::location::ListLocationsRequest) { // NOLINT + return Idempotency::kIdempotent; +} + +Idempotency AuthProviderServiceConnectionIdempotencyPolicy::GetLocation( + google::cloud::location::GetLocationRequest const&) { + return Idempotency::kIdempotent; +} + +Idempotency AuthProviderServiceConnectionIdempotencyPolicy::SetIamPolicy( + google::iam::v1::SetIamPolicyRequest const& request) { + return request.policy().etag().empty() ? Idempotency::kNonIdempotent + : Idempotency::kIdempotent; +} + +Idempotency AuthProviderServiceConnectionIdempotencyPolicy::GetIamPolicy( + google::iam::v1::GetIamPolicyRequest const&) { + return Idempotency::kIdempotent; +} + +Idempotency AuthProviderServiceConnectionIdempotencyPolicy::TestIamPermissions( + google::iam::v1::TestIamPermissionsRequest const&) { + return Idempotency::kIdempotent; +} + +std::unique_ptr +MakeDefaultAuthProviderServiceConnectionIdempotencyPolicy() { + return std::make_unique(); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentidentity_v1 +} // namespace cloud +} // namespace google diff --git a/google/cloud/agentidentity/v1/auth_provider_connection_idempotency_policy.h b/google/cloud/agentidentity/v1/auth_provider_connection_idempotency_policy.h new file mode 100644 index 0000000000000..ce9ed6b051589 --- /dev/null +++ b/google/cloud/agentidentity/v1/auth_provider_connection_idempotency_policy.h @@ -0,0 +1,122 @@ +// Copyright 2026 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 by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/cloud/agentidentity/v1/auth_provider_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_AUTH_PROVIDER_CONNECTION_IDEMPOTENCY_POLICY_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_AUTH_PROVIDER_CONNECTION_IDEMPOTENCY_POLICY_H + +#include "google/cloud/agentidentity/v1/auth_provider_service.grpc.pb.h" +#include "google/cloud/location/locations.grpc.pb.h" +#include "google/cloud/idempotency.h" +#include "google/cloud/version.h" +#include "google/iam/v1/iam_policy.grpc.pb.h" +#include + +namespace google { +namespace cloud { +namespace agentidentity_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class AuthProviderServiceConnectionIdempotencyPolicy { + public: + virtual ~AuthProviderServiceConnectionIdempotencyPolicy(); + + /// Create a new copy of this object. + virtual std::unique_ptr + clone() const; + + virtual google::cloud::Idempotency ListAuthProviders( + google::cloud::agentidentity::v1::ListAuthProvidersRequest request); + + virtual google::cloud::Idempotency GetAuthProvider( + google::cloud::agentidentity::v1::GetAuthProviderRequest const& request); + + virtual google::cloud::Idempotency CreateAuthProvider( + google::cloud::agentidentity::v1::CreateAuthProviderRequest const& + request); + + virtual google::cloud::Idempotency UpdateAuthProvider( + google::cloud::agentidentity::v1::UpdateAuthProviderRequest const& + request); + + virtual google::cloud::Idempotency DeleteAuthProvider( + google::cloud::agentidentity::v1::DeleteAuthProviderRequest const& + request); + + virtual google::cloud::Idempotency UndeleteAuthProvider( + google::cloud::agentidentity::v1::UndeleteAuthProviderRequest const& + request); + + virtual google::cloud::Idempotency QueryAuthProviders( + google::cloud::agentidentity::v1::QueryAuthProvidersRequest request); + + virtual google::cloud::Idempotency QueryWorkloads( + google::cloud::agentidentity::v1::QueryWorkloadsRequest request); + + virtual google::cloud::Idempotency ListAuthorizations( + google::cloud::agentidentity::v1::ListAuthorizationsRequest request); + + virtual google::cloud::Idempotency GetAuthorization( + google::cloud::agentidentity::v1::GetAuthorizationRequest const& request); + + virtual google::cloud::Idempotency DeleteAuthorization( + google::cloud::agentidentity::v1::DeleteAuthorizationRequest const& + request); + + virtual google::cloud::Idempotency ListAccessSummaries( + google::cloud::agentidentity::v1::ListAccessSummariesRequest request); + + virtual google::cloud::Idempotency GetAccessSummary( + google::cloud::agentidentity::v1::GetAccessSummaryRequest const& request); + + virtual google::cloud::Idempotency RevokeAuthorization( + google::cloud::agentidentity::v1::RevokeAuthorizationRequest const& + request); + + virtual google::cloud::Idempotency EnableAuthProvider( + google::cloud::agentidentity::v1::EnableAuthProviderRequest const& + request); + + virtual google::cloud::Idempotency DisableAuthProvider( + google::cloud::agentidentity::v1::DisableAuthProviderRequest const& + request); + + virtual google::cloud::Idempotency ListLocations( + google::cloud::location::ListLocationsRequest request); + + virtual google::cloud::Idempotency GetLocation( + google::cloud::location::GetLocationRequest const& request); + + virtual google::cloud::Idempotency SetIamPolicy( + google::iam::v1::SetIamPolicyRequest const& request); + + virtual google::cloud::Idempotency GetIamPolicy( + google::iam::v1::GetIamPolicyRequest const& request); + + virtual google::cloud::Idempotency TestIamPermissions( + google::iam::v1::TestIamPermissionsRequest const& request); +}; + +std::unique_ptr +MakeDefaultAuthProviderServiceConnectionIdempotencyPolicy(); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentidentity_v1 +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_AUTH_PROVIDER_CONNECTION_IDEMPOTENCY_POLICY_H diff --git a/google/cloud/agentidentity/v1/auth_provider_options.h b/google/cloud/agentidentity/v1/auth_provider_options.h new file mode 100644 index 0000000000000..27fabf358d607 --- /dev/null +++ b/google/cloud/agentidentity/v1/auth_provider_options.h @@ -0,0 +1,76 @@ +// Copyright 2026 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 by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/cloud/agentidentity/v1/auth_provider_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_AUTH_PROVIDER_OPTIONS_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_AUTH_PROVIDER_OPTIONS_H + +#include "google/cloud/agentidentity/v1/auth_provider_connection.h" +#include "google/cloud/agentidentity/v1/auth_provider_connection_idempotency_policy.h" +#include "google/cloud/backoff_policy.h" +#include "google/cloud/options.h" +#include "google/cloud/version.h" +#include + +namespace google { +namespace cloud { +namespace agentidentity_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +/** + * Use with `google::cloud::Options` to configure the retry policy. + * + * @ingroup google-cloud-agentidentity-options + */ +struct AuthProviderServiceRetryPolicyOption { + using Type = std::shared_ptr; +}; + +/** + * Use with `google::cloud::Options` to configure the backoff policy. + * + * @ingroup google-cloud-agentidentity-options + */ +struct AuthProviderServiceBackoffPolicyOption { + using Type = std::shared_ptr; +}; + +/** + * Use with `google::cloud::Options` to configure which operations are retried. + * + * @ingroup google-cloud-agentidentity-options + */ +struct AuthProviderServiceConnectionIdempotencyPolicyOption { + using Type = std::shared_ptr; +}; + +/** + * The options applicable to AuthProviderService. + * + * @ingroup google-cloud-agentidentity-options + */ +using AuthProviderServicePolicyOptionList = + OptionList; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentidentity_v1 +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_AUTH_PROVIDER_OPTIONS_H diff --git a/google/cloud/agentidentity/v1/internal/auth_provider_auth_decorator.cc b/google/cloud/agentidentity/v1/internal/auth_provider_auth_decorator.cc new file mode 100644 index 0000000000000..63bcebe0c0ef0 --- /dev/null +++ b/google/cloud/agentidentity/v1/internal/auth_provider_auth_decorator.cc @@ -0,0 +1,238 @@ +// Copyright 2026 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 by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/cloud/agentidentity/v1/auth_provider_service.proto + +#include "google/cloud/agentidentity/v1/internal/auth_provider_auth_decorator.h" +#include "google/cloud/agentidentity/v1/auth_provider_service.grpc.pb.h" +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace agentidentity_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +AuthProviderServiceAuth::AuthProviderServiceAuth( + std::shared_ptr auth, + std::shared_ptr child) + : auth_(std::move(auth)), child_(std::move(child)) {} + +StatusOr +AuthProviderServiceAuth::ListAuthProviders( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAuthProvidersRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->ListAuthProviders(context, options, request); +} + +StatusOr +AuthProviderServiceAuth::GetAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAuthProviderRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->GetAuthProvider(context, options, request); +} + +StatusOr +AuthProviderServiceAuth::CreateAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::CreateAuthProviderRequest const& + request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->CreateAuthProvider(context, options, request); +} + +StatusOr +AuthProviderServiceAuth::UpdateAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::UpdateAuthProviderRequest const& + request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->UpdateAuthProvider(context, options, request); +} + +Status AuthProviderServiceAuth::DeleteAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DeleteAuthProviderRequest const& + request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->DeleteAuthProvider(context, options, request); +} + +StatusOr +AuthProviderServiceAuth::UndeleteAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::UndeleteAuthProviderRequest const& + request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->UndeleteAuthProvider(context, options, request); +} + +StatusOr +AuthProviderServiceAuth::QueryAuthProviders( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::QueryAuthProvidersRequest const& + request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->QueryAuthProviders(context, options, request); +} + +StatusOr +AuthProviderServiceAuth::QueryWorkloads( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::QueryWorkloadsRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->QueryWorkloads(context, options, request); +} + +StatusOr +AuthProviderServiceAuth::ListAuthorizations( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAuthorizationsRequest const& + request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->ListAuthorizations(context, options, request); +} + +StatusOr +AuthProviderServiceAuth::GetAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAuthorizationRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->GetAuthorization(context, options, request); +} + +Status AuthProviderServiceAuth::DeleteAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DeleteAuthorizationRequest const& + request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->DeleteAuthorization(context, options, request); +} + +StatusOr +AuthProviderServiceAuth::ListAccessSummaries( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAccessSummariesRequest const& + request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->ListAccessSummaries(context, options, request); +} + +StatusOr +AuthProviderServiceAuth::GetAccessSummary( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAccessSummaryRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->GetAccessSummary(context, options, request); +} + +StatusOr +AuthProviderServiceAuth::RevokeAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::RevokeAuthorizationRequest const& + request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->RevokeAuthorization(context, options, request); +} + +StatusOr +AuthProviderServiceAuth::EnableAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::EnableAuthProviderRequest const& + request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->EnableAuthProvider(context, options, request); +} + +StatusOr +AuthProviderServiceAuth::DisableAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DisableAuthProviderRequest const& + request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->DisableAuthProvider(context, options, request); +} + +StatusOr +AuthProviderServiceAuth::ListLocations( + grpc::ClientContext& context, Options const& options, + google::cloud::location::ListLocationsRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->ListLocations(context, options, request); +} + +StatusOr +AuthProviderServiceAuth::GetLocation( + grpc::ClientContext& context, Options const& options, + google::cloud::location::GetLocationRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->GetLocation(context, options, request); +} + +StatusOr AuthProviderServiceAuth::SetIamPolicy( + grpc::ClientContext& context, Options const& options, + google::iam::v1::SetIamPolicyRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->SetIamPolicy(context, options, request); +} + +StatusOr AuthProviderServiceAuth::GetIamPolicy( + grpc::ClientContext& context, Options const& options, + google::iam::v1::GetIamPolicyRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->GetIamPolicy(context, options, request); +} + +StatusOr +AuthProviderServiceAuth::TestIamPermissions( + grpc::ClientContext& context, Options const& options, + google::iam::v1::TestIamPermissionsRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->TestIamPermissions(context, options, request); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentidentity_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" diff --git a/google/cloud/agentidentity/v1/internal/auth_provider_auth_decorator.h b/google/cloud/agentidentity/v1/internal/auth_provider_auth_decorator.h new file mode 100644 index 0000000000000..d11a1161cd26c --- /dev/null +++ b/google/cloud/agentidentity/v1/internal/auth_provider_auth_decorator.h @@ -0,0 +1,161 @@ +// Copyright 2026 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 by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/cloud/agentidentity/v1/auth_provider_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_AUTH_DECORATOR_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_AUTH_DECORATOR_H + +#include "google/cloud/agentidentity/v1/internal/auth_provider_stub.h" +#include "google/cloud/internal/unified_grpc_credentials.h" +#include "google/cloud/version.h" +#include +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace agentidentity_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class AuthProviderServiceAuth : public AuthProviderServiceStub { + public: + ~AuthProviderServiceAuth() override = default; + AuthProviderServiceAuth( + std::shared_ptr auth, + std::shared_ptr child); + + StatusOr + ListAuthProviders( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAuthProvidersRequest const& request) + override; + + StatusOr GetAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAuthProviderRequest const& request) + override; + + StatusOr CreateAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::CreateAuthProviderRequest const& + request) override; + + StatusOr UpdateAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::UpdateAuthProviderRequest const& + request) override; + + Status DeleteAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DeleteAuthProviderRequest const& + request) override; + + StatusOr UndeleteAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::UndeleteAuthProviderRequest const& + request) override; + + StatusOr + QueryAuthProviders( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::QueryAuthProvidersRequest const& + request) override; + + StatusOr + QueryWorkloads(grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::QueryWorkloadsRequest const& + request) override; + + StatusOr + ListAuthorizations( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAuthorizationsRequest const& + request) override; + + StatusOr GetAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAuthorizationRequest const& request) + override; + + Status DeleteAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DeleteAuthorizationRequest const& + request) override; + + StatusOr + ListAccessSummaries( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAccessSummariesRequest const& + request) override; + + StatusOr GetAccessSummary( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAccessSummaryRequest const& request) + override; + + StatusOr + RevokeAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::RevokeAuthorizationRequest const& + request) override; + + StatusOr EnableAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::EnableAuthProviderRequest const& + request) override; + + StatusOr DisableAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DisableAuthProviderRequest const& + request) override; + + StatusOr ListLocations( + grpc::ClientContext& context, Options const& options, + google::cloud::location::ListLocationsRequest const& request) override; + + StatusOr GetLocation( + grpc::ClientContext& context, Options const& options, + google::cloud::location::GetLocationRequest const& request) override; + + StatusOr SetIamPolicy( + grpc::ClientContext& context, Options const& options, + google::iam::v1::SetIamPolicyRequest const& request) override; + + StatusOr GetIamPolicy( + grpc::ClientContext& context, Options const& options, + google::iam::v1::GetIamPolicyRequest const& request) override; + + StatusOr TestIamPermissions( + grpc::ClientContext& context, Options const& options, + google::iam::v1::TestIamPermissionsRequest const& request) override; + + private: + std::shared_ptr auth_; + std::shared_ptr child_; +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentidentity_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_AUTH_DECORATOR_H diff --git a/google/cloud/agentidentity/v1/internal/auth_provider_connection_impl.cc b/google/cloud/agentidentity/v1/internal/auth_provider_connection_impl.cc new file mode 100644 index 0000000000000..ad82f11e813c5 --- /dev/null +++ b/google/cloud/agentidentity/v1/internal/auth_provider_connection_impl.cc @@ -0,0 +1,506 @@ +// Copyright 2026 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 by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/cloud/agentidentity/v1/auth_provider_service.proto + +#include "google/cloud/agentidentity/v1/internal/auth_provider_connection_impl.h" +#include "google/cloud/agentidentity/v1/internal/auth_provider_option_defaults.h" +#include "google/cloud/background_threads.h" +#include "google/cloud/common_options.h" +#include "google/cloud/grpc_options.h" +#include "google/cloud/internal/pagination_range.h" +#include "google/cloud/internal/retry_loop.h" +#include +#include + +namespace google { +namespace cloud { +namespace agentidentity_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN +namespace { + +std::unique_ptr retry_policy( + Options const& options) { + return options.get() + ->clone(); +} + +std::unique_ptr backoff_policy(Options const& options) { + return options + .get() + ->clone(); +} + +std::unique_ptr< + agentidentity_v1::AuthProviderServiceConnectionIdempotencyPolicy> +idempotency_policy(Options const& options) { + return options + .get() + ->clone(); +} + +} // namespace + +AuthProviderServiceConnectionImpl::AuthProviderServiceConnectionImpl( + std::unique_ptr background, + std::shared_ptr stub, + Options options) + : background_(std::move(background)), + stub_(std::move(stub)), + options_(internal::MergeOptions( + std::move(options), AuthProviderServiceConnection::options())) {} + +StreamRange +AuthProviderServiceConnectionImpl::ListAuthProviders( + google::cloud::agentidentity::v1::ListAuthProvidersRequest request) { + request.clear_page_token(); + auto current = google::cloud::internal::SaveCurrentOptions(); + auto idempotency = idempotency_policy(*current)->ListAuthProviders(request); + char const* function_name = __func__; + return google::cloud::internal::MakePaginationRange< + StreamRange>( + current, std::move(request), + [idempotency, function_name, stub = stub_, + retry = + std::shared_ptr( + retry_policy(*current)), + backoff = std::shared_ptr(backoff_policy(*current))]( + Options const& options, + google::cloud::agentidentity::v1::ListAuthProvidersRequest const& r) { + return google::cloud::internal::RetryLoop( + retry->clone(), backoff->clone(), idempotency, + [stub](grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1:: + ListAuthProvidersRequest const& request) { + return stub->ListAuthProviders(context, options, request); + }, + options, r, function_name); + }, + [](google::cloud::agentidentity::v1::ListAuthProvidersResponse r) { + std::vector result( + r.auth_providers().size()); + auto& messages = *r.mutable_auth_providers(); + std::move(messages.begin(), messages.end(), result.begin()); + return result; + }); +} + +StatusOr +AuthProviderServiceConnectionImpl::GetAuthProvider( + google::cloud::agentidentity::v1::GetAuthProviderRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->GetAuthProvider(request), + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAuthProviderRequest const& + request) { + return stub_->GetAuthProvider(context, options, request); + }, + *current, request, __func__); +} + +StatusOr +AuthProviderServiceConnectionImpl::CreateAuthProvider( + google::cloud::agentidentity::v1::CreateAuthProviderRequest const& + request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->CreateAuthProvider(request), + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::CreateAuthProviderRequest const& + request) { + return stub_->CreateAuthProvider(context, options, request); + }, + *current, request, __func__); +} + +StatusOr +AuthProviderServiceConnectionImpl::UpdateAuthProvider( + google::cloud::agentidentity::v1::UpdateAuthProviderRequest const& + request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->UpdateAuthProvider(request), + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::UpdateAuthProviderRequest const& + request) { + return stub_->UpdateAuthProvider(context, options, request); + }, + *current, request, __func__); +} + +Status AuthProviderServiceConnectionImpl::DeleteAuthProvider( + google::cloud::agentidentity::v1::DeleteAuthProviderRequest const& + request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->DeleteAuthProvider(request), + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DeleteAuthProviderRequest const& + request) { + return stub_->DeleteAuthProvider(context, options, request); + }, + *current, request, __func__); +} + +StatusOr +AuthProviderServiceConnectionImpl::UndeleteAuthProvider( + google::cloud::agentidentity::v1::UndeleteAuthProviderRequest const& + request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->UndeleteAuthProvider(request), + [this]( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::UndeleteAuthProviderRequest const& + request) { + return stub_->UndeleteAuthProvider(context, options, request); + }, + *current, request, __func__); +} + +StreamRange AuthProviderServiceConnectionImpl::QueryAuthProviders( + google::cloud::agentidentity::v1::QueryAuthProvidersRequest request) { + request.clear_page_token(); + auto current = google::cloud::internal::SaveCurrentOptions(); + auto idempotency = idempotency_policy(*current)->QueryAuthProviders(request); + char const* function_name = __func__; + return google::cloud::internal::MakePaginationRange>( + current, std::move(request), + [idempotency, function_name, stub = stub_, + retry = + std::shared_ptr( + retry_policy(*current)), + backoff = std::shared_ptr(backoff_policy(*current))]( + Options const& options, + google::cloud::agentidentity::v1::QueryAuthProvidersRequest const& + r) { + return google::cloud::internal::RetryLoop( + retry->clone(), backoff->clone(), idempotency, + [stub](grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1:: + QueryAuthProvidersRequest const& request) { + return stub->QueryAuthProviders(context, options, request); + }, + options, r, function_name); + }, + [](google::cloud::agentidentity::v1::QueryAuthProvidersResponse r) { + std::vector result(r.auth_provider_names().size()); + auto& messages = *r.mutable_auth_provider_names(); + std::move(messages.begin(), messages.end(), result.begin()); + return result; + }); +} + +StreamRange AuthProviderServiceConnectionImpl::QueryWorkloads( + google::cloud::agentidentity::v1::QueryWorkloadsRequest request) { + request.clear_page_token(); + auto current = google::cloud::internal::SaveCurrentOptions(); + auto idempotency = idempotency_policy(*current)->QueryWorkloads(request); + char const* function_name = __func__; + return google::cloud::internal::MakePaginationRange>( + current, std::move(request), + [idempotency, function_name, stub = stub_, + retry = + std::shared_ptr( + retry_policy(*current)), + backoff = std::shared_ptr(backoff_policy(*current))]( + Options const& options, + google::cloud::agentidentity::v1::QueryWorkloadsRequest const& r) { + return google::cloud::internal::RetryLoop( + retry->clone(), backoff->clone(), idempotency, + [stub]( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::QueryWorkloadsRequest const& + request) { + return stub->QueryWorkloads(context, options, request); + }, + options, r, function_name); + }, + [](google::cloud::agentidentity::v1::QueryWorkloadsResponse r) { + std::vector result(r.workload_ids().size()); + auto& messages = *r.mutable_workload_ids(); + std::move(messages.begin(), messages.end(), result.begin()); + return result; + }); +} + +StreamRange +AuthProviderServiceConnectionImpl::ListAuthorizations( + google::cloud::agentidentity::v1::ListAuthorizationsRequest request) { + request.clear_page_token(); + auto current = google::cloud::internal::SaveCurrentOptions(); + auto idempotency = idempotency_policy(*current)->ListAuthorizations(request); + char const* function_name = __func__; + return google::cloud::internal::MakePaginationRange< + StreamRange>( + current, std::move(request), + [idempotency, function_name, stub = stub_, + retry = + std::shared_ptr( + retry_policy(*current)), + backoff = std::shared_ptr(backoff_policy(*current))]( + Options const& options, + google::cloud::agentidentity::v1::ListAuthorizationsRequest const& + r) { + return google::cloud::internal::RetryLoop( + retry->clone(), backoff->clone(), idempotency, + [stub](grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1:: + ListAuthorizationsRequest const& request) { + return stub->ListAuthorizations(context, options, request); + }, + options, r, function_name); + }, + [](google::cloud::agentidentity::v1::ListAuthorizationsResponse r) { + std::vector result( + r.authorizations().size()); + auto& messages = *r.mutable_authorizations(); + std::move(messages.begin(), messages.end(), result.begin()); + return result; + }); +} + +StatusOr +AuthProviderServiceConnectionImpl::GetAuthorization( + google::cloud::agentidentity::v1::GetAuthorizationRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->GetAuthorization(request), + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAuthorizationRequest const& + request) { + return stub_->GetAuthorization(context, options, request); + }, + *current, request, __func__); +} + +Status AuthProviderServiceConnectionImpl::DeleteAuthorization( + google::cloud::agentidentity::v1::DeleteAuthorizationRequest const& + request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->DeleteAuthorization(request), + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DeleteAuthorizationRequest const& + request) { + return stub_->DeleteAuthorization(context, options, request); + }, + *current, request, __func__); +} + +StreamRange +AuthProviderServiceConnectionImpl::ListAccessSummaries( + google::cloud::agentidentity::v1::ListAccessSummariesRequest request) { + request.clear_page_token(); + auto current = google::cloud::internal::SaveCurrentOptions(); + auto idempotency = idempotency_policy(*current)->ListAccessSummaries(request); + char const* function_name = __func__; + return google::cloud::internal::MakePaginationRange< + StreamRange>( + current, std::move(request), + [idempotency, function_name, stub = stub_, + retry = + std::shared_ptr( + retry_policy(*current)), + backoff = std::shared_ptr(backoff_policy(*current))]( + Options const& options, + google::cloud::agentidentity::v1::ListAccessSummariesRequest const& + r) { + return google::cloud::internal::RetryLoop( + retry->clone(), backoff->clone(), idempotency, + [stub](grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1:: + ListAccessSummariesRequest const& request) { + return stub->ListAccessSummaries(context, options, request); + }, + options, r, function_name); + }, + [](google::cloud::agentidentity::v1::ListAccessSummariesResponse r) { + std::vector result( + r.access_summaries().size()); + auto& messages = *r.mutable_access_summaries(); + std::move(messages.begin(), messages.end(), result.begin()); + return result; + }); +} + +StatusOr +AuthProviderServiceConnectionImpl::GetAccessSummary( + google::cloud::agentidentity::v1::GetAccessSummaryRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->GetAccessSummary(request), + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAccessSummaryRequest const& + request) { + return stub_->GetAccessSummary(context, options, request); + }, + *current, request, __func__); +} + +StatusOr +AuthProviderServiceConnectionImpl::RevokeAuthorization( + google::cloud::agentidentity::v1::RevokeAuthorizationRequest const& + request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->RevokeAuthorization(request), + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::RevokeAuthorizationRequest const& + request) { + return stub_->RevokeAuthorization(context, options, request); + }, + *current, request, __func__); +} + +StatusOr +AuthProviderServiceConnectionImpl::EnableAuthProvider( + google::cloud::agentidentity::v1::EnableAuthProviderRequest const& + request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->EnableAuthProvider(request), + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::EnableAuthProviderRequest const& + request) { + return stub_->EnableAuthProvider(context, options, request); + }, + *current, request, __func__); +} + +StatusOr +AuthProviderServiceConnectionImpl::DisableAuthProvider( + google::cloud::agentidentity::v1::DisableAuthProviderRequest const& + request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->DisableAuthProvider(request), + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DisableAuthProviderRequest const& + request) { + return stub_->DisableAuthProvider(context, options, request); + }, + *current, request, __func__); +} + +StreamRange +AuthProviderServiceConnectionImpl::ListLocations( + google::cloud::location::ListLocationsRequest request) { + request.clear_page_token(); + auto current = google::cloud::internal::SaveCurrentOptions(); + auto idempotency = idempotency_policy(*current)->ListLocations(request); + char const* function_name = __func__; + return google::cloud::internal::MakePaginationRange< + StreamRange>( + current, std::move(request), + [idempotency, function_name, stub = stub_, + retry = + std::shared_ptr( + retry_policy(*current)), + backoff = std::shared_ptr(backoff_policy(*current))]( + Options const& options, + google::cloud::location::ListLocationsRequest const& r) { + return google::cloud::internal::RetryLoop( + retry->clone(), backoff->clone(), idempotency, + [stub]( + grpc::ClientContext& context, Options const& options, + google::cloud::location::ListLocationsRequest const& request) { + return stub->ListLocations(context, options, request); + }, + options, r, function_name); + }, + [](google::cloud::location::ListLocationsResponse r) { + std::vector result( + r.locations().size()); + auto& messages = *r.mutable_locations(); + std::move(messages.begin(), messages.end(), result.begin()); + return result; + }); +} + +StatusOr +AuthProviderServiceConnectionImpl::GetLocation( + google::cloud::location::GetLocationRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->GetLocation(request), + [this](grpc::ClientContext& context, Options const& options, + google::cloud::location::GetLocationRequest const& request) { + return stub_->GetLocation(context, options, request); + }, + *current, request, __func__); +} + +StatusOr +AuthProviderServiceConnectionImpl::SetIamPolicy( + google::iam::v1::SetIamPolicyRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->SetIamPolicy(request), + [this](grpc::ClientContext& context, Options const& options, + google::iam::v1::SetIamPolicyRequest const& request) { + return stub_->SetIamPolicy(context, options, request); + }, + *current, request, __func__); +} + +StatusOr +AuthProviderServiceConnectionImpl::GetIamPolicy( + google::iam::v1::GetIamPolicyRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->GetIamPolicy(request), + [this](grpc::ClientContext& context, Options const& options, + google::iam::v1::GetIamPolicyRequest const& request) { + return stub_->GetIamPolicy(context, options, request); + }, + *current, request, __func__); +} + +StatusOr +AuthProviderServiceConnectionImpl::TestIamPermissions( + google::iam::v1::TestIamPermissionsRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->TestIamPermissions(request), + [this](grpc::ClientContext& context, Options const& options, + google::iam::v1::TestIamPermissionsRequest const& request) { + return stub_->TestIamPermissions(context, options, request); + }, + *current, request, __func__); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentidentity_v1_internal +} // namespace cloud +} // namespace google diff --git a/google/cloud/agentidentity/v1/internal/auth_provider_connection_impl.h b/google/cloud/agentidentity/v1/internal/auth_provider_connection_impl.h new file mode 100644 index 0000000000000..a0c6630d4c2c0 --- /dev/null +++ b/google/cloud/agentidentity/v1/internal/auth_provider_connection_impl.h @@ -0,0 +1,143 @@ +// Copyright 2026 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 by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/cloud/agentidentity/v1/auth_provider_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_CONNECTION_IMPL_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_CONNECTION_IMPL_H + +#include "google/cloud/agentidentity/v1/auth_provider_connection.h" +#include "google/cloud/agentidentity/v1/auth_provider_connection_idempotency_policy.h" +#include "google/cloud/agentidentity/v1/auth_provider_options.h" +#include "google/cloud/agentidentity/v1/internal/auth_provider_retry_traits.h" +#include "google/cloud/agentidentity/v1/internal/auth_provider_stub.h" +#include "google/cloud/background_threads.h" +#include "google/cloud/backoff_policy.h" +#include "google/cloud/options.h" +#include "google/cloud/status_or.h" +#include "google/cloud/stream_range.h" +#include "google/cloud/version.h" +#include + +namespace google { +namespace cloud { +namespace agentidentity_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class AuthProviderServiceConnectionImpl + : public agentidentity_v1::AuthProviderServiceConnection { + public: + ~AuthProviderServiceConnectionImpl() override = default; + + AuthProviderServiceConnectionImpl( + std::unique_ptr background, + std::shared_ptr stub, + Options options); + + Options options() override { return options_; } + + StreamRange ListAuthProviders( + google::cloud::agentidentity::v1::ListAuthProvidersRequest request) + override; + + StatusOr GetAuthProvider( + google::cloud::agentidentity::v1::GetAuthProviderRequest const& request) + override; + + StatusOr CreateAuthProvider( + google::cloud::agentidentity::v1::CreateAuthProviderRequest const& + request) override; + + StatusOr UpdateAuthProvider( + google::cloud::agentidentity::v1::UpdateAuthProviderRequest const& + request) override; + + Status DeleteAuthProvider( + google::cloud::agentidentity::v1::DeleteAuthProviderRequest const& + request) override; + + StatusOr UndeleteAuthProvider( + google::cloud::agentidentity::v1::UndeleteAuthProviderRequest const& + request) override; + + StreamRange QueryAuthProviders( + google::cloud::agentidentity::v1::QueryAuthProvidersRequest request) + override; + + StreamRange QueryWorkloads( + google::cloud::agentidentity::v1::QueryWorkloadsRequest request) override; + + StreamRange + ListAuthorizations(google::cloud::agentidentity::v1::ListAuthorizationsRequest + request) override; + + StatusOr GetAuthorization( + google::cloud::agentidentity::v1::GetAuthorizationRequest const& request) + override; + + Status DeleteAuthorization( + google::cloud::agentidentity::v1::DeleteAuthorizationRequest const& + request) override; + + StreamRange + ListAccessSummaries( + google::cloud::agentidentity::v1::ListAccessSummariesRequest request) + override; + + StatusOr GetAccessSummary( + google::cloud::agentidentity::v1::GetAccessSummaryRequest const& request) + override; + + StatusOr + RevokeAuthorization( + google::cloud::agentidentity::v1::RevokeAuthorizationRequest const& + request) override; + + StatusOr EnableAuthProvider( + google::cloud::agentidentity::v1::EnableAuthProviderRequest const& + request) override; + + StatusOr DisableAuthProvider( + google::cloud::agentidentity::v1::DisableAuthProviderRequest const& + request) override; + + StreamRange ListLocations( + google::cloud::location::ListLocationsRequest request) override; + + StatusOr GetLocation( + google::cloud::location::GetLocationRequest const& request) override; + + StatusOr SetIamPolicy( + google::iam::v1::SetIamPolicyRequest const& request) override; + + StatusOr GetIamPolicy( + google::iam::v1::GetIamPolicyRequest const& request) override; + + StatusOr TestIamPermissions( + google::iam::v1::TestIamPermissionsRequest const& request) override; + + private: + std::unique_ptr background_; + std::shared_ptr stub_; + Options options_; +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentidentity_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_CONNECTION_IMPL_H diff --git a/google/cloud/agentidentity/v1/internal/auth_provider_logging_decorator.cc b/google/cloud/agentidentity/v1/internal/auth_provider_logging_decorator.cc new file mode 100644 index 0000000000000..cf28bbdf9d006 --- /dev/null +++ b/google/cloud/agentidentity/v1/internal/auth_provider_logging_decorator.cc @@ -0,0 +1,322 @@ +// Copyright 2026 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 by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/cloud/agentidentity/v1/auth_provider_service.proto + +#include "google/cloud/agentidentity/v1/internal/auth_provider_logging_decorator.h" +#include "google/cloud/agentidentity/v1/auth_provider_service.grpc.pb.h" +#include "google/cloud/internal/log_wrapper.h" +#include "google/cloud/status_or.h" +#include +#include +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace agentidentity_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +AuthProviderServiceLogging::AuthProviderServiceLogging( + std::shared_ptr child, + TracingOptions tracing_options, std::set const&) + : child_(std::move(child)), tracing_options_(std::move(tracing_options)) {} + +StatusOr +AuthProviderServiceLogging::ListAuthProviders( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAuthProvidersRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAuthProvidersRequest const& + request) { + return child_->ListAuthProviders(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +AuthProviderServiceLogging::GetAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAuthProviderRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAuthProviderRequest const& + request) { + return child_->GetAuthProvider(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +AuthProviderServiceLogging::CreateAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::CreateAuthProviderRequest const& + request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::CreateAuthProviderRequest const& + request) { + return child_->CreateAuthProvider(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +AuthProviderServiceLogging::UpdateAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::UpdateAuthProviderRequest const& + request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::UpdateAuthProviderRequest const& + request) { + return child_->UpdateAuthProvider(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +Status AuthProviderServiceLogging::DeleteAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DeleteAuthProviderRequest const& + request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DeleteAuthProviderRequest const& + request) { + return child_->DeleteAuthProvider(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +AuthProviderServiceLogging::UndeleteAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::UndeleteAuthProviderRequest const& + request) { + return google::cloud::internal::LogWrapper( + [this]( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::UndeleteAuthProviderRequest const& + request) { + return child_->UndeleteAuthProvider(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +AuthProviderServiceLogging::QueryAuthProviders( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::QueryAuthProvidersRequest const& + request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::QueryAuthProvidersRequest const& + request) { + return child_->QueryAuthProviders(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +AuthProviderServiceLogging::QueryWorkloads( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::QueryWorkloadsRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::QueryWorkloadsRequest const& + request) { + return child_->QueryWorkloads(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +AuthProviderServiceLogging::ListAuthorizations( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAuthorizationsRequest const& + request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAuthorizationsRequest const& + request) { + return child_->ListAuthorizations(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +AuthProviderServiceLogging::GetAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAuthorizationRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAuthorizationRequest const& + request) { + return child_->GetAuthorization(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +Status AuthProviderServiceLogging::DeleteAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DeleteAuthorizationRequest const& + request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DeleteAuthorizationRequest const& + request) { + return child_->DeleteAuthorization(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +AuthProviderServiceLogging::ListAccessSummaries( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAccessSummariesRequest const& + request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAccessSummariesRequest const& + request) { + return child_->ListAccessSummaries(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +AuthProviderServiceLogging::GetAccessSummary( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAccessSummaryRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAccessSummaryRequest const& + request) { + return child_->GetAccessSummary(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +AuthProviderServiceLogging::RevokeAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::RevokeAuthorizationRequest const& + request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::RevokeAuthorizationRequest const& + request) { + return child_->RevokeAuthorization(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +AuthProviderServiceLogging::EnableAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::EnableAuthProviderRequest const& + request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::EnableAuthProviderRequest const& + request) { + return child_->EnableAuthProvider(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +AuthProviderServiceLogging::DisableAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DisableAuthProviderRequest const& + request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DisableAuthProviderRequest const& + request) { + return child_->DisableAuthProvider(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +AuthProviderServiceLogging::ListLocations( + grpc::ClientContext& context, Options const& options, + google::cloud::location::ListLocationsRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::location::ListLocationsRequest const& request) { + return child_->ListLocations(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +AuthProviderServiceLogging::GetLocation( + grpc::ClientContext& context, Options const& options, + google::cloud::location::GetLocationRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::location::GetLocationRequest const& request) { + return child_->GetLocation(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr AuthProviderServiceLogging::SetIamPolicy( + grpc::ClientContext& context, Options const& options, + google::iam::v1::SetIamPolicyRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::iam::v1::SetIamPolicyRequest const& request) { + return child_->SetIamPolicy(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr AuthProviderServiceLogging::GetIamPolicy( + grpc::ClientContext& context, Options const& options, + google::iam::v1::GetIamPolicyRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::iam::v1::GetIamPolicyRequest const& request) { + return child_->GetIamPolicy(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +AuthProviderServiceLogging::TestIamPermissions( + grpc::ClientContext& context, Options const& options, + google::iam::v1::TestIamPermissionsRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::iam::v1::TestIamPermissionsRequest const& request) { + return child_->TestIamPermissions(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentidentity_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" diff --git a/google/cloud/agentidentity/v1/internal/auth_provider_logging_decorator.h b/google/cloud/agentidentity/v1/internal/auth_provider_logging_decorator.h new file mode 100644 index 0000000000000..fe6869655032a --- /dev/null +++ b/google/cloud/agentidentity/v1/internal/auth_provider_logging_decorator.h @@ -0,0 +1,161 @@ +// Copyright 2026 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 by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/cloud/agentidentity/v1/auth_provider_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_LOGGING_DECORATOR_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_LOGGING_DECORATOR_H + +#include "google/cloud/agentidentity/v1/internal/auth_provider_stub.h" +#include "google/cloud/tracing_options.h" +#include "google/cloud/version.h" +#include +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace agentidentity_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class AuthProviderServiceLogging : public AuthProviderServiceStub { + public: + ~AuthProviderServiceLogging() override = default; + AuthProviderServiceLogging(std::shared_ptr child, + TracingOptions tracing_options, + std::set const& components); + + StatusOr + ListAuthProviders( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAuthProvidersRequest const& request) + override; + + StatusOr GetAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAuthProviderRequest const& request) + override; + + StatusOr CreateAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::CreateAuthProviderRequest const& + request) override; + + StatusOr UpdateAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::UpdateAuthProviderRequest const& + request) override; + + Status DeleteAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DeleteAuthProviderRequest const& + request) override; + + StatusOr UndeleteAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::UndeleteAuthProviderRequest const& + request) override; + + StatusOr + QueryAuthProviders( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::QueryAuthProvidersRequest const& + request) override; + + StatusOr + QueryWorkloads(grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::QueryWorkloadsRequest const& + request) override; + + StatusOr + ListAuthorizations( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAuthorizationsRequest const& + request) override; + + StatusOr GetAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAuthorizationRequest const& request) + override; + + Status DeleteAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DeleteAuthorizationRequest const& + request) override; + + StatusOr + ListAccessSummaries( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAccessSummariesRequest const& + request) override; + + StatusOr GetAccessSummary( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAccessSummaryRequest const& request) + override; + + StatusOr + RevokeAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::RevokeAuthorizationRequest const& + request) override; + + StatusOr EnableAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::EnableAuthProviderRequest const& + request) override; + + StatusOr DisableAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DisableAuthProviderRequest const& + request) override; + + StatusOr ListLocations( + grpc::ClientContext& context, Options const& options, + google::cloud::location::ListLocationsRequest const& request) override; + + StatusOr GetLocation( + grpc::ClientContext& context, Options const& options, + google::cloud::location::GetLocationRequest const& request) override; + + StatusOr SetIamPolicy( + grpc::ClientContext& context, Options const& options, + google::iam::v1::SetIamPolicyRequest const& request) override; + + StatusOr GetIamPolicy( + grpc::ClientContext& context, Options const& options, + google::iam::v1::GetIamPolicyRequest const& request) override; + + StatusOr TestIamPermissions( + grpc::ClientContext& context, Options const& options, + google::iam::v1::TestIamPermissionsRequest const& request) override; + + private: + std::shared_ptr child_; + TracingOptions tracing_options_; +}; // AuthProviderServiceLogging + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentidentity_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_LOGGING_DECORATOR_H diff --git a/google/cloud/agentidentity/v1/internal/auth_provider_metadata_decorator.cc b/google/cloud/agentidentity/v1/internal/auth_provider_metadata_decorator.cc new file mode 100644 index 0000000000000..aa162f667b675 --- /dev/null +++ b/google/cloud/agentidentity/v1/internal/auth_provider_metadata_decorator.cc @@ -0,0 +1,270 @@ +// Copyright 2026 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 by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/cloud/agentidentity/v1/auth_provider_service.proto + +#include "google/cloud/agentidentity/v1/internal/auth_provider_metadata_decorator.h" +#include "google/cloud/agentidentity/v1/auth_provider_service.grpc.pb.h" +#include "google/cloud/grpc_options.h" +#include "google/cloud/internal/api_client_header.h" +#include "google/cloud/internal/url_encode.h" +#include "google/cloud/status_or.h" +#include "absl/strings/str_cat.h" +#include "absl/strings/str_join.h" +#include +#include +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace agentidentity_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +AuthProviderServiceMetadata::AuthProviderServiceMetadata( + std::shared_ptr child, + std::multimap fixed_metadata, + std::string api_client_header) + : child_(std::move(child)), + fixed_metadata_(std::move(fixed_metadata)), + api_client_header_( + api_client_header.empty() + ? google::cloud::internal::GeneratedLibClientHeader() + : std::move(api_client_header)) {} + +StatusOr +AuthProviderServiceMetadata::ListAuthProviders( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAuthProvidersRequest const& request) { + SetMetadata(context, options, + absl::StrCat("parent=", internal::UrlEncode(request.parent()))); + return child_->ListAuthProviders(context, options, request); +} + +StatusOr +AuthProviderServiceMetadata::GetAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAuthProviderRequest const& request) { + SetMetadata(context, options, + absl::StrCat("name=", internal::UrlEncode(request.name()))); + return child_->GetAuthProvider(context, options, request); +} + +StatusOr +AuthProviderServiceMetadata::CreateAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::CreateAuthProviderRequest const& + request) { + SetMetadata(context, options, + absl::StrCat("parent=", internal::UrlEncode(request.parent()))); + return child_->CreateAuthProvider(context, options, request); +} + +StatusOr +AuthProviderServiceMetadata::UpdateAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::UpdateAuthProviderRequest const& + request) { + SetMetadata( + context, options, + absl::StrCat("auth_provider.name=", + internal::UrlEncode(request.auth_provider().name()))); + return child_->UpdateAuthProvider(context, options, request); +} + +Status AuthProviderServiceMetadata::DeleteAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DeleteAuthProviderRequest const& + request) { + SetMetadata(context, options, + absl::StrCat("name=", internal::UrlEncode(request.name()))); + return child_->DeleteAuthProvider(context, options, request); +} + +StatusOr +AuthProviderServiceMetadata::UndeleteAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::UndeleteAuthProviderRequest const& + request) { + SetMetadata(context, options, + absl::StrCat("name=", internal::UrlEncode(request.name()))); + return child_->UndeleteAuthProvider(context, options, request); +} + +StatusOr +AuthProviderServiceMetadata::QueryAuthProviders( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::QueryAuthProvidersRequest const& + request) { + SetMetadata(context, options, + absl::StrCat("parent=", internal::UrlEncode(request.parent()))); + return child_->QueryAuthProviders(context, options, request); +} + +StatusOr +AuthProviderServiceMetadata::QueryWorkloads( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::QueryWorkloadsRequest const& request) { + SetMetadata(context, options, + absl::StrCat("name=", internal::UrlEncode(request.name()))); + return child_->QueryWorkloads(context, options, request); +} + +StatusOr +AuthProviderServiceMetadata::ListAuthorizations( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAuthorizationsRequest const& + request) { + SetMetadata(context, options, + absl::StrCat("parent=", internal::UrlEncode(request.parent()))); + return child_->ListAuthorizations(context, options, request); +} + +StatusOr +AuthProviderServiceMetadata::GetAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAuthorizationRequest const& request) { + SetMetadata(context, options, + absl::StrCat("name=", internal::UrlEncode(request.name()))); + return child_->GetAuthorization(context, options, request); +} + +Status AuthProviderServiceMetadata::DeleteAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DeleteAuthorizationRequest const& + request) { + SetMetadata(context, options, + absl::StrCat("name=", internal::UrlEncode(request.name()))); + return child_->DeleteAuthorization(context, options, request); +} + +StatusOr +AuthProviderServiceMetadata::ListAccessSummaries( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAccessSummariesRequest const& + request) { + SetMetadata(context, options, + absl::StrCat("parent=", internal::UrlEncode(request.parent()))); + return child_->ListAccessSummaries(context, options, request); +} + +StatusOr +AuthProviderServiceMetadata::GetAccessSummary( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAccessSummaryRequest const& request) { + SetMetadata(context, options, + absl::StrCat("name=", internal::UrlEncode(request.name()))); + return child_->GetAccessSummary(context, options, request); +} + +StatusOr +AuthProviderServiceMetadata::RevokeAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::RevokeAuthorizationRequest const& + request) { + SetMetadata(context, options, + absl::StrCat("name=", internal::UrlEncode(request.name()))); + return child_->RevokeAuthorization(context, options, request); +} + +StatusOr +AuthProviderServiceMetadata::EnableAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::EnableAuthProviderRequest const& + request) { + SetMetadata(context, options, + absl::StrCat("name=", internal::UrlEncode(request.name()))); + return child_->EnableAuthProvider(context, options, request); +} + +StatusOr +AuthProviderServiceMetadata::DisableAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DisableAuthProviderRequest const& + request) { + SetMetadata(context, options, + absl::StrCat("name=", internal::UrlEncode(request.name()))); + return child_->DisableAuthProvider(context, options, request); +} + +StatusOr +AuthProviderServiceMetadata::ListLocations( + grpc::ClientContext& context, Options const& options, + google::cloud::location::ListLocationsRequest const& request) { + SetMetadata(context, options, + absl::StrCat("name=", internal::UrlEncode(request.name()))); + return child_->ListLocations(context, options, request); +} + +StatusOr +AuthProviderServiceMetadata::GetLocation( + grpc::ClientContext& context, Options const& options, + google::cloud::location::GetLocationRequest const& request) { + SetMetadata(context, options, + absl::StrCat("name=", internal::UrlEncode(request.name()))); + return child_->GetLocation(context, options, request); +} + +StatusOr AuthProviderServiceMetadata::SetIamPolicy( + grpc::ClientContext& context, Options const& options, + google::iam::v1::SetIamPolicyRequest const& request) { + SetMetadata( + context, options, + absl::StrCat("resource=", internal::UrlEncode(request.resource()))); + return child_->SetIamPolicy(context, options, request); +} + +StatusOr AuthProviderServiceMetadata::GetIamPolicy( + grpc::ClientContext& context, Options const& options, + google::iam::v1::GetIamPolicyRequest const& request) { + SetMetadata( + context, options, + absl::StrCat("resource=", internal::UrlEncode(request.resource()))); + return child_->GetIamPolicy(context, options, request); +} + +StatusOr +AuthProviderServiceMetadata::TestIamPermissions( + grpc::ClientContext& context, Options const& options, + google::iam::v1::TestIamPermissionsRequest const& request) { + SetMetadata( + context, options, + absl::StrCat("resource=", internal::UrlEncode(request.resource()))); + return child_->TestIamPermissions(context, options, request); +} + +void AuthProviderServiceMetadata::SetMetadata( + grpc::ClientContext& context, Options const& options, + std::string const& request_params) { + context.AddMetadata("x-goog-request-params", request_params); + SetMetadata(context, options); +} + +void AuthProviderServiceMetadata::SetMetadata(grpc::ClientContext& context, + Options const& options) { + google::cloud::internal::SetMetadata(context, options, fixed_metadata_, + api_client_header_); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentidentity_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" diff --git a/google/cloud/agentidentity/v1/internal/auth_provider_metadata_decorator.h b/google/cloud/agentidentity/v1/internal/auth_provider_metadata_decorator.h new file mode 100644 index 0000000000000..f79c19cfe0936 --- /dev/null +++ b/google/cloud/agentidentity/v1/internal/auth_provider_metadata_decorator.h @@ -0,0 +1,167 @@ +// Copyright 2026 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 by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/cloud/agentidentity/v1/auth_provider_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_METADATA_DECORATOR_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_METADATA_DECORATOR_H + +#include "google/cloud/agentidentity/v1/internal/auth_provider_stub.h" +#include "google/cloud/options.h" +#include "google/cloud/version.h" +#include +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace agentidentity_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class AuthProviderServiceMetadata : public AuthProviderServiceStub { + public: + ~AuthProviderServiceMetadata() override = default; + AuthProviderServiceMetadata( + std::shared_ptr child, + std::multimap fixed_metadata, + std::string api_client_header = ""); + + StatusOr + ListAuthProviders( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAuthProvidersRequest const& request) + override; + + StatusOr GetAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAuthProviderRequest const& request) + override; + + StatusOr CreateAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::CreateAuthProviderRequest const& + request) override; + + StatusOr UpdateAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::UpdateAuthProviderRequest const& + request) override; + + Status DeleteAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DeleteAuthProviderRequest const& + request) override; + + StatusOr UndeleteAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::UndeleteAuthProviderRequest const& + request) override; + + StatusOr + QueryAuthProviders( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::QueryAuthProvidersRequest const& + request) override; + + StatusOr + QueryWorkloads(grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::QueryWorkloadsRequest const& + request) override; + + StatusOr + ListAuthorizations( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAuthorizationsRequest const& + request) override; + + StatusOr GetAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAuthorizationRequest const& request) + override; + + Status DeleteAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DeleteAuthorizationRequest const& + request) override; + + StatusOr + ListAccessSummaries( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAccessSummariesRequest const& + request) override; + + StatusOr GetAccessSummary( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAccessSummaryRequest const& request) + override; + + StatusOr + RevokeAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::RevokeAuthorizationRequest const& + request) override; + + StatusOr EnableAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::EnableAuthProviderRequest const& + request) override; + + StatusOr DisableAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DisableAuthProviderRequest const& + request) override; + + StatusOr ListLocations( + grpc::ClientContext& context, Options const& options, + google::cloud::location::ListLocationsRequest const& request) override; + + StatusOr GetLocation( + grpc::ClientContext& context, Options const& options, + google::cloud::location::GetLocationRequest const& request) override; + + StatusOr SetIamPolicy( + grpc::ClientContext& context, Options const& options, + google::iam::v1::SetIamPolicyRequest const& request) override; + + StatusOr GetIamPolicy( + grpc::ClientContext& context, Options const& options, + google::iam::v1::GetIamPolicyRequest const& request) override; + + StatusOr TestIamPermissions( + grpc::ClientContext& context, Options const& options, + google::iam::v1::TestIamPermissionsRequest const& request) override; + + private: + void SetMetadata(grpc::ClientContext& context, Options const& options, + std::string const& request_params); + void SetMetadata(grpc::ClientContext& context, Options const& options); + + std::shared_ptr child_; + std::multimap fixed_metadata_; + std::string api_client_header_; +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentidentity_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_METADATA_DECORATOR_H diff --git a/google/cloud/agentidentity/v1/internal/auth_provider_option_defaults.cc b/google/cloud/agentidentity/v1/internal/auth_provider_option_defaults.cc new file mode 100644 index 0000000000000..928e71943b178 --- /dev/null +++ b/google/cloud/agentidentity/v1/internal/auth_provider_option_defaults.cc @@ -0,0 +1,71 @@ +// Copyright 2026 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 by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/cloud/agentidentity/v1/auth_provider_service.proto + +#include "google/cloud/agentidentity/v1/internal/auth_provider_option_defaults.h" +#include "google/cloud/agentidentity/v1/auth_provider_connection.h" +#include "google/cloud/agentidentity/v1/auth_provider_options.h" +#include "google/cloud/internal/populate_common_options.h" +#include "google/cloud/internal/populate_grpc_options.h" +#include +#include + +namespace google { +namespace cloud { +namespace agentidentity_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +namespace { +auto constexpr kBackoffScaling = 2.0; +} // namespace + +Options AuthProviderServiceDefaultOptions(Options options) { + options = internal::PopulateCommonOptions( + std::move(options), "GOOGLE_CLOUD_CPP_AUTH_PROVIDER_SERVICE_ENDPOINT", "", + "GOOGLE_CLOUD_CPP_AUTH_PROVIDER_SERVICE_AUTHORITY", + "agentidentity.googleapis.com"); + options = internal::PopulateGrpcOptions(std::move(options)); + if (!options.has()) { + options.set( + agentidentity_v1::AuthProviderServiceLimitedTimeRetryPolicy( + std::chrono::minutes(10)) + .clone()); + } + if (!options + .has()) { + options.set( + ExponentialBackoffPolicy( + std::chrono::seconds(0), std::chrono::seconds(1), + std::chrono::minutes(5), kBackoffScaling, kBackoffScaling) + .clone()); + } + if (!options + .has()) { + options.set< + agentidentity_v1::AuthProviderServiceConnectionIdempotencyPolicyOption>( + agentidentity_v1:: + MakeDefaultAuthProviderServiceConnectionIdempotencyPolicy()); + } + + return options; +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentidentity_v1_internal +} // namespace cloud +} // namespace google diff --git a/google/cloud/agentidentity/v1/internal/auth_provider_option_defaults.h b/google/cloud/agentidentity/v1/internal/auth_provider_option_defaults.h new file mode 100644 index 0000000000000..940bb29fcc302 --- /dev/null +++ b/google/cloud/agentidentity/v1/internal/auth_provider_option_defaults.h @@ -0,0 +1,37 @@ +// Copyright 2026 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 by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/cloud/agentidentity/v1/auth_provider_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_OPTION_DEFAULTS_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_OPTION_DEFAULTS_H + +#include "google/cloud/options.h" +#include "google/cloud/version.h" + +namespace google { +namespace cloud { +namespace agentidentity_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +Options AuthProviderServiceDefaultOptions(Options options); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentidentity_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_OPTION_DEFAULTS_H diff --git a/google/cloud/agentidentity/v1/internal/auth_provider_retry_traits.h b/google/cloud/agentidentity/v1/internal/auth_provider_retry_traits.h new file mode 100644 index 0000000000000..12d21117d71e0 --- /dev/null +++ b/google/cloud/agentidentity/v1/internal/auth_provider_retry_traits.h @@ -0,0 +1,43 @@ +// Copyright 2026 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 by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/cloud/agentidentity/v1/auth_provider_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_RETRY_TRAITS_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_RETRY_TRAITS_H + +#include "google/cloud/status.h" +#include "google/cloud/version.h" + +namespace google { +namespace cloud { +namespace agentidentity_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +/// Define the gRPC status code semantics for retrying requests. +struct AuthProviderServiceRetryTraits { + static bool IsPermanentFailure(google::cloud::Status const& status) { + return status.code() != StatusCode::kOk && + status.code() != StatusCode::kUnavailable; + } +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentidentity_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_RETRY_TRAITS_H diff --git a/google/cloud/agentidentity/v1/internal/auth_provider_sources.cc b/google/cloud/agentidentity/v1/internal/auth_provider_sources.cc new file mode 100644 index 0000000000000..b171d0d42e43f --- /dev/null +++ b/google/cloud/agentidentity/v1/internal/auth_provider_sources.cc @@ -0,0 +1,32 @@ +// Copyright 2026 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 by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/cloud/agentidentity/v1/auth_provider_service.proto + +// NOLINTBEGIN(bugprone-suspicious-include) +#include "google/cloud/agentidentity/v1/auth_provider_client.cc" +#include "google/cloud/agentidentity/v1/auth_provider_connection.cc" +#include "google/cloud/agentidentity/v1/auth_provider_connection_idempotency_policy.cc" +#include "google/cloud/agentidentity/v1/internal/auth_provider_auth_decorator.cc" +#include "google/cloud/agentidentity/v1/internal/auth_provider_connection_impl.cc" +#include "google/cloud/agentidentity/v1/internal/auth_provider_logging_decorator.cc" +#include "google/cloud/agentidentity/v1/internal/auth_provider_metadata_decorator.cc" +#include "google/cloud/agentidentity/v1/internal/auth_provider_option_defaults.cc" +#include "google/cloud/agentidentity/v1/internal/auth_provider_stub.cc" +#include "google/cloud/agentidentity/v1/internal/auth_provider_stub_factory.cc" +#include "google/cloud/agentidentity/v1/internal/auth_provider_tracing_connection.cc" +#include "google/cloud/agentidentity/v1/internal/auth_provider_tracing_stub.cc" +// NOLINTEND(bugprone-suspicious-include) diff --git a/google/cloud/agentidentity/v1/internal/auth_provider_stub.cc b/google/cloud/agentidentity/v1/internal/auth_provider_stub.cc new file mode 100644 index 0000000000000..f9906c862ca79 --- /dev/null +++ b/google/cloud/agentidentity/v1/internal/auth_provider_stub.cc @@ -0,0 +1,301 @@ +// Copyright 2026 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 by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/cloud/agentidentity/v1/auth_provider_service.proto + +#include "google/cloud/agentidentity/v1/internal/auth_provider_stub.h" +#include "google/cloud/agentidentity/v1/auth_provider_service.grpc.pb.h" +#include "google/cloud/grpc_error_delegate.h" +#include "google/cloud/status_or.h" +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace agentidentity_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +AuthProviderServiceStub::~AuthProviderServiceStub() = default; + +StatusOr +DefaultAuthProviderServiceStub::ListAuthProviders( + grpc::ClientContext& context, Options const&, + google::cloud::agentidentity::v1::ListAuthProvidersRequest const& request) { + google::cloud::agentidentity::v1::ListAuthProvidersResponse response; + auto status = grpc_stub_->ListAuthProviders(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultAuthProviderServiceStub::GetAuthProvider( + grpc::ClientContext& context, Options const&, + google::cloud::agentidentity::v1::GetAuthProviderRequest const& request) { + google::cloud::agentidentity::v1::AuthProvider response; + auto status = grpc_stub_->GetAuthProvider(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultAuthProviderServiceStub::CreateAuthProvider( + grpc::ClientContext& context, Options const&, + google::cloud::agentidentity::v1::CreateAuthProviderRequest const& + request) { + google::cloud::agentidentity::v1::AuthProvider response; + auto status = grpc_stub_->CreateAuthProvider(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultAuthProviderServiceStub::UpdateAuthProvider( + grpc::ClientContext& context, Options const&, + google::cloud::agentidentity::v1::UpdateAuthProviderRequest const& + request) { + google::cloud::agentidentity::v1::AuthProvider response; + auto status = grpc_stub_->UpdateAuthProvider(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +Status DefaultAuthProviderServiceStub::DeleteAuthProvider( + grpc::ClientContext& context, Options const&, + google::cloud::agentidentity::v1::DeleteAuthProviderRequest const& + request) { + google::protobuf::Empty response; + auto status = grpc_stub_->DeleteAuthProvider(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return google::cloud::Status(); +} + +StatusOr +DefaultAuthProviderServiceStub::UndeleteAuthProvider( + grpc::ClientContext& context, Options const&, + google::cloud::agentidentity::v1::UndeleteAuthProviderRequest const& + request) { + google::cloud::agentidentity::v1::AuthProvider response; + auto status = grpc_stub_->UndeleteAuthProvider(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultAuthProviderServiceStub::QueryAuthProviders( + grpc::ClientContext& context, Options const&, + google::cloud::agentidentity::v1::QueryAuthProvidersRequest const& + request) { + google::cloud::agentidentity::v1::QueryAuthProvidersResponse response; + auto status = grpc_stub_->QueryAuthProviders(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultAuthProviderServiceStub::QueryWorkloads( + grpc::ClientContext& context, Options const&, + google::cloud::agentidentity::v1::QueryWorkloadsRequest const& request) { + google::cloud::agentidentity::v1::QueryWorkloadsResponse response; + auto status = grpc_stub_->QueryWorkloads(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultAuthProviderServiceStub::ListAuthorizations( + grpc::ClientContext& context, Options const&, + google::cloud::agentidentity::v1::ListAuthorizationsRequest const& + request) { + google::cloud::agentidentity::v1::ListAuthorizationsResponse response; + auto status = grpc_stub_->ListAuthorizations(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultAuthProviderServiceStub::GetAuthorization( + grpc::ClientContext& context, Options const&, + google::cloud::agentidentity::v1::GetAuthorizationRequest const& request) { + google::cloud::agentidentity::v1::Authorization response; + auto status = grpc_stub_->GetAuthorization(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +Status DefaultAuthProviderServiceStub::DeleteAuthorization( + grpc::ClientContext& context, Options const&, + google::cloud::agentidentity::v1::DeleteAuthorizationRequest const& + request) { + google::protobuf::Empty response; + auto status = grpc_stub_->DeleteAuthorization(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return google::cloud::Status(); +} + +StatusOr +DefaultAuthProviderServiceStub::ListAccessSummaries( + grpc::ClientContext& context, Options const&, + google::cloud::agentidentity::v1::ListAccessSummariesRequest const& + request) { + google::cloud::agentidentity::v1::ListAccessSummariesResponse response; + auto status = grpc_stub_->ListAccessSummaries(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultAuthProviderServiceStub::GetAccessSummary( + grpc::ClientContext& context, Options const&, + google::cloud::agentidentity::v1::GetAccessSummaryRequest const& request) { + google::cloud::agentidentity::v1::AccessSummary response; + auto status = grpc_stub_->GetAccessSummary(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultAuthProviderServiceStub::RevokeAuthorization( + grpc::ClientContext& context, Options const&, + google::cloud::agentidentity::v1::RevokeAuthorizationRequest const& + request) { + google::cloud::agentidentity::v1::RevokeAuthorizationResponse response; + auto status = grpc_stub_->RevokeAuthorization(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultAuthProviderServiceStub::EnableAuthProvider( + grpc::ClientContext& context, Options const&, + google::cloud::agentidentity::v1::EnableAuthProviderRequest const& + request) { + google::cloud::agentidentity::v1::AuthProvider response; + auto status = grpc_stub_->EnableAuthProvider(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultAuthProviderServiceStub::DisableAuthProvider( + grpc::ClientContext& context, Options const&, + google::cloud::agentidentity::v1::DisableAuthProviderRequest const& + request) { + google::cloud::agentidentity::v1::AuthProvider response; + auto status = grpc_stub_->DisableAuthProvider(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultAuthProviderServiceStub::ListLocations( + grpc::ClientContext& context, Options const&, + google::cloud::location::ListLocationsRequest const& request) { + google::cloud::location::ListLocationsResponse response; + auto status = locations_stub_->ListLocations(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultAuthProviderServiceStub::GetLocation( + grpc::ClientContext& context, Options const&, + google::cloud::location::GetLocationRequest const& request) { + google::cloud::location::Location response; + auto status = locations_stub_->GetLocation(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr DefaultAuthProviderServiceStub::SetIamPolicy( + grpc::ClientContext& context, Options const&, + google::iam::v1::SetIamPolicyRequest const& request) { + google::iam::v1::Policy response; + auto status = iampolicy_stub_->SetIamPolicy(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr DefaultAuthProviderServiceStub::GetIamPolicy( + grpc::ClientContext& context, Options const&, + google::iam::v1::GetIamPolicyRequest const& request) { + google::iam::v1::Policy response; + auto status = iampolicy_stub_->GetIamPolicy(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultAuthProviderServiceStub::TestIamPermissions( + grpc::ClientContext& context, Options const&, + google::iam::v1::TestIamPermissionsRequest const& request) { + google::iam::v1::TestIamPermissionsResponse response; + auto status = + iampolicy_stub_->TestIamPermissions(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentidentity_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" diff --git a/google/cloud/agentidentity/v1/internal/auth_provider_stub.h b/google/cloud/agentidentity/v1/internal/auth_provider_stub.h new file mode 100644 index 0000000000000..fce298a1eac99 --- /dev/null +++ b/google/cloud/agentidentity/v1/internal/auth_provider_stub.h @@ -0,0 +1,295 @@ +// Copyright 2026 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 by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/cloud/agentidentity/v1/auth_provider_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_STUB_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_STUB_H + +#include "google/cloud/agentidentity/v1/auth_provider_service.grpc.pb.h" +#include "google/cloud/location/locations.grpc.pb.h" +#include "google/cloud/options.h" +#include "google/cloud/status_or.h" +#include "google/cloud/version.h" +#include "google/iam/v1/iam_policy.grpc.pb.h" +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace agentidentity_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class AuthProviderServiceStub { + public: + virtual ~AuthProviderServiceStub() = 0; + + virtual StatusOr + ListAuthProviders( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAuthProvidersRequest const& + request) = 0; + + virtual StatusOr + GetAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAuthProviderRequest const& + request) = 0; + + virtual StatusOr + CreateAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::CreateAuthProviderRequest const& + request) = 0; + + virtual StatusOr + UpdateAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::UpdateAuthProviderRequest const& + request) = 0; + + virtual Status DeleteAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DeleteAuthProviderRequest const& + request) = 0; + + virtual StatusOr + UndeleteAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::UndeleteAuthProviderRequest const& + request) = 0; + + virtual StatusOr + QueryAuthProviders( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::QueryAuthProvidersRequest const& + request) = 0; + + virtual StatusOr + QueryWorkloads(grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::QueryWorkloadsRequest const& + request) = 0; + + virtual StatusOr + ListAuthorizations( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAuthorizationsRequest const& + request) = 0; + + virtual StatusOr + GetAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAuthorizationRequest const& + request) = 0; + + virtual Status DeleteAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DeleteAuthorizationRequest const& + request) = 0; + + virtual StatusOr< + google::cloud::agentidentity::v1::ListAccessSummariesResponse> + ListAccessSummaries( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAccessSummariesRequest const& + request) = 0; + + virtual StatusOr + GetAccessSummary( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAccessSummaryRequest const& + request) = 0; + + virtual StatusOr< + google::cloud::agentidentity::v1::RevokeAuthorizationResponse> + RevokeAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::RevokeAuthorizationRequest const& + request) = 0; + + virtual StatusOr + EnableAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::EnableAuthProviderRequest const& + request) = 0; + + virtual StatusOr + DisableAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DisableAuthProviderRequest const& + request) = 0; + + virtual StatusOr + ListLocations( + grpc::ClientContext& context, Options const& options, + google::cloud::location::ListLocationsRequest const& request) = 0; + + virtual StatusOr GetLocation( + grpc::ClientContext& context, Options const& options, + google::cloud::location::GetLocationRequest const& request) = 0; + + virtual StatusOr SetIamPolicy( + grpc::ClientContext& context, Options const& options, + google::iam::v1::SetIamPolicyRequest const& request) = 0; + + virtual StatusOr GetIamPolicy( + grpc::ClientContext& context, Options const& options, + google::iam::v1::GetIamPolicyRequest const& request) = 0; + + virtual StatusOr + TestIamPermissions( + grpc::ClientContext& context, Options const& options, + google::iam::v1::TestIamPermissionsRequest const& request) = 0; +}; + +class DefaultAuthProviderServiceStub : public AuthProviderServiceStub { + public: + explicit DefaultAuthProviderServiceStub( + std::unique_ptr< + google::cloud::agentidentity::v1::AuthProviderService::StubInterface> + grpc_stub, + std::unique_ptr iampolicy_stub, + std::unique_ptr + locations_stub) + : grpc_stub_(std::move(grpc_stub)), + iampolicy_stub_(std::move(iampolicy_stub)), + locations_stub_(std::move(locations_stub)) {} + + StatusOr + ListAuthProviders( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAuthProvidersRequest const& request) + override; + + StatusOr GetAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAuthProviderRequest const& request) + override; + + StatusOr CreateAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::CreateAuthProviderRequest const& + request) override; + + StatusOr UpdateAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::UpdateAuthProviderRequest const& + request) override; + + Status DeleteAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DeleteAuthProviderRequest const& + request) override; + + StatusOr UndeleteAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::UndeleteAuthProviderRequest const& + request) override; + + StatusOr + QueryAuthProviders( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::QueryAuthProvidersRequest const& + request) override; + + StatusOr + QueryWorkloads(grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::QueryWorkloadsRequest const& + request) override; + + StatusOr + ListAuthorizations( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAuthorizationsRequest const& + request) override; + + StatusOr GetAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAuthorizationRequest const& request) + override; + + Status DeleteAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DeleteAuthorizationRequest const& + request) override; + + StatusOr + ListAccessSummaries( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAccessSummariesRequest const& + request) override; + + StatusOr GetAccessSummary( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAccessSummaryRequest const& request) + override; + + StatusOr + RevokeAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::RevokeAuthorizationRequest const& + request) override; + + StatusOr EnableAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::EnableAuthProviderRequest const& + request) override; + + StatusOr DisableAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DisableAuthProviderRequest const& + request) override; + + StatusOr ListLocations( + grpc::ClientContext& context, Options const& options, + google::cloud::location::ListLocationsRequest const& request) override; + + StatusOr GetLocation( + grpc::ClientContext& context, Options const& options, + google::cloud::location::GetLocationRequest const& request) override; + + StatusOr SetIamPolicy( + grpc::ClientContext& context, Options const& options, + google::iam::v1::SetIamPolicyRequest const& request) override; + + StatusOr GetIamPolicy( + grpc::ClientContext& context, Options const& options, + google::iam::v1::GetIamPolicyRequest const& request) override; + + StatusOr TestIamPermissions( + grpc::ClientContext& context, Options const& options, + google::iam::v1::TestIamPermissionsRequest const& request) override; + + private: + std::unique_ptr< + google::cloud::agentidentity::v1::AuthProviderService::StubInterface> + grpc_stub_; + std::unique_ptr iampolicy_stub_; + std::unique_ptr + locations_stub_; +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentidentity_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_STUB_H diff --git a/google/cloud/agentidentity/v1/internal/auth_provider_stub_factory.cc b/google/cloud/agentidentity/v1/internal/auth_provider_stub_factory.cc new file mode 100644 index 0000000000000..5b9a85fca9719 --- /dev/null +++ b/google/cloud/agentidentity/v1/internal/auth_provider_stub_factory.cc @@ -0,0 +1,83 @@ +// Copyright 2026 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 by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/cloud/agentidentity/v1/auth_provider_service.proto + +#include "google/cloud/agentidentity/v1/internal/auth_provider_stub_factory.h" +#include "google/cloud/agentidentity/v1/auth_provider_service.grpc.pb.h" +#include "google/cloud/agentidentity/v1/internal/auth_provider_auth_decorator.h" +#include "google/cloud/agentidentity/v1/internal/auth_provider_logging_decorator.h" +#include "google/cloud/agentidentity/v1/internal/auth_provider_metadata_decorator.h" +#include "google/cloud/agentidentity/v1/internal/auth_provider_stub.h" +#include "google/cloud/agentidentity/v1/internal/auth_provider_tracing_stub.h" +#include "google/cloud/location/locations.grpc.pb.h" +#include "google/cloud/common_options.h" +#include "google/cloud/grpc_options.h" +#include "google/cloud/internal/algorithm.h" +#include "google/cloud/internal/opentelemetry.h" +#include "google/cloud/log.h" +#include "google/cloud/options.h" +#include "google/iam/v1/iam_policy.grpc.pb.h" +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace agentidentity_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +std::shared_ptr CreateDefaultAuthProviderServiceStub( + std::shared_ptr auth, + Options const& options) { + auto channel = auth->CreateChannel(options.get(), + internal::MakeChannelArguments(options)); + auto service_grpc_stub = + google::cloud::agentidentity::v1::AuthProviderService::NewStub(channel); + auto service_iampolicy_stub = google::iam::v1::IAMPolicy::NewStub(channel); + auto service_locations_stub = + google::cloud::location::Locations::NewStub(channel); + std::shared_ptr stub = + std::make_shared( + std::move(service_grpc_stub), std::move(service_iampolicy_stub), + std::move(service_locations_stub)); + + if (auth->RequiresConfigureContext()) { + stub = std::make_shared(std::move(auth), + std::move(stub)); + } + stub = std::make_shared( + std::move(stub), std::multimap{}); + if (internal::Contains(options.get(), "rpc")) { + GCP_LOG(INFO) << "Enabled logging for gRPC calls"; + stub = std::make_shared( + std::move(stub), options.get(), + options.get()); + } + if (internal::TracingEnabled(options)) { + stub = MakeAuthProviderServiceTracingStub(std::move(stub)); + } + return stub; +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentidentity_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" diff --git a/google/cloud/agentidentity/v1/internal/auth_provider_stub_factory.h b/google/cloud/agentidentity/v1/internal/auth_provider_stub_factory.h new file mode 100644 index 0000000000000..d20c1da9c67e8 --- /dev/null +++ b/google/cloud/agentidentity/v1/internal/auth_provider_stub_factory.h @@ -0,0 +1,47 @@ +// Copyright 2026 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 by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/cloud/agentidentity/v1/auth_provider_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_STUB_FACTORY_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_STUB_FACTORY_H + +#include "google/cloud/agentidentity/v1/internal/auth_provider_stub.h" +#include "google/cloud/internal/unified_grpc_credentials.h" +#include "google/cloud/options.h" +#include "google/cloud/version.h" +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace agentidentity_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +std::shared_ptr CreateDefaultAuthProviderServiceStub( + std::shared_ptr auth, + Options const& options); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentidentity_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_STUB_FACTORY_H diff --git a/google/cloud/agentidentity/v1/internal/auth_provider_tracing_connection.cc b/google/cloud/agentidentity/v1/internal/auth_provider_tracing_connection.cc new file mode 100644 index 0000000000000..9f672578a6283 --- /dev/null +++ b/google/cloud/agentidentity/v1/internal/auth_provider_tracing_connection.cc @@ -0,0 +1,256 @@ +// Copyright 2026 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 by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/cloud/agentidentity/v1/auth_provider_service.proto + +#include "google/cloud/agentidentity/v1/internal/auth_provider_tracing_connection.h" +#include "google/cloud/internal/opentelemetry.h" +#include "google/cloud/internal/traced_stream_range.h" +#include +#include + +namespace google { +namespace cloud { +namespace agentidentity_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +AuthProviderServiceTracingConnection::AuthProviderServiceTracingConnection( + std::shared_ptr child) + : child_(std::move(child)) {} + +StreamRange +AuthProviderServiceTracingConnection::ListAuthProviders( + google::cloud::agentidentity::v1::ListAuthProvidersRequest request) { + auto span = internal::MakeSpan( + "agentidentity_v1::AuthProviderServiceConnection::ListAuthProviders"); + internal::OTelScope scope(span); + auto sr = child_->ListAuthProviders(std::move(request)); + return internal::MakeTracedStreamRange< + google::cloud::agentidentity::v1::AuthProvider>(std::move(span), + std::move(sr)); +} + +StatusOr +AuthProviderServiceTracingConnection::GetAuthProvider( + google::cloud::agentidentity::v1::GetAuthProviderRequest const& request) { + auto span = internal::MakeSpan( + "agentidentity_v1::AuthProviderServiceConnection::GetAuthProvider"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->GetAuthProvider(request)); +} + +StatusOr +AuthProviderServiceTracingConnection::CreateAuthProvider( + google::cloud::agentidentity::v1::CreateAuthProviderRequest const& + request) { + auto span = internal::MakeSpan( + "agentidentity_v1::AuthProviderServiceConnection::CreateAuthProvider"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->CreateAuthProvider(request)); +} + +StatusOr +AuthProviderServiceTracingConnection::UpdateAuthProvider( + google::cloud::agentidentity::v1::UpdateAuthProviderRequest const& + request) { + auto span = internal::MakeSpan( + "agentidentity_v1::AuthProviderServiceConnection::UpdateAuthProvider"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->UpdateAuthProvider(request)); +} + +Status AuthProviderServiceTracingConnection::DeleteAuthProvider( + google::cloud::agentidentity::v1::DeleteAuthProviderRequest const& + request) { + auto span = internal::MakeSpan( + "agentidentity_v1::AuthProviderServiceConnection::DeleteAuthProvider"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->DeleteAuthProvider(request)); +} + +StatusOr +AuthProviderServiceTracingConnection::UndeleteAuthProvider( + google::cloud::agentidentity::v1::UndeleteAuthProviderRequest const& + request) { + auto span = internal::MakeSpan( + "agentidentity_v1::AuthProviderServiceConnection::UndeleteAuthProvider"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->UndeleteAuthProvider(request)); +} + +StreamRange +AuthProviderServiceTracingConnection::QueryAuthProviders( + google::cloud::agentidentity::v1::QueryAuthProvidersRequest request) { + auto span = internal::MakeSpan( + "agentidentity_v1::AuthProviderServiceConnection::QueryAuthProviders"); + internal::OTelScope scope(span); + auto sr = child_->QueryAuthProviders(std::move(request)); + return internal::MakeTracedStreamRange(std::move(span), + std::move(sr)); +} + +StreamRange AuthProviderServiceTracingConnection::QueryWorkloads( + google::cloud::agentidentity::v1::QueryWorkloadsRequest request) { + auto span = internal::MakeSpan( + "agentidentity_v1::AuthProviderServiceConnection::QueryWorkloads"); + internal::OTelScope scope(span); + auto sr = child_->QueryWorkloads(std::move(request)); + return internal::MakeTracedStreamRange(std::move(span), + std::move(sr)); +} + +StreamRange +AuthProviderServiceTracingConnection::ListAuthorizations( + google::cloud::agentidentity::v1::ListAuthorizationsRequest request) { + auto span = internal::MakeSpan( + "agentidentity_v1::AuthProviderServiceConnection::ListAuthorizations"); + internal::OTelScope scope(span); + auto sr = child_->ListAuthorizations(std::move(request)); + return internal::MakeTracedStreamRange< + google::cloud::agentidentity::v1::Authorization>(std::move(span), + std::move(sr)); +} + +StatusOr +AuthProviderServiceTracingConnection::GetAuthorization( + google::cloud::agentidentity::v1::GetAuthorizationRequest const& request) { + auto span = internal::MakeSpan( + "agentidentity_v1::AuthProviderServiceConnection::GetAuthorization"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->GetAuthorization(request)); +} + +Status AuthProviderServiceTracingConnection::DeleteAuthorization( + google::cloud::agentidentity::v1::DeleteAuthorizationRequest const& + request) { + auto span = internal::MakeSpan( + "agentidentity_v1::AuthProviderServiceConnection::DeleteAuthorization"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->DeleteAuthorization(request)); +} + +StreamRange +AuthProviderServiceTracingConnection::ListAccessSummaries( + google::cloud::agentidentity::v1::ListAccessSummariesRequest request) { + auto span = internal::MakeSpan( + "agentidentity_v1::AuthProviderServiceConnection::ListAccessSummaries"); + internal::OTelScope scope(span); + auto sr = child_->ListAccessSummaries(std::move(request)); + return internal::MakeTracedStreamRange< + google::cloud::agentidentity::v1::AccessSummary>(std::move(span), + std::move(sr)); +} + +StatusOr +AuthProviderServiceTracingConnection::GetAccessSummary( + google::cloud::agentidentity::v1::GetAccessSummaryRequest const& request) { + auto span = internal::MakeSpan( + "agentidentity_v1::AuthProviderServiceConnection::GetAccessSummary"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->GetAccessSummary(request)); +} + +StatusOr +AuthProviderServiceTracingConnection::RevokeAuthorization( + google::cloud::agentidentity::v1::RevokeAuthorizationRequest const& + request) { + auto span = internal::MakeSpan( + "agentidentity_v1::AuthProviderServiceConnection::RevokeAuthorization"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->RevokeAuthorization(request)); +} + +StatusOr +AuthProviderServiceTracingConnection::EnableAuthProvider( + google::cloud::agentidentity::v1::EnableAuthProviderRequest const& + request) { + auto span = internal::MakeSpan( + "agentidentity_v1::AuthProviderServiceConnection::EnableAuthProvider"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->EnableAuthProvider(request)); +} + +StatusOr +AuthProviderServiceTracingConnection::DisableAuthProvider( + google::cloud::agentidentity::v1::DisableAuthProviderRequest const& + request) { + auto span = internal::MakeSpan( + "agentidentity_v1::AuthProviderServiceConnection::DisableAuthProvider"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->DisableAuthProvider(request)); +} + +StreamRange +AuthProviderServiceTracingConnection::ListLocations( + google::cloud::location::ListLocationsRequest request) { + auto span = internal::MakeSpan( + "agentidentity_v1::AuthProviderServiceConnection::ListLocations"); + internal::OTelScope scope(span); + auto sr = child_->ListLocations(std::move(request)); + return internal::MakeTracedStreamRange( + std::move(span), std::move(sr)); +} + +StatusOr +AuthProviderServiceTracingConnection::GetLocation( + google::cloud::location::GetLocationRequest const& request) { + auto span = internal::MakeSpan( + "agentidentity_v1::AuthProviderServiceConnection::GetLocation"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->GetLocation(request)); +} + +StatusOr +AuthProviderServiceTracingConnection::SetIamPolicy( + google::iam::v1::SetIamPolicyRequest const& request) { + auto span = internal::MakeSpan( + "agentidentity_v1::AuthProviderServiceConnection::SetIamPolicy"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->SetIamPolicy(request)); +} + +StatusOr +AuthProviderServiceTracingConnection::GetIamPolicy( + google::iam::v1::GetIamPolicyRequest const& request) { + auto span = internal::MakeSpan( + "agentidentity_v1::AuthProviderServiceConnection::GetIamPolicy"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->GetIamPolicy(request)); +} + +StatusOr +AuthProviderServiceTracingConnection::TestIamPermissions( + google::iam::v1::TestIamPermissionsRequest const& request) { + auto span = internal::MakeSpan( + "agentidentity_v1::AuthProviderServiceConnection::TestIamPermissions"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->TestIamPermissions(request)); +} + +std::shared_ptr +MakeAuthProviderServiceTracingConnection( + std::shared_ptr conn) { + if (internal::TracingEnabled(conn->options())) { + conn = + std::make_shared(std::move(conn)); + } + return conn; +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentidentity_v1_internal +} // namespace cloud +} // namespace google diff --git a/google/cloud/agentidentity/v1/internal/auth_provider_tracing_connection.h b/google/cloud/agentidentity/v1/internal/auth_provider_tracing_connection.h new file mode 100644 index 0000000000000..9d924cda4da92 --- /dev/null +++ b/google/cloud/agentidentity/v1/internal/auth_provider_tracing_connection.h @@ -0,0 +1,140 @@ +// Copyright 2026 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 by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/cloud/agentidentity/v1/auth_provider_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_TRACING_CONNECTION_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_TRACING_CONNECTION_H + +#include "google/cloud/agentidentity/v1/auth_provider_connection.h" +#include "google/cloud/version.h" +#include + +namespace google { +namespace cloud { +namespace agentidentity_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class AuthProviderServiceTracingConnection + : public agentidentity_v1::AuthProviderServiceConnection { + public: + ~AuthProviderServiceTracingConnection() override = default; + + explicit AuthProviderServiceTracingConnection( + std::shared_ptr child); + + Options options() override { return child_->options(); } + + StreamRange ListAuthProviders( + google::cloud::agentidentity::v1::ListAuthProvidersRequest request) + override; + + StatusOr GetAuthProvider( + google::cloud::agentidentity::v1::GetAuthProviderRequest const& request) + override; + + StatusOr CreateAuthProvider( + google::cloud::agentidentity::v1::CreateAuthProviderRequest const& + request) override; + + StatusOr UpdateAuthProvider( + google::cloud::agentidentity::v1::UpdateAuthProviderRequest const& + request) override; + + Status DeleteAuthProvider( + google::cloud::agentidentity::v1::DeleteAuthProviderRequest const& + request) override; + + StatusOr UndeleteAuthProvider( + google::cloud::agentidentity::v1::UndeleteAuthProviderRequest const& + request) override; + + StreamRange QueryAuthProviders( + google::cloud::agentidentity::v1::QueryAuthProvidersRequest request) + override; + + StreamRange QueryWorkloads( + google::cloud::agentidentity::v1::QueryWorkloadsRequest request) override; + + StreamRange + ListAuthorizations(google::cloud::agentidentity::v1::ListAuthorizationsRequest + request) override; + + StatusOr GetAuthorization( + google::cloud::agentidentity::v1::GetAuthorizationRequest const& request) + override; + + Status DeleteAuthorization( + google::cloud::agentidentity::v1::DeleteAuthorizationRequest const& + request) override; + + StreamRange + ListAccessSummaries( + google::cloud::agentidentity::v1::ListAccessSummariesRequest request) + override; + + StatusOr GetAccessSummary( + google::cloud::agentidentity::v1::GetAccessSummaryRequest const& request) + override; + + StatusOr + RevokeAuthorization( + google::cloud::agentidentity::v1::RevokeAuthorizationRequest const& + request) override; + + StatusOr EnableAuthProvider( + google::cloud::agentidentity::v1::EnableAuthProviderRequest const& + request) override; + + StatusOr DisableAuthProvider( + google::cloud::agentidentity::v1::DisableAuthProviderRequest const& + request) override; + + StreamRange ListLocations( + google::cloud::location::ListLocationsRequest request) override; + + StatusOr GetLocation( + google::cloud::location::GetLocationRequest const& request) override; + + StatusOr SetIamPolicy( + google::iam::v1::SetIamPolicyRequest const& request) override; + + StatusOr GetIamPolicy( + google::iam::v1::GetIamPolicyRequest const& request) override; + + StatusOr TestIamPermissions( + google::iam::v1::TestIamPermissionsRequest const& request) override; + + private: + std::shared_ptr child_; +}; + +/** + * Conditionally applies the tracing decorator to the given connection. + * + * The connection is only decorated if tracing is enabled (as determined by the + * connection's options). + */ +std::shared_ptr +MakeAuthProviderServiceTracingConnection( + std::shared_ptr conn); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentidentity_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_TRACING_CONNECTION_H diff --git a/google/cloud/agentidentity/v1/internal/auth_provider_tracing_stub.cc b/google/cloud/agentidentity/v1/internal/auth_provider_tracing_stub.cc new file mode 100644 index 0000000000000..4d7f806d9ab8c --- /dev/null +++ b/google/cloud/agentidentity/v1/internal/auth_provider_tracing_stub.cc @@ -0,0 +1,317 @@ +// Copyright 2026 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 by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/cloud/agentidentity/v1/auth_provider_service.proto + +#include "google/cloud/agentidentity/v1/internal/auth_provider_tracing_stub.h" +#include "google/cloud/internal/grpc_opentelemetry.h" +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace agentidentity_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +AuthProviderServiceTracingStub::AuthProviderServiceTracingStub( + std::shared_ptr child) + : child_(std::move(child)), propagator_(internal::MakePropagator()) {} + +StatusOr +AuthProviderServiceTracingStub::ListAuthProviders( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAuthProvidersRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentidentity.v1.AuthProviderService", "ListAuthProviders"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan( + context, *span, child_->ListAuthProviders(context, options, request)); +} + +StatusOr +AuthProviderServiceTracingStub::GetAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAuthProviderRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentidentity.v1.AuthProviderService", "GetAuthProvider"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->GetAuthProvider(context, options, request)); +} + +StatusOr +AuthProviderServiceTracingStub::CreateAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::CreateAuthProviderRequest const& + request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentidentity.v1.AuthProviderService", + "CreateAuthProvider"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan( + context, *span, child_->CreateAuthProvider(context, options, request)); +} + +StatusOr +AuthProviderServiceTracingStub::UpdateAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::UpdateAuthProviderRequest const& + request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentidentity.v1.AuthProviderService", + "UpdateAuthProvider"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan( + context, *span, child_->UpdateAuthProvider(context, options, request)); +} + +Status AuthProviderServiceTracingStub::DeleteAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DeleteAuthProviderRequest const& + request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentidentity.v1.AuthProviderService", + "DeleteAuthProvider"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan( + context, *span, child_->DeleteAuthProvider(context, options, request)); +} + +StatusOr +AuthProviderServiceTracingStub::UndeleteAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::UndeleteAuthProviderRequest const& + request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentidentity.v1.AuthProviderService", + "UndeleteAuthProvider"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan( + context, *span, child_->UndeleteAuthProvider(context, options, request)); +} + +StatusOr +AuthProviderServiceTracingStub::QueryAuthProviders( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::QueryAuthProvidersRequest const& + request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentidentity.v1.AuthProviderService", + "QueryAuthProviders"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan( + context, *span, child_->QueryAuthProviders(context, options, request)); +} + +StatusOr +AuthProviderServiceTracingStub::QueryWorkloads( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::QueryWorkloadsRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentidentity.v1.AuthProviderService", "QueryWorkloads"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->QueryWorkloads(context, options, request)); +} + +StatusOr +AuthProviderServiceTracingStub::ListAuthorizations( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAuthorizationsRequest const& + request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentidentity.v1.AuthProviderService", + "ListAuthorizations"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan( + context, *span, child_->ListAuthorizations(context, options, request)); +} + +StatusOr +AuthProviderServiceTracingStub::GetAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAuthorizationRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentidentity.v1.AuthProviderService", "GetAuthorization"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->GetAuthorization(context, options, request)); +} + +Status AuthProviderServiceTracingStub::DeleteAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DeleteAuthorizationRequest const& + request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentidentity.v1.AuthProviderService", + "DeleteAuthorization"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan( + context, *span, child_->DeleteAuthorization(context, options, request)); +} + +StatusOr +AuthProviderServiceTracingStub::ListAccessSummaries( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAccessSummariesRequest const& + request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentidentity.v1.AuthProviderService", + "ListAccessSummaries"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan( + context, *span, child_->ListAccessSummaries(context, options, request)); +} + +StatusOr +AuthProviderServiceTracingStub::GetAccessSummary( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAccessSummaryRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentidentity.v1.AuthProviderService", "GetAccessSummary"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->GetAccessSummary(context, options, request)); +} + +StatusOr +AuthProviderServiceTracingStub::RevokeAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::RevokeAuthorizationRequest const& + request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentidentity.v1.AuthProviderService", + "RevokeAuthorization"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan( + context, *span, child_->RevokeAuthorization(context, options, request)); +} + +StatusOr +AuthProviderServiceTracingStub::EnableAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::EnableAuthProviderRequest const& + request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentidentity.v1.AuthProviderService", + "EnableAuthProvider"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan( + context, *span, child_->EnableAuthProvider(context, options, request)); +} + +StatusOr +AuthProviderServiceTracingStub::DisableAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DisableAuthProviderRequest const& + request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentidentity.v1.AuthProviderService", + "DisableAuthProvider"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan( + context, *span, child_->DisableAuthProvider(context, options, request)); +} + +StatusOr +AuthProviderServiceTracingStub::ListLocations( + grpc::ClientContext& context, Options const& options, + google::cloud::location::ListLocationsRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentidentity.v1.AuthProviderService", "ListLocations"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->ListLocations(context, options, request)); +} + +StatusOr +AuthProviderServiceTracingStub::GetLocation( + grpc::ClientContext& context, Options const& options, + google::cloud::location::GetLocationRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentidentity.v1.AuthProviderService", "GetLocation"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->GetLocation(context, options, request)); +} + +StatusOr AuthProviderServiceTracingStub::SetIamPolicy( + grpc::ClientContext& context, Options const& options, + google::iam::v1::SetIamPolicyRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentidentity.v1.AuthProviderService", "SetIamPolicy"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->SetIamPolicy(context, options, request)); +} + +StatusOr AuthProviderServiceTracingStub::GetIamPolicy( + grpc::ClientContext& context, Options const& options, + google::iam::v1::GetIamPolicyRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentidentity.v1.AuthProviderService", "GetIamPolicy"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->GetIamPolicy(context, options, request)); +} + +StatusOr +AuthProviderServiceTracingStub::TestIamPermissions( + grpc::ClientContext& context, Options const& options, + google::iam::v1::TestIamPermissionsRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentidentity.v1.AuthProviderService", + "TestIamPermissions"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan( + context, *span, child_->TestIamPermissions(context, options, request)); +} + +std::shared_ptr MakeAuthProviderServiceTracingStub( + std::shared_ptr stub) { + return std::make_shared(std::move(stub)); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentidentity_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" diff --git a/google/cloud/agentidentity/v1/internal/auth_provider_tracing_stub.h b/google/cloud/agentidentity/v1/internal/auth_provider_tracing_stub.h new file mode 100644 index 0000000000000..589415597f828 --- /dev/null +++ b/google/cloud/agentidentity/v1/internal/auth_provider_tracing_stub.h @@ -0,0 +1,170 @@ +// Copyright 2026 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 by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/cloud/agentidentity/v1/auth_provider_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_TRACING_STUB_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_TRACING_STUB_H + +#include "google/cloud/agentidentity/v1/internal/auth_provider_stub.h" +#include "google/cloud/internal/trace_propagator.h" +#include "google/cloud/options.h" +#include "google/cloud/version.h" +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace agentidentity_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class AuthProviderServiceTracingStub : public AuthProviderServiceStub { + public: + ~AuthProviderServiceTracingStub() override = default; + + explicit AuthProviderServiceTracingStub( + std::shared_ptr child); + + StatusOr + ListAuthProviders( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAuthProvidersRequest const& request) + override; + + StatusOr GetAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAuthProviderRequest const& request) + override; + + StatusOr CreateAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::CreateAuthProviderRequest const& + request) override; + + StatusOr UpdateAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::UpdateAuthProviderRequest const& + request) override; + + Status DeleteAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DeleteAuthProviderRequest const& + request) override; + + StatusOr UndeleteAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::UndeleteAuthProviderRequest const& + request) override; + + StatusOr + QueryAuthProviders( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::QueryAuthProvidersRequest const& + request) override; + + StatusOr + QueryWorkloads(grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::QueryWorkloadsRequest const& + request) override; + + StatusOr + ListAuthorizations( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAuthorizationsRequest const& + request) override; + + StatusOr GetAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAuthorizationRequest const& request) + override; + + Status DeleteAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DeleteAuthorizationRequest const& + request) override; + + StatusOr + ListAccessSummaries( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::ListAccessSummariesRequest const& + request) override; + + StatusOr GetAccessSummary( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::GetAccessSummaryRequest const& request) + override; + + StatusOr + RevokeAuthorization( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::RevokeAuthorizationRequest const& + request) override; + + StatusOr EnableAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::EnableAuthProviderRequest const& + request) override; + + StatusOr DisableAuthProvider( + grpc::ClientContext& context, Options const& options, + google::cloud::agentidentity::v1::DisableAuthProviderRequest const& + request) override; + + StatusOr ListLocations( + grpc::ClientContext& context, Options const& options, + google::cloud::location::ListLocationsRequest const& request) override; + + StatusOr GetLocation( + grpc::ClientContext& context, Options const& options, + google::cloud::location::GetLocationRequest const& request) override; + + StatusOr SetIamPolicy( + grpc::ClientContext& context, Options const& options, + google::iam::v1::SetIamPolicyRequest const& request) override; + + StatusOr GetIamPolicy( + grpc::ClientContext& context, Options const& options, + google::iam::v1::GetIamPolicyRequest const& request) override; + + StatusOr TestIamPermissions( + grpc::ClientContext& context, Options const& options, + google::iam::v1::TestIamPermissionsRequest const& request) override; + + private: + std::shared_ptr child_; + std::shared_ptr + propagator_; +}; + +/** + * Applies the tracing decorator to the given stub. + * + * The stub is only decorated if the library has been compiled with + * OpenTelemetry. + */ +std::shared_ptr MakeAuthProviderServiceTracingStub( + std::shared_ptr stub); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentidentity_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_INTERNAL_AUTH_PROVIDER_TRACING_STUB_H diff --git a/google/cloud/agentidentity/v1/mocks/mock_auth_provider_connection.h b/google/cloud/agentidentity/v1/mocks/mock_auth_provider_connection.h new file mode 100644 index 0000000000000..a66e53ac1b477 --- /dev/null +++ b/google/cloud/agentidentity/v1/mocks/mock_auth_provider_connection.h @@ -0,0 +1,175 @@ +// Copyright 2026 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 by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/cloud/agentidentity/v1/auth_provider_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_MOCKS_MOCK_AUTH_PROVIDER_CONNECTION_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_MOCKS_MOCK_AUTH_PROVIDER_CONNECTION_H + +#include "google/cloud/agentidentity/v1/auth_provider_connection.h" +#include + +namespace google { +namespace cloud { +namespace agentidentity_v1_mocks { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +/** + * A class to mock `AuthProviderServiceConnection`. + * + * Application developers may want to test their code with simulated responses, + * including errors, from an object of type `AuthProviderServiceClient`. To do + * so, construct an object of type `AuthProviderServiceClient` with an instance + * of this class. Then use the Google Test framework functions to program the + * behavior of this mock. + * + * @see [This example][bq-mock] for how to test your application with GoogleTest. + * While the example showcases types from the BigQuery library, the underlying + * principles apply for any pair of `*Client` and `*Connection`. + * + * [bq-mock]: @cloud_cpp_docs_link{bigquery,bigquery-read-mock} + */ +class MockAuthProviderServiceConnection + : public agentidentity_v1::AuthProviderServiceConnection { + public: + MOCK_METHOD(Options, options, (), (override)); + + MOCK_METHOD( + (StreamRange), + ListAuthProviders, + (google::cloud::agentidentity::v1::ListAuthProvidersRequest request), + (override)); + + MOCK_METHOD( + StatusOr, GetAuthProvider, + (google::cloud::agentidentity::v1::GetAuthProviderRequest const& request), + (override)); + + MOCK_METHOD( + StatusOr, + CreateAuthProvider, + (google::cloud::agentidentity::v1::CreateAuthProviderRequest const& + request), + (override)); + + MOCK_METHOD( + StatusOr, + UpdateAuthProvider, + (google::cloud::agentidentity::v1::UpdateAuthProviderRequest const& + request), + (override)); + + MOCK_METHOD( + Status, DeleteAuthProvider, + (google::cloud::agentidentity::v1::DeleteAuthProviderRequest const& + request), + (override)); + + MOCK_METHOD( + StatusOr, + UndeleteAuthProvider, + (google::cloud::agentidentity::v1::UndeleteAuthProviderRequest const& + request), + (override)); + + MOCK_METHOD( + (StreamRange), QueryAuthProviders, + (google::cloud::agentidentity::v1::QueryAuthProvidersRequest request), + (override)); + + MOCK_METHOD((StreamRange), QueryWorkloads, + (google::cloud::agentidentity::v1::QueryWorkloadsRequest request), + (override)); + + MOCK_METHOD( + (StreamRange), + ListAuthorizations, + (google::cloud::agentidentity::v1::ListAuthorizationsRequest request), + (override)); + + MOCK_METHOD(StatusOr, + GetAuthorization, + (google::cloud::agentidentity::v1::GetAuthorizationRequest const& + request), + (override)); + + MOCK_METHOD( + Status, DeleteAuthorization, + (google::cloud::agentidentity::v1::DeleteAuthorizationRequest const& + request), + (override)); + + MOCK_METHOD( + (StreamRange), + ListAccessSummaries, + (google::cloud::agentidentity::v1::ListAccessSummariesRequest request), + (override)); + + MOCK_METHOD(StatusOr, + GetAccessSummary, + (google::cloud::agentidentity::v1::GetAccessSummaryRequest const& + request), + (override)); + + MOCK_METHOD( + StatusOr, + RevokeAuthorization, + (google::cloud::agentidentity::v1::RevokeAuthorizationRequest const& + request), + (override)); + + MOCK_METHOD( + StatusOr, + EnableAuthProvider, + (google::cloud::agentidentity::v1::EnableAuthProviderRequest const& + request), + (override)); + + MOCK_METHOD( + StatusOr, + DisableAuthProvider, + (google::cloud::agentidentity::v1::DisableAuthProviderRequest const& + request), + (override)); + + MOCK_METHOD((StreamRange), ListLocations, + (google::cloud::location::ListLocationsRequest request), + (override)); + + MOCK_METHOD(StatusOr, GetLocation, + (google::cloud::location::GetLocationRequest const& request), + (override)); + + MOCK_METHOD(StatusOr, SetIamPolicy, + (google::iam::v1::SetIamPolicyRequest const& request), + (override)); + + MOCK_METHOD(StatusOr, GetIamPolicy, + (google::iam::v1::GetIamPolicyRequest const& request), + (override)); + + MOCK_METHOD(StatusOr, + TestIamPermissions, + (google::iam::v1::TestIamPermissionsRequest const& request), + (override)); +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentidentity_v1_mocks +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTIDENTITY_V1_MOCKS_MOCK_AUTH_PROVIDER_CONNECTION_H diff --git a/google/cloud/agentidentity/v1/samples/auth_provider_client_samples.cc b/google/cloud/agentidentity/v1/samples/auth_provider_client_samples.cc new file mode 100644 index 0000000000000..c4a3e5532cc8a --- /dev/null +++ b/google/cloud/agentidentity/v1/samples/auth_provider_client_samples.cc @@ -0,0 +1,190 @@ +// Copyright 2026 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 by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: google/cloud/agentidentity/v1/auth_provider_service.proto + +#include "google/cloud/agentidentity/v1/auth_provider_client.h" +#include "google/cloud/agentidentity/v1/auth_provider_connection_idempotency_policy.h" +#include "google/cloud/agentidentity/v1/auth_provider_options.h" +#include "google/cloud/common_options.h" +#include "google/cloud/credentials.h" +#include "google/cloud/internal/getenv.h" +#include "google/cloud/testing_util/example_driver.h" +#include "google/cloud/universe_domain.h" +#include +#include +#include +#include + +// clang-format off +// main-dox-marker: agentidentity_v1::AuthProviderServiceClient +// clang-format on +namespace { + +void SetClientEndpoint(std::vector const& argv) { + if (!argv.empty()) { + throw google::cloud::testing_util::Usage{"set-client-endpoint"}; + } + //! [set-client-endpoint] + // This configuration is common with Private Google Access: + // https://cloud.google.com/vpc/docs/private-google-access + auto options = google::cloud::Options{}.set( + "private.googleapis.com"); + auto vpc_client = google::cloud::agentidentity_v1::AuthProviderServiceClient( + google::cloud::agentidentity_v1::MakeAuthProviderServiceConnection( + options)); + //! [set-client-endpoint] +} + +void SetClientUniverseDomain(std::vector const& argv) { + if (!argv.empty()) { + throw google::cloud::testing_util::Usage{"set-client-universe-domain"}; + } + //! [set-client-universe-domain] + google::cloud::Options options; + + // AddUniverseDomainOption interrogates the UnifiedCredentialsOption, if set, + // in the provided Options for the Universe Domain associated with the + // credentials and adds it to the set of Options. + // If no UnifiedCredentialsOption is set, GoogleDefaultCredentials are used. + auto ud_options = google::cloud::AddUniverseDomainOption(std::move(options)); + + if (!ud_options.ok()) throw std::move(ud_options).status(); + auto ud_client = google::cloud::agentidentity_v1::AuthProviderServiceClient( + google::cloud::agentidentity_v1::MakeAuthProviderServiceConnection( + *ud_options)); + //! [set-client-universe-domain] +} + +//! [custom-idempotency-policy] +class CustomIdempotencyPolicy + : public google::cloud::agentidentity_v1:: + AuthProviderServiceConnectionIdempotencyPolicy { + public: + ~CustomIdempotencyPolicy() override = default; + std::unique_ptr + clone() const override { + return std::make_unique(*this); + } + // Override inherited functions to define as needed. +}; +//! [custom-idempotency-policy] + +void SetRetryPolicy(std::vector const& argv) { + if (!argv.empty()) { + throw google::cloud::testing_util::Usage{"set-client-retry-policy"}; + } + //! [set-retry-policy] + auto options = + google::cloud::Options{} + .set( + CustomIdempotencyPolicy().clone()) + .set( + google::cloud::agentidentity_v1:: + AuthProviderServiceLimitedErrorCountRetryPolicy(3) + .clone()) + .set( + google::cloud::ExponentialBackoffPolicy( + /*initial_delay=*/std::chrono::milliseconds(200), + /*maximum_delay=*/std::chrono::seconds(45), + /*scaling=*/2.0) + .clone()); + auto connection = + google::cloud::agentidentity_v1::MakeAuthProviderServiceConnection( + options); + + // c1 and c2 share the same retry policies + auto c1 = + google::cloud::agentidentity_v1::AuthProviderServiceClient(connection); + auto c2 = + google::cloud::agentidentity_v1::AuthProviderServiceClient(connection); + + // You can override any of the policies in a new client. This new client + // will share the policies from c1 (or c2) *except* for the retry policy. + auto c3 = google::cloud::agentidentity_v1::AuthProviderServiceClient( + connection, google::cloud::Options{} + .set( + google::cloud::agentidentity_v1:: + AuthProviderServiceLimitedTimeRetryPolicy( + std::chrono::minutes(5)) + .clone())); + + // You can also override the policies in a single call: + // c3.SomeRpc(..., google::cloud::Options{} + // .set( + // google::cloud::agentidentity_v1::AuthProviderServiceLimitedErrorCountRetryPolicy(10).clone())); + //! [set-retry-policy] +} + +void WithServiceAccount(std::vector const& argv) { + if (argv.size() != 1 || argv[0] == "--help") { + throw google::cloud::testing_util::Usage{"with-service-account "}; + } + //! [with-service-account] + [](std::string const& keyfile) { + auto is = std::ifstream(keyfile); + is.exceptions(std::ios::badbit); // Minimal error handling in examples + auto contents = std::string(std::istreambuf_iterator(is.rdbuf()), {}); + auto options = + google::cloud::Options{}.set( + google::cloud::MakeServiceAccountCredentials(contents)); + return google::cloud::agentidentity_v1::AuthProviderServiceClient( + google::cloud::agentidentity_v1::MakeAuthProviderServiceConnection( + options)); + } + //! [with-service-account] + (argv.at(0)); +} + +void AutoRun(std::vector const& argv) { + namespace examples = ::google::cloud::testing_util; + using ::google::cloud::internal::GetEnv; + if (!argv.empty()) throw examples::Usage{"auto"}; + examples::CheckEnvironmentVariablesAreSet( + {"GOOGLE_CLOUD_CPP_TEST_SERVICE_ACCOUNT_KEYFILE"}); + auto const keyfile = + GetEnv("GOOGLE_CLOUD_CPP_TEST_SERVICE_ACCOUNT_KEYFILE").value(); + + std::cout << "\nRunning SetClientEndpoint() example" << std::endl; + SetClientEndpoint({}); + + std::cout << "\nRunning SetRetryPolicy() example" << std::endl; + SetRetryPolicy({}); + + std::cout << "\nRunning WithServiceAccount() example" << std::endl; + WithServiceAccount({keyfile}); + + std::cout << "\nRunning SetClientUniverseDomain() example" << std::endl; + SetClientUniverseDomain({}); +} + +} // namespace + +int main(int argc, char* argv[]) { // NOLINT(bugprone-exception-escape) + google::cloud::testing_util::Example example({ + {"set-client-endpoint", SetClientEndpoint}, + {"set-retry-policy", SetRetryPolicy}, + {"with-service-account", WithServiceAccount}, + {"set-client-universe-domain", SetClientUniverseDomain}, + {"auto", AutoRun}, + }); + return example.Run(argc, argv); +} diff --git a/libraries.bzl b/libraries.bzl index 15271538a710f..f07c00a0cef36 100644 --- a/libraries.bzl +++ b/libraries.bzl @@ -27,6 +27,7 @@ GOOGLE_CLOUD_CPP_GA_LIBRARIES = [ "accessapproval", "accesscontextmanager", "advisorynotifications", + "agentidentity", "agentregistry", "aiplatform", "alloydb",