diff --git a/CHANGELOG.md b/CHANGELOG.md index 91c579b314dc5..8af0652279cc5 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.7.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 Registry API](/google/cloud/agentregistry/README.md) + ## v3.6.0 - 2026-06 ### New Libraries diff --git a/README.md b/README.md index 321b05795e3b5..62963363b11f3 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 Registry API](google/cloud/agentregistry/README.md) + [[quickstart]](google/cloud/agentregistry/quickstart/README.md) + [[reference]](https://cloud.google.com/cpp/docs/reference/agentregistry/latest) - [Vertex AI API](google/cloud/aiplatform/README.md) [[quickstart]](google/cloud/aiplatform/quickstart/README.md) [[reference]](https://cloud.google.com/cpp/docs/reference/aiplatform/latest) diff --git a/ci/abi-dumps/google_cloud_cpp_agentregistry.expected.abi.dump.gz b/ci/abi-dumps/google_cloud_cpp_agentregistry.expected.abi.dump.gz new file mode 100644 index 0000000000000..5338e27897bbb Binary files /dev/null and b/ci/abi-dumps/google_cloud_cpp_agentregistry.expected.abi.dump.gz differ diff --git a/ci/etc/expected_install_directories b/ci/etc/expected_install_directories index 8fa8ed6564b4a..a381f0ce62ebd 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/agentregistry +./include/google/cloud/agentregistry/v1 +./include/google/cloud/agentregistry/v1/internal +./include/google/cloud/agentregistry/v1/mocks ./include/google/cloud/aiplatform ./include/google/cloud/aiplatform/v1 ./include/google/cloud/aiplatform/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_agentregistry +./lib64/cmake/google_cloud_cpp_agentregistry_mocks ./lib64/cmake/google_cloud_cpp_aiplatform ./lib64/cmake/google_cloud_cpp_aiplatform_mocks ./lib64/cmake/google_cloud_cpp_alloydb diff --git a/cmake/GoogleCloudCppFeatures.cmake b/cmake/GoogleCloudCppFeatures.cmake index 8b18b09c214d3..93ca9b28fb58b 100644 --- a/cmake/GoogleCloudCppFeatures.cmake +++ b/cmake/GoogleCloudCppFeatures.cmake @@ -44,6 +44,7 @@ set(GOOGLE_CLOUD_CPP_GA_LIBRARIES "accessapproval" "accesscontextmanager" "advisorynotifications" + "agentregistry" # Generated 2026-06-26 "aiplatform" "alloydb" "apigateway" diff --git a/external/googleapis/protodeps/agentregistry.deps b/external/googleapis/protodeps/agentregistry.deps new file mode 100644 index 0000000000000..ce4eebcf1a3ab --- /dev/null +++ b/external/googleapis/protodeps/agentregistry.deps @@ -0,0 +1,9 @@ +@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/longrunning:operations_proto +@googleapis//google/rpc:status_proto diff --git a/external/googleapis/protolists/agentregistry.list b/external/googleapis/protolists/agentregistry.list new file mode 100644 index 0000000000000..155b5b1531fef --- /dev/null +++ b/external/googleapis/protolists/agentregistry.list @@ -0,0 +1,7 @@ +@googleapis//google/cloud/agentregistry/v1:agent.proto +@googleapis//google/cloud/agentregistry/v1:agentregistry_service.proto +@googleapis//google/cloud/agentregistry/v1:binding.proto +@googleapis//google/cloud/agentregistry/v1:endpoint.proto +@googleapis//google/cloud/agentregistry/v1:mcp_server.proto +@googleapis//google/cloud/agentregistry/v1:properties.proto +@googleapis//google/cloud/agentregistry/v1:service.proto diff --git a/external/googleapis/update_libraries.sh b/external/googleapis/update_libraries.sh index 9a0a0f594b118..435aba11a06e3 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" + ["agentregistry"]="@googleapis//google/cloud/agentregistry/v1:agentregistry_cc_grpc" ["accesscontextmanager"]="$( printf ",%s" \ "@googleapis//google/identity/accesscontextmanager/type:type_cc_grpc" \ diff --git a/generator/generator_config.textproto b/generator/generator_config.textproto index 2a925f097e6a3..3bac272e49689 100644 --- a/generator/generator_config.textproto +++ b/generator/generator_config.textproto @@ -22,6 +22,14 @@ service { retryable_status_codes: ["kUnavailable"] } +# Agent Registry +service { + service_proto_path: "google/cloud/agentregistry/v1/agentregistry_service.proto" + product_path: "google/cloud/agentregistry/v1" + initial_copyright_year: "2026" + retryable_status_codes: ["kUnavailable"] +} + # Access Context Manager service { service_proto_path: "google/identity/accesscontextmanager/v1/access_context_manager.proto" diff --git a/google/cloud/agentregistry/BUILD.bazel b/google/cloud/agentregistry/BUILD.bazel new file mode 100644 index 0000000000000..55b4438406c64 --- /dev/null +++ b/google/cloud/agentregistry/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/agentregistry/v1:agentregistry_cc_grpc", +] + +cc_gapic_library( + name = "agentregistry", + googleapis_deps = googleapis_deps, + service_dirs = service_dirs, +) diff --git a/google/cloud/agentregistry/CMakeLists.txt b/google/cloud/agentregistry/CMakeLists.txt new file mode 100644 index 0000000000000..df8066419555a --- /dev/null +++ b/google/cloud/agentregistry/CMakeLists.txt @@ -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. +# ~~~ + +include(GoogleCloudCppLibrary) + +google_cloud_cpp_add_gapic_library(agentregistry "Agent Registry API" + SERVICE_DIRS "v1/") + +if (BUILD_TESTING AND GOOGLE_CLOUD_CPP_ENABLE_CXX_EXCEPTIONS) + add_executable(agentregistry_quickstart "quickstart/quickstart.cc") + target_link_libraries(agentregistry_quickstart + PRIVATE google-cloud-cpp::agentregistry) + google_cloud_cpp_add_common_options(agentregistry_quickstart) + add_test( + NAME agentregistry_quickstart + COMMAND + cmake -P "${PROJECT_SOURCE_DIR}/cmake/quickstart-runner.cmake" + $ GOOGLE_CLOUD_PROJECT + GOOGLE_CLOUD_CPP_TEST_REGION) + set_tests_properties( + agentregistry_quickstart + PROPERTIES LABELS "integration-test;quickstart" PASS_REGULAR_EXPRESSION + "Permanent error.*gcloud-cpp.retry.function=ListAgents") +endif () diff --git a/google/cloud/agentregistry/README.md b/google/cloud/agentregistry/README.md new file mode 100644 index 0000000000000..3516d48de1f53 --- /dev/null +++ b/google/cloud/agentregistry/README.md @@ -0,0 +1,63 @@ +# Agent Registry API C++ Client Library + +This directory contains an idiomatic C++ client library for the +[Agent Registry API][cloud-service-docs]. + +Agent Registry is a centralized, unified catalog that lets you store, discover, +and govern Model Context Protocol (MCP) servers, tools, and AI agents within +Google Cloud. + +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/agentregistry/v1/agent_registry_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 agentregistry = ::google::cloud::agentregistry_v1; + auto client = agentregistry::AgentRegistryClient( + agentregistry::MakeAgentRegistryConnection()); + + for (auto r : client.ListAgents(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 Registry 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://docs.cloud.google.com/agent-registry/overview +[doxygen-link]: https://cloud.google.com/cpp/docs/reference/agentregistry/latest/ +[source-link]: https://github.com/googleapis/google-cloud-cpp/tree/main/google/cloud/agentregistry diff --git a/google/cloud/agentregistry/doc/environment-variables.dox b/google/cloud/agentregistry/doc/environment-variables.dox new file mode 100644 index 0000000000000..04a8065df9737 --- /dev/null +++ b/google/cloud/agentregistry/doc/environment-variables.dox @@ -0,0 +1,49 @@ +/*! +@page agentregistry-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 agentregistry-env-endpoint Endpoint Overrides + + + +- `GOOGLE_CLOUD_CPP_AGENT_REGISTRY_ENDPOINT=...` overrides the + `EndpointOption` (which defaults to "agentregistry.googleapis.com") + used by `MakeAgentRegistryConnection()`. + + + +@see google::cloud::EndpointOption + +@section agentregistry-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 agentregistry-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/agentregistry/doc/main.dox b/google/cloud/agentregistry/doc/main.dox new file mode 100644 index 0000000000000..950e693d9f263 --- /dev/null +++ b/google/cloud/agentregistry/doc/main.dox @@ -0,0 +1,50 @@ +/*! + +@mainpage Agent Registry API C++ Client Library + +An idiomatic C++ client library for the [Agent Registry API][cloud-service-docs]. + +Agent Registry is a centralized, unified catalog that lets you store, +discover, and govern Model Context Protocol (MCP) servers, tools, and AI +agents within Google Cloud. + +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/agentregistry/quickstart/` directory, +which should give you a taste of the Agent Registry API C++ client library API. + +@snippet quickstart.cc all + +## Main classes + + +The main class in this library is +[`agentregistry_v1::AgentRegistryClient`](@ref google::cloud::agentregistry_v1::AgentRegistryClient). All RPCs are exposed +as member functions of this class. Other classes provide helpers, configuration +parameters, and infrastructure to mock +[`agentregistry_v1::AgentRegistryClient`](@ref google::cloud::agentregistry_v1::AgentRegistryClient) when testing your +application. + + +## More Information + +- @ref common-error-handling - describes how the library reports errors. +- @ref agentregistry-override-endpoint - describes how to override the default + endpoint. +- @ref agentregistry-override-authentication - describes how to change the + authentication credentials used by the library. +- @ref agentregistry-override-retry - describes how to change the default retry + policies. +- @ref agentregistry-env - describes environment variables that can configure the + behavior of the library. +- @ref agentregistry-override-universe-domain - describes how to override the default universe domain. + +[cloud-service-docs]: https://docs.cloud.google.com/agent-registry/overview + +*/ diff --git a/google/cloud/agentregistry/doc/options.dox b/google/cloud/agentregistry/doc/options.dox new file mode 100644 index 0000000000000..5213de3d58197 --- /dev/null +++ b/google/cloud/agentregistry/doc/options.dox @@ -0,0 +1,10 @@ +/*! +@defgroup google-cloud-agentregistry-options Agent Registry 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/agentregistry/doc/override-authentication.dox b/google/cloud/agentregistry/doc/override-authentication.dox new file mode 100644 index 0000000000000..31d87f8569155 --- /dev/null +++ b/google/cloud/agentregistry/doc/override-authentication.dox @@ -0,0 +1,35 @@ +/*! +@page agentregistry-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 agent_registry_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 agentregistry_v1::AgentRegistryClient-service-account-snippet Override agentregistry_v1::AgentRegistryClient Authentication Defaults + +@snippet google/cloud/agentregistry/v1/samples/agent_registry_client_samples.cc with-service-account + +*/ +// diff --git a/google/cloud/agentregistry/doc/override-endpoint.dox b/google/cloud/agentregistry/doc/override-endpoint.dox new file mode 100644 index 0000000000000..5214f9868d2a4 --- /dev/null +++ b/google/cloud/agentregistry/doc/override-endpoint.dox @@ -0,0 +1,25 @@ +/*! +@page agentregistry-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 `agentregistry_v1::AgentRegistryClient`: + +@snippet agent_registry_client_samples.cc set-client-endpoint + + + +*/ + +// + +/*! @page agentregistry_v1::AgentRegistryClient-endpoint-snippet Override agentregistry_v1::AgentRegistryClient Endpoint Configuration + +@snippet google/cloud/agentregistry/v1/samples/agent_registry_client_samples.cc set-client-endpoint + +*/ +// diff --git a/google/cloud/agentregistry/doc/override-retry-policies.dox b/google/cloud/agentregistry/doc/override-retry-policies.dox new file mode 100644 index 0000000000000..a2eb92885829e --- /dev/null +++ b/google/cloud/agentregistry/doc/override-retry-policies.dox @@ -0,0 +1,108 @@ +/*! +@page agentregistry-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 agentregistry-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 agentregistry-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 agentregistry-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 agentregistry-override-retry-example Example + + +For example, this will override the retry policies for `agentregistry_v1::AgentRegistryClient`: + +@snippet agent_registry_client_samples.cc set-retry-policy + +This assumes you have created a custom idempotency policy. Such as: + +@snippet agent_registry_client_samples.cc custom-idempotency-policy + +This will override the polling policies for `agentregistry_v1::AgentRegistryClient` + +@snippet agent_registry_client_samples.cc set-polling-policy + + + + +@section agentregistry-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 agentregistry_v1::AgentRegistryClient-retry-snippet Override agentregistry_v1::AgentRegistryClient Retry Policies + +This shows how to override the retry policies for agentregistry_v1::AgentRegistryClient: + +@snippet google/cloud/agentregistry/v1/samples/agent_registry_client_samples.cc set-retry-policy + +Assuming you have created a custom idempotency policy. Such as: + +@snippet google/cloud/agentregistry/v1/samples/agent_registry_client_samples.cc custom-idempotency-policy + +*/ +// diff --git a/google/cloud/agentregistry/doc/override-universe-domain.dox b/google/cloud/agentregistry/doc/override-universe-domain.dox new file mode 100644 index 0000000000000..6a48408ca7709 --- /dev/null +++ b/google/cloud/agentregistry/doc/override-universe-domain.dox @@ -0,0 +1,24 @@ +/*! +@page agentregistry-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 `agentregistry_v1::AgentRegistryClient`: + +@snippet agent_registry_client_samples.cc set-client-universe-domain + + + +*/ + +// + +/*! @page agentregistry_v1::AgentRegistryClient-universe-domain-snippet Override agentregistry_v1::AgentRegistryClient Universe Domain + +@snippet google/cloud/agentregistry/v1/samples/agent_registry_client_samples.cc set-client-universe-domain + +*/ +// diff --git a/google/cloud/agentregistry/quickstart/.bazelrc b/google/cloud/agentregistry/quickstart/.bazelrc new file mode 100644 index 0000000000000..d66e2ac9e0cb0 --- /dev/null +++ b/google/cloud/agentregistry/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 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/agentregistry/quickstart/BUILD.bazel b/google/cloud/agentregistry/quickstart/BUILD.bazel new file mode 100644 index 0000000000000..907bf57488815 --- /dev/null +++ b/google/cloud/agentregistry/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//:agentregistry", + ], +) diff --git a/google/cloud/agentregistry/quickstart/CMakeLists.txt b/google/cloud/agentregistry/quickstart/CMakeLists.txt new file mode 100644 index 0000000000000..b456f7edb49a7 --- /dev/null +++ b/google/cloud/agentregistry/quickstart/CMakeLists.txt @@ -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. + +# This file shows how to use the Agent Registry API C++ client library from a +# larger CMake project. + +cmake_minimum_required(VERSION 3.22...3.31) +project(google-cloud-cpp-agentregistry-quickstart CXX) + +find_package(google_cloud_cpp_agentregistry 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::agentregistry) diff --git a/google/cloud/agentregistry/quickstart/Makefile b/google/cloud/agentregistry/quickstart/Makefile new file mode 100644 index 0000000000000..9a84892762d12 --- /dev/null +++ b/google/cloud/agentregistry/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 Registry 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= +CXXLD=$(CXX) +BIN=. + +all: $(BIN)/quickstart + +# Configuration variables to compile and link against the Agent Registry API C++ +# client library. +CLIENT_MODULE := google_cloud_cpp_agentregistry +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/agentregistry/quickstart/README.md b/google/cloud/agentregistry/quickstart/README.md new file mode 100644 index 0000000000000..2f6915bbb8f7d --- /dev/null +++ b/google/cloud/agentregistry/quickstart/README.md @@ -0,0 +1,135 @@ +# HOWTO: using the Agent Registry API C++ client in your project + +This directory contains small examples showing how to use the Agent Registry 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 Registry 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/agentregistry/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,agentregistry] + ``` + + 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/agentregistry/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/agentregistry/quickstart/WORKSPACE.bazel b/google/cloud/agentregistry/quickstart/WORKSPACE.bazel new file mode 100644 index 0000000000000..b1ebc0d9210ae --- /dev/null +++ b/google/cloud/agentregistry/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 Registry 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 = "57d754883a4b4bead60e40f1db5e8a44ba2aa17b605eef56d85234839d5819a3", + strip_prefix = "google-cloud-cpp-3.6.0", + url = "https://github.com/googleapis/google-cloud-cpp/archive/v3.6.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/agentregistry/quickstart/quickstart.cc b/google/cloud/agentregistry/quickstart/quickstart.cc new file mode 100644 index 0000000000000..e3a6fd0941bfe --- /dev/null +++ b/google/cloud/agentregistry/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/agentregistry/v1/agent_registry_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 agentregistry = ::google::cloud::agentregistry_v1; + auto client = agentregistry::AgentRegistryClient( + agentregistry::MakeAgentRegistryConnection()); + + for (auto r : client.ListAgents(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/agentregistry/v1/.repo-metadata.json b/google/cloud/agentregistry/v1/.repo-metadata.json new file mode 100644 index 0000000000000..e8e681395a461 --- /dev/null +++ b/google/cloud/agentregistry/v1/.repo-metadata.json @@ -0,0 +1,14 @@ +{ + "api_id": "agentregistry.googleapis.com", + "api_shortname": "agentregistry", + "client_documentation": "https://cloud.google.com/cpp/docs/reference/agentregistry/latest", + "distribution_name": "google-cloud-cpp", + "issue_tracker": "https://issuetracker.google.com/issues?q=componentid:1992739%20status=open", + "language": "cpp", + "library_type": "GAPIC_AUTO", + "name_pretty": "Agent Registry API", + "product_documentation": "https://docs.cloud.google.com/agent-registry/overview", + "release_level": "stable", + "repo": "googleapis/google-cloud-cpp", + "requires_billing": true +} diff --git a/google/cloud/agentregistry/v1/agent_registry_client.cc b/google/cloud/agentregistry/v1/agent_registry_client.cc new file mode 100644 index 0000000000000..11b0621f04640 --- /dev/null +++ b/google/cloud/agentregistry/v1/agent_registry_client.cc @@ -0,0 +1,577 @@ +// 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/agentregistry/v1/agentregistry_service.proto + +#include "google/cloud/agentregistry/v1/agent_registry_client.h" +#include +#include + +namespace google { +namespace cloud { +namespace agentregistry_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +AgentRegistryClient::AgentRegistryClient( + std::shared_ptr connection, Options opts) + : connection_(std::move(connection)), + options_( + internal::MergeOptions(std::move(opts), connection_->options())) {} +AgentRegistryClient::~AgentRegistryClient() = default; + +StreamRange +AgentRegistryClient::ListAgents(std::string const& parent, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentregistry::v1::ListAgentsRequest request; + request.set_parent(parent); + return connection_->ListAgents(request); +} + +StreamRange +AgentRegistryClient::ListAgents( + google::cloud::agentregistry::v1::ListAgentsRequest request, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->ListAgents(std::move(request)); +} + +StreamRange +AgentRegistryClient::SearchAgents(std::string const& parent, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentregistry::v1::SearchAgentsRequest request; + request.set_parent(parent); + return connection_->SearchAgents(request); +} + +StreamRange +AgentRegistryClient::SearchAgents( + google::cloud::agentregistry::v1::SearchAgentsRequest request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->SearchAgents(std::move(request)); +} + +StatusOr AgentRegistryClient::GetAgent( + std::string const& name, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentregistry::v1::GetAgentRequest request; + request.set_name(name); + return connection_->GetAgent(request); +} + +StatusOr AgentRegistryClient::GetAgent( + google::cloud::agentregistry::v1::GetAgentRequest const& request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->GetAgent(request); +} + +StreamRange +AgentRegistryClient::ListEndpoints(std::string const& parent, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentregistry::v1::ListEndpointsRequest request; + request.set_parent(parent); + return connection_->ListEndpoints(request); +} + +StreamRange +AgentRegistryClient::ListEndpoints( + google::cloud::agentregistry::v1::ListEndpointsRequest request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->ListEndpoints(std::move(request)); +} + +StatusOr +AgentRegistryClient::GetEndpoint(std::string const& name, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentregistry::v1::GetEndpointRequest request; + request.set_name(name); + return connection_->GetEndpoint(request); +} + +StatusOr +AgentRegistryClient::GetEndpoint( + google::cloud::agentregistry::v1::GetEndpointRequest const& request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->GetEndpoint(request); +} + +StreamRange +AgentRegistryClient::ListMcpServers(std::string const& parent, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentregistry::v1::ListMcpServersRequest request; + request.set_parent(parent); + return connection_->ListMcpServers(request); +} + +StreamRange +AgentRegistryClient::ListMcpServers( + google::cloud::agentregistry::v1::ListMcpServersRequest request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->ListMcpServers(std::move(request)); +} + +StreamRange +AgentRegistryClient::SearchMcpServers(std::string const& parent, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentregistry::v1::SearchMcpServersRequest request; + request.set_parent(parent); + return connection_->SearchMcpServers(request); +} + +StreamRange +AgentRegistryClient::SearchMcpServers( + google::cloud::agentregistry::v1::SearchMcpServersRequest request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->SearchMcpServers(std::move(request)); +} + +StatusOr +AgentRegistryClient::GetMcpServer(std::string const& name, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentregistry::v1::GetMcpServerRequest request; + request.set_name(name); + return connection_->GetMcpServer(request); +} + +StatusOr +AgentRegistryClient::GetMcpServer( + google::cloud::agentregistry::v1::GetMcpServerRequest const& request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->GetMcpServer(request); +} + +StreamRange +AgentRegistryClient::ListServices(std::string const& parent, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentregistry::v1::ListServicesRequest request; + request.set_parent(parent); + return connection_->ListServices(request); +} + +StreamRange +AgentRegistryClient::ListServices( + google::cloud::agentregistry::v1::ListServicesRequest request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->ListServices(std::move(request)); +} + +StatusOr +AgentRegistryClient::GetService(std::string const& name, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentregistry::v1::GetServiceRequest request; + request.set_name(name); + return connection_->GetService(request); +} + +StatusOr +AgentRegistryClient::GetService( + google::cloud::agentregistry::v1::GetServiceRequest const& request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->GetService(request); +} + +future> +AgentRegistryClient::CreateService( + std::string const& parent, + google::cloud::agentregistry::v1::Service const& service, + std::string const& service_id, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentregistry::v1::CreateServiceRequest request; + request.set_parent(parent); + *request.mutable_service() = service; + request.set_service_id(service_id); + return connection_->CreateService(request); +} + +StatusOr AgentRegistryClient::CreateService( + NoAwaitTag, std::string const& parent, + google::cloud::agentregistry::v1::Service const& service, + std::string const& service_id, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentregistry::v1::CreateServiceRequest request; + request.set_parent(parent); + *request.mutable_service() = service; + request.set_service_id(service_id); + return connection_->CreateService(NoAwaitTag{}, request); +} + +future> +AgentRegistryClient::CreateService( + google::cloud::agentregistry::v1::CreateServiceRequest const& request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->CreateService(request); +} + +StatusOr AgentRegistryClient::CreateService( + NoAwaitTag, + google::cloud::agentregistry::v1::CreateServiceRequest const& request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->CreateService(NoAwaitTag{}, request); +} + +future> +AgentRegistryClient::CreateService( + google::longrunning::Operation const& operation, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->CreateService(operation); +} + +future> +AgentRegistryClient::UpdateService( + google::cloud::agentregistry::v1::Service const& service, + google::protobuf::FieldMask const& update_mask, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentregistry::v1::UpdateServiceRequest request; + *request.mutable_service() = service; + *request.mutable_update_mask() = update_mask; + return connection_->UpdateService(request); +} + +StatusOr AgentRegistryClient::UpdateService( + NoAwaitTag, google::cloud::agentregistry::v1::Service const& service, + google::protobuf::FieldMask const& update_mask, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentregistry::v1::UpdateServiceRequest request; + *request.mutable_service() = service; + *request.mutable_update_mask() = update_mask; + return connection_->UpdateService(NoAwaitTag{}, request); +} + +future> +AgentRegistryClient::UpdateService( + google::cloud::agentregistry::v1::UpdateServiceRequest const& request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->UpdateService(request); +} + +StatusOr AgentRegistryClient::UpdateService( + NoAwaitTag, + google::cloud::agentregistry::v1::UpdateServiceRequest const& request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->UpdateService(NoAwaitTag{}, request); +} + +future> +AgentRegistryClient::UpdateService( + google::longrunning::Operation const& operation, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->UpdateService(operation); +} + +future> +AgentRegistryClient::DeleteService(std::string const& name, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentregistry::v1::DeleteServiceRequest request; + request.set_name(name); + return connection_->DeleteService(request); +} + +StatusOr AgentRegistryClient::DeleteService( + NoAwaitTag, std::string const& name, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentregistry::v1::DeleteServiceRequest request; + request.set_name(name); + return connection_->DeleteService(NoAwaitTag{}, request); +} + +future> +AgentRegistryClient::DeleteService( + google::cloud::agentregistry::v1::DeleteServiceRequest const& request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->DeleteService(request); +} + +StatusOr AgentRegistryClient::DeleteService( + NoAwaitTag, + google::cloud::agentregistry::v1::DeleteServiceRequest const& request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->DeleteService(NoAwaitTag{}, request); +} + +future> +AgentRegistryClient::DeleteService( + google::longrunning::Operation const& operation, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->DeleteService(operation); +} + +StreamRange +AgentRegistryClient::ListBindings(std::string const& parent, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentregistry::v1::ListBindingsRequest request; + request.set_parent(parent); + return connection_->ListBindings(request); +} + +StreamRange +AgentRegistryClient::ListBindings( + google::cloud::agentregistry::v1::ListBindingsRequest request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->ListBindings(std::move(request)); +} + +StatusOr +AgentRegistryClient::GetBinding(std::string const& name, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentregistry::v1::GetBindingRequest request; + request.set_name(name); + return connection_->GetBinding(request); +} + +StatusOr +AgentRegistryClient::GetBinding( + google::cloud::agentregistry::v1::GetBindingRequest const& request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->GetBinding(request); +} + +future> +AgentRegistryClient::CreateBinding( + std::string const& parent, + google::cloud::agentregistry::v1::Binding const& binding, + std::string const& binding_id, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentregistry::v1::CreateBindingRequest request; + request.set_parent(parent); + *request.mutable_binding() = binding; + request.set_binding_id(binding_id); + return connection_->CreateBinding(request); +} + +StatusOr AgentRegistryClient::CreateBinding( + NoAwaitTag, std::string const& parent, + google::cloud::agentregistry::v1::Binding const& binding, + std::string const& binding_id, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentregistry::v1::CreateBindingRequest request; + request.set_parent(parent); + *request.mutable_binding() = binding; + request.set_binding_id(binding_id); + return connection_->CreateBinding(NoAwaitTag{}, request); +} + +future> +AgentRegistryClient::CreateBinding( + google::cloud::agentregistry::v1::CreateBindingRequest const& request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->CreateBinding(request); +} + +StatusOr AgentRegistryClient::CreateBinding( + NoAwaitTag, + google::cloud::agentregistry::v1::CreateBindingRequest const& request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->CreateBinding(NoAwaitTag{}, request); +} + +future> +AgentRegistryClient::CreateBinding( + google::longrunning::Operation const& operation, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->CreateBinding(operation); +} + +future> +AgentRegistryClient::UpdateBinding( + google::cloud::agentregistry::v1::Binding const& binding, + google::protobuf::FieldMask const& update_mask, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentregistry::v1::UpdateBindingRequest request; + *request.mutable_binding() = binding; + *request.mutable_update_mask() = update_mask; + return connection_->UpdateBinding(request); +} + +StatusOr AgentRegistryClient::UpdateBinding( + NoAwaitTag, google::cloud::agentregistry::v1::Binding const& binding, + google::protobuf::FieldMask const& update_mask, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentregistry::v1::UpdateBindingRequest request; + *request.mutable_binding() = binding; + *request.mutable_update_mask() = update_mask; + return connection_->UpdateBinding(NoAwaitTag{}, request); +} + +future> +AgentRegistryClient::UpdateBinding( + google::cloud::agentregistry::v1::UpdateBindingRequest const& request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->UpdateBinding(request); +} + +StatusOr AgentRegistryClient::UpdateBinding( + NoAwaitTag, + google::cloud::agentregistry::v1::UpdateBindingRequest const& request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->UpdateBinding(NoAwaitTag{}, request); +} + +future> +AgentRegistryClient::UpdateBinding( + google::longrunning::Operation const& operation, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->UpdateBinding(operation); +} + +future> +AgentRegistryClient::DeleteBinding(std::string const& name, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentregistry::v1::DeleteBindingRequest request; + request.set_name(name); + return connection_->DeleteBinding(request); +} + +StatusOr AgentRegistryClient::DeleteBinding( + NoAwaitTag, std::string const& name, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentregistry::v1::DeleteBindingRequest request; + request.set_name(name); + return connection_->DeleteBinding(NoAwaitTag{}, request); +} + +future> +AgentRegistryClient::DeleteBinding( + google::cloud::agentregistry::v1::DeleteBindingRequest const& request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->DeleteBinding(request); +} + +StatusOr AgentRegistryClient::DeleteBinding( + NoAwaitTag, + google::cloud::agentregistry::v1::DeleteBindingRequest const& request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->DeleteBinding(NoAwaitTag{}, request); +} + +future> +AgentRegistryClient::DeleteBinding( + google::longrunning::Operation const& operation, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->DeleteBinding(operation); +} + +StreamRange +AgentRegistryClient::FetchAvailableBindings(std::string const& parent, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::agentregistry::v1::FetchAvailableBindingsRequest request; + request.set_parent(parent); + return connection_->FetchAvailableBindings(request); +} + +StreamRange +AgentRegistryClient::FetchAvailableBindings( + google::cloud::agentregistry::v1::FetchAvailableBindingsRequest request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->FetchAvailableBindings(std::move(request)); +} + +StreamRange +AgentRegistryClient::ListLocations( + google::cloud::location::ListLocationsRequest request, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->ListLocations(std::move(request)); +} + +StatusOr AgentRegistryClient::GetLocation( + google::cloud::location::GetLocationRequest const& request, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->GetLocation(request); +} + +StreamRange AgentRegistryClient::ListOperations( + std::string const& name, std::string const& filter, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::longrunning::ListOperationsRequest request; + request.set_name(name); + request.set_filter(filter); + return connection_->ListOperations(request); +} + +StreamRange AgentRegistryClient::ListOperations( + google::longrunning::ListOperationsRequest request, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->ListOperations(std::move(request)); +} + +StatusOr AgentRegistryClient::GetOperation( + std::string const& name, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::longrunning::GetOperationRequest request; + request.set_name(name); + return connection_->GetOperation(request); +} + +StatusOr AgentRegistryClient::GetOperation( + google::longrunning::GetOperationRequest const& request, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->GetOperation(request); +} + +Status AgentRegistryClient::DeleteOperation(std::string const& name, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::longrunning::DeleteOperationRequest request; + request.set_name(name); + return connection_->DeleteOperation(request); +} + +Status AgentRegistryClient::DeleteOperation( + google::longrunning::DeleteOperationRequest const& request, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->DeleteOperation(request); +} + +Status AgentRegistryClient::CancelOperation(std::string const& name, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::longrunning::CancelOperationRequest request; + request.set_name(name); + return connection_->CancelOperation(request); +} + +Status AgentRegistryClient::CancelOperation( + google::longrunning::CancelOperationRequest const& request, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->CancelOperation(request); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentregistry_v1 +} // namespace cloud +} // namespace google diff --git a/google/cloud/agentregistry/v1/agent_registry_client.h b/google/cloud/agentregistry/v1/agent_registry_client.h new file mode 100644 index 0000000000000..071f527408a39 --- /dev/null +++ b/google/cloud/agentregistry/v1/agent_registry_client.h @@ -0,0 +1,2038 @@ +// 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/agentregistry/v1/agentregistry_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_AGENT_REGISTRY_CLIENT_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_AGENT_REGISTRY_CLIENT_H + +#include "google/cloud/agentregistry/v1/agent_registry_connection.h" +#include "google/cloud/future.h" +#include "google/cloud/no_await_tag.h" +#include "google/cloud/options.h" +#include "google/cloud/polling_policy.h" +#include "google/cloud/status_or.h" +#include "google/cloud/version.h" +#include "google/longrunning/operations.grpc.pb.h" +#include +#include +#include + +namespace google { +namespace cloud { +namespace agentregistry_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +/// +/// Service for managing Agents, Endpoints, McpServers, Services, and Bindings. +/// +/// @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 AgentRegistryClient { + public: + explicit AgentRegistryClient( + std::shared_ptr connection, Options opts = {}); + ~AgentRegistryClient(); + + ///@{ + /// @name Copy and move support + AgentRegistryClient(AgentRegistryClient const&) = default; + AgentRegistryClient& operator=(AgentRegistryClient const&) = default; + AgentRegistryClient(AgentRegistryClient&&) = default; + AgentRegistryClient& operator=(AgentRegistryClient&&) = default; + ///@} + + ///@{ + /// @name Equality + friend bool operator==(AgentRegistryClient const& a, + AgentRegistryClient const& b) { + return a.connection_ == b.connection_; + } + friend bool operator!=(AgentRegistryClient const& a, + AgentRegistryClient const& b) { + return !(a == b); + } + ///@} + + // clang-format off + /// + /// Lists Agents in a given project and location. + /// + /// @param parent Required. Parent value for ListAgentsRequest + /// @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.agentregistry.v1.Agent], 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.agentregistry.v1.Agent]: @googleapis_reference_link{google/cloud/agentregistry/v1/agent.proto#L36} + /// [google.cloud.agentregistry.v1.ListAgentsRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L243} + /// + // clang-format on + StreamRange ListAgents( + std::string const& parent, Options opts = {}); + + // clang-format off + /// + /// Lists Agents 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.agentregistry.v1.ListAgentsRequest]. + /// 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.agentregistry.v1.Agent], 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.agentregistry.v1.Agent]: @googleapis_reference_link{google/cloud/agentregistry/v1/agent.proto#L36} + /// [google.cloud.agentregistry.v1.ListAgentsRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L243} + /// + // clang-format on + StreamRange ListAgents( + google::cloud::agentregistry::v1::ListAgentsRequest request, + Options opts = {}); + + // clang-format off + /// + /// Searches Agents in a given project and location. + /// + /// @param parent Required. Parent value for SearchAgentsRequest. 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.agentregistry.v1.Agent], 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.agentregistry.v1.Agent]: @googleapis_reference_link{google/cloud/agentregistry/v1/agent.proto#L36} + /// [google.cloud.agentregistry.v1.SearchAgentsRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L276} + /// + // clang-format on + StreamRange SearchAgents( + std::string const& parent, Options opts = {}); + + // clang-format off + /// + /// Searches Agents 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.agentregistry.v1.SearchAgentsRequest]. + /// 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.agentregistry.v1.Agent], 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.agentregistry.v1.Agent]: @googleapis_reference_link{google/cloud/agentregistry/v1/agent.proto#L36} + /// [google.cloud.agentregistry.v1.SearchAgentsRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L276} + /// + // clang-format on + StreamRange SearchAgents( + google::cloud::agentregistry::v1::SearchAgentsRequest request, + Options opts = {}); + + // clang-format off + /// + /// Gets details of a single Agent. + /// + /// @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.agentregistry.v1.Agent]) + /// 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.agentregistry.v1.Agent]: @googleapis_reference_link{google/cloud/agentregistry/v1/agent.proto#L36} + /// [google.cloud.agentregistry.v1.GetAgentRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L351} + /// + // clang-format on + StatusOr GetAgent( + std::string const& name, Options opts = {}); + + // clang-format off + /// + /// Gets details of a single 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.agentregistry.v1.GetAgentRequest]. + /// 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.agentregistry.v1.Agent]) + /// 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.agentregistry.v1.Agent]: @googleapis_reference_link{google/cloud/agentregistry/v1/agent.proto#L36} + /// [google.cloud.agentregistry.v1.GetAgentRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L351} + /// + // clang-format on + StatusOr GetAgent( + google::cloud::agentregistry::v1::GetAgentRequest const& request, + Options opts = {}); + + // clang-format off + /// + /// Lists Endpoints in a given project and location. + /// + /// @param parent Required. The project and location to list endpoints in. + /// Expected 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.agentregistry.v1.Endpoint], 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.agentregistry.v1.Endpoint]: @googleapis_reference_link{google/cloud/agentregistry/v1/endpoint.proto#L34} + /// [google.cloud.agentregistry.v1.ListEndpointsRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L362} + /// + // clang-format on + StreamRange ListEndpoints( + std::string const& parent, Options opts = {}); + + // clang-format off + /// + /// Lists Endpoints 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.agentregistry.v1.ListEndpointsRequest]. + /// 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.agentregistry.v1.Endpoint], 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.agentregistry.v1.Endpoint]: @googleapis_reference_link{google/cloud/agentregistry/v1/endpoint.proto#L34} + /// [google.cloud.agentregistry.v1.ListEndpointsRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L362} + /// + // clang-format on + StreamRange ListEndpoints( + google::cloud::agentregistry::v1::ListEndpointsRequest request, + Options opts = {}); + + // clang-format off + /// + /// Gets details of a single Endpoint. + /// + /// @param name Required. The name of the endpoint to retrieve. + /// Format: `projects/{project}/locations/{location}/endpoints/{endpoint}` + /// @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.agentregistry.v1.Endpoint]) + /// 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.agentregistry.v1.Endpoint]: @googleapis_reference_link{google/cloud/agentregistry/v1/endpoint.proto#L34} + /// [google.cloud.agentregistry.v1.GetEndpointRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L409} + /// + // clang-format on + StatusOr GetEndpoint( + std::string const& name, Options opts = {}); + + // clang-format off + /// + /// Gets details of a single Endpoint. + /// + /// @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.agentregistry.v1.GetEndpointRequest]. + /// 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.agentregistry.v1.Endpoint]) + /// 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.agentregistry.v1.Endpoint]: @googleapis_reference_link{google/cloud/agentregistry/v1/endpoint.proto#L34} + /// [google.cloud.agentregistry.v1.GetEndpointRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L409} + /// + // clang-format on + StatusOr GetEndpoint( + google::cloud::agentregistry::v1::GetEndpointRequest const& request, + Options opts = {}); + + // clang-format off + /// + /// Lists McpServers in a given project and location. + /// + /// @param parent Required. Parent value for ListMcpServersRequest. 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.agentregistry.v1.McpServer], 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.agentregistry.v1.ListMcpServersRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L421} + /// [google.cloud.agentregistry.v1.McpServer]: @googleapis_reference_link{google/cloud/agentregistry/v1/mcp_server.proto#L34} + /// + // clang-format on + StreamRange ListMcpServers( + std::string const& parent, Options opts = {}); + + // clang-format off + /// + /// Lists McpServers 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.agentregistry.v1.ListMcpServersRequest]. + /// 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.agentregistry.v1.McpServer], 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.agentregistry.v1.ListMcpServersRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L421} + /// [google.cloud.agentregistry.v1.McpServer]: @googleapis_reference_link{google/cloud/agentregistry/v1/mcp_server.proto#L34} + /// + // clang-format on + StreamRange ListMcpServers( + google::cloud::agentregistry::v1::ListMcpServersRequest request, + Options opts = {}); + + // clang-format off + /// + /// Searches McpServers in a given project and location. + /// + /// @param parent Required. Parent value for SearchMcpServersRequest. 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.agentregistry.v1.McpServer], 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.agentregistry.v1.McpServer]: @googleapis_reference_link{google/cloud/agentregistry/v1/mcp_server.proto#L34} + /// [google.cloud.agentregistry.v1.SearchMcpServersRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L455} + /// + // clang-format on + StreamRange SearchMcpServers( + std::string const& parent, Options opts = {}); + + // clang-format off + /// + /// Searches McpServers 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.agentregistry.v1.SearchMcpServersRequest]. + /// 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.agentregistry.v1.McpServer], 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.agentregistry.v1.McpServer]: @googleapis_reference_link{google/cloud/agentregistry/v1/mcp_server.proto#L34} + /// [google.cloud.agentregistry.v1.SearchMcpServersRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L455} + /// + // clang-format on + StreamRange SearchMcpServers( + google::cloud::agentregistry::v1::SearchMcpServersRequest request, + Options opts = {}); + + // clang-format off + /// + /// Gets details of a single McpServer. + /// + /// @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.agentregistry.v1.McpServer]) + /// 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.agentregistry.v1.GetMcpServerRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L527} + /// [google.cloud.agentregistry.v1.McpServer]: @googleapis_reference_link{google/cloud/agentregistry/v1/mcp_server.proto#L34} + /// + // clang-format on + StatusOr GetMcpServer( + std::string const& name, Options opts = {}); + + // clang-format off + /// + /// Gets details of a single McpServer. + /// + /// @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.agentregistry.v1.GetMcpServerRequest]. + /// 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.agentregistry.v1.McpServer]) + /// 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.agentregistry.v1.GetMcpServerRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L527} + /// [google.cloud.agentregistry.v1.McpServer]: @googleapis_reference_link{google/cloud/agentregistry/v1/mcp_server.proto#L34} + /// + // clang-format on + StatusOr GetMcpServer( + google::cloud::agentregistry::v1::GetMcpServerRequest const& request, + Options opts = {}); + + // clang-format off + /// + /// Lists Services in a given project and location. + /// + /// @param parent Required. The project and location to list services in. + /// Expected 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.agentregistry.v1.Service], 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.agentregistry.v1.ListServicesRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L538} + /// [google.cloud.agentregistry.v1.Service]: @googleapis_reference_link{google/cloud/agentregistry/v1/service.proto#L34} + /// + // clang-format on + StreamRange ListServices( + std::string const& parent, Options opts = {}); + + // clang-format off + /// + /// Lists Services 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.agentregistry.v1.ListServicesRequest]. + /// 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.agentregistry.v1.Service], 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.agentregistry.v1.ListServicesRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L538} + /// [google.cloud.agentregistry.v1.Service]: @googleapis_reference_link{google/cloud/agentregistry/v1/service.proto#L34} + /// + // clang-format on + StreamRange ListServices( + google::cloud::agentregistry::v1::ListServicesRequest request, + Options opts = {}); + + // clang-format off + /// + /// Gets details of a single Service. + /// + /// @param name Required. The name of the Service. + /// Format: `projects/{project}/locations/{location}/services/{service}`. + /// @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.agentregistry.v1.Service]) + /// 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.agentregistry.v1.GetServiceRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L584} + /// [google.cloud.agentregistry.v1.Service]: @googleapis_reference_link{google/cloud/agentregistry/v1/service.proto#L34} + /// + // clang-format on + StatusOr GetService( + std::string const& name, Options opts = {}); + + // clang-format off + /// + /// Gets details of a single 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.agentregistry.v1.GetServiceRequest]. + /// 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.agentregistry.v1.Service]) + /// 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.agentregistry.v1.GetServiceRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L584} + /// [google.cloud.agentregistry.v1.Service]: @googleapis_reference_link{google/cloud/agentregistry/v1/service.proto#L34} + /// + // clang-format on + StatusOr GetService( + google::cloud::agentregistry::v1::GetServiceRequest const& request, + Options opts = {}); + + // clang-format off + /// + /// Creates a new Service in a given project and location. + /// + /// @param parent Required. The project and location to create the Service in. + /// Expected format: `projects/{project}/locations/{location}`. + /// @param service Required. The Service resource that is being created. + /// Format: `projects/{project}/locations/{location}/services/{service}`. + /// @param service_id Required. The ID to use for the service, which will become the final + /// component of the service's resource name. + /// @n + /// This value should be 4-63 characters, and valid characters + /// are `/[a-z][0-9]-/`. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return A [`future`] that becomes satisfied when the LRO + /// ([Long Running Operation]) completes or the polling policy in effect + /// for this call is exhausted. The future is satisfied with an error if + /// the LRO completes with an error or the polling policy is exhausted. + /// In this case the [`StatusOr`] returned by the future contains the + /// error. If the LRO completes successfully the value of the future + /// contains the LRO's result. For this RPC the result is a + /// [google.cloud.agentregistry.v1.Service] proto message. + /// The C++ class representing this message is created by Protobuf, using + /// 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 + /// [Long Running Operation]: https://google.aip.dev/151 + /// [`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.agentregistry.v1.CreateServiceRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L596} + /// [google.cloud.agentregistry.v1.Service]: @googleapis_reference_link{google/cloud/agentregistry/v1/service.proto#L34} + /// + // clang-format on + future> CreateService( + std::string const& parent, + google::cloud::agentregistry::v1::Service const& service, + std::string const& service_id, Options opts = {}); + + // clang-format off + /// + /// @copybrief CreateService + /// + /// Specifying the [`NoAwaitTag`] immediately returns the + /// [`google::longrunning::Operation`] that corresponds to the Long Running + /// Operation that has been started. No polling for operation status occurs. + /// + /// [`NoAwaitTag`]: @ref google::cloud::NoAwaitTag + /// + // clang-format on + StatusOr CreateService( + NoAwaitTag, std::string const& parent, + google::cloud::agentregistry::v1::Service const& service, + std::string const& service_id, Options opts = {}); + + // clang-format off + /// + /// Creates a new Service 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.agentregistry.v1.CreateServiceRequest]. + /// 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 [`future`] that becomes satisfied when the LRO + /// ([Long Running Operation]) completes or the polling policy in effect + /// for this call is exhausted. The future is satisfied with an error if + /// the LRO completes with an error or the polling policy is exhausted. + /// In this case the [`StatusOr`] returned by the future contains the + /// error. If the LRO completes successfully the value of the future + /// contains the LRO's result. For this RPC the result is a + /// [google.cloud.agentregistry.v1.Service] proto message. + /// The C++ class representing this message is created by Protobuf, using + /// 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 + /// [Long Running Operation]: https://google.aip.dev/151 + /// [`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.agentregistry.v1.CreateServiceRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L596} + /// [google.cloud.agentregistry.v1.Service]: @googleapis_reference_link{google/cloud/agentregistry/v1/service.proto#L34} + /// + // clang-format on + future> CreateService( + google::cloud::agentregistry::v1::CreateServiceRequest const& request, + Options opts = {}); + + // clang-format off + /// + /// @copybrief CreateService + /// + /// Specifying the [`NoAwaitTag`] immediately returns the + /// [`google::longrunning::Operation`] that corresponds to the Long Running + /// Operation that has been started. No polling for operation status occurs. + /// + /// [`NoAwaitTag`]: @ref google::cloud::NoAwaitTag + /// + // clang-format on + StatusOr CreateService( + NoAwaitTag, + google::cloud::agentregistry::v1::CreateServiceRequest const& request, + Options opts = {}); + + // clang-format off + /// + /// @copybrief CreateService + /// + /// This method accepts a `google::longrunning::Operation` that corresponds + /// to a previously started Long Running Operation (LRO) and polls the status + /// of the LRO in the background. + /// + // clang-format on + future> CreateService( + google::longrunning::Operation const& operation, Options opts = {}); + + // clang-format off + /// + /// Updates the parameters of a single Service. + /// + /// @param service Required. The Service resource that is being updated. + /// Format: `projects/{project}/locations/{location}/services/{service}`. + /// @param update_mask Optional. Field mask is used to specify the fields to be overwritten in the + /// Service 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 A [`future`] that becomes satisfied when the LRO + /// ([Long Running Operation]) completes or the polling policy in effect + /// for this call is exhausted. The future is satisfied with an error if + /// the LRO completes with an error or the polling policy is exhausted. + /// In this case the [`StatusOr`] returned by the future contains the + /// error. If the LRO completes successfully the value of the future + /// contains the LRO's result. For this RPC the result is a + /// [google.cloud.agentregistry.v1.Service] proto message. + /// The C++ class representing this message is created by Protobuf, using + /// 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 + /// [Long Running Operation]: https://google.aip.dev/151 + /// [`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.agentregistry.v1.Service]: @googleapis_reference_link{google/cloud/agentregistry/v1/service.proto#L34} + /// [google.cloud.agentregistry.v1.UpdateServiceRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L686} + /// + // clang-format on + future> UpdateService( + google::cloud::agentregistry::v1::Service const& service, + google::protobuf::FieldMask const& update_mask, Options opts = {}); + + // clang-format off + /// + /// @copybrief UpdateService + /// + /// Specifying the [`NoAwaitTag`] immediately returns the + /// [`google::longrunning::Operation`] that corresponds to the Long Running + /// Operation that has been started. No polling for operation status occurs. + /// + /// [`NoAwaitTag`]: @ref google::cloud::NoAwaitTag + /// + // clang-format on + StatusOr UpdateService( + NoAwaitTag, google::cloud::agentregistry::v1::Service const& service, + google::protobuf::FieldMask const& update_mask, Options opts = {}); + + // clang-format off + /// + /// Updates the parameters of a single 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.agentregistry.v1.UpdateServiceRequest]. + /// 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 [`future`] that becomes satisfied when the LRO + /// ([Long Running Operation]) completes or the polling policy in effect + /// for this call is exhausted. The future is satisfied with an error if + /// the LRO completes with an error or the polling policy is exhausted. + /// In this case the [`StatusOr`] returned by the future contains the + /// error. If the LRO completes successfully the value of the future + /// contains the LRO's result. For this RPC the result is a + /// [google.cloud.agentregistry.v1.Service] proto message. + /// The C++ class representing this message is created by Protobuf, using + /// 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 + /// [Long Running Operation]: https://google.aip.dev/151 + /// [`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.agentregistry.v1.Service]: @googleapis_reference_link{google/cloud/agentregistry/v1/service.proto#L34} + /// [google.cloud.agentregistry.v1.UpdateServiceRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L686} + /// + // clang-format on + future> UpdateService( + google::cloud::agentregistry::v1::UpdateServiceRequest const& request, + Options opts = {}); + + // clang-format off + /// + /// @copybrief UpdateService + /// + /// Specifying the [`NoAwaitTag`] immediately returns the + /// [`google::longrunning::Operation`] that corresponds to the Long Running + /// Operation that has been started. No polling for operation status occurs. + /// + /// [`NoAwaitTag`]: @ref google::cloud::NoAwaitTag + /// + // clang-format on + StatusOr UpdateService( + NoAwaitTag, + google::cloud::agentregistry::v1::UpdateServiceRequest const& request, + Options opts = {}); + + // clang-format off + /// + /// @copybrief UpdateService + /// + /// This method accepts a `google::longrunning::Operation` that corresponds + /// to a previously started Long Running Operation (LRO) and polls the status + /// of the LRO in the background. + /// + // clang-format on + future> UpdateService( + google::longrunning::Operation const& operation, Options opts = {}); + + // clang-format off + /// + /// Deletes a single Service. + /// + /// @param name Required. The name of the Service. + /// Format: `projects/{project}/locations/{location}/services/{service}`. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return A [`future`] that becomes satisfied when the LRO + /// ([Long Running Operation]) completes or the polling policy in effect + /// for this call is exhausted. The future is satisfied with an error if + /// the LRO completes with an error or the polling policy is exhausted. + /// In this case the [`StatusOr`] returned by the future contains the + /// error. If the LRO completes successfully the value of the future + /// contains the LRO's result. For this RPC the result is a + /// [google.cloud.agentregistry.v1.OperationMetadata] proto message. + /// The C++ class representing this message is created by Protobuf, using + /// 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 + /// [Long Running Operation]: https://google.aip.dev/151 + /// [`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.agentregistry.v1.DeleteServiceRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L720} + /// [google.cloud.agentregistry.v1.OperationMetadata]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L750} + /// + // clang-format on + future> + DeleteService(std::string const& name, Options opts = {}); + + // clang-format off + /// + /// @copybrief DeleteService + /// + /// Specifying the [`NoAwaitTag`] immediately returns the + /// [`google::longrunning::Operation`] that corresponds to the Long Running + /// Operation that has been started. No polling for operation status occurs. + /// + /// [`NoAwaitTag`]: @ref google::cloud::NoAwaitTag + /// + // clang-format on + StatusOr DeleteService( + NoAwaitTag, std::string const& name, Options opts = {}); + + // clang-format off + /// + /// Deletes a single 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.agentregistry.v1.DeleteServiceRequest]. + /// 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 [`future`] that becomes satisfied when the LRO + /// ([Long Running Operation]) completes or the polling policy in effect + /// for this call is exhausted. The future is satisfied with an error if + /// the LRO completes with an error or the polling policy is exhausted. + /// In this case the [`StatusOr`] returned by the future contains the + /// error. If the LRO completes successfully the value of the future + /// contains the LRO's result. For this RPC the result is a + /// [google.cloud.agentregistry.v1.OperationMetadata] proto message. + /// The C++ class representing this message is created by Protobuf, using + /// 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 + /// [Long Running Operation]: https://google.aip.dev/151 + /// [`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.agentregistry.v1.DeleteServiceRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L720} + /// [google.cloud.agentregistry.v1.OperationMetadata]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L750} + /// + // clang-format on + future> + DeleteService( + google::cloud::agentregistry::v1::DeleteServiceRequest const& request, + Options opts = {}); + + // clang-format off + /// + /// @copybrief DeleteService + /// + /// Specifying the [`NoAwaitTag`] immediately returns the + /// [`google::longrunning::Operation`] that corresponds to the Long Running + /// Operation that has been started. No polling for operation status occurs. + /// + /// [`NoAwaitTag`]: @ref google::cloud::NoAwaitTag + /// + // clang-format on + StatusOr DeleteService( + NoAwaitTag, + google::cloud::agentregistry::v1::DeleteServiceRequest const& request, + Options opts = {}); + + // clang-format off + /// + /// @copybrief DeleteService + /// + /// This method accepts a `google::longrunning::Operation` that corresponds + /// to a previously started Long Running Operation (LRO) and polls the status + /// of the LRO in the background. + /// + // clang-format on + future> + DeleteService(google::longrunning::Operation const& operation, + Options opts = {}); + + // clang-format off + /// + /// Lists Bindings in a given project and location. + /// + /// @param parent Required. The project and location to list bindings in. + /// Expected 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.agentregistry.v1.Binding], 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.agentregistry.v1.Binding]: @googleapis_reference_link{google/cloud/agentregistry/v1/binding.proto#L32} + /// [google.cloud.agentregistry.v1.ListBindingsRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L781} + /// + // clang-format on + StreamRange ListBindings( + std::string const& parent, Options opts = {}); + + // clang-format off + /// + /// Lists Bindings 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.agentregistry.v1.ListBindingsRequest]. + /// 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.agentregistry.v1.Binding], 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.agentregistry.v1.Binding]: @googleapis_reference_link{google/cloud/agentregistry/v1/binding.proto#L32} + /// [google.cloud.agentregistry.v1.ListBindingsRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L781} + /// + // clang-format on + StreamRange ListBindings( + google::cloud::agentregistry::v1::ListBindingsRequest request, + Options opts = {}); + + // clang-format off + /// + /// Gets details of a single Binding. + /// + /// @param name Required. The name of the Binding. + /// Format: `projects/{project}/locations/{location}/bindings/{binding}`. + /// @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.agentregistry.v1.Binding]) + /// 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.agentregistry.v1.Binding]: @googleapis_reference_link{google/cloud/agentregistry/v1/binding.proto#L32} + /// [google.cloud.agentregistry.v1.GetBindingRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L821} + /// + // clang-format on + StatusOr GetBinding( + std::string const& name, Options opts = {}); + + // clang-format off + /// + /// Gets details of a single Binding. + /// + /// @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.agentregistry.v1.GetBindingRequest]. + /// 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.agentregistry.v1.Binding]) + /// 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.agentregistry.v1.Binding]: @googleapis_reference_link{google/cloud/agentregistry/v1/binding.proto#L32} + /// [google.cloud.agentregistry.v1.GetBindingRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L821} + /// + // clang-format on + StatusOr GetBinding( + google::cloud::agentregistry::v1::GetBindingRequest const& request, + Options opts = {}); + + // clang-format off + /// + /// Creates a new Binding in a given project and location. + /// + /// @param parent Required. The project and location to create the Binding in. + /// Expected format: `projects/{project}/locations/{location}`. + /// @param binding Required. The Binding resource that is being created. + /// @param binding_id Required. The ID to use for the binding, which will become the final + /// component of the binding's resource name. + /// @n + /// This value should be 4-63 characters, and must conform to RFC-1034. + /// Specifically, it must match the regular expression + /// `^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$`. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return A [`future`] that becomes satisfied when the LRO + /// ([Long Running Operation]) completes or the polling policy in effect + /// for this call is exhausted. The future is satisfied with an error if + /// the LRO completes with an error or the polling policy is exhausted. + /// In this case the [`StatusOr`] returned by the future contains the + /// error. If the LRO completes successfully the value of the future + /// contains the LRO's result. For this RPC the result is a + /// [google.cloud.agentregistry.v1.Binding] proto message. + /// The C++ class representing this message is created by Protobuf, using + /// 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 + /// [Long Running Operation]: https://google.aip.dev/151 + /// [`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.agentregistry.v1.Binding]: @googleapis_reference_link{google/cloud/agentregistry/v1/binding.proto#L32} + /// [google.cloud.agentregistry.v1.CreateBindingRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L833} + /// + // clang-format on + future> CreateBinding( + std::string const& parent, + google::cloud::agentregistry::v1::Binding const& binding, + std::string const& binding_id, Options opts = {}); + + // clang-format off + /// + /// @copybrief CreateBinding + /// + /// Specifying the [`NoAwaitTag`] immediately returns the + /// [`google::longrunning::Operation`] that corresponds to the Long Running + /// Operation that has been started. No polling for operation status occurs. + /// + /// [`NoAwaitTag`]: @ref google::cloud::NoAwaitTag + /// + // clang-format on + StatusOr CreateBinding( + NoAwaitTag, std::string const& parent, + google::cloud::agentregistry::v1::Binding const& binding, + std::string const& binding_id, Options opts = {}); + + // clang-format off + /// + /// Creates a new Binding 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.agentregistry.v1.CreateBindingRequest]. + /// 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 [`future`] that becomes satisfied when the LRO + /// ([Long Running Operation]) completes or the polling policy in effect + /// for this call is exhausted. The future is satisfied with an error if + /// the LRO completes with an error or the polling policy is exhausted. + /// In this case the [`StatusOr`] returned by the future contains the + /// error. If the LRO completes successfully the value of the future + /// contains the LRO's result. For this RPC the result is a + /// [google.cloud.agentregistry.v1.Binding] proto message. + /// The C++ class representing this message is created by Protobuf, using + /// 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 + /// [Long Running Operation]: https://google.aip.dev/151 + /// [`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.agentregistry.v1.Binding]: @googleapis_reference_link{google/cloud/agentregistry/v1/binding.proto#L32} + /// [google.cloud.agentregistry.v1.CreateBindingRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L833} + /// + // clang-format on + future> CreateBinding( + google::cloud::agentregistry::v1::CreateBindingRequest const& request, + Options opts = {}); + + // clang-format off + /// + /// @copybrief CreateBinding + /// + /// Specifying the [`NoAwaitTag`] immediately returns the + /// [`google::longrunning::Operation`] that corresponds to the Long Running + /// Operation that has been started. No polling for operation status occurs. + /// + /// [`NoAwaitTag`]: @ref google::cloud::NoAwaitTag + /// + // clang-format on + StatusOr CreateBinding( + NoAwaitTag, + google::cloud::agentregistry::v1::CreateBindingRequest const& request, + Options opts = {}); + + // clang-format off + /// + /// @copybrief CreateBinding + /// + /// This method accepts a `google::longrunning::Operation` that corresponds + /// to a previously started Long Running Operation (LRO) and polls the status + /// of the LRO in the background. + /// + // clang-format on + future> CreateBinding( + google::longrunning::Operation const& operation, Options opts = {}); + + // clang-format off + /// + /// Updates the parameters of a single Binding. + /// + /// @param binding Required. The Binding resource that is being updated. + /// @param update_mask Optional. Field mask is used to specify the fields to be overwritten in the + /// Binding 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 A [`future`] that becomes satisfied when the LRO + /// ([Long Running Operation]) completes or the polling policy in effect + /// for this call is exhausted. The future is satisfied with an error if + /// the LRO completes with an error or the polling policy is exhausted. + /// In this case the [`StatusOr`] returned by the future contains the + /// error. If the LRO completes successfully the value of the future + /// contains the LRO's result. For this RPC the result is a + /// [google.cloud.agentregistry.v1.Binding] proto message. + /// The C++ class representing this message is created by Protobuf, using + /// 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 + /// [Long Running Operation]: https://google.aip.dev/151 + /// [`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.agentregistry.v1.Binding]: @googleapis_reference_link{google/cloud/agentregistry/v1/binding.proto#L32} + /// [google.cloud.agentregistry.v1.UpdateBindingRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L874} + /// + // clang-format on + future> UpdateBinding( + google::cloud::agentregistry::v1::Binding const& binding, + google::protobuf::FieldMask const& update_mask, Options opts = {}); + + // clang-format off + /// + /// @copybrief UpdateBinding + /// + /// Specifying the [`NoAwaitTag`] immediately returns the + /// [`google::longrunning::Operation`] that corresponds to the Long Running + /// Operation that has been started. No polling for operation status occurs. + /// + /// [`NoAwaitTag`]: @ref google::cloud::NoAwaitTag + /// + // clang-format on + StatusOr UpdateBinding( + NoAwaitTag, google::cloud::agentregistry::v1::Binding const& binding, + google::protobuf::FieldMask const& update_mask, Options opts = {}); + + // clang-format off + /// + /// Updates the parameters of a single Binding. + /// + /// @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.agentregistry.v1.UpdateBindingRequest]. + /// 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 [`future`] that becomes satisfied when the LRO + /// ([Long Running Operation]) completes or the polling policy in effect + /// for this call is exhausted. The future is satisfied with an error if + /// the LRO completes with an error or the polling policy is exhausted. + /// In this case the [`StatusOr`] returned by the future contains the + /// error. If the LRO completes successfully the value of the future + /// contains the LRO's result. For this RPC the result is a + /// [google.cloud.agentregistry.v1.Binding] proto message. + /// The C++ class representing this message is created by Protobuf, using + /// 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 + /// [Long Running Operation]: https://google.aip.dev/151 + /// [`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.agentregistry.v1.Binding]: @googleapis_reference_link{google/cloud/agentregistry/v1/binding.proto#L32} + /// [google.cloud.agentregistry.v1.UpdateBindingRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L874} + /// + // clang-format on + future> UpdateBinding( + google::cloud::agentregistry::v1::UpdateBindingRequest const& request, + Options opts = {}); + + // clang-format off + /// + /// @copybrief UpdateBinding + /// + /// Specifying the [`NoAwaitTag`] immediately returns the + /// [`google::longrunning::Operation`] that corresponds to the Long Running + /// Operation that has been started. No polling for operation status occurs. + /// + /// [`NoAwaitTag`]: @ref google::cloud::NoAwaitTag + /// + // clang-format on + StatusOr UpdateBinding( + NoAwaitTag, + google::cloud::agentregistry::v1::UpdateBindingRequest const& request, + Options opts = {}); + + // clang-format off + /// + /// @copybrief UpdateBinding + /// + /// This method accepts a `google::longrunning::Operation` that corresponds + /// to a previously started Long Running Operation (LRO) and polls the status + /// of the LRO in the background. + /// + // clang-format on + future> UpdateBinding( + google::longrunning::Operation const& operation, Options opts = {}); + + // clang-format off + /// + /// Deletes a single Binding. + /// + /// @param name Required. The name of the Binding. + /// Format: `projects/{project}/locations/{location}/bindings/{binding}`. + /// @param opts Optional. Override the class-level options, such as retry and + /// backoff policies. + /// @return A [`future`] that becomes satisfied when the LRO + /// ([Long Running Operation]) completes or the polling policy in effect + /// for this call is exhausted. The future is satisfied with an error if + /// the LRO completes with an error or the polling policy is exhausted. + /// In this case the [`StatusOr`] returned by the future contains the + /// error. If the LRO completes successfully the value of the future + /// contains the LRO's result. For this RPC the result is a + /// [google.cloud.agentregistry.v1.OperationMetadata] proto message. + /// The C++ class representing this message is created by Protobuf, using + /// 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 + /// [Long Running Operation]: https://google.aip.dev/151 + /// [`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.agentregistry.v1.DeleteBindingRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L907} + /// [google.cloud.agentregistry.v1.OperationMetadata]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L750} + /// + // clang-format on + future> + DeleteBinding(std::string const& name, Options opts = {}); + + // clang-format off + /// + /// @copybrief DeleteBinding + /// + /// Specifying the [`NoAwaitTag`] immediately returns the + /// [`google::longrunning::Operation`] that corresponds to the Long Running + /// Operation that has been started. No polling for operation status occurs. + /// + /// [`NoAwaitTag`]: @ref google::cloud::NoAwaitTag + /// + // clang-format on + StatusOr DeleteBinding( + NoAwaitTag, std::string const& name, Options opts = {}); + + // clang-format off + /// + /// Deletes a single Binding. + /// + /// @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.agentregistry.v1.DeleteBindingRequest]. + /// 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 [`future`] that becomes satisfied when the LRO + /// ([Long Running Operation]) completes or the polling policy in effect + /// for this call is exhausted. The future is satisfied with an error if + /// the LRO completes with an error or the polling policy is exhausted. + /// In this case the [`StatusOr`] returned by the future contains the + /// error. If the LRO completes successfully the value of the future + /// contains the LRO's result. For this RPC the result is a + /// [google.cloud.agentregistry.v1.OperationMetadata] proto message. + /// The C++ class representing this message is created by Protobuf, using + /// 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 + /// [Long Running Operation]: https://google.aip.dev/151 + /// [`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.agentregistry.v1.DeleteBindingRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L907} + /// [google.cloud.agentregistry.v1.OperationMetadata]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L750} + /// + // clang-format on + future> + DeleteBinding( + google::cloud::agentregistry::v1::DeleteBindingRequest const& request, + Options opts = {}); + + // clang-format off + /// + /// @copybrief DeleteBinding + /// + /// Specifying the [`NoAwaitTag`] immediately returns the + /// [`google::longrunning::Operation`] that corresponds to the Long Running + /// Operation that has been started. No polling for operation status occurs. + /// + /// [`NoAwaitTag`]: @ref google::cloud::NoAwaitTag + /// + // clang-format on + StatusOr DeleteBinding( + NoAwaitTag, + google::cloud::agentregistry::v1::DeleteBindingRequest const& request, + Options opts = {}); + + // clang-format off + /// + /// @copybrief DeleteBinding + /// + /// This method accepts a `google::longrunning::Operation` that corresponds + /// to a previously started Long Running Operation (LRO) and polls the status + /// of the LRO in the background. + /// + // clang-format on + future> + DeleteBinding(google::longrunning::Operation const& operation, + Options opts = {}); + + // clang-format off + /// + /// Fetches available Bindings. + /// + /// @param parent Required. The parent, in the 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.agentregistry.v1.Binding], 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.agentregistry.v1.Binding]: @googleapis_reference_link{google/cloud/agentregistry/v1/binding.proto#L32} + /// [google.cloud.agentregistry.v1.FetchAvailableBindingsRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L637} + /// + // clang-format on + StreamRange FetchAvailableBindings( + std::string const& parent, Options opts = {}); + + // clang-format off + /// + /// Fetches available Bindings. + /// + /// @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.agentregistry.v1.FetchAvailableBindingsRequest]. + /// 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.agentregistry.v1.Binding], 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.agentregistry.v1.Binding]: @googleapis_reference_link{google/cloud/agentregistry/v1/binding.proto#L32} + /// [google.cloud.agentregistry.v1.FetchAvailableBindingsRequest]: @googleapis_reference_link{google/cloud/agentregistry/v1/agentregistry_service.proto#L637} + /// + // clang-format on + StreamRange FetchAvailableBindings( + google::cloud::agentregistry::v1::FetchAvailableBindingsRequest 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 + /// + /// Lists operations that match the specified filter in the request. If the + /// server doesn't support this method, it returns `UNIMPLEMENTED`. + /// + /// @param name The name of the operation's parent resource. + /// @param filter The standard list filter. + /// @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.longrunning.Operation], 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.longrunning.ListOperationsRequest]: @googleapis_reference_link{google/longrunning/operations.proto#L167} + /// [google.longrunning.Operation]: @googleapis_reference_link{google/longrunning/operations.proto#L121} + /// + // clang-format on + StreamRange ListOperations( + std::string const& name, std::string const& filter, Options opts = {}); + + // clang-format off + /// + /// Lists operations that match the specified filter in the request. If the + /// server doesn't support this method, it returns `UNIMPLEMENTED`. + /// + /// @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.longrunning.ListOperationsRequest]. + /// 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.longrunning.Operation], 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.longrunning.ListOperationsRequest]: @googleapis_reference_link{google/longrunning/operations.proto#L167} + /// [google.longrunning.Operation]: @googleapis_reference_link{google/longrunning/operations.proto#L121} + /// + // clang-format on + StreamRange ListOperations( + google::longrunning::ListOperationsRequest request, Options opts = {}); + + // clang-format off + /// + /// Gets the latest state of a long-running operation. Clients can use this + /// method to poll the operation result at intervals as recommended by the API + /// service. + /// + /// @param name The name of the operation 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.longrunning.Operation]) + /// 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.longrunning.GetOperationRequest]: @googleapis_reference_link{google/longrunning/operations.proto#L160} + /// [google.longrunning.Operation]: @googleapis_reference_link{google/longrunning/operations.proto#L121} + /// + // clang-format on + StatusOr GetOperation(std::string const& name, + Options opts = {}); + + // clang-format off + /// + /// Gets the latest state of a long-running operation. Clients can use this + /// method to poll the operation result at intervals as recommended by the API + /// 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.longrunning.GetOperationRequest]. + /// 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.longrunning.Operation]) + /// 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.longrunning.GetOperationRequest]: @googleapis_reference_link{google/longrunning/operations.proto#L160} + /// [google.longrunning.Operation]: @googleapis_reference_link{google/longrunning/operations.proto#L121} + /// + // clang-format on + StatusOr GetOperation( + google::longrunning::GetOperationRequest const& request, + Options opts = {}); + + // clang-format off + /// + /// Deletes a long-running operation. This method indicates that the client is + /// no longer interested in the operation result. It does not cancel the + /// operation. If the server doesn't support this method, it returns + /// `google.rpc.Code.UNIMPLEMENTED`. + /// + /// @param name The name of the operation resource to be deleted. + /// @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.longrunning.DeleteOperationRequest]: @googleapis_reference_link{google/longrunning/operations.proto#L219} + /// + // clang-format on + Status DeleteOperation(std::string const& name, Options opts = {}); + + // clang-format off + /// + /// Deletes a long-running operation. This method indicates that the client is + /// no longer interested in the operation result. It does not cancel the + /// operation. If the server doesn't support this method, it returns + /// `google.rpc.Code.UNIMPLEMENTED`. + /// + /// @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.longrunning.DeleteOperationRequest]. + /// 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.longrunning.DeleteOperationRequest]: @googleapis_reference_link{google/longrunning/operations.proto#L219} + /// + // clang-format on + Status DeleteOperation( + google::longrunning::DeleteOperationRequest const& request, + Options opts = {}); + + // clang-format off + /// + /// Starts asynchronous cancellation on a long-running operation. The server + /// makes a best effort to cancel the operation, but success is not + /// guaranteed. If the server doesn't support this method, it returns + /// `google.rpc.Code.UNIMPLEMENTED`. Clients can use + /// [Operations.GetOperation][google.longrunning.Operations.GetOperation] or + /// other methods to check whether the cancellation succeeded or whether the + /// operation completed despite cancellation. On successful cancellation, + /// the operation is not deleted; instead, it becomes an operation with + /// an [Operation.error][google.longrunning.Operation.error] value with a + /// [google.rpc.Status.code][google.rpc.Status.code] of `1`, corresponding to + /// `Code.CANCELLED`. + /// + /// @param name The name of the operation resource to be cancelled. + /// @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.longrunning.CancelOperationRequest]: @googleapis_reference_link{google/longrunning/operations.proto#L212} + /// [google.longrunning.Operation.error]: @googleapis_reference_link{google/longrunning/operations.proto#L144} + /// [google.longrunning.Operations.GetOperation]: @googleapis_reference_link{google/longrunning/operations.proto#L70} + /// [google.rpc.Status.code]: @googleapis_reference_link{google/rpc/status.proto#L37} + /// + // clang-format on + Status CancelOperation(std::string const& name, Options opts = {}); + + // clang-format off + /// + /// Starts asynchronous cancellation on a long-running operation. The server + /// makes a best effort to cancel the operation, but success is not + /// guaranteed. If the server doesn't support this method, it returns + /// `google.rpc.Code.UNIMPLEMENTED`. Clients can use + /// [Operations.GetOperation][google.longrunning.Operations.GetOperation] or + /// other methods to check whether the cancellation succeeded or whether the + /// operation completed despite cancellation. On successful cancellation, + /// the operation is not deleted; instead, it becomes an operation with + /// an [Operation.error][google.longrunning.Operation.error] value with a + /// [google.rpc.Status.code][google.rpc.Status.code] of `1`, corresponding to + /// `Code.CANCELLED`. + /// + /// @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.longrunning.CancelOperationRequest]. + /// 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.longrunning.CancelOperationRequest]: @googleapis_reference_link{google/longrunning/operations.proto#L212} + /// [google.longrunning.Operation.error]: @googleapis_reference_link{google/longrunning/operations.proto#L144} + /// [google.longrunning.Operations.GetOperation]: @googleapis_reference_link{google/longrunning/operations.proto#L70} + /// [google.rpc.Status.code]: @googleapis_reference_link{google/rpc/status.proto#L37} + /// + // clang-format on + Status CancelOperation( + google::longrunning::CancelOperationRequest const& request, + Options opts = {}); + + private: + std::shared_ptr connection_; + Options options_; +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentregistry_v1 +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_AGENT_REGISTRY_CLIENT_H diff --git a/google/cloud/agentregistry/v1/agent_registry_connection.cc b/google/cloud/agentregistry/v1/agent_registry_connection.cc new file mode 100644 index 0000000000000..3c29e0752db56 --- /dev/null +++ b/google/cloud/agentregistry/v1/agent_registry_connection.cc @@ -0,0 +1,318 @@ +// 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/agentregistry/v1/agentregistry_service.proto + +#include "google/cloud/agentregistry/v1/agent_registry_connection.h" +#include "google/cloud/agentregistry/v1/agent_registry_options.h" +#include "google/cloud/agentregistry/v1/internal/agent_registry_connection_impl.h" +#include "google/cloud/agentregistry/v1/internal/agent_registry_option_defaults.h" +#include "google/cloud/agentregistry/v1/internal/agent_registry_stub_factory.h" +#include "google/cloud/agentregistry/v1/internal/agent_registry_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 agentregistry_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +AgentRegistryConnection::~AgentRegistryConnection() = default; + +StreamRange +AgentRegistryConnection::ListAgents( + google::cloud::agentregistry::v1:: + ListAgentsRequest) { // NOLINT(performance-unnecessary-value-param) + return google::cloud::internal::MakeUnimplementedPaginationRange< + StreamRange>(); +} + +StreamRange +AgentRegistryConnection::SearchAgents( + google::cloud::agentregistry::v1:: + SearchAgentsRequest) { // NOLINT(performance-unnecessary-value-param) + return google::cloud::internal::MakeUnimplementedPaginationRange< + StreamRange>(); +} + +StatusOr +AgentRegistryConnection::GetAgent( + google::cloud::agentregistry::v1::GetAgentRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +StreamRange +AgentRegistryConnection::ListEndpoints( + google::cloud::agentregistry::v1:: + ListEndpointsRequest) { // NOLINT(performance-unnecessary-value-param) + return google::cloud::internal::MakeUnimplementedPaginationRange< + StreamRange>(); +} + +StatusOr +AgentRegistryConnection::GetEndpoint( + google::cloud::agentregistry::v1::GetEndpointRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +StreamRange +AgentRegistryConnection::ListMcpServers( + google::cloud::agentregistry::v1:: + ListMcpServersRequest) { // NOLINT(performance-unnecessary-value-param) + return google::cloud::internal::MakeUnimplementedPaginationRange< + StreamRange>(); +} + +StreamRange +AgentRegistryConnection::SearchMcpServers( + google::cloud::agentregistry::v1:: + SearchMcpServersRequest) { // NOLINT(performance-unnecessary-value-param) + return google::cloud::internal::MakeUnimplementedPaginationRange< + StreamRange>(); +} + +StatusOr +AgentRegistryConnection::GetMcpServer( + google::cloud::agentregistry::v1::GetMcpServerRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +StreamRange +AgentRegistryConnection::ListServices( + google::cloud::agentregistry::v1:: + ListServicesRequest) { // NOLINT(performance-unnecessary-value-param) + return google::cloud::internal::MakeUnimplementedPaginationRange< + StreamRange>(); +} + +StatusOr +AgentRegistryConnection::GetService( + google::cloud::agentregistry::v1::GetServiceRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +future> +AgentRegistryConnection::CreateService( + google::cloud::agentregistry::v1::CreateServiceRequest const&) { + return google::cloud::make_ready_future< + StatusOr>( + Status(StatusCode::kUnimplemented, "not implemented")); +} + +StatusOr AgentRegistryConnection::CreateService( + NoAwaitTag, google::cloud::agentregistry::v1::CreateServiceRequest const&) { + return StatusOr( + Status(StatusCode::kUnimplemented, "not implemented")); +} + +future> +AgentRegistryConnection::CreateService(google::longrunning::Operation const&) { + return google::cloud::make_ready_future< + StatusOr>( + Status(StatusCode::kUnimplemented, "not implemented")); +} + +future> +AgentRegistryConnection::UpdateService( + google::cloud::agentregistry::v1::UpdateServiceRequest const&) { + return google::cloud::make_ready_future< + StatusOr>( + Status(StatusCode::kUnimplemented, "not implemented")); +} + +StatusOr AgentRegistryConnection::UpdateService( + NoAwaitTag, google::cloud::agentregistry::v1::UpdateServiceRequest const&) { + return StatusOr( + Status(StatusCode::kUnimplemented, "not implemented")); +} + +future> +AgentRegistryConnection::UpdateService(google::longrunning::Operation const&) { + return google::cloud::make_ready_future< + StatusOr>( + Status(StatusCode::kUnimplemented, "not implemented")); +} + +future> +AgentRegistryConnection::DeleteService( + google::cloud::agentregistry::v1::DeleteServiceRequest const&) { + return google::cloud::make_ready_future< + StatusOr>( + Status(StatusCode::kUnimplemented, "not implemented")); +} + +StatusOr AgentRegistryConnection::DeleteService( + NoAwaitTag, google::cloud::agentregistry::v1::DeleteServiceRequest const&) { + return StatusOr( + Status(StatusCode::kUnimplemented, "not implemented")); +} + +future> +AgentRegistryConnection::DeleteService(google::longrunning::Operation const&) { + return google::cloud::make_ready_future< + StatusOr>( + Status(StatusCode::kUnimplemented, "not implemented")); +} + +StreamRange +AgentRegistryConnection::ListBindings( + google::cloud::agentregistry::v1:: + ListBindingsRequest) { // NOLINT(performance-unnecessary-value-param) + return google::cloud::internal::MakeUnimplementedPaginationRange< + StreamRange>(); +} + +StatusOr +AgentRegistryConnection::GetBinding( + google::cloud::agentregistry::v1::GetBindingRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +future> +AgentRegistryConnection::CreateBinding( + google::cloud::agentregistry::v1::CreateBindingRequest const&) { + return google::cloud::make_ready_future< + StatusOr>( + Status(StatusCode::kUnimplemented, "not implemented")); +} + +StatusOr AgentRegistryConnection::CreateBinding( + NoAwaitTag, google::cloud::agentregistry::v1::CreateBindingRequest const&) { + return StatusOr( + Status(StatusCode::kUnimplemented, "not implemented")); +} + +future> +AgentRegistryConnection::CreateBinding(google::longrunning::Operation const&) { + return google::cloud::make_ready_future< + StatusOr>( + Status(StatusCode::kUnimplemented, "not implemented")); +} + +future> +AgentRegistryConnection::UpdateBinding( + google::cloud::agentregistry::v1::UpdateBindingRequest const&) { + return google::cloud::make_ready_future< + StatusOr>( + Status(StatusCode::kUnimplemented, "not implemented")); +} + +StatusOr AgentRegistryConnection::UpdateBinding( + NoAwaitTag, google::cloud::agentregistry::v1::UpdateBindingRequest const&) { + return StatusOr( + Status(StatusCode::kUnimplemented, "not implemented")); +} + +future> +AgentRegistryConnection::UpdateBinding(google::longrunning::Operation const&) { + return google::cloud::make_ready_future< + StatusOr>( + Status(StatusCode::kUnimplemented, "not implemented")); +} + +future> +AgentRegistryConnection::DeleteBinding( + google::cloud::agentregistry::v1::DeleteBindingRequest const&) { + return google::cloud::make_ready_future< + StatusOr>( + Status(StatusCode::kUnimplemented, "not implemented")); +} + +StatusOr AgentRegistryConnection::DeleteBinding( + NoAwaitTag, google::cloud::agentregistry::v1::DeleteBindingRequest const&) { + return StatusOr( + Status(StatusCode::kUnimplemented, "not implemented")); +} + +future> +AgentRegistryConnection::DeleteBinding(google::longrunning::Operation const&) { + return google::cloud::make_ready_future< + StatusOr>( + Status(StatusCode::kUnimplemented, "not implemented")); +} + +StreamRange +AgentRegistryConnection::FetchAvailableBindings( + google::cloud::agentregistry::v1:: + FetchAvailableBindingsRequest) { // NOLINT(performance-unnecessary-value-param) + return google::cloud::internal::MakeUnimplementedPaginationRange< + StreamRange>(); +} + +StreamRange +AgentRegistryConnection::ListLocations( + google::cloud::location:: + ListLocationsRequest) { // NOLINT(performance-unnecessary-value-param) + return google::cloud::internal::MakeUnimplementedPaginationRange< + StreamRange>(); +} + +StatusOr +AgentRegistryConnection::GetLocation( + google::cloud::location::GetLocationRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +StreamRange +AgentRegistryConnection::ListOperations( + google::longrunning:: + ListOperationsRequest) { // NOLINT(performance-unnecessary-value-param) + return google::cloud::internal::MakeUnimplementedPaginationRange< + StreamRange>(); +} + +StatusOr AgentRegistryConnection::GetOperation( + google::longrunning::GetOperationRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +Status AgentRegistryConnection::DeleteOperation( + google::longrunning::DeleteOperationRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +Status AgentRegistryConnection::CancelOperation( + google::longrunning::CancelOperationRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +std::shared_ptr MakeAgentRegistryConnection( + Options options) { + internal::CheckExpectedOptions(options, + __func__); + options = agentregistry_v1_internal::AgentRegistryDefaultOptions( + std::move(options)); + auto background = internal::MakeBackgroundThreadsFactory(options)(); + auto auth = internal::CreateAuthenticationStrategy(background->cq(), options); + auto stub = agentregistry_v1_internal::CreateDefaultAgentRegistryStub( + std::move(auth), options); + return agentregistry_v1_internal::MakeAgentRegistryTracingConnection( + std::make_shared( + std::move(background), std::move(stub), std::move(options))); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentregistry_v1 +} // namespace cloud +} // namespace google diff --git a/google/cloud/agentregistry/v1/agent_registry_connection.h b/google/cloud/agentregistry/v1/agent_registry_connection.h new file mode 100644 index 0000000000000..9c0e428519f17 --- /dev/null +++ b/google/cloud/agentregistry/v1/agent_registry_connection.h @@ -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/agentregistry/v1/agentregistry_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_AGENT_REGISTRY_CONNECTION_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_AGENT_REGISTRY_CONNECTION_H + +#include "google/cloud/agentregistry/v1/agent_registry_connection_idempotency_policy.h" +#include "google/cloud/agentregistry/v1/agentregistry_service.pb.h" +#include "google/cloud/agentregistry/v1/internal/agent_registry_retry_traits.h" +#include "google/cloud/backoff_policy.h" +#include "google/cloud/future.h" +#include "google/cloud/internal/retry_policy_impl.h" +#include "google/cloud/no_await_tag.h" +#include "google/cloud/options.h" +#include "google/cloud/polling_policy.h" +#include "google/cloud/status_or.h" +#include "google/cloud/stream_range.h" +#include "google/cloud/version.h" +#include "google/longrunning/operations.grpc.pb.h" +#include + +namespace google { +namespace cloud { +namespace agentregistry_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +/// The retry policy for `AgentRegistryConnection`. +class AgentRegistryRetryPolicy : 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 `AgentRegistryConnection` 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 AgentRegistryLimitedErrorCountRetryPolicy + : public AgentRegistryRetryPolicy { + 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 AgentRegistryLimitedErrorCountRetryPolicy(int maximum_failures) + : impl_(maximum_failures) {} + + AgentRegistryLimitedErrorCountRetryPolicy( + AgentRegistryLimitedErrorCountRetryPolicy&& rhs) noexcept + : AgentRegistryLimitedErrorCountRetryPolicy(rhs.maximum_failures()) {} + AgentRegistryLimitedErrorCountRetryPolicy( + AgentRegistryLimitedErrorCountRetryPolicy const& rhs) noexcept + : AgentRegistryLimitedErrorCountRetryPolicy(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 = AgentRegistryRetryPolicy; + + private: + google::cloud::internal::LimitedErrorCountRetryPolicy< + agentregistry_v1_internal::AgentRegistryRetryTraits> + impl_; +}; + +/** + * A retry policy for `AgentRegistryConnection` 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 AgentRegistryLimitedTimeRetryPolicy : public AgentRegistryRetryPolicy { + 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 AgentRegistryLimitedTimeRetryPolicy( + std::chrono::duration maximum_duration) + : impl_(maximum_duration) {} + + AgentRegistryLimitedTimeRetryPolicy( + AgentRegistryLimitedTimeRetryPolicy&& rhs) noexcept + : AgentRegistryLimitedTimeRetryPolicy(rhs.maximum_duration()) {} + AgentRegistryLimitedTimeRetryPolicy( + AgentRegistryLimitedTimeRetryPolicy const& rhs) noexcept + : AgentRegistryLimitedTimeRetryPolicy(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 = AgentRegistryRetryPolicy; + + private: + google::cloud::internal::LimitedTimeRetryPolicy< + agentregistry_v1_internal::AgentRegistryRetryTraits> + impl_; +}; + +/** + * The `AgentRegistryConnection` object for `AgentRegistryClient`. + * + * This interface defines virtual methods for each of the user-facing overload + * sets in `AgentRegistryClient`. This allows users to inject custom behavior + * (e.g., with a Google Mock object) when writing tests that use objects of type + * `AgentRegistryClient`. + * + * To create a concrete instance, see `MakeAgentRegistryConnection()`. + * + * For mocking, see `agentregistry_v1_mocks::MockAgentRegistryConnection`. + */ +class AgentRegistryConnection { + public: + virtual ~AgentRegistryConnection() = 0; + + virtual Options options() { return Options{}; } + + virtual StreamRange ListAgents( + google::cloud::agentregistry::v1::ListAgentsRequest request); + + virtual StreamRange SearchAgents( + google::cloud::agentregistry::v1::SearchAgentsRequest request); + + virtual StatusOr GetAgent( + google::cloud::agentregistry::v1::GetAgentRequest const& request); + + virtual StreamRange ListEndpoints( + google::cloud::agentregistry::v1::ListEndpointsRequest request); + + virtual StatusOr GetEndpoint( + google::cloud::agentregistry::v1::GetEndpointRequest const& request); + + virtual StreamRange + ListMcpServers( + google::cloud::agentregistry::v1::ListMcpServersRequest request); + + virtual StreamRange + SearchMcpServers( + google::cloud::agentregistry::v1::SearchMcpServersRequest request); + + virtual StatusOr GetMcpServer( + google::cloud::agentregistry::v1::GetMcpServerRequest const& request); + + virtual StreamRange ListServices( + google::cloud::agentregistry::v1::ListServicesRequest request); + + virtual StatusOr GetService( + google::cloud::agentregistry::v1::GetServiceRequest const& request); + + virtual future> + CreateService( + google::cloud::agentregistry::v1::CreateServiceRequest const& request); + + virtual StatusOr CreateService( + NoAwaitTag, + google::cloud::agentregistry::v1::CreateServiceRequest const& request); + + virtual future> + CreateService(google::longrunning::Operation const& operation); + + virtual future> + UpdateService( + google::cloud::agentregistry::v1::UpdateServiceRequest const& request); + + virtual StatusOr UpdateService( + NoAwaitTag, + google::cloud::agentregistry::v1::UpdateServiceRequest const& request); + + virtual future> + UpdateService(google::longrunning::Operation const& operation); + + virtual future> + DeleteService( + google::cloud::agentregistry::v1::DeleteServiceRequest const& request); + + virtual StatusOr DeleteService( + NoAwaitTag, + google::cloud::agentregistry::v1::DeleteServiceRequest const& request); + + virtual future> + DeleteService(google::longrunning::Operation const& operation); + + virtual StreamRange ListBindings( + google::cloud::agentregistry::v1::ListBindingsRequest request); + + virtual StatusOr GetBinding( + google::cloud::agentregistry::v1::GetBindingRequest const& request); + + virtual future> + CreateBinding( + google::cloud::agentregistry::v1::CreateBindingRequest const& request); + + virtual StatusOr CreateBinding( + NoAwaitTag, + google::cloud::agentregistry::v1::CreateBindingRequest const& request); + + virtual future> + CreateBinding(google::longrunning::Operation const& operation); + + virtual future> + UpdateBinding( + google::cloud::agentregistry::v1::UpdateBindingRequest const& request); + + virtual StatusOr UpdateBinding( + NoAwaitTag, + google::cloud::agentregistry::v1::UpdateBindingRequest const& request); + + virtual future> + UpdateBinding(google::longrunning::Operation const& operation); + + virtual future> + DeleteBinding( + google::cloud::agentregistry::v1::DeleteBindingRequest const& request); + + virtual StatusOr DeleteBinding( + NoAwaitTag, + google::cloud::agentregistry::v1::DeleteBindingRequest const& request); + + virtual future> + DeleteBinding(google::longrunning::Operation const& operation); + + virtual StreamRange + FetchAvailableBindings( + google::cloud::agentregistry::v1::FetchAvailableBindingsRequest request); + + virtual StreamRange ListLocations( + google::cloud::location::ListLocationsRequest request); + + virtual StatusOr GetLocation( + google::cloud::location::GetLocationRequest const& request); + + virtual StreamRange ListOperations( + google::longrunning::ListOperationsRequest request); + + virtual StatusOr GetOperation( + google::longrunning::GetOperationRequest const& request); + + virtual Status DeleteOperation( + google::longrunning::DeleteOperationRequest const& request); + + virtual Status CancelOperation( + google::longrunning::CancelOperationRequest const& request); +}; + +/** + * A factory function to construct an object of type `AgentRegistryConnection`. + * + * The returned connection object should not be used directly; instead it + * should be passed as an argument to the constructor of AgentRegistryClient. + * + * The optional @p options argument may be used to configure aspects of the + * returned `AgentRegistryConnection`. Expected options are any of the types in + * the following option lists: + * + * - `google::cloud::CommonOptionList` + * - `google::cloud::GrpcOptionList` + * - `google::cloud::UnifiedCredentialsOptionList` + * - `google::cloud::agentregistry_v1::AgentRegistryPolicyOptionList` + * + * @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 `AgentRegistryConnection` created by + * this function. + */ +std::shared_ptr MakeAgentRegistryConnection( + Options options = {}); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentregistry_v1 +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_AGENT_REGISTRY_CONNECTION_H diff --git a/google/cloud/agentregistry/v1/agent_registry_connection_idempotency_policy.cc b/google/cloud/agentregistry/v1/agent_registry_connection_idempotency_policy.cc new file mode 100644 index 0000000000000..3b33cc47baffb --- /dev/null +++ b/google/cloud/agentregistry/v1/agent_registry_connection_idempotency_policy.cc @@ -0,0 +1,171 @@ +// 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/agentregistry/v1/agentregistry_service.proto + +#include "google/cloud/agentregistry/v1/agent_registry_connection_idempotency_policy.h" +#include + +namespace google { +namespace cloud { +namespace agentregistry_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +using ::google::cloud::Idempotency; + +AgentRegistryConnectionIdempotencyPolicy:: + ~AgentRegistryConnectionIdempotencyPolicy() = default; + +std::unique_ptr +AgentRegistryConnectionIdempotencyPolicy::clone() const { + return std::make_unique(*this); +} + +Idempotency AgentRegistryConnectionIdempotencyPolicy::ListAgents( + google::cloud::agentregistry::v1::ListAgentsRequest) { // NOLINT + return Idempotency::kIdempotent; +} + +Idempotency AgentRegistryConnectionIdempotencyPolicy::SearchAgents( + google::cloud::agentregistry::v1::SearchAgentsRequest) { // NOLINT + return Idempotency::kNonIdempotent; +} + +Idempotency AgentRegistryConnectionIdempotencyPolicy::GetAgent( + google::cloud::agentregistry::v1::GetAgentRequest const&) { + return Idempotency::kIdempotent; +} + +Idempotency AgentRegistryConnectionIdempotencyPolicy::ListEndpoints( + google::cloud::agentregistry::v1::ListEndpointsRequest) { // NOLINT + return Idempotency::kIdempotent; +} + +Idempotency AgentRegistryConnectionIdempotencyPolicy::GetEndpoint( + google::cloud::agentregistry::v1::GetEndpointRequest const&) { + return Idempotency::kIdempotent; +} + +Idempotency AgentRegistryConnectionIdempotencyPolicy::ListMcpServers( + google::cloud::agentregistry::v1::ListMcpServersRequest) { // NOLINT + return Idempotency::kIdempotent; +} + +Idempotency AgentRegistryConnectionIdempotencyPolicy::SearchMcpServers( + google::cloud::agentregistry::v1::SearchMcpServersRequest) { // NOLINT + return Idempotency::kNonIdempotent; +} + +Idempotency AgentRegistryConnectionIdempotencyPolicy::GetMcpServer( + google::cloud::agentregistry::v1::GetMcpServerRequest const&) { + return Idempotency::kIdempotent; +} + +Idempotency AgentRegistryConnectionIdempotencyPolicy::ListServices( + google::cloud::agentregistry::v1::ListServicesRequest) { // NOLINT + return Idempotency::kIdempotent; +} + +Idempotency AgentRegistryConnectionIdempotencyPolicy::GetService( + google::cloud::agentregistry::v1::GetServiceRequest const&) { + return Idempotency::kIdempotent; +} + +Idempotency AgentRegistryConnectionIdempotencyPolicy::CreateService( + google::cloud::agentregistry::v1::CreateServiceRequest const&) { + return Idempotency::kNonIdempotent; +} + +Idempotency AgentRegistryConnectionIdempotencyPolicy::UpdateService( + google::cloud::agentregistry::v1::UpdateServiceRequest const&) { + return Idempotency::kNonIdempotent; +} + +Idempotency AgentRegistryConnectionIdempotencyPolicy::DeleteService( + google::cloud::agentregistry::v1::DeleteServiceRequest const&) { + return Idempotency::kNonIdempotent; +} + +Idempotency AgentRegistryConnectionIdempotencyPolicy::ListBindings( + google::cloud::agentregistry::v1::ListBindingsRequest) { // NOLINT + return Idempotency::kIdempotent; +} + +Idempotency AgentRegistryConnectionIdempotencyPolicy::GetBinding( + google::cloud::agentregistry::v1::GetBindingRequest const&) { + return Idempotency::kIdempotent; +} + +Idempotency AgentRegistryConnectionIdempotencyPolicy::CreateBinding( + google::cloud::agentregistry::v1::CreateBindingRequest const&) { + return Idempotency::kNonIdempotent; +} + +Idempotency AgentRegistryConnectionIdempotencyPolicy::UpdateBinding( + google::cloud::agentregistry::v1::UpdateBindingRequest const&) { + return Idempotency::kNonIdempotent; +} + +Idempotency AgentRegistryConnectionIdempotencyPolicy::DeleteBinding( + google::cloud::agentregistry::v1::DeleteBindingRequest const&) { + return Idempotency::kNonIdempotent; +} + +Idempotency AgentRegistryConnectionIdempotencyPolicy::FetchAvailableBindings( + google::cloud::agentregistry::v1:: + FetchAvailableBindingsRequest) { // NOLINT + return Idempotency::kIdempotent; +} + +Idempotency AgentRegistryConnectionIdempotencyPolicy::ListLocations( + google::cloud::location::ListLocationsRequest) { // NOLINT + return Idempotency::kIdempotent; +} + +Idempotency AgentRegistryConnectionIdempotencyPolicy::GetLocation( + google::cloud::location::GetLocationRequest const&) { + return Idempotency::kIdempotent; +} + +Idempotency AgentRegistryConnectionIdempotencyPolicy::ListOperations( + google::longrunning::ListOperationsRequest) { // NOLINT + return Idempotency::kIdempotent; +} + +Idempotency AgentRegistryConnectionIdempotencyPolicy::GetOperation( + google::longrunning::GetOperationRequest const&) { + return Idempotency::kIdempotent; +} + +Idempotency AgentRegistryConnectionIdempotencyPolicy::DeleteOperation( + google::longrunning::DeleteOperationRequest const&) { + return Idempotency::kNonIdempotent; +} + +Idempotency AgentRegistryConnectionIdempotencyPolicy::CancelOperation( + google::longrunning::CancelOperationRequest const&) { + return Idempotency::kNonIdempotent; +} + +std::unique_ptr +MakeDefaultAgentRegistryConnectionIdempotencyPolicy() { + return std::make_unique(); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentregistry_v1 +} // namespace cloud +} // namespace google diff --git a/google/cloud/agentregistry/v1/agent_registry_connection_idempotency_policy.h b/google/cloud/agentregistry/v1/agent_registry_connection_idempotency_policy.h new file mode 100644 index 0000000000000..e719c8582995c --- /dev/null +++ b/google/cloud/agentregistry/v1/agent_registry_connection_idempotency_policy.h @@ -0,0 +1,126 @@ +// 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/agentregistry/v1/agentregistry_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_AGENT_REGISTRY_CONNECTION_IDEMPOTENCY_POLICY_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_AGENT_REGISTRY_CONNECTION_IDEMPOTENCY_POLICY_H + +#include "google/cloud/agentregistry/v1/agentregistry_service.grpc.pb.h" +#include "google/cloud/location/locations.grpc.pb.h" +#include "google/cloud/idempotency.h" +#include "google/cloud/version.h" +#include "google/longrunning/operations.grpc.pb.h" +#include + +namespace google { +namespace cloud { +namespace agentregistry_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class AgentRegistryConnectionIdempotencyPolicy { + public: + virtual ~AgentRegistryConnectionIdempotencyPolicy(); + + /// Create a new copy of this object. + virtual std::unique_ptr clone() + const; + + virtual google::cloud::Idempotency ListAgents( + google::cloud::agentregistry::v1::ListAgentsRequest request); + + virtual google::cloud::Idempotency SearchAgents( + google::cloud::agentregistry::v1::SearchAgentsRequest request); + + virtual google::cloud::Idempotency GetAgent( + google::cloud::agentregistry::v1::GetAgentRequest const& request); + + virtual google::cloud::Idempotency ListEndpoints( + google::cloud::agentregistry::v1::ListEndpointsRequest request); + + virtual google::cloud::Idempotency GetEndpoint( + google::cloud::agentregistry::v1::GetEndpointRequest const& request); + + virtual google::cloud::Idempotency ListMcpServers( + google::cloud::agentregistry::v1::ListMcpServersRequest request); + + virtual google::cloud::Idempotency SearchMcpServers( + google::cloud::agentregistry::v1::SearchMcpServersRequest request); + + virtual google::cloud::Idempotency GetMcpServer( + google::cloud::agentregistry::v1::GetMcpServerRequest const& request); + + virtual google::cloud::Idempotency ListServices( + google::cloud::agentregistry::v1::ListServicesRequest request); + + virtual google::cloud::Idempotency GetService( + google::cloud::agentregistry::v1::GetServiceRequest const& request); + + virtual google::cloud::Idempotency CreateService( + google::cloud::agentregistry::v1::CreateServiceRequest const& request); + + virtual google::cloud::Idempotency UpdateService( + google::cloud::agentregistry::v1::UpdateServiceRequest const& request); + + virtual google::cloud::Idempotency DeleteService( + google::cloud::agentregistry::v1::DeleteServiceRequest const& request); + + virtual google::cloud::Idempotency ListBindings( + google::cloud::agentregistry::v1::ListBindingsRequest request); + + virtual google::cloud::Idempotency GetBinding( + google::cloud::agentregistry::v1::GetBindingRequest const& request); + + virtual google::cloud::Idempotency CreateBinding( + google::cloud::agentregistry::v1::CreateBindingRequest const& request); + + virtual google::cloud::Idempotency UpdateBinding( + google::cloud::agentregistry::v1::UpdateBindingRequest const& request); + + virtual google::cloud::Idempotency DeleteBinding( + google::cloud::agentregistry::v1::DeleteBindingRequest const& request); + + virtual google::cloud::Idempotency FetchAvailableBindings( + google::cloud::agentregistry::v1::FetchAvailableBindingsRequest 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 ListOperations( + google::longrunning::ListOperationsRequest request); + + virtual google::cloud::Idempotency GetOperation( + google::longrunning::GetOperationRequest const& request); + + virtual google::cloud::Idempotency DeleteOperation( + google::longrunning::DeleteOperationRequest const& request); + + virtual google::cloud::Idempotency CancelOperation( + google::longrunning::CancelOperationRequest const& request); +}; + +std::unique_ptr +MakeDefaultAgentRegistryConnectionIdempotencyPolicy(); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentregistry_v1 +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_AGENT_REGISTRY_CONNECTION_IDEMPOTENCY_POLICY_H diff --git a/google/cloud/agentregistry/v1/agent_registry_options.h b/google/cloud/agentregistry/v1/agent_registry_options.h new file mode 100644 index 0000000000000..53f7da8f32452 --- /dev/null +++ b/google/cloud/agentregistry/v1/agent_registry_options.h @@ -0,0 +1,86 @@ +// 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/agentregistry/v1/agentregistry_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_AGENT_REGISTRY_OPTIONS_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_AGENT_REGISTRY_OPTIONS_H + +#include "google/cloud/agentregistry/v1/agent_registry_connection.h" +#include "google/cloud/agentregistry/v1/agent_registry_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 agentregistry_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +/** + * Use with `google::cloud::Options` to configure the retry policy. + * + * @ingroup google-cloud-agentregistry-options + */ +struct AgentRegistryRetryPolicyOption { + using Type = std::shared_ptr; +}; + +/** + * Use with `google::cloud::Options` to configure the backoff policy. + * + * @ingroup google-cloud-agentregistry-options + */ +struct AgentRegistryBackoffPolicyOption { + using Type = std::shared_ptr; +}; + +/** + * Use with `google::cloud::Options` to configure which operations are retried. + * + * @ingroup google-cloud-agentregistry-options + */ +struct AgentRegistryConnectionIdempotencyPolicyOption { + using Type = std::shared_ptr; +}; + +/** + * Use with `google::cloud::Options` to configure the long-running operations + * polling policy. + * + * @ingroup google-cloud-agentregistry-options + */ +struct AgentRegistryPollingPolicyOption { + using Type = std::shared_ptr; +}; + +/** + * The options applicable to AgentRegistry. + * + * @ingroup google-cloud-agentregistry-options + */ +using AgentRegistryPolicyOptionList = + OptionList; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentregistry_v1 +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_AGENT_REGISTRY_OPTIONS_H diff --git a/google/cloud/agentregistry/v1/internal/agent_registry_auth_decorator.cc b/google/cloud/agentregistry/v1/internal/agent_registry_auth_decorator.cc new file mode 100644 index 0000000000000..fb95eaa9e25de --- /dev/null +++ b/google/cloud/agentregistry/v1/internal/agent_registry_auth_decorator.cc @@ -0,0 +1,413 @@ +// 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/agentregistry/v1/agentregistry_service.proto + +#include "google/cloud/agentregistry/v1/internal/agent_registry_auth_decorator.h" +#include "google/cloud/agentregistry/v1/agentregistry_service.grpc.pb.h" +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace agentregistry_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +AgentRegistryAuth::AgentRegistryAuth( + std::shared_ptr auth, + std::shared_ptr child) + : auth_(std::move(auth)), child_(std::move(child)) {} + +StatusOr +AgentRegistryAuth::ListAgents( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListAgentsRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->ListAgents(context, options, request); +} + +StatusOr +AgentRegistryAuth::SearchAgents( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::SearchAgentsRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->SearchAgents(context, options, request); +} + +StatusOr AgentRegistryAuth::GetAgent( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetAgentRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->GetAgent(context, options, request); +} + +StatusOr +AgentRegistryAuth::ListEndpoints( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListEndpointsRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->ListEndpoints(context, options, request); +} + +StatusOr +AgentRegistryAuth::GetEndpoint( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetEndpointRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->GetEndpoint(context, options, request); +} + +StatusOr +AgentRegistryAuth::ListMcpServers( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListMcpServersRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->ListMcpServers(context, options, request); +} + +StatusOr +AgentRegistryAuth::SearchMcpServers( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::SearchMcpServersRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->SearchMcpServers(context, options, request); +} + +StatusOr +AgentRegistryAuth::GetMcpServer( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetMcpServerRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->GetMcpServer(context, options, request); +} + +StatusOr +AgentRegistryAuth::ListServices( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListServicesRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->ListServices(context, options, request); +} + +StatusOr +AgentRegistryAuth::GetService( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetServiceRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->GetService(context, options, request); +} + +future> +AgentRegistryAuth::AsyncCreateService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::CreateServiceRequest const& request) { + using ReturnType = StatusOr; + return auth_->AsyncConfigureContext(std::move(context)) + .then([cq, child = child_, options = std::move(options), + request](future>> + f) mutable { + auto context = f.get(); + if (!context) { + return make_ready_future(ReturnType(std::move(context).status())); + } + return child->AsyncCreateService(cq, *std::move(context), + std::move(options), request); + }); +} + +StatusOr AgentRegistryAuth::CreateService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::CreateServiceRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->CreateService(context, options, request); +} + +future> +AgentRegistryAuth::AsyncUpdateService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::UpdateServiceRequest const& request) { + using ReturnType = StatusOr; + return auth_->AsyncConfigureContext(std::move(context)) + .then([cq, child = child_, options = std::move(options), + request](future>> + f) mutable { + auto context = f.get(); + if (!context) { + return make_ready_future(ReturnType(std::move(context).status())); + } + return child->AsyncUpdateService(cq, *std::move(context), + std::move(options), request); + }); +} + +StatusOr AgentRegistryAuth::UpdateService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::UpdateServiceRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->UpdateService(context, options, request); +} + +future> +AgentRegistryAuth::AsyncDeleteService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::DeleteServiceRequest const& request) { + using ReturnType = StatusOr; + return auth_->AsyncConfigureContext(std::move(context)) + .then([cq, child = child_, options = std::move(options), + request](future>> + f) mutable { + auto context = f.get(); + if (!context) { + return make_ready_future(ReturnType(std::move(context).status())); + } + return child->AsyncDeleteService(cq, *std::move(context), + std::move(options), request); + }); +} + +StatusOr AgentRegistryAuth::DeleteService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::DeleteServiceRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->DeleteService(context, options, request); +} + +StatusOr +AgentRegistryAuth::ListBindings( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListBindingsRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->ListBindings(context, options, request); +} + +StatusOr +AgentRegistryAuth::GetBinding( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetBindingRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->GetBinding(context, options, request); +} + +future> +AgentRegistryAuth::AsyncCreateBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::CreateBindingRequest const& request) { + using ReturnType = StatusOr; + return auth_->AsyncConfigureContext(std::move(context)) + .then([cq, child = child_, options = std::move(options), + request](future>> + f) mutable { + auto context = f.get(); + if (!context) { + return make_ready_future(ReturnType(std::move(context).status())); + } + return child->AsyncCreateBinding(cq, *std::move(context), + std::move(options), request); + }); +} + +StatusOr AgentRegistryAuth::CreateBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::CreateBindingRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->CreateBinding(context, options, request); +} + +future> +AgentRegistryAuth::AsyncUpdateBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::UpdateBindingRequest const& request) { + using ReturnType = StatusOr; + return auth_->AsyncConfigureContext(std::move(context)) + .then([cq, child = child_, options = std::move(options), + request](future>> + f) mutable { + auto context = f.get(); + if (!context) { + return make_ready_future(ReturnType(std::move(context).status())); + } + return child->AsyncUpdateBinding(cq, *std::move(context), + std::move(options), request); + }); +} + +StatusOr AgentRegistryAuth::UpdateBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::UpdateBindingRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->UpdateBinding(context, options, request); +} + +future> +AgentRegistryAuth::AsyncDeleteBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::DeleteBindingRequest const& request) { + using ReturnType = StatusOr; + return auth_->AsyncConfigureContext(std::move(context)) + .then([cq, child = child_, options = std::move(options), + request](future>> + f) mutable { + auto context = f.get(); + if (!context) { + return make_ready_future(ReturnType(std::move(context).status())); + } + return child->AsyncDeleteBinding(cq, *std::move(context), + std::move(options), request); + }); +} + +StatusOr AgentRegistryAuth::DeleteBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::DeleteBindingRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->DeleteBinding(context, options, request); +} + +StatusOr +AgentRegistryAuth::FetchAvailableBindings( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::FetchAvailableBindingsRequest const& + request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->FetchAvailableBindings(context, options, request); +} + +StatusOr +AgentRegistryAuth::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 AgentRegistryAuth::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 +AgentRegistryAuth::ListOperations( + grpc::ClientContext& context, Options const& options, + google::longrunning::ListOperationsRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->ListOperations(context, options, request); +} + +StatusOr AgentRegistryAuth::GetOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::GetOperationRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->GetOperation(context, options, request); +} + +Status AgentRegistryAuth::DeleteOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::DeleteOperationRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->DeleteOperation(context, options, request); +} + +Status AgentRegistryAuth::CancelOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::CancelOperationRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->CancelOperation(context, options, request); +} + +future> +AgentRegistryAuth::AsyncGetOperation( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::GetOperationRequest const& request) { + using ReturnType = StatusOr; + return auth_->AsyncConfigureContext(std::move(context)) + .then([cq, child = child_, options = std::move(options), + request](future>> + f) mutable { + auto context = f.get(); + if (!context) { + return make_ready_future(ReturnType(std::move(context).status())); + } + return child->AsyncGetOperation(cq, *std::move(context), + std::move(options), request); + }); +} + +future AgentRegistryAuth::AsyncCancelOperation( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::CancelOperationRequest const& request) { + return auth_->AsyncConfigureContext(std::move(context)) + .then([cq, child = child_, options = std::move(options), + request](future>> + f) mutable { + auto context = f.get(); + if (!context) return make_ready_future(std::move(context).status()); + return child->AsyncCancelOperation(cq, *std::move(context), + std::move(options), request); + }); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentregistry_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" diff --git a/google/cloud/agentregistry/v1/internal/agent_registry_auth_decorator.h b/google/cloud/agentregistry/v1/internal/agent_registry_auth_decorator.h new file mode 100644 index 0000000000000..9ad9ebcd78067 --- /dev/null +++ b/google/cloud/agentregistry/v1/internal/agent_registry_auth_decorator.h @@ -0,0 +1,232 @@ +// 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/agentregistry/v1/agentregistry_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_AUTH_DECORATOR_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_AUTH_DECORATOR_H + +#include "google/cloud/agentregistry/v1/internal/agent_registry_stub.h" +#include "google/cloud/internal/unified_grpc_credentials.h" +#include "google/cloud/version.h" +#include "google/longrunning/operations.grpc.pb.h" +#include +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace agentregistry_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class AgentRegistryAuth : public AgentRegistryStub { + public: + ~AgentRegistryAuth() override = default; + AgentRegistryAuth( + std::shared_ptr auth, + std::shared_ptr child); + + StatusOr ListAgents( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListAgentsRequest const& request) + override; + + StatusOr SearchAgents( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::SearchAgentsRequest const& request) + override; + + StatusOr GetAgent( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetAgentRequest const& request) + override; + + StatusOr + ListEndpoints(grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListEndpointsRequest const& + request) override; + + StatusOr GetEndpoint( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetEndpointRequest const& request) + override; + + StatusOr + ListMcpServers(grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListMcpServersRequest const& + request) override; + + StatusOr + SearchMcpServers( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::SearchMcpServersRequest const& request) + override; + + StatusOr GetMcpServer( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetMcpServerRequest const& request) + override; + + StatusOr ListServices( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListServicesRequest const& request) + override; + + StatusOr GetService( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetServiceRequest const& request) + override; + + future> AsyncCreateService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::CreateServiceRequest const& request) + override; + + StatusOr CreateService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::CreateServiceRequest const& request) + override; + + future> AsyncUpdateService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::UpdateServiceRequest const& request) + override; + + StatusOr UpdateService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::UpdateServiceRequest const& request) + override; + + future> AsyncDeleteService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::DeleteServiceRequest const& request) + override; + + StatusOr DeleteService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::DeleteServiceRequest const& request) + override; + + StatusOr ListBindings( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListBindingsRequest const& request) + override; + + StatusOr GetBinding( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetBindingRequest const& request) + override; + + future> AsyncCreateBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::CreateBindingRequest const& request) + override; + + StatusOr CreateBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::CreateBindingRequest const& request) + override; + + future> AsyncUpdateBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::UpdateBindingRequest const& request) + override; + + StatusOr UpdateBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::UpdateBindingRequest const& request) + override; + + future> AsyncDeleteBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::DeleteBindingRequest const& request) + override; + + StatusOr DeleteBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::DeleteBindingRequest const& request) + override; + + StatusOr + FetchAvailableBindings( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::FetchAvailableBindingsRequest 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 ListOperations( + grpc::ClientContext& context, Options const& options, + google::longrunning::ListOperationsRequest const& request) override; + + StatusOr GetOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::GetOperationRequest const& request) override; + + Status DeleteOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::DeleteOperationRequest const& request) override; + + Status CancelOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::CancelOperationRequest const& request) override; + + future> AsyncGetOperation( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::GetOperationRequest const& request) override; + + future AsyncCancelOperation( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::CancelOperationRequest const& request) override; + + private: + std::shared_ptr auth_; + std::shared_ptr child_; +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentregistry_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_AUTH_DECORATOR_H diff --git a/google/cloud/agentregistry/v1/internal/agent_registry_connection_impl.cc b/google/cloud/agentregistry/v1/internal/agent_registry_connection_impl.cc new file mode 100644 index 0000000000000..97f50333f7fbb --- /dev/null +++ b/google/cloud/agentregistry/v1/internal/agent_registry_connection_impl.cc @@ -0,0 +1,1108 @@ +// 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/agentregistry/v1/agentregistry_service.proto + +#include "google/cloud/agentregistry/v1/internal/agent_registry_connection_impl.h" +#include "google/cloud/agentregistry/v1/internal/agent_registry_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/async_long_running_operation.h" +#include "google/cloud/internal/pagination_range.h" +#include "google/cloud/internal/retry_loop.h" +#include +#include + +namespace google { +namespace cloud { +namespace agentregistry_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 +idempotency_policy(Options const& options) { + return options + .get() + ->clone(); +} + +std::unique_ptr polling_policy(Options const& options) { + return options.get() + ->clone(); +} + +} // namespace + +AgentRegistryConnectionImpl::AgentRegistryConnectionImpl( + std::unique_ptr background, + std::shared_ptr stub, + Options options) + : background_(std::move(background)), + stub_(std::move(stub)), + options_(internal::MergeOptions(std::move(options), + AgentRegistryConnection::options())) {} + +StreamRange +AgentRegistryConnectionImpl::ListAgents( + google::cloud::agentregistry::v1::ListAgentsRequest request) { + request.clear_page_token(); + auto current = google::cloud::internal::SaveCurrentOptions(); + auto idempotency = idempotency_policy(*current)->ListAgents(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::agentregistry::v1::ListAgentsRequest const& r) { + return google::cloud::internal::RetryLoop( + retry->clone(), backoff->clone(), idempotency, + [stub](grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListAgentsRequest const& + request) { + return stub->ListAgents(context, options, request); + }, + options, r, function_name); + }, + [](google::cloud::agentregistry::v1::ListAgentsResponse r) { + std::vector result( + r.agents().size()); + auto& messages = *r.mutable_agents(); + std::move(messages.begin(), messages.end(), result.begin()); + return result; + }); +} + +StreamRange +AgentRegistryConnectionImpl::SearchAgents( + google::cloud::agentregistry::v1::SearchAgentsRequest request) { + request.clear_page_token(); + auto current = google::cloud::internal::SaveCurrentOptions(); + auto idempotency = idempotency_policy(*current)->SearchAgents(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::agentregistry::v1::SearchAgentsRequest const& r) { + return google::cloud::internal::RetryLoop( + retry->clone(), backoff->clone(), idempotency, + [stub](grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::SearchAgentsRequest const& + request) { + return stub->SearchAgents(context, options, request); + }, + options, r, function_name); + }, + [](google::cloud::agentregistry::v1::SearchAgentsResponse r) { + std::vector result( + r.agents().size()); + auto& messages = *r.mutable_agents(); + std::move(messages.begin(), messages.end(), result.begin()); + return result; + }); +} + +StatusOr +AgentRegistryConnectionImpl::GetAgent( + google::cloud::agentregistry::v1::GetAgentRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->GetAgent(request), + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetAgentRequest const& request) { + return stub_->GetAgent(context, options, request); + }, + *current, request, __func__); +} + +StreamRange +AgentRegistryConnectionImpl::ListEndpoints( + google::cloud::agentregistry::v1::ListEndpointsRequest request) { + request.clear_page_token(); + auto current = google::cloud::internal::SaveCurrentOptions(); + auto idempotency = idempotency_policy(*current)->ListEndpoints(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::agentregistry::v1::ListEndpointsRequest const& r) { + return google::cloud::internal::RetryLoop( + retry->clone(), backoff->clone(), idempotency, + [stub](grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListEndpointsRequest const& + request) { + return stub->ListEndpoints(context, options, request); + }, + options, r, function_name); + }, + [](google::cloud::agentregistry::v1::ListEndpointsResponse r) { + std::vector result( + r.endpoints().size()); + auto& messages = *r.mutable_endpoints(); + std::move(messages.begin(), messages.end(), result.begin()); + return result; + }); +} + +StatusOr +AgentRegistryConnectionImpl::GetEndpoint( + google::cloud::agentregistry::v1::GetEndpointRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->GetEndpoint(request), + [this]( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetEndpointRequest const& request) { + return stub_->GetEndpoint(context, options, request); + }, + *current, request, __func__); +} + +StreamRange +AgentRegistryConnectionImpl::ListMcpServers( + google::cloud::agentregistry::v1::ListMcpServersRequest request) { + request.clear_page_token(); + auto current = google::cloud::internal::SaveCurrentOptions(); + auto idempotency = idempotency_policy(*current)->ListMcpServers(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::agentregistry::v1::ListMcpServersRequest const& r) { + return google::cloud::internal::RetryLoop( + retry->clone(), backoff->clone(), idempotency, + [stub]( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListMcpServersRequest const& + request) { + return stub->ListMcpServers(context, options, request); + }, + options, r, function_name); + }, + [](google::cloud::agentregistry::v1::ListMcpServersResponse r) { + std::vector result( + r.mcp_servers().size()); + auto& messages = *r.mutable_mcp_servers(); + std::move(messages.begin(), messages.end(), result.begin()); + return result; + }); +} + +StreamRange +AgentRegistryConnectionImpl::SearchMcpServers( + google::cloud::agentregistry::v1::SearchMcpServersRequest request) { + request.clear_page_token(); + auto current = google::cloud::internal::SaveCurrentOptions(); + auto idempotency = idempotency_policy(*current)->SearchMcpServers(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::agentregistry::v1::SearchMcpServersRequest const& r) { + return google::cloud::internal::RetryLoop( + retry->clone(), backoff->clone(), idempotency, + [stub]( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::SearchMcpServersRequest const& + request) { + return stub->SearchMcpServers(context, options, request); + }, + options, r, function_name); + }, + [](google::cloud::agentregistry::v1::SearchMcpServersResponse r) { + std::vector result( + r.mcp_servers().size()); + auto& messages = *r.mutable_mcp_servers(); + std::move(messages.begin(), messages.end(), result.begin()); + return result; + }); +} + +StatusOr +AgentRegistryConnectionImpl::GetMcpServer( + google::cloud::agentregistry::v1::GetMcpServerRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->GetMcpServer(request), + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetMcpServerRequest const& + request) { + return stub_->GetMcpServer(context, options, request); + }, + *current, request, __func__); +} + +StreamRange +AgentRegistryConnectionImpl::ListServices( + google::cloud::agentregistry::v1::ListServicesRequest request) { + request.clear_page_token(); + auto current = google::cloud::internal::SaveCurrentOptions(); + auto idempotency = idempotency_policy(*current)->ListServices(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::agentregistry::v1::ListServicesRequest const& r) { + return google::cloud::internal::RetryLoop( + retry->clone(), backoff->clone(), idempotency, + [stub](grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListServicesRequest const& + request) { + return stub->ListServices(context, options, request); + }, + options, r, function_name); + }, + [](google::cloud::agentregistry::v1::ListServicesResponse r) { + std::vector result( + r.services().size()); + auto& messages = *r.mutable_services(); + std::move(messages.begin(), messages.end(), result.begin()); + return result; + }); +} + +StatusOr +AgentRegistryConnectionImpl::GetService( + google::cloud::agentregistry::v1::GetServiceRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->GetService(request), + [this]( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetServiceRequest const& request) { + return stub_->GetService(context, options, request); + }, + *current, request, __func__); +} + +future> +AgentRegistryConnectionImpl::CreateService( + google::cloud::agentregistry::v1::CreateServiceRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + auto request_copy = request; + auto const idempotent = + idempotency_policy(*current)->CreateService(request_copy); + return google::cloud::internal::AsyncLongRunningOperation< + google::cloud::agentregistry::v1::Service>( + background_->cq(), current, std::move(request_copy), + [stub = stub_]( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::CreateServiceRequest const& + request) { + return stub->AsyncCreateService(cq, std::move(context), + std::move(options), request); + }, + [stub = stub_](google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::GetOperationRequest const& request) { + return stub->AsyncGetOperation(cq, std::move(context), + std::move(options), request); + }, + [stub = stub_]( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::CancelOperationRequest const& request) { + return stub->AsyncCancelOperation(cq, std::move(context), + std::move(options), request); + }, + &google::cloud::internal::ExtractLongRunningResultResponse< + google::cloud::agentregistry::v1::Service>, + retry_policy(*current), backoff_policy(*current), idempotent, + polling_policy(*current), __func__); +} + +StatusOr +AgentRegistryConnectionImpl::CreateService( + NoAwaitTag, + google::cloud::agentregistry::v1::CreateServiceRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->CreateService(request), + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::CreateServiceRequest const& + request) { + return stub_->CreateService(context, options, request); + }, + *current, request, __func__); +} + +future> +AgentRegistryConnectionImpl::CreateService( + google::longrunning::Operation const& operation) { + auto current = google::cloud::internal::SaveCurrentOptions(); + if (!operation.metadata() + .Is()) { + return make_ready_future< + StatusOr>( + internal::InvalidArgumentError( + "operation does not correspond to CreateService", + GCP_ERROR_INFO().WithMetadata("operation", + operation.metadata().DebugString()))); + } + + return google::cloud::internal::AsyncAwaitLongRunningOperation< + google::cloud::agentregistry::v1::Service>( + background_->cq(), current, operation, + [stub = stub_](google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::GetOperationRequest const& request) { + return stub->AsyncGetOperation(cq, std::move(context), + std::move(options), request); + }, + [stub = stub_]( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::CancelOperationRequest const& request) { + return stub->AsyncCancelOperation(cq, std::move(context), + std::move(options), request); + }, + &google::cloud::internal::ExtractLongRunningResultResponse< + google::cloud::agentregistry::v1::Service>, + polling_policy(*current), __func__); +} + +future> +AgentRegistryConnectionImpl::UpdateService( + google::cloud::agentregistry::v1::UpdateServiceRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + auto request_copy = request; + auto const idempotent = + idempotency_policy(*current)->UpdateService(request_copy); + return google::cloud::internal::AsyncLongRunningOperation< + google::cloud::agentregistry::v1::Service>( + background_->cq(), current, std::move(request_copy), + [stub = stub_]( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::UpdateServiceRequest const& + request) { + return stub->AsyncUpdateService(cq, std::move(context), + std::move(options), request); + }, + [stub = stub_](google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::GetOperationRequest const& request) { + return stub->AsyncGetOperation(cq, std::move(context), + std::move(options), request); + }, + [stub = stub_]( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::CancelOperationRequest const& request) { + return stub->AsyncCancelOperation(cq, std::move(context), + std::move(options), request); + }, + &google::cloud::internal::ExtractLongRunningResultResponse< + google::cloud::agentregistry::v1::Service>, + retry_policy(*current), backoff_policy(*current), idempotent, + polling_policy(*current), __func__); +} + +StatusOr +AgentRegistryConnectionImpl::UpdateService( + NoAwaitTag, + google::cloud::agentregistry::v1::UpdateServiceRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->UpdateService(request), + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::UpdateServiceRequest const& + request) { + return stub_->UpdateService(context, options, request); + }, + *current, request, __func__); +} + +future> +AgentRegistryConnectionImpl::UpdateService( + google::longrunning::Operation const& operation) { + auto current = google::cloud::internal::SaveCurrentOptions(); + if (!operation.metadata() + .Is()) { + return make_ready_future< + StatusOr>( + internal::InvalidArgumentError( + "operation does not correspond to UpdateService", + GCP_ERROR_INFO().WithMetadata("operation", + operation.metadata().DebugString()))); + } + + return google::cloud::internal::AsyncAwaitLongRunningOperation< + google::cloud::agentregistry::v1::Service>( + background_->cq(), current, operation, + [stub = stub_](google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::GetOperationRequest const& request) { + return stub->AsyncGetOperation(cq, std::move(context), + std::move(options), request); + }, + [stub = stub_]( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::CancelOperationRequest const& request) { + return stub->AsyncCancelOperation(cq, std::move(context), + std::move(options), request); + }, + &google::cloud::internal::ExtractLongRunningResultResponse< + google::cloud::agentregistry::v1::Service>, + polling_policy(*current), __func__); +} + +future> +AgentRegistryConnectionImpl::DeleteService( + google::cloud::agentregistry::v1::DeleteServiceRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + auto request_copy = request; + auto const idempotent = + idempotency_policy(*current)->DeleteService(request_copy); + return google::cloud::internal::AsyncLongRunningOperation< + google::cloud::agentregistry::v1::OperationMetadata>( + background_->cq(), current, std::move(request_copy), + [stub = stub_]( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::DeleteServiceRequest const& + request) { + return stub->AsyncDeleteService(cq, std::move(context), + std::move(options), request); + }, + [stub = stub_](google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::GetOperationRequest const& request) { + return stub->AsyncGetOperation(cq, std::move(context), + std::move(options), request); + }, + [stub = stub_]( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::CancelOperationRequest const& request) { + return stub->AsyncCancelOperation(cq, std::move(context), + std::move(options), request); + }, + &google::cloud::internal::ExtractLongRunningResultMetadata< + google::cloud::agentregistry::v1::OperationMetadata>, + retry_policy(*current), backoff_policy(*current), idempotent, + polling_policy(*current), __func__); +} + +StatusOr +AgentRegistryConnectionImpl::DeleteService( + NoAwaitTag, + google::cloud::agentregistry::v1::DeleteServiceRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->DeleteService(request), + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::DeleteServiceRequest const& + request) { + return stub_->DeleteService(context, options, request); + }, + *current, request, __func__); +} + +future> +AgentRegistryConnectionImpl::DeleteService( + google::longrunning::Operation const& operation) { + auto current = google::cloud::internal::SaveCurrentOptions(); + if (!operation.metadata() + .Is()) { + return make_ready_future< + StatusOr>( + internal::InvalidArgumentError( + "operation does not correspond to DeleteService", + GCP_ERROR_INFO().WithMetadata("operation", + operation.metadata().DebugString()))); + } + + return google::cloud::internal::AsyncAwaitLongRunningOperation< + google::cloud::agentregistry::v1::OperationMetadata>( + background_->cq(), current, operation, + [stub = stub_](google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::GetOperationRequest const& request) { + return stub->AsyncGetOperation(cq, std::move(context), + std::move(options), request); + }, + [stub = stub_]( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::CancelOperationRequest const& request) { + return stub->AsyncCancelOperation(cq, std::move(context), + std::move(options), request); + }, + &google::cloud::internal::ExtractLongRunningResultMetadata< + google::cloud::agentregistry::v1::OperationMetadata>, + polling_policy(*current), __func__); +} + +StreamRange +AgentRegistryConnectionImpl::ListBindings( + google::cloud::agentregistry::v1::ListBindingsRequest request) { + request.clear_page_token(); + auto current = google::cloud::internal::SaveCurrentOptions(); + auto idempotency = idempotency_policy(*current)->ListBindings(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::agentregistry::v1::ListBindingsRequest const& r) { + return google::cloud::internal::RetryLoop( + retry->clone(), backoff->clone(), idempotency, + [stub](grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListBindingsRequest const& + request) { + return stub->ListBindings(context, options, request); + }, + options, r, function_name); + }, + [](google::cloud::agentregistry::v1::ListBindingsResponse r) { + std::vector result( + r.bindings().size()); + auto& messages = *r.mutable_bindings(); + std::move(messages.begin(), messages.end(), result.begin()); + return result; + }); +} + +StatusOr +AgentRegistryConnectionImpl::GetBinding( + google::cloud::agentregistry::v1::GetBindingRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->GetBinding(request), + [this]( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetBindingRequest const& request) { + return stub_->GetBinding(context, options, request); + }, + *current, request, __func__); +} + +future> +AgentRegistryConnectionImpl::CreateBinding( + google::cloud::agentregistry::v1::CreateBindingRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + auto request_copy = request; + auto const idempotent = + idempotency_policy(*current)->CreateBinding(request_copy); + return google::cloud::internal::AsyncLongRunningOperation< + google::cloud::agentregistry::v1::Binding>( + background_->cq(), current, std::move(request_copy), + [stub = stub_]( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::CreateBindingRequest const& + request) { + return stub->AsyncCreateBinding(cq, std::move(context), + std::move(options), request); + }, + [stub = stub_](google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::GetOperationRequest const& request) { + return stub->AsyncGetOperation(cq, std::move(context), + std::move(options), request); + }, + [stub = stub_]( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::CancelOperationRequest const& request) { + return stub->AsyncCancelOperation(cq, std::move(context), + std::move(options), request); + }, + &google::cloud::internal::ExtractLongRunningResultResponse< + google::cloud::agentregistry::v1::Binding>, + retry_policy(*current), backoff_policy(*current), idempotent, + polling_policy(*current), __func__); +} + +StatusOr +AgentRegistryConnectionImpl::CreateBinding( + NoAwaitTag, + google::cloud::agentregistry::v1::CreateBindingRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->CreateBinding(request), + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::CreateBindingRequest const& + request) { + return stub_->CreateBinding(context, options, request); + }, + *current, request, __func__); +} + +future> +AgentRegistryConnectionImpl::CreateBinding( + google::longrunning::Operation const& operation) { + auto current = google::cloud::internal::SaveCurrentOptions(); + if (!operation.metadata() + .Is()) { + return make_ready_future< + StatusOr>( + internal::InvalidArgumentError( + "operation does not correspond to CreateBinding", + GCP_ERROR_INFO().WithMetadata("operation", + operation.metadata().DebugString()))); + } + + return google::cloud::internal::AsyncAwaitLongRunningOperation< + google::cloud::agentregistry::v1::Binding>( + background_->cq(), current, operation, + [stub = stub_](google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::GetOperationRequest const& request) { + return stub->AsyncGetOperation(cq, std::move(context), + std::move(options), request); + }, + [stub = stub_]( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::CancelOperationRequest const& request) { + return stub->AsyncCancelOperation(cq, std::move(context), + std::move(options), request); + }, + &google::cloud::internal::ExtractLongRunningResultResponse< + google::cloud::agentregistry::v1::Binding>, + polling_policy(*current), __func__); +} + +future> +AgentRegistryConnectionImpl::UpdateBinding( + google::cloud::agentregistry::v1::UpdateBindingRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + auto request_copy = request; + auto const idempotent = + idempotency_policy(*current)->UpdateBinding(request_copy); + return google::cloud::internal::AsyncLongRunningOperation< + google::cloud::agentregistry::v1::Binding>( + background_->cq(), current, std::move(request_copy), + [stub = stub_]( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::UpdateBindingRequest const& + request) { + return stub->AsyncUpdateBinding(cq, std::move(context), + std::move(options), request); + }, + [stub = stub_](google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::GetOperationRequest const& request) { + return stub->AsyncGetOperation(cq, std::move(context), + std::move(options), request); + }, + [stub = stub_]( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::CancelOperationRequest const& request) { + return stub->AsyncCancelOperation(cq, std::move(context), + std::move(options), request); + }, + &google::cloud::internal::ExtractLongRunningResultResponse< + google::cloud::agentregistry::v1::Binding>, + retry_policy(*current), backoff_policy(*current), idempotent, + polling_policy(*current), __func__); +} + +StatusOr +AgentRegistryConnectionImpl::UpdateBinding( + NoAwaitTag, + google::cloud::agentregistry::v1::UpdateBindingRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->UpdateBinding(request), + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::UpdateBindingRequest const& + request) { + return stub_->UpdateBinding(context, options, request); + }, + *current, request, __func__); +} + +future> +AgentRegistryConnectionImpl::UpdateBinding( + google::longrunning::Operation const& operation) { + auto current = google::cloud::internal::SaveCurrentOptions(); + if (!operation.metadata() + .Is()) { + return make_ready_future< + StatusOr>( + internal::InvalidArgumentError( + "operation does not correspond to UpdateBinding", + GCP_ERROR_INFO().WithMetadata("operation", + operation.metadata().DebugString()))); + } + + return google::cloud::internal::AsyncAwaitLongRunningOperation< + google::cloud::agentregistry::v1::Binding>( + background_->cq(), current, operation, + [stub = stub_](google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::GetOperationRequest const& request) { + return stub->AsyncGetOperation(cq, std::move(context), + std::move(options), request); + }, + [stub = stub_]( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::CancelOperationRequest const& request) { + return stub->AsyncCancelOperation(cq, std::move(context), + std::move(options), request); + }, + &google::cloud::internal::ExtractLongRunningResultResponse< + google::cloud::agentregistry::v1::Binding>, + polling_policy(*current), __func__); +} + +future> +AgentRegistryConnectionImpl::DeleteBinding( + google::cloud::agentregistry::v1::DeleteBindingRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + auto request_copy = request; + auto const idempotent = + idempotency_policy(*current)->DeleteBinding(request_copy); + return google::cloud::internal::AsyncLongRunningOperation< + google::cloud::agentregistry::v1::OperationMetadata>( + background_->cq(), current, std::move(request_copy), + [stub = stub_]( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::DeleteBindingRequest const& + request) { + return stub->AsyncDeleteBinding(cq, std::move(context), + std::move(options), request); + }, + [stub = stub_](google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::GetOperationRequest const& request) { + return stub->AsyncGetOperation(cq, std::move(context), + std::move(options), request); + }, + [stub = stub_]( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::CancelOperationRequest const& request) { + return stub->AsyncCancelOperation(cq, std::move(context), + std::move(options), request); + }, + &google::cloud::internal::ExtractLongRunningResultMetadata< + google::cloud::agentregistry::v1::OperationMetadata>, + retry_policy(*current), backoff_policy(*current), idempotent, + polling_policy(*current), __func__); +} + +StatusOr +AgentRegistryConnectionImpl::DeleteBinding( + NoAwaitTag, + google::cloud::agentregistry::v1::DeleteBindingRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->DeleteBinding(request), + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::DeleteBindingRequest const& + request) { + return stub_->DeleteBinding(context, options, request); + }, + *current, request, __func__); +} + +future> +AgentRegistryConnectionImpl::DeleteBinding( + google::longrunning::Operation const& operation) { + auto current = google::cloud::internal::SaveCurrentOptions(); + if (!operation.metadata() + .Is()) { + return make_ready_future< + StatusOr>( + internal::InvalidArgumentError( + "operation does not correspond to DeleteBinding", + GCP_ERROR_INFO().WithMetadata("operation", + operation.metadata().DebugString()))); + } + + return google::cloud::internal::AsyncAwaitLongRunningOperation< + google::cloud::agentregistry::v1::OperationMetadata>( + background_->cq(), current, operation, + [stub = stub_](google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::GetOperationRequest const& request) { + return stub->AsyncGetOperation(cq, std::move(context), + std::move(options), request); + }, + [stub = stub_]( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::CancelOperationRequest const& request) { + return stub->AsyncCancelOperation(cq, std::move(context), + std::move(options), request); + }, + &google::cloud::internal::ExtractLongRunningResultMetadata< + google::cloud::agentregistry::v1::OperationMetadata>, + polling_policy(*current), __func__); +} + +StreamRange +AgentRegistryConnectionImpl::FetchAvailableBindings( + google::cloud::agentregistry::v1::FetchAvailableBindingsRequest request) { + request.clear_page_token(); + auto current = google::cloud::internal::SaveCurrentOptions(); + auto idempotency = + idempotency_policy(*current)->FetchAvailableBindings(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::agentregistry::v1::FetchAvailableBindingsRequest const& + r) { + return google::cloud::internal::RetryLoop( + retry->clone(), backoff->clone(), idempotency, + [stub](grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1:: + FetchAvailableBindingsRequest const& request) { + return stub->FetchAvailableBindings(context, options, request); + }, + options, r, function_name); + }, + [](google::cloud::agentregistry::v1::FetchAvailableBindingsResponse r) { + std::vector result( + r.bindings().size()); + auto& messages = *r.mutable_bindings(); + std::move(messages.begin(), messages.end(), result.begin()); + return result; + }); +} + +StreamRange +AgentRegistryConnectionImpl::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 +AgentRegistryConnectionImpl::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__); +} + +StreamRange +AgentRegistryConnectionImpl::ListOperations( + google::longrunning::ListOperationsRequest request) { + request.clear_page_token(); + auto current = google::cloud::internal::SaveCurrentOptions(); + auto idempotency = idempotency_policy(*current)->ListOperations(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::longrunning::ListOperationsRequest const& r) { + return google::cloud::internal::RetryLoop( + retry->clone(), backoff->clone(), idempotency, + [stub](grpc::ClientContext& context, Options const& options, + google::longrunning::ListOperationsRequest const& request) { + return stub->ListOperations(context, options, request); + }, + options, r, function_name); + }, + [](google::longrunning::ListOperationsResponse r) { + std::vector result( + r.operations().size()); + auto& messages = *r.mutable_operations(); + std::move(messages.begin(), messages.end(), result.begin()); + return result; + }); +} + +StatusOr +AgentRegistryConnectionImpl::GetOperation( + google::longrunning::GetOperationRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->GetOperation(request), + [this](grpc::ClientContext& context, Options const& options, + google::longrunning::GetOperationRequest const& request) { + return stub_->GetOperation(context, options, request); + }, + *current, request, __func__); +} + +Status AgentRegistryConnectionImpl::DeleteOperation( + google::longrunning::DeleteOperationRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->DeleteOperation(request), + [this](grpc::ClientContext& context, Options const& options, + google::longrunning::DeleteOperationRequest const& request) { + return stub_->DeleteOperation(context, options, request); + }, + *current, request, __func__); +} + +Status AgentRegistryConnectionImpl::CancelOperation( + google::longrunning::CancelOperationRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->CancelOperation(request), + [this](grpc::ClientContext& context, Options const& options, + google::longrunning::CancelOperationRequest const& request) { + return stub_->CancelOperation(context, options, request); + }, + *current, request, __func__); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentregistry_v1_internal +} // namespace cloud +} // namespace google diff --git a/google/cloud/agentregistry/v1/internal/agent_registry_connection_impl.h b/google/cloud/agentregistry/v1/internal/agent_registry_connection_impl.h new file mode 100644 index 0000000000000..c19ff76ca0705 --- /dev/null +++ b/google/cloud/agentregistry/v1/internal/agent_registry_connection_impl.h @@ -0,0 +1,202 @@ +// 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/agentregistry/v1/agentregistry_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_CONNECTION_IMPL_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_CONNECTION_IMPL_H + +#include "google/cloud/agentregistry/v1/agent_registry_connection.h" +#include "google/cloud/agentregistry/v1/agent_registry_connection_idempotency_policy.h" +#include "google/cloud/agentregistry/v1/agent_registry_options.h" +#include "google/cloud/agentregistry/v1/internal/agent_registry_retry_traits.h" +#include "google/cloud/agentregistry/v1/internal/agent_registry_stub.h" +#include "google/cloud/background_threads.h" +#include "google/cloud/backoff_policy.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/stream_range.h" +#include "google/cloud/version.h" +#include "google/longrunning/operations.grpc.pb.h" +#include + +namespace google { +namespace cloud { +namespace agentregistry_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class AgentRegistryConnectionImpl + : public agentregistry_v1::AgentRegistryConnection { + public: + ~AgentRegistryConnectionImpl() override = default; + + AgentRegistryConnectionImpl( + std::unique_ptr background, + std::shared_ptr stub, + Options options); + + Options options() override { return options_; } + + StreamRange ListAgents( + google::cloud::agentregistry::v1::ListAgentsRequest request) override; + + StreamRange SearchAgents( + google::cloud::agentregistry::v1::SearchAgentsRequest request) override; + + StatusOr GetAgent( + google::cloud::agentregistry::v1::GetAgentRequest const& request) + override; + + StreamRange ListEndpoints( + google::cloud::agentregistry::v1::ListEndpointsRequest request) override; + + StatusOr GetEndpoint( + google::cloud::agentregistry::v1::GetEndpointRequest const& request) + override; + + StreamRange ListMcpServers( + google::cloud::agentregistry::v1::ListMcpServersRequest request) override; + + StreamRange SearchMcpServers( + google::cloud::agentregistry::v1::SearchMcpServersRequest request) + override; + + StatusOr GetMcpServer( + google::cloud::agentregistry::v1::GetMcpServerRequest const& request) + override; + + StreamRange ListServices( + google::cloud::agentregistry::v1::ListServicesRequest request) override; + + StatusOr GetService( + google::cloud::agentregistry::v1::GetServiceRequest const& request) + override; + + future> CreateService( + google::cloud::agentregistry::v1::CreateServiceRequest const& request) + override; + + StatusOr CreateService( + NoAwaitTag, + google::cloud::agentregistry::v1::CreateServiceRequest const& request) + override; + + future> CreateService( + google::longrunning::Operation const& operation) override; + + future> UpdateService( + google::cloud::agentregistry::v1::UpdateServiceRequest const& request) + override; + + StatusOr UpdateService( + NoAwaitTag, + google::cloud::agentregistry::v1::UpdateServiceRequest const& request) + override; + + future> UpdateService( + google::longrunning::Operation const& operation) override; + + future> + DeleteService(google::cloud::agentregistry::v1::DeleteServiceRequest const& + request) override; + + StatusOr DeleteService( + NoAwaitTag, + google::cloud::agentregistry::v1::DeleteServiceRequest const& request) + override; + + future> + DeleteService(google::longrunning::Operation const& operation) override; + + StreamRange ListBindings( + google::cloud::agentregistry::v1::ListBindingsRequest request) override; + + StatusOr GetBinding( + google::cloud::agentregistry::v1::GetBindingRequest const& request) + override; + + future> CreateBinding( + google::cloud::agentregistry::v1::CreateBindingRequest const& request) + override; + + StatusOr CreateBinding( + NoAwaitTag, + google::cloud::agentregistry::v1::CreateBindingRequest const& request) + override; + + future> CreateBinding( + google::longrunning::Operation const& operation) override; + + future> UpdateBinding( + google::cloud::agentregistry::v1::UpdateBindingRequest const& request) + override; + + StatusOr UpdateBinding( + NoAwaitTag, + google::cloud::agentregistry::v1::UpdateBindingRequest const& request) + override; + + future> UpdateBinding( + google::longrunning::Operation const& operation) override; + + future> + DeleteBinding(google::cloud::agentregistry::v1::DeleteBindingRequest const& + request) override; + + StatusOr DeleteBinding( + NoAwaitTag, + google::cloud::agentregistry::v1::DeleteBindingRequest const& request) + override; + + future> + DeleteBinding(google::longrunning::Operation const& operation) override; + + StreamRange FetchAvailableBindings( + google::cloud::agentregistry::v1::FetchAvailableBindingsRequest request) + override; + + StreamRange ListLocations( + google::cloud::location::ListLocationsRequest request) override; + + StatusOr GetLocation( + google::cloud::location::GetLocationRequest const& request) override; + + StreamRange ListOperations( + google::longrunning::ListOperationsRequest request) override; + + StatusOr GetOperation( + google::longrunning::GetOperationRequest const& request) override; + + Status DeleteOperation( + google::longrunning::DeleteOperationRequest const& request) override; + + Status CancelOperation( + google::longrunning::CancelOperationRequest const& request) override; + + private: + std::unique_ptr background_; + std::shared_ptr stub_; + Options options_; +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentregistry_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_CONNECTION_IMPL_H diff --git a/google/cloud/agentregistry/v1/internal/agent_registry_logging_decorator.cc b/google/cloud/agentregistry/v1/internal/agent_registry_logging_decorator.cc new file mode 100644 index 0000000000000..d6bb1fea55e4f --- /dev/null +++ b/google/cloud/agentregistry/v1/internal/agent_registry_logging_decorator.cc @@ -0,0 +1,505 @@ +// 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/agentregistry/v1/agentregistry_service.proto + +#include "google/cloud/agentregistry/v1/internal/agent_registry_logging_decorator.h" +#include "google/cloud/agentregistry/v1/agentregistry_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 agentregistry_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +AgentRegistryLogging::AgentRegistryLogging( + std::shared_ptr child, TracingOptions tracing_options, + std::set const&) + : child_(std::move(child)), tracing_options_(std::move(tracing_options)) {} + +StatusOr +AgentRegistryLogging::ListAgents( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListAgentsRequest const& request) { + return google::cloud::internal::LogWrapper( + [this]( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListAgentsRequest const& request) { + return child_->ListAgents(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +AgentRegistryLogging::SearchAgents( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::SearchAgentsRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::SearchAgentsRequest const& + request) { + return child_->SearchAgents(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +AgentRegistryLogging::GetAgent( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetAgentRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetAgentRequest const& request) { + return child_->GetAgent(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +AgentRegistryLogging::ListEndpoints( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListEndpointsRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListEndpointsRequest const& + request) { + return child_->ListEndpoints(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +AgentRegistryLogging::GetEndpoint( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetEndpointRequest const& request) { + return google::cloud::internal::LogWrapper( + [this]( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetEndpointRequest const& request) { + return child_->GetEndpoint(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +AgentRegistryLogging::ListMcpServers( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListMcpServersRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListMcpServersRequest const& + request) { + return child_->ListMcpServers(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +AgentRegistryLogging::SearchMcpServers( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::SearchMcpServersRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::SearchMcpServersRequest const& + request) { + return child_->SearchMcpServers(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +AgentRegistryLogging::GetMcpServer( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetMcpServerRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetMcpServerRequest const& + request) { + return child_->GetMcpServer(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +AgentRegistryLogging::ListServices( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListServicesRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListServicesRequest const& + request) { + return child_->ListServices(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +AgentRegistryLogging::GetService( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetServiceRequest const& request) { + return google::cloud::internal::LogWrapper( + [this]( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetServiceRequest const& request) { + return child_->GetService(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +future> +AgentRegistryLogging::AsyncCreateService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::CreateServiceRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::CreateServiceRequest const& + request) { + return child_->AsyncCreateService(cq, std::move(context), + std::move(options), request); + }, + cq, std::move(context), std::move(options), request, __func__, + tracing_options_); +} + +StatusOr AgentRegistryLogging::CreateService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::CreateServiceRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::CreateServiceRequest const& + request) { + return child_->CreateService(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +future> +AgentRegistryLogging::AsyncUpdateService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::UpdateServiceRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::UpdateServiceRequest const& + request) { + return child_->AsyncUpdateService(cq, std::move(context), + std::move(options), request); + }, + cq, std::move(context), std::move(options), request, __func__, + tracing_options_); +} + +StatusOr AgentRegistryLogging::UpdateService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::UpdateServiceRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::UpdateServiceRequest const& + request) { + return child_->UpdateService(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +future> +AgentRegistryLogging::AsyncDeleteService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::DeleteServiceRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::DeleteServiceRequest const& + request) { + return child_->AsyncDeleteService(cq, std::move(context), + std::move(options), request); + }, + cq, std::move(context), std::move(options), request, __func__, + tracing_options_); +} + +StatusOr AgentRegistryLogging::DeleteService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::DeleteServiceRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::DeleteServiceRequest const& + request) { + return child_->DeleteService(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +AgentRegistryLogging::ListBindings( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListBindingsRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListBindingsRequest const& + request) { + return child_->ListBindings(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +AgentRegistryLogging::GetBinding( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetBindingRequest const& request) { + return google::cloud::internal::LogWrapper( + [this]( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetBindingRequest const& request) { + return child_->GetBinding(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +future> +AgentRegistryLogging::AsyncCreateBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::CreateBindingRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::CreateBindingRequest const& + request) { + return child_->AsyncCreateBinding(cq, std::move(context), + std::move(options), request); + }, + cq, std::move(context), std::move(options), request, __func__, + tracing_options_); +} + +StatusOr AgentRegistryLogging::CreateBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::CreateBindingRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::CreateBindingRequest const& + request) { + return child_->CreateBinding(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +future> +AgentRegistryLogging::AsyncUpdateBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::UpdateBindingRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::UpdateBindingRequest const& + request) { + return child_->AsyncUpdateBinding(cq, std::move(context), + std::move(options), request); + }, + cq, std::move(context), std::move(options), request, __func__, + tracing_options_); +} + +StatusOr AgentRegistryLogging::UpdateBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::UpdateBindingRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::UpdateBindingRequest const& + request) { + return child_->UpdateBinding(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +future> +AgentRegistryLogging::AsyncDeleteBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::DeleteBindingRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::DeleteBindingRequest const& + request) { + return child_->AsyncDeleteBinding(cq, std::move(context), + std::move(options), request); + }, + cq, std::move(context), std::move(options), request, __func__, + tracing_options_); +} + +StatusOr AgentRegistryLogging::DeleteBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::DeleteBindingRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::DeleteBindingRequest const& + request) { + return child_->DeleteBinding(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +AgentRegistryLogging::FetchAvailableBindings( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::FetchAvailableBindingsRequest const& + request) { + return google::cloud::internal::LogWrapper( + [this]( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::FetchAvailableBindingsRequest const& + request) { + return child_->FetchAvailableBindings(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +AgentRegistryLogging::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 AgentRegistryLogging::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 +AgentRegistryLogging::ListOperations( + grpc::ClientContext& context, Options const& options, + google::longrunning::ListOperationsRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::longrunning::ListOperationsRequest const& request) { + return child_->ListOperations(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr AgentRegistryLogging::GetOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::GetOperationRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::longrunning::GetOperationRequest const& request) { + return child_->GetOperation(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +Status AgentRegistryLogging::DeleteOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::DeleteOperationRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::longrunning::DeleteOperationRequest const& request) { + return child_->DeleteOperation(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +Status AgentRegistryLogging::CancelOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::CancelOperationRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::longrunning::CancelOperationRequest const& request) { + return child_->CancelOperation(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +future> +AgentRegistryLogging::AsyncGetOperation( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::GetOperationRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::GetOperationRequest const& request) { + return child_->AsyncGetOperation(cq, std::move(context), + std::move(options), request); + }, + cq, std::move(context), std::move(options), request, __func__, + tracing_options_); +} + +future AgentRegistryLogging::AsyncCancelOperation( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::CancelOperationRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::CancelOperationRequest const& request) { + return child_->AsyncCancelOperation(cq, std::move(context), + std::move(options), request); + }, + cq, std::move(context), std::move(options), request, __func__, + tracing_options_); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentregistry_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" diff --git a/google/cloud/agentregistry/v1/internal/agent_registry_logging_decorator.h b/google/cloud/agentregistry/v1/internal/agent_registry_logging_decorator.h new file mode 100644 index 0000000000000..ac77ce3dab216 --- /dev/null +++ b/google/cloud/agentregistry/v1/internal/agent_registry_logging_decorator.h @@ -0,0 +1,232 @@ +// 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/agentregistry/v1/agentregistry_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_LOGGING_DECORATOR_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_LOGGING_DECORATOR_H + +#include "google/cloud/agentregistry/v1/internal/agent_registry_stub.h" +#include "google/cloud/tracing_options.h" +#include "google/cloud/version.h" +#include "google/longrunning/operations.grpc.pb.h" +#include +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace agentregistry_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class AgentRegistryLogging : public AgentRegistryStub { + public: + ~AgentRegistryLogging() override = default; + AgentRegistryLogging(std::shared_ptr child, + TracingOptions tracing_options, + std::set const& components); + + StatusOr ListAgents( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListAgentsRequest const& request) + override; + + StatusOr SearchAgents( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::SearchAgentsRequest const& request) + override; + + StatusOr GetAgent( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetAgentRequest const& request) + override; + + StatusOr + ListEndpoints(grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListEndpointsRequest const& + request) override; + + StatusOr GetEndpoint( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetEndpointRequest const& request) + override; + + StatusOr + ListMcpServers(grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListMcpServersRequest const& + request) override; + + StatusOr + SearchMcpServers( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::SearchMcpServersRequest const& request) + override; + + StatusOr GetMcpServer( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetMcpServerRequest const& request) + override; + + StatusOr ListServices( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListServicesRequest const& request) + override; + + StatusOr GetService( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetServiceRequest const& request) + override; + + future> AsyncCreateService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::CreateServiceRequest const& request) + override; + + StatusOr CreateService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::CreateServiceRequest const& request) + override; + + future> AsyncUpdateService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::UpdateServiceRequest const& request) + override; + + StatusOr UpdateService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::UpdateServiceRequest const& request) + override; + + future> AsyncDeleteService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::DeleteServiceRequest const& request) + override; + + StatusOr DeleteService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::DeleteServiceRequest const& request) + override; + + StatusOr ListBindings( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListBindingsRequest const& request) + override; + + StatusOr GetBinding( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetBindingRequest const& request) + override; + + future> AsyncCreateBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::CreateBindingRequest const& request) + override; + + StatusOr CreateBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::CreateBindingRequest const& request) + override; + + future> AsyncUpdateBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::UpdateBindingRequest const& request) + override; + + StatusOr UpdateBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::UpdateBindingRequest const& request) + override; + + future> AsyncDeleteBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::DeleteBindingRequest const& request) + override; + + StatusOr DeleteBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::DeleteBindingRequest const& request) + override; + + StatusOr + FetchAvailableBindings( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::FetchAvailableBindingsRequest 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 ListOperations( + grpc::ClientContext& context, Options const& options, + google::longrunning::ListOperationsRequest const& request) override; + + StatusOr GetOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::GetOperationRequest const& request) override; + + Status DeleteOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::DeleteOperationRequest const& request) override; + + Status CancelOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::CancelOperationRequest const& request) override; + + future> AsyncGetOperation( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::GetOperationRequest const& request) override; + + future AsyncCancelOperation( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::CancelOperationRequest const& request) override; + + private: + std::shared_ptr child_; + TracingOptions tracing_options_; +}; // AgentRegistryLogging + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentregistry_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_LOGGING_DECORATOR_H diff --git a/google/cloud/agentregistry/v1/internal/agent_registry_metadata_decorator.cc b/google/cloud/agentregistry/v1/internal/agent_registry_metadata_decorator.cc new file mode 100644 index 0000000000000..ff8447e16f8fb --- /dev/null +++ b/google/cloud/agentregistry/v1/internal/agent_registry_metadata_decorator.cc @@ -0,0 +1,384 @@ +// 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/agentregistry/v1/agentregistry_service.proto + +#include "google/cloud/agentregistry/v1/internal/agent_registry_metadata_decorator.h" +#include "google/cloud/agentregistry/v1/agentregistry_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 agentregistry_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +AgentRegistryMetadata::AgentRegistryMetadata( + 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 +AgentRegistryMetadata::ListAgents( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListAgentsRequest const& request) { + SetMetadata(context, options, + absl::StrCat("parent=", internal::UrlEncode(request.parent()))); + return child_->ListAgents(context, options, request); +} + +StatusOr +AgentRegistryMetadata::SearchAgents( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::SearchAgentsRequest const& request) { + SetMetadata(context, options, + absl::StrCat("parent=", internal::UrlEncode(request.parent()))); + return child_->SearchAgents(context, options, request); +} + +StatusOr +AgentRegistryMetadata::GetAgent( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetAgentRequest const& request) { + SetMetadata(context, options, + absl::StrCat("name=", internal::UrlEncode(request.name()))); + return child_->GetAgent(context, options, request); +} + +StatusOr +AgentRegistryMetadata::ListEndpoints( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListEndpointsRequest const& request) { + SetMetadata(context, options, + absl::StrCat("parent=", internal::UrlEncode(request.parent()))); + return child_->ListEndpoints(context, options, request); +} + +StatusOr +AgentRegistryMetadata::GetEndpoint( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetEndpointRequest const& request) { + SetMetadata(context, options, + absl::StrCat("name=", internal::UrlEncode(request.name()))); + return child_->GetEndpoint(context, options, request); +} + +StatusOr +AgentRegistryMetadata::ListMcpServers( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListMcpServersRequest const& request) { + SetMetadata(context, options, + absl::StrCat("parent=", internal::UrlEncode(request.parent()))); + return child_->ListMcpServers(context, options, request); +} + +StatusOr +AgentRegistryMetadata::SearchMcpServers( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::SearchMcpServersRequest const& request) { + SetMetadata(context, options, + absl::StrCat("parent=", internal::UrlEncode(request.parent()))); + return child_->SearchMcpServers(context, options, request); +} + +StatusOr +AgentRegistryMetadata::GetMcpServer( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetMcpServerRequest const& request) { + SetMetadata(context, options, + absl::StrCat("name=", internal::UrlEncode(request.name()))); + return child_->GetMcpServer(context, options, request); +} + +StatusOr +AgentRegistryMetadata::ListServices( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListServicesRequest const& request) { + SetMetadata(context, options, + absl::StrCat("parent=", internal::UrlEncode(request.parent()))); + return child_->ListServices(context, options, request); +} + +StatusOr +AgentRegistryMetadata::GetService( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetServiceRequest const& request) { + SetMetadata(context, options, + absl::StrCat("name=", internal::UrlEncode(request.name()))); + return child_->GetService(context, options, request); +} + +future> +AgentRegistryMetadata::AsyncCreateService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::CreateServiceRequest const& request) { + SetMetadata(*context, *options, + absl::StrCat("parent=", internal::UrlEncode(request.parent()))); + return child_->AsyncCreateService(cq, std::move(context), std::move(options), + request); +} + +StatusOr AgentRegistryMetadata::CreateService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::CreateServiceRequest const& request) { + SetMetadata(context, options, + absl::StrCat("parent=", internal::UrlEncode(request.parent()))); + return child_->CreateService(context, options, request); +} + +future> +AgentRegistryMetadata::AsyncUpdateService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::UpdateServiceRequest const& request) { + SetMetadata(*context, *options, + absl::StrCat("service.name=", + internal::UrlEncode(request.service().name()))); + return child_->AsyncUpdateService(cq, std::move(context), std::move(options), + request); +} + +StatusOr AgentRegistryMetadata::UpdateService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::UpdateServiceRequest const& request) { + SetMetadata(context, options, + absl::StrCat("service.name=", + internal::UrlEncode(request.service().name()))); + return child_->UpdateService(context, options, request); +} + +future> +AgentRegistryMetadata::AsyncDeleteService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::DeleteServiceRequest const& request) { + SetMetadata(*context, *options, + absl::StrCat("name=", internal::UrlEncode(request.name()))); + return child_->AsyncDeleteService(cq, std::move(context), std::move(options), + request); +} + +StatusOr AgentRegistryMetadata::DeleteService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::DeleteServiceRequest const& request) { + SetMetadata(context, options, + absl::StrCat("name=", internal::UrlEncode(request.name()))); + return child_->DeleteService(context, options, request); +} + +StatusOr +AgentRegistryMetadata::ListBindings( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListBindingsRequest const& request) { + SetMetadata(context, options, + absl::StrCat("parent=", internal::UrlEncode(request.parent()))); + return child_->ListBindings(context, options, request); +} + +StatusOr +AgentRegistryMetadata::GetBinding( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetBindingRequest const& request) { + SetMetadata(context, options, + absl::StrCat("name=", internal::UrlEncode(request.name()))); + return child_->GetBinding(context, options, request); +} + +future> +AgentRegistryMetadata::AsyncCreateBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::CreateBindingRequest const& request) { + SetMetadata(*context, *options, + absl::StrCat("parent=", internal::UrlEncode(request.parent()))); + return child_->AsyncCreateBinding(cq, std::move(context), std::move(options), + request); +} + +StatusOr AgentRegistryMetadata::CreateBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::CreateBindingRequest const& request) { + SetMetadata(context, options, + absl::StrCat("parent=", internal::UrlEncode(request.parent()))); + return child_->CreateBinding(context, options, request); +} + +future> +AgentRegistryMetadata::AsyncUpdateBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::UpdateBindingRequest const& request) { + SetMetadata(*context, *options, + absl::StrCat("binding.name=", + internal::UrlEncode(request.binding().name()))); + return child_->AsyncUpdateBinding(cq, std::move(context), std::move(options), + request); +} + +StatusOr AgentRegistryMetadata::UpdateBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::UpdateBindingRequest const& request) { + SetMetadata(context, options, + absl::StrCat("binding.name=", + internal::UrlEncode(request.binding().name()))); + return child_->UpdateBinding(context, options, request); +} + +future> +AgentRegistryMetadata::AsyncDeleteBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::DeleteBindingRequest const& request) { + SetMetadata(*context, *options, + absl::StrCat("name=", internal::UrlEncode(request.name()))); + return child_->AsyncDeleteBinding(cq, std::move(context), std::move(options), + request); +} + +StatusOr AgentRegistryMetadata::DeleteBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::DeleteBindingRequest const& request) { + SetMetadata(context, options, + absl::StrCat("name=", internal::UrlEncode(request.name()))); + return child_->DeleteBinding(context, options, request); +} + +StatusOr +AgentRegistryMetadata::FetchAvailableBindings( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::FetchAvailableBindingsRequest const& + request) { + SetMetadata(context, options, + absl::StrCat("parent=", internal::UrlEncode(request.parent()))); + return child_->FetchAvailableBindings(context, options, request); +} + +StatusOr +AgentRegistryMetadata::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 AgentRegistryMetadata::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 +AgentRegistryMetadata::ListOperations( + grpc::ClientContext& context, Options const& options, + google::longrunning::ListOperationsRequest const& request) { + SetMetadata(context, options, + absl::StrCat("name=", internal::UrlEncode(request.name()))); + return child_->ListOperations(context, options, request); +} + +StatusOr AgentRegistryMetadata::GetOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::GetOperationRequest const& request) { + SetMetadata(context, options, + absl::StrCat("name=", internal::UrlEncode(request.name()))); + return child_->GetOperation(context, options, request); +} + +Status AgentRegistryMetadata::DeleteOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::DeleteOperationRequest const& request) { + SetMetadata(context, options, + absl::StrCat("name=", internal::UrlEncode(request.name()))); + return child_->DeleteOperation(context, options, request); +} + +Status AgentRegistryMetadata::CancelOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::CancelOperationRequest const& request) { + SetMetadata(context, options, + absl::StrCat("name=", internal::UrlEncode(request.name()))); + return child_->CancelOperation(context, options, request); +} + +future> +AgentRegistryMetadata::AsyncGetOperation( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::GetOperationRequest const& request) { + SetMetadata(*context, *options, + absl::StrCat("name=", internal::UrlEncode(request.name()))); + return child_->AsyncGetOperation(cq, std::move(context), std::move(options), + request); +} + +future AgentRegistryMetadata::AsyncCancelOperation( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::CancelOperationRequest const& request) { + SetMetadata(*context, *options, + absl::StrCat("name=", internal::UrlEncode(request.name()))); + return child_->AsyncCancelOperation(cq, std::move(context), + std::move(options), request); +} + +void AgentRegistryMetadata::SetMetadata(grpc::ClientContext& context, + Options const& options, + std::string const& request_params) { + context.AddMetadata("x-goog-request-params", request_params); + SetMetadata(context, options); +} + +void AgentRegistryMetadata::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 agentregistry_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" diff --git a/google/cloud/agentregistry/v1/internal/agent_registry_metadata_decorator.h b/google/cloud/agentregistry/v1/internal/agent_registry_metadata_decorator.h new file mode 100644 index 0000000000000..80dfa3212edf8 --- /dev/null +++ b/google/cloud/agentregistry/v1/internal/agent_registry_metadata_decorator.h @@ -0,0 +1,237 @@ +// 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/agentregistry/v1/agentregistry_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_METADATA_DECORATOR_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_METADATA_DECORATOR_H + +#include "google/cloud/agentregistry/v1/internal/agent_registry_stub.h" +#include "google/cloud/options.h" +#include "google/cloud/version.h" +#include "google/longrunning/operations.grpc.pb.h" +#include +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace agentregistry_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class AgentRegistryMetadata : public AgentRegistryStub { + public: + ~AgentRegistryMetadata() override = default; + AgentRegistryMetadata(std::shared_ptr child, + std::multimap fixed_metadata, + std::string api_client_header = ""); + + StatusOr ListAgents( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListAgentsRequest const& request) + override; + + StatusOr SearchAgents( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::SearchAgentsRequest const& request) + override; + + StatusOr GetAgent( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetAgentRequest const& request) + override; + + StatusOr + ListEndpoints(grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListEndpointsRequest const& + request) override; + + StatusOr GetEndpoint( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetEndpointRequest const& request) + override; + + StatusOr + ListMcpServers(grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListMcpServersRequest const& + request) override; + + StatusOr + SearchMcpServers( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::SearchMcpServersRequest const& request) + override; + + StatusOr GetMcpServer( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetMcpServerRequest const& request) + override; + + StatusOr ListServices( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListServicesRequest const& request) + override; + + StatusOr GetService( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetServiceRequest const& request) + override; + + future> AsyncCreateService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::CreateServiceRequest const& request) + override; + + StatusOr CreateService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::CreateServiceRequest const& request) + override; + + future> AsyncUpdateService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::UpdateServiceRequest const& request) + override; + + StatusOr UpdateService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::UpdateServiceRequest const& request) + override; + + future> AsyncDeleteService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::DeleteServiceRequest const& request) + override; + + StatusOr DeleteService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::DeleteServiceRequest const& request) + override; + + StatusOr ListBindings( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListBindingsRequest const& request) + override; + + StatusOr GetBinding( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetBindingRequest const& request) + override; + + future> AsyncCreateBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::CreateBindingRequest const& request) + override; + + StatusOr CreateBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::CreateBindingRequest const& request) + override; + + future> AsyncUpdateBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::UpdateBindingRequest const& request) + override; + + StatusOr UpdateBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::UpdateBindingRequest const& request) + override; + + future> AsyncDeleteBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::DeleteBindingRequest const& request) + override; + + StatusOr DeleteBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::DeleteBindingRequest const& request) + override; + + StatusOr + FetchAvailableBindings( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::FetchAvailableBindingsRequest 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 ListOperations( + grpc::ClientContext& context, Options const& options, + google::longrunning::ListOperationsRequest const& request) override; + + StatusOr GetOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::GetOperationRequest const& request) override; + + Status DeleteOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::DeleteOperationRequest const& request) override; + + Status CancelOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::CancelOperationRequest const& request) override; + + future> AsyncGetOperation( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::GetOperationRequest const& request) override; + + future AsyncCancelOperation( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::CancelOperationRequest 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 agentregistry_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_METADATA_DECORATOR_H diff --git a/google/cloud/agentregistry/v1/internal/agent_registry_option_defaults.cc b/google/cloud/agentregistry/v1/internal/agent_registry_option_defaults.cc new file mode 100644 index 0000000000000..385cf387e1398 --- /dev/null +++ b/google/cloud/agentregistry/v1/internal/agent_registry_option_defaults.cc @@ -0,0 +1,81 @@ +// 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/agentregistry/v1/agentregistry_service.proto + +#include "google/cloud/agentregistry/v1/internal/agent_registry_option_defaults.h" +#include "google/cloud/agentregistry/v1/agent_registry_connection.h" +#include "google/cloud/agentregistry/v1/agent_registry_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 agentregistry_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +namespace { +auto constexpr kBackoffScaling = 2.0; +} // namespace + +Options AgentRegistryDefaultOptions(Options options) { + options = internal::PopulateCommonOptions( + std::move(options), "GOOGLE_CLOUD_CPP_AGENT_REGISTRY_ENDPOINT", "", + "GOOGLE_CLOUD_CPP_AGENT_REGISTRY_AUTHORITY", + "agentregistry.googleapis.com"); + options = internal::PopulateGrpcOptions(std::move(options)); + if (!options.has()) { + options.set( + agentregistry_v1::AgentRegistryLimitedTimeRetryPolicy( + 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( + GenericPollingPolicy< + agentregistry_v1::AgentRegistryRetryPolicyOption::Type, + agentregistry_v1::AgentRegistryBackoffPolicyOption::Type>( + options.get() + ->clone(), + ExponentialBackoffPolicy(std::chrono::seconds(1), + std::chrono::minutes(5), kBackoffScaling) + .clone()) + .clone()); + } + if (!options.has< + agentregistry_v1::AgentRegistryConnectionIdempotencyPolicyOption>()) { + options + .set( + agentregistry_v1:: + MakeDefaultAgentRegistryConnectionIdempotencyPolicy()); + } + + return options; +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentregistry_v1_internal +} // namespace cloud +} // namespace google diff --git a/google/cloud/agentregistry/v1/internal/agent_registry_option_defaults.h b/google/cloud/agentregistry/v1/internal/agent_registry_option_defaults.h new file mode 100644 index 0000000000000..61bbe50b47246 --- /dev/null +++ b/google/cloud/agentregistry/v1/internal/agent_registry_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/agentregistry/v1/agentregistry_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_OPTION_DEFAULTS_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_OPTION_DEFAULTS_H + +#include "google/cloud/options.h" +#include "google/cloud/version.h" + +namespace google { +namespace cloud { +namespace agentregistry_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +Options AgentRegistryDefaultOptions(Options options); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentregistry_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_OPTION_DEFAULTS_H diff --git a/google/cloud/agentregistry/v1/internal/agent_registry_retry_traits.h b/google/cloud/agentregistry/v1/internal/agent_registry_retry_traits.h new file mode 100644 index 0000000000000..8bbac01a8c968 --- /dev/null +++ b/google/cloud/agentregistry/v1/internal/agent_registry_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/agentregistry/v1/agentregistry_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_RETRY_TRAITS_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_RETRY_TRAITS_H + +#include "google/cloud/status.h" +#include "google/cloud/version.h" + +namespace google { +namespace cloud { +namespace agentregistry_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +/// Define the gRPC status code semantics for retrying requests. +struct AgentRegistryRetryTraits { + static bool IsPermanentFailure(google::cloud::Status const& status) { + return status.code() != StatusCode::kOk && + status.code() != StatusCode::kUnavailable; + } +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentregistry_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_RETRY_TRAITS_H diff --git a/google/cloud/agentregistry/v1/internal/agent_registry_sources.cc b/google/cloud/agentregistry/v1/internal/agent_registry_sources.cc new file mode 100644 index 0000000000000..1d2d520feafa5 --- /dev/null +++ b/google/cloud/agentregistry/v1/internal/agent_registry_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/agentregistry/v1/agentregistry_service.proto + +// NOLINTBEGIN(bugprone-suspicious-include) +#include "google/cloud/agentregistry/v1/agent_registry_client.cc" +#include "google/cloud/agentregistry/v1/agent_registry_connection.cc" +#include "google/cloud/agentregistry/v1/agent_registry_connection_idempotency_policy.cc" +#include "google/cloud/agentregistry/v1/internal/agent_registry_auth_decorator.cc" +#include "google/cloud/agentregistry/v1/internal/agent_registry_connection_impl.cc" +#include "google/cloud/agentregistry/v1/internal/agent_registry_logging_decorator.cc" +#include "google/cloud/agentregistry/v1/internal/agent_registry_metadata_decorator.cc" +#include "google/cloud/agentregistry/v1/internal/agent_registry_option_defaults.cc" +#include "google/cloud/agentregistry/v1/internal/agent_registry_stub.cc" +#include "google/cloud/agentregistry/v1/internal/agent_registry_stub_factory.cc" +#include "google/cloud/agentregistry/v1/internal/agent_registry_tracing_connection.cc" +#include "google/cloud/agentregistry/v1/internal/agent_registry_tracing_stub.cc" +// NOLINTEND(bugprone-suspicious-include) diff --git a/google/cloud/agentregistry/v1/internal/agent_registry_stub.cc b/google/cloud/agentregistry/v1/internal/agent_registry_stub.cc new file mode 100644 index 0000000000000..9a6dba3f5fe27 --- /dev/null +++ b/google/cloud/agentregistry/v1/internal/agent_registry_stub.cc @@ -0,0 +1,494 @@ +// 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/agentregistry/v1/agentregistry_service.proto + +#include "google/cloud/agentregistry/v1/internal/agent_registry_stub.h" +#include "google/cloud/agentregistry/v1/agentregistry_service.grpc.pb.h" +#include "google/cloud/grpc_error_delegate.h" +#include "google/cloud/status_or.h" +#include "google/longrunning/operations.grpc.pb.h" +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace agentregistry_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +AgentRegistryStub::~AgentRegistryStub() = default; + +StatusOr +DefaultAgentRegistryStub::ListAgents( + grpc::ClientContext& context, Options const&, + google::cloud::agentregistry::v1::ListAgentsRequest const& request) { + google::cloud::agentregistry::v1::ListAgentsResponse response; + auto status = grpc_stub_->ListAgents(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultAgentRegistryStub::SearchAgents( + grpc::ClientContext& context, Options const&, + google::cloud::agentregistry::v1::SearchAgentsRequest const& request) { + google::cloud::agentregistry::v1::SearchAgentsResponse response; + auto status = grpc_stub_->SearchAgents(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultAgentRegistryStub::GetAgent( + grpc::ClientContext& context, Options const&, + google::cloud::agentregistry::v1::GetAgentRequest const& request) { + google::cloud::agentregistry::v1::Agent response; + auto status = grpc_stub_->GetAgent(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultAgentRegistryStub::ListEndpoints( + grpc::ClientContext& context, Options const&, + google::cloud::agentregistry::v1::ListEndpointsRequest const& request) { + google::cloud::agentregistry::v1::ListEndpointsResponse response; + auto status = grpc_stub_->ListEndpoints(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultAgentRegistryStub::GetEndpoint( + grpc::ClientContext& context, Options const&, + google::cloud::agentregistry::v1::GetEndpointRequest const& request) { + google::cloud::agentregistry::v1::Endpoint response; + auto status = grpc_stub_->GetEndpoint(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultAgentRegistryStub::ListMcpServers( + grpc::ClientContext& context, Options const&, + google::cloud::agentregistry::v1::ListMcpServersRequest const& request) { + google::cloud::agentregistry::v1::ListMcpServersResponse response; + auto status = grpc_stub_->ListMcpServers(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultAgentRegistryStub::SearchMcpServers( + grpc::ClientContext& context, Options const&, + google::cloud::agentregistry::v1::SearchMcpServersRequest const& request) { + google::cloud::agentregistry::v1::SearchMcpServersResponse response; + auto status = grpc_stub_->SearchMcpServers(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultAgentRegistryStub::GetMcpServer( + grpc::ClientContext& context, Options const&, + google::cloud::agentregistry::v1::GetMcpServerRequest const& request) { + google::cloud::agentregistry::v1::McpServer response; + auto status = grpc_stub_->GetMcpServer(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultAgentRegistryStub::ListServices( + grpc::ClientContext& context, Options const&, + google::cloud::agentregistry::v1::ListServicesRequest const& request) { + google::cloud::agentregistry::v1::ListServicesResponse response; + auto status = grpc_stub_->ListServices(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultAgentRegistryStub::GetService( + grpc::ClientContext& context, Options const&, + google::cloud::agentregistry::v1::GetServiceRequest const& request) { + google::cloud::agentregistry::v1::Service response; + auto status = grpc_stub_->GetService(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +future> +DefaultAgentRegistryStub::AsyncCreateService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions, + google::cloud::agentregistry::v1::CreateServiceRequest const& request) { + return internal::MakeUnaryRpcImpl< + google::cloud::agentregistry::v1::CreateServiceRequest, + google::longrunning::Operation>( + cq, + [this]( + grpc::ClientContext* context, + google::cloud::agentregistry::v1::CreateServiceRequest const& request, + grpc::CompletionQueue* cq) { + return grpc_stub_->AsyncCreateService(context, request, cq); + }, + request, std::move(context)); +} + +StatusOr +DefaultAgentRegistryStub::CreateService( + grpc::ClientContext& context, Options, + google::cloud::agentregistry::v1::CreateServiceRequest const& request) { + google::longrunning::Operation response; + auto status = grpc_stub_->CreateService(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +future> +DefaultAgentRegistryStub::AsyncUpdateService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions, + google::cloud::agentregistry::v1::UpdateServiceRequest const& request) { + return internal::MakeUnaryRpcImpl< + google::cloud::agentregistry::v1::UpdateServiceRequest, + google::longrunning::Operation>( + cq, + [this]( + grpc::ClientContext* context, + google::cloud::agentregistry::v1::UpdateServiceRequest const& request, + grpc::CompletionQueue* cq) { + return grpc_stub_->AsyncUpdateService(context, request, cq); + }, + request, std::move(context)); +} + +StatusOr +DefaultAgentRegistryStub::UpdateService( + grpc::ClientContext& context, Options, + google::cloud::agentregistry::v1::UpdateServiceRequest const& request) { + google::longrunning::Operation response; + auto status = grpc_stub_->UpdateService(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +future> +DefaultAgentRegistryStub::AsyncDeleteService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions, + google::cloud::agentregistry::v1::DeleteServiceRequest const& request) { + return internal::MakeUnaryRpcImpl< + google::cloud::agentregistry::v1::DeleteServiceRequest, + google::longrunning::Operation>( + cq, + [this]( + grpc::ClientContext* context, + google::cloud::agentregistry::v1::DeleteServiceRequest const& request, + grpc::CompletionQueue* cq) { + return grpc_stub_->AsyncDeleteService(context, request, cq); + }, + request, std::move(context)); +} + +StatusOr +DefaultAgentRegistryStub::DeleteService( + grpc::ClientContext& context, Options, + google::cloud::agentregistry::v1::DeleteServiceRequest const& request) { + google::longrunning::Operation response; + auto status = grpc_stub_->DeleteService(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultAgentRegistryStub::ListBindings( + grpc::ClientContext& context, Options const&, + google::cloud::agentregistry::v1::ListBindingsRequest const& request) { + google::cloud::agentregistry::v1::ListBindingsResponse response; + auto status = grpc_stub_->ListBindings(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultAgentRegistryStub::GetBinding( + grpc::ClientContext& context, Options const&, + google::cloud::agentregistry::v1::GetBindingRequest const& request) { + google::cloud::agentregistry::v1::Binding response; + auto status = grpc_stub_->GetBinding(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +future> +DefaultAgentRegistryStub::AsyncCreateBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions, + google::cloud::agentregistry::v1::CreateBindingRequest const& request) { + return internal::MakeUnaryRpcImpl< + google::cloud::agentregistry::v1::CreateBindingRequest, + google::longrunning::Operation>( + cq, + [this]( + grpc::ClientContext* context, + google::cloud::agentregistry::v1::CreateBindingRequest const& request, + grpc::CompletionQueue* cq) { + return grpc_stub_->AsyncCreateBinding(context, request, cq); + }, + request, std::move(context)); +} + +StatusOr +DefaultAgentRegistryStub::CreateBinding( + grpc::ClientContext& context, Options, + google::cloud::agentregistry::v1::CreateBindingRequest const& request) { + google::longrunning::Operation response; + auto status = grpc_stub_->CreateBinding(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +future> +DefaultAgentRegistryStub::AsyncUpdateBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions, + google::cloud::agentregistry::v1::UpdateBindingRequest const& request) { + return internal::MakeUnaryRpcImpl< + google::cloud::agentregistry::v1::UpdateBindingRequest, + google::longrunning::Operation>( + cq, + [this]( + grpc::ClientContext* context, + google::cloud::agentregistry::v1::UpdateBindingRequest const& request, + grpc::CompletionQueue* cq) { + return grpc_stub_->AsyncUpdateBinding(context, request, cq); + }, + request, std::move(context)); +} + +StatusOr +DefaultAgentRegistryStub::UpdateBinding( + grpc::ClientContext& context, Options, + google::cloud::agentregistry::v1::UpdateBindingRequest const& request) { + google::longrunning::Operation response; + auto status = grpc_stub_->UpdateBinding(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +future> +DefaultAgentRegistryStub::AsyncDeleteBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions, + google::cloud::agentregistry::v1::DeleteBindingRequest const& request) { + return internal::MakeUnaryRpcImpl< + google::cloud::agentregistry::v1::DeleteBindingRequest, + google::longrunning::Operation>( + cq, + [this]( + grpc::ClientContext* context, + google::cloud::agentregistry::v1::DeleteBindingRequest const& request, + grpc::CompletionQueue* cq) { + return grpc_stub_->AsyncDeleteBinding(context, request, cq); + }, + request, std::move(context)); +} + +StatusOr +DefaultAgentRegistryStub::DeleteBinding( + grpc::ClientContext& context, Options, + google::cloud::agentregistry::v1::DeleteBindingRequest const& request) { + google::longrunning::Operation response; + auto status = grpc_stub_->DeleteBinding(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultAgentRegistryStub::FetchAvailableBindings( + grpc::ClientContext& context, Options const&, + google::cloud::agentregistry::v1::FetchAvailableBindingsRequest const& + request) { + google::cloud::agentregistry::v1::FetchAvailableBindingsResponse response; + auto status = + grpc_stub_->FetchAvailableBindings(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultAgentRegistryStub::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 +DefaultAgentRegistryStub::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 +DefaultAgentRegistryStub::ListOperations( + grpc::ClientContext& context, Options const&, + google::longrunning::ListOperationsRequest const& request) { + google::longrunning::ListOperationsResponse response; + auto status = operations_stub_->ListOperations(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr DefaultAgentRegistryStub::GetOperation( + grpc::ClientContext& context, Options const&, + google::longrunning::GetOperationRequest const& request) { + google::longrunning::Operation response; + auto status = operations_stub_->GetOperation(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +Status DefaultAgentRegistryStub::DeleteOperation( + grpc::ClientContext& context, Options const&, + google::longrunning::DeleteOperationRequest const& request) { + google::protobuf::Empty response; + auto status = operations_stub_->DeleteOperation(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return google::cloud::Status(); +} + +Status DefaultAgentRegistryStub::CancelOperation( + grpc::ClientContext& context, Options const&, + google::longrunning::CancelOperationRequest const& request) { + google::protobuf::Empty response; + auto status = operations_stub_->CancelOperation(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return google::cloud::Status(); +} + +future> +DefaultAgentRegistryStub::AsyncGetOperation( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + // NOLINTNEXTLINE(performance-unnecessary-value-param) + google::cloud::internal::ImmutableOptions, + google::longrunning::GetOperationRequest const& request) { + return internal::MakeUnaryRpcImpl( + cq, + [this](grpc::ClientContext* context, + google::longrunning::GetOperationRequest const& request, + grpc::CompletionQueue* cq) { + return operations_stub_->AsyncGetOperation(context, request, cq); + }, + request, std::move(context)); +} + +future DefaultAgentRegistryStub::AsyncCancelOperation( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + // NOLINTNEXTLINE(performance-unnecessary-value-param) + google::cloud::internal::ImmutableOptions, + google::longrunning::CancelOperationRequest const& request) { + return internal::MakeUnaryRpcImpl( + cq, + [this](grpc::ClientContext* context, + google::longrunning::CancelOperationRequest const& request, + grpc::CompletionQueue* cq) { + return operations_stub_->AsyncCancelOperation(context, request, + cq); + }, + request, std::move(context)) + .then([](future> f) { + return f.get().status(); + }); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentregistry_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" diff --git a/google/cloud/agentregistry/v1/internal/agent_registry_stub.h b/google/cloud/agentregistry/v1/internal/agent_registry_stub.h new file mode 100644 index 0000000000000..620b49d6b46bb --- /dev/null +++ b/google/cloud/agentregistry/v1/internal/agent_registry_stub.h @@ -0,0 +1,424 @@ +// 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/agentregistry/v1/agentregistry_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_STUB_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_STUB_H + +#include "google/cloud/agentregistry/v1/agentregistry_service.grpc.pb.h" +#include "google/cloud/location/locations.grpc.pb.h" +#include "google/cloud/completion_queue.h" +#include "google/cloud/future.h" +#include "google/cloud/options.h" +#include "google/cloud/status_or.h" +#include "google/cloud/version.h" +#include "google/longrunning/operations.grpc.pb.h" +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace agentregistry_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class AgentRegistryStub { + public: + virtual ~AgentRegistryStub() = 0; + + virtual StatusOr + ListAgents( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListAgentsRequest const& request) = 0; + + virtual StatusOr + SearchAgents( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::SearchAgentsRequest const& request) = 0; + + virtual StatusOr GetAgent( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetAgentRequest const& request) = 0; + + virtual StatusOr + ListEndpoints(grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListEndpointsRequest const& + request) = 0; + + virtual StatusOr GetEndpoint( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetEndpointRequest const& request) = 0; + + virtual StatusOr + ListMcpServers(grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListMcpServersRequest const& + request) = 0; + + virtual StatusOr + SearchMcpServers( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::SearchMcpServersRequest const& + request) = 0; + + virtual StatusOr GetMcpServer( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetMcpServerRequest const& request) = 0; + + virtual StatusOr + ListServices( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListServicesRequest const& request) = 0; + + virtual StatusOr GetService( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetServiceRequest const& request) = 0; + + virtual future> AsyncCreateService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::CreateServiceRequest const& + request) = 0; + + virtual StatusOr CreateService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::CreateServiceRequest const& + request) = 0; + + virtual future> AsyncUpdateService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::UpdateServiceRequest const& + request) = 0; + + virtual StatusOr UpdateService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::UpdateServiceRequest const& + request) = 0; + + virtual future> AsyncDeleteService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::DeleteServiceRequest const& + request) = 0; + + virtual StatusOr DeleteService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::DeleteServiceRequest const& + request) = 0; + + virtual StatusOr + ListBindings( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListBindingsRequest const& request) = 0; + + virtual StatusOr GetBinding( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetBindingRequest const& request) = 0; + + virtual future> AsyncCreateBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::CreateBindingRequest const& + request) = 0; + + virtual StatusOr CreateBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::CreateBindingRequest const& + request) = 0; + + virtual future> AsyncUpdateBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::UpdateBindingRequest const& + request) = 0; + + virtual StatusOr UpdateBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::UpdateBindingRequest const& + request) = 0; + + virtual future> AsyncDeleteBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::DeleteBindingRequest const& + request) = 0; + + virtual StatusOr DeleteBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::DeleteBindingRequest const& + request) = 0; + + virtual StatusOr< + google::cloud::agentregistry::v1::FetchAvailableBindingsResponse> + FetchAvailableBindings( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::FetchAvailableBindingsRequest 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 ListOperations( + grpc::ClientContext& context, Options const& options, + google::longrunning::ListOperationsRequest const& request) = 0; + + virtual StatusOr GetOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::GetOperationRequest const& request) = 0; + + virtual Status DeleteOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::DeleteOperationRequest const& request) = 0; + + virtual Status CancelOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::CancelOperationRequest const& request) = 0; + + virtual future> AsyncGetOperation( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::GetOperationRequest const& request) = 0; + + virtual future AsyncCancelOperation( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::CancelOperationRequest const& request) = 0; +}; + +class DefaultAgentRegistryStub : public AgentRegistryStub { + public: + DefaultAgentRegistryStub( + std::unique_ptr< + google::cloud::agentregistry::v1::AgentRegistry::StubInterface> + grpc_stub, + std::unique_ptr + locations_stub, + std::unique_ptr + operations_stub) + : grpc_stub_(std::move(grpc_stub)), + locations_stub_(std::move(locations_stub)), + operations_stub_(std::move(operations_stub)) {} + + StatusOr ListAgents( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListAgentsRequest const& request) + override; + + StatusOr SearchAgents( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::SearchAgentsRequest const& request) + override; + + StatusOr GetAgent( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetAgentRequest const& request) + override; + + StatusOr + ListEndpoints(grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListEndpointsRequest const& + request) override; + + StatusOr GetEndpoint( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetEndpointRequest const& request) + override; + + StatusOr + ListMcpServers(grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListMcpServersRequest const& + request) override; + + StatusOr + SearchMcpServers( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::SearchMcpServersRequest const& request) + override; + + StatusOr GetMcpServer( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetMcpServerRequest const& request) + override; + + StatusOr ListServices( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListServicesRequest const& request) + override; + + StatusOr GetService( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetServiceRequest const& request) + override; + + future> AsyncCreateService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::CreateServiceRequest const& request) + override; + + StatusOr CreateService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::CreateServiceRequest const& request) + override; + + future> AsyncUpdateService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::UpdateServiceRequest const& request) + override; + + StatusOr UpdateService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::UpdateServiceRequest const& request) + override; + + future> AsyncDeleteService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::DeleteServiceRequest const& request) + override; + + StatusOr DeleteService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::DeleteServiceRequest const& request) + override; + + StatusOr ListBindings( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListBindingsRequest const& request) + override; + + StatusOr GetBinding( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetBindingRequest const& request) + override; + + future> AsyncCreateBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::CreateBindingRequest const& request) + override; + + StatusOr CreateBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::CreateBindingRequest const& request) + override; + + future> AsyncUpdateBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::UpdateBindingRequest const& request) + override; + + StatusOr UpdateBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::UpdateBindingRequest const& request) + override; + + future> AsyncDeleteBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::DeleteBindingRequest const& request) + override; + + StatusOr DeleteBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::DeleteBindingRequest const& request) + override; + + StatusOr + FetchAvailableBindings( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::FetchAvailableBindingsRequest 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 ListOperations( + grpc::ClientContext& context, Options const& options, + google::longrunning::ListOperationsRequest const& request) override; + + StatusOr GetOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::GetOperationRequest const& request) override; + + Status DeleteOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::DeleteOperationRequest const& request) override; + + Status CancelOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::CancelOperationRequest const& request) override; + + future> AsyncGetOperation( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::GetOperationRequest const& request) override; + + future AsyncCancelOperation( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::CancelOperationRequest const& request) override; + + private: + std::unique_ptr< + google::cloud::agentregistry::v1::AgentRegistry::StubInterface> + grpc_stub_; + std::unique_ptr + locations_stub_; + std::unique_ptr + operations_stub_; +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentregistry_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_STUB_H diff --git a/google/cloud/agentregistry/v1/internal/agent_registry_stub_factory.cc b/google/cloud/agentregistry/v1/internal/agent_registry_stub_factory.cc new file mode 100644 index 0000000000000..312b05058905b --- /dev/null +++ b/google/cloud/agentregistry/v1/internal/agent_registry_stub_factory.cc @@ -0,0 +1,82 @@ +// 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/agentregistry/v1/agentregistry_service.proto + +#include "google/cloud/agentregistry/v1/internal/agent_registry_stub_factory.h" +#include "google/cloud/agentregistry/v1/agentregistry_service.grpc.pb.h" +#include "google/cloud/agentregistry/v1/internal/agent_registry_auth_decorator.h" +#include "google/cloud/agentregistry/v1/internal/agent_registry_logging_decorator.h" +#include "google/cloud/agentregistry/v1/internal/agent_registry_metadata_decorator.h" +#include "google/cloud/agentregistry/v1/internal/agent_registry_stub.h" +#include "google/cloud/agentregistry/v1/internal/agent_registry_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/longrunning/operations.grpc.pb.h" +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace agentregistry_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +std::shared_ptr CreateDefaultAgentRegistryStub( + std::shared_ptr auth, + Options const& options) { + auto channel = auth->CreateChannel(options.get(), + internal::MakeChannelArguments(options)); + auto service_grpc_stub = + google::cloud::agentregistry::v1::AgentRegistry::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_locations_stub), + google::longrunning::Operations::NewStub(channel)); + + 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 = MakeAgentRegistryTracingStub(std::move(stub)); + } + return stub; +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentregistry_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" diff --git a/google/cloud/agentregistry/v1/internal/agent_registry_stub_factory.h b/google/cloud/agentregistry/v1/internal/agent_registry_stub_factory.h new file mode 100644 index 0000000000000..c0983e3638045 --- /dev/null +++ b/google/cloud/agentregistry/v1/internal/agent_registry_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/agentregistry/v1/agentregistry_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_STUB_FACTORY_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_STUB_FACTORY_H + +#include "google/cloud/agentregistry/v1/internal/agent_registry_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 agentregistry_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +std::shared_ptr CreateDefaultAgentRegistryStub( + std::shared_ptr auth, + Options const& options); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentregistry_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_STUB_FACTORY_H diff --git a/google/cloud/agentregistry/v1/internal/agent_registry_tracing_connection.cc b/google/cloud/agentregistry/v1/internal/agent_registry_tracing_connection.cc new file mode 100644 index 0000000000000..019f169b4cca6 --- /dev/null +++ b/google/cloud/agentregistry/v1/internal/agent_registry_tracing_connection.cc @@ -0,0 +1,409 @@ +// 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/agentregistry/v1/agentregistry_service.proto + +#include "google/cloud/agentregistry/v1/internal/agent_registry_tracing_connection.h" +#include "google/cloud/internal/opentelemetry.h" +#include "google/cloud/internal/traced_stream_range.h" +#include +#include + +namespace google { +namespace cloud { +namespace agentregistry_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +AgentRegistryTracingConnection::AgentRegistryTracingConnection( + std::shared_ptr child) + : child_(std::move(child)) {} + +StreamRange +AgentRegistryTracingConnection::ListAgents( + google::cloud::agentregistry::v1::ListAgentsRequest request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::ListAgents"); + internal::OTelScope scope(span); + auto sr = child_->ListAgents(std::move(request)); + return internal::MakeTracedStreamRange< + google::cloud::agentregistry::v1::Agent>(std::move(span), std::move(sr)); +} + +StreamRange +AgentRegistryTracingConnection::SearchAgents( + google::cloud::agentregistry::v1::SearchAgentsRequest request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::SearchAgents"); + internal::OTelScope scope(span); + auto sr = child_->SearchAgents(std::move(request)); + return internal::MakeTracedStreamRange< + google::cloud::agentregistry::v1::Agent>(std::move(span), std::move(sr)); +} + +StatusOr +AgentRegistryTracingConnection::GetAgent( + google::cloud::agentregistry::v1::GetAgentRequest const& request) { + auto span = + internal::MakeSpan("agentregistry_v1::AgentRegistryConnection::GetAgent"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->GetAgent(request)); +} + +StreamRange +AgentRegistryTracingConnection::ListEndpoints( + google::cloud::agentregistry::v1::ListEndpointsRequest request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::ListEndpoints"); + internal::OTelScope scope(span); + auto sr = child_->ListEndpoints(std::move(request)); + return internal::MakeTracedStreamRange< + google::cloud::agentregistry::v1::Endpoint>(std::move(span), + std::move(sr)); +} + +StatusOr +AgentRegistryTracingConnection::GetEndpoint( + google::cloud::agentregistry::v1::GetEndpointRequest const& request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::GetEndpoint"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->GetEndpoint(request)); +} + +StreamRange +AgentRegistryTracingConnection::ListMcpServers( + google::cloud::agentregistry::v1::ListMcpServersRequest request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::ListMcpServers"); + internal::OTelScope scope(span); + auto sr = child_->ListMcpServers(std::move(request)); + return internal::MakeTracedStreamRange< + google::cloud::agentregistry::v1::McpServer>(std::move(span), + std::move(sr)); +} + +StreamRange +AgentRegistryTracingConnection::SearchMcpServers( + google::cloud::agentregistry::v1::SearchMcpServersRequest request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::SearchMcpServers"); + internal::OTelScope scope(span); + auto sr = child_->SearchMcpServers(std::move(request)); + return internal::MakeTracedStreamRange< + google::cloud::agentregistry::v1::McpServer>(std::move(span), + std::move(sr)); +} + +StatusOr +AgentRegistryTracingConnection::GetMcpServer( + google::cloud::agentregistry::v1::GetMcpServerRequest const& request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::GetMcpServer"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->GetMcpServer(request)); +} + +StreamRange +AgentRegistryTracingConnection::ListServices( + google::cloud::agentregistry::v1::ListServicesRequest request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::ListServices"); + internal::OTelScope scope(span); + auto sr = child_->ListServices(std::move(request)); + return internal::MakeTracedStreamRange< + google::cloud::agentregistry::v1::Service>(std::move(span), + std::move(sr)); +} + +StatusOr +AgentRegistryTracingConnection::GetService( + google::cloud::agentregistry::v1::GetServiceRequest const& request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::GetService"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->GetService(request)); +} + +future> +AgentRegistryTracingConnection::CreateService( + google::cloud::agentregistry::v1::CreateServiceRequest const& request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::CreateService"); + internal::OTelScope scope(span); + return internal::EndSpan(std::move(span), child_->CreateService(request)); +} + +StatusOr +AgentRegistryTracingConnection::CreateService( + NoAwaitTag, + google::cloud::agentregistry::v1::CreateServiceRequest const& request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::CreateService"); + opentelemetry::trace::Scope scope(span); + return internal::EndSpan(*span, child_->CreateService(NoAwaitTag{}, request)); +} + +future> +AgentRegistryTracingConnection::CreateService( + google::longrunning::Operation const& operation) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::CreateService"); + internal::OTelScope scope(span); + return internal::EndSpan(std::move(span), child_->CreateService(operation)); +} + +future> +AgentRegistryTracingConnection::UpdateService( + google::cloud::agentregistry::v1::UpdateServiceRequest const& request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::UpdateService"); + internal::OTelScope scope(span); + return internal::EndSpan(std::move(span), child_->UpdateService(request)); +} + +StatusOr +AgentRegistryTracingConnection::UpdateService( + NoAwaitTag, + google::cloud::agentregistry::v1::UpdateServiceRequest const& request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::UpdateService"); + opentelemetry::trace::Scope scope(span); + return internal::EndSpan(*span, child_->UpdateService(NoAwaitTag{}, request)); +} + +future> +AgentRegistryTracingConnection::UpdateService( + google::longrunning::Operation const& operation) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::UpdateService"); + internal::OTelScope scope(span); + return internal::EndSpan(std::move(span), child_->UpdateService(operation)); +} + +future> +AgentRegistryTracingConnection::DeleteService( + google::cloud::agentregistry::v1::DeleteServiceRequest const& request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::DeleteService"); + internal::OTelScope scope(span); + return internal::EndSpan(std::move(span), child_->DeleteService(request)); +} + +StatusOr +AgentRegistryTracingConnection::DeleteService( + NoAwaitTag, + google::cloud::agentregistry::v1::DeleteServiceRequest const& request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::DeleteService"); + opentelemetry::trace::Scope scope(span); + return internal::EndSpan(*span, child_->DeleteService(NoAwaitTag{}, request)); +} + +future> +AgentRegistryTracingConnection::DeleteService( + google::longrunning::Operation const& operation) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::DeleteService"); + internal::OTelScope scope(span); + return internal::EndSpan(std::move(span), child_->DeleteService(operation)); +} + +StreamRange +AgentRegistryTracingConnection::ListBindings( + google::cloud::agentregistry::v1::ListBindingsRequest request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::ListBindings"); + internal::OTelScope scope(span); + auto sr = child_->ListBindings(std::move(request)); + return internal::MakeTracedStreamRange< + google::cloud::agentregistry::v1::Binding>(std::move(span), + std::move(sr)); +} + +StatusOr +AgentRegistryTracingConnection::GetBinding( + google::cloud::agentregistry::v1::GetBindingRequest const& request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::GetBinding"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->GetBinding(request)); +} + +future> +AgentRegistryTracingConnection::CreateBinding( + google::cloud::agentregistry::v1::CreateBindingRequest const& request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::CreateBinding"); + internal::OTelScope scope(span); + return internal::EndSpan(std::move(span), child_->CreateBinding(request)); +} + +StatusOr +AgentRegistryTracingConnection::CreateBinding( + NoAwaitTag, + google::cloud::agentregistry::v1::CreateBindingRequest const& request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::CreateBinding"); + opentelemetry::trace::Scope scope(span); + return internal::EndSpan(*span, child_->CreateBinding(NoAwaitTag{}, request)); +} + +future> +AgentRegistryTracingConnection::CreateBinding( + google::longrunning::Operation const& operation) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::CreateBinding"); + internal::OTelScope scope(span); + return internal::EndSpan(std::move(span), child_->CreateBinding(operation)); +} + +future> +AgentRegistryTracingConnection::UpdateBinding( + google::cloud::agentregistry::v1::UpdateBindingRequest const& request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::UpdateBinding"); + internal::OTelScope scope(span); + return internal::EndSpan(std::move(span), child_->UpdateBinding(request)); +} + +StatusOr +AgentRegistryTracingConnection::UpdateBinding( + NoAwaitTag, + google::cloud::agentregistry::v1::UpdateBindingRequest const& request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::UpdateBinding"); + opentelemetry::trace::Scope scope(span); + return internal::EndSpan(*span, child_->UpdateBinding(NoAwaitTag{}, request)); +} + +future> +AgentRegistryTracingConnection::UpdateBinding( + google::longrunning::Operation const& operation) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::UpdateBinding"); + internal::OTelScope scope(span); + return internal::EndSpan(std::move(span), child_->UpdateBinding(operation)); +} + +future> +AgentRegistryTracingConnection::DeleteBinding( + google::cloud::agentregistry::v1::DeleteBindingRequest const& request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::DeleteBinding"); + internal::OTelScope scope(span); + return internal::EndSpan(std::move(span), child_->DeleteBinding(request)); +} + +StatusOr +AgentRegistryTracingConnection::DeleteBinding( + NoAwaitTag, + google::cloud::agentregistry::v1::DeleteBindingRequest const& request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::DeleteBinding"); + opentelemetry::trace::Scope scope(span); + return internal::EndSpan(*span, child_->DeleteBinding(NoAwaitTag{}, request)); +} + +future> +AgentRegistryTracingConnection::DeleteBinding( + google::longrunning::Operation const& operation) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::DeleteBinding"); + internal::OTelScope scope(span); + return internal::EndSpan(std::move(span), child_->DeleteBinding(operation)); +} + +StreamRange +AgentRegistryTracingConnection::FetchAvailableBindings( + google::cloud::agentregistry::v1::FetchAvailableBindingsRequest request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::FetchAvailableBindings"); + internal::OTelScope scope(span); + auto sr = child_->FetchAvailableBindings(std::move(request)); + return internal::MakeTracedStreamRange< + google::cloud::agentregistry::v1::Binding>(std::move(span), + std::move(sr)); +} + +StreamRange +AgentRegistryTracingConnection::ListLocations( + google::cloud::location::ListLocationsRequest request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::ListLocations"); + internal::OTelScope scope(span); + auto sr = child_->ListLocations(std::move(request)); + return internal::MakeTracedStreamRange( + std::move(span), std::move(sr)); +} + +StatusOr +AgentRegistryTracingConnection::GetLocation( + google::cloud::location::GetLocationRequest const& request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::GetLocation"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->GetLocation(request)); +} + +StreamRange +AgentRegistryTracingConnection::ListOperations( + google::longrunning::ListOperationsRequest request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::ListOperations"); + internal::OTelScope scope(span); + auto sr = child_->ListOperations(std::move(request)); + return internal::MakeTracedStreamRange( + std::move(span), std::move(sr)); +} + +StatusOr +AgentRegistryTracingConnection::GetOperation( + google::longrunning::GetOperationRequest const& request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::GetOperation"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->GetOperation(request)); +} + +Status AgentRegistryTracingConnection::DeleteOperation( + google::longrunning::DeleteOperationRequest const& request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::DeleteOperation"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->DeleteOperation(request)); +} + +Status AgentRegistryTracingConnection::CancelOperation( + google::longrunning::CancelOperationRequest const& request) { + auto span = internal::MakeSpan( + "agentregistry_v1::AgentRegistryConnection::CancelOperation"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->CancelOperation(request)); +} + +std::shared_ptr +MakeAgentRegistryTracingConnection( + 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 agentregistry_v1_internal +} // namespace cloud +} // namespace google diff --git a/google/cloud/agentregistry/v1/internal/agent_registry_tracing_connection.h b/google/cloud/agentregistry/v1/internal/agent_registry_tracing_connection.h new file mode 100644 index 0000000000000..0b64bc8c5989e --- /dev/null +++ b/google/cloud/agentregistry/v1/internal/agent_registry_tracing_connection.h @@ -0,0 +1,196 @@ +// 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/agentregistry/v1/agentregistry_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_TRACING_CONNECTION_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_TRACING_CONNECTION_H + +#include "google/cloud/agentregistry/v1/agent_registry_connection.h" +#include "google/cloud/version.h" +#include + +namespace google { +namespace cloud { +namespace agentregistry_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class AgentRegistryTracingConnection + : public agentregistry_v1::AgentRegistryConnection { + public: + ~AgentRegistryTracingConnection() override = default; + + explicit AgentRegistryTracingConnection( + std::shared_ptr child); + + Options options() override { return child_->options(); } + + StreamRange ListAgents( + google::cloud::agentregistry::v1::ListAgentsRequest request) override; + + StreamRange SearchAgents( + google::cloud::agentregistry::v1::SearchAgentsRequest request) override; + + StatusOr GetAgent( + google::cloud::agentregistry::v1::GetAgentRequest const& request) + override; + + StreamRange ListEndpoints( + google::cloud::agentregistry::v1::ListEndpointsRequest request) override; + + StatusOr GetEndpoint( + google::cloud::agentregistry::v1::GetEndpointRequest const& request) + override; + + StreamRange ListMcpServers( + google::cloud::agentregistry::v1::ListMcpServersRequest request) override; + + StreamRange SearchMcpServers( + google::cloud::agentregistry::v1::SearchMcpServersRequest request) + override; + + StatusOr GetMcpServer( + google::cloud::agentregistry::v1::GetMcpServerRequest const& request) + override; + + StreamRange ListServices( + google::cloud::agentregistry::v1::ListServicesRequest request) override; + + StatusOr GetService( + google::cloud::agentregistry::v1::GetServiceRequest const& request) + override; + + future> CreateService( + google::cloud::agentregistry::v1::CreateServiceRequest const& request) + override; + + StatusOr CreateService( + NoAwaitTag, + google::cloud::agentregistry::v1::CreateServiceRequest const& request) + override; + + future> CreateService( + google::longrunning::Operation const& operation) override; + + future> UpdateService( + google::cloud::agentregistry::v1::UpdateServiceRequest const& request) + override; + + StatusOr UpdateService( + NoAwaitTag, + google::cloud::agentregistry::v1::UpdateServiceRequest const& request) + override; + + future> UpdateService( + google::longrunning::Operation const& operation) override; + + future> + DeleteService(google::cloud::agentregistry::v1::DeleteServiceRequest const& + request) override; + + StatusOr DeleteService( + NoAwaitTag, + google::cloud::agentregistry::v1::DeleteServiceRequest const& request) + override; + + future> + DeleteService(google::longrunning::Operation const& operation) override; + + StreamRange ListBindings( + google::cloud::agentregistry::v1::ListBindingsRequest request) override; + + StatusOr GetBinding( + google::cloud::agentregistry::v1::GetBindingRequest const& request) + override; + + future> CreateBinding( + google::cloud::agentregistry::v1::CreateBindingRequest const& request) + override; + + StatusOr CreateBinding( + NoAwaitTag, + google::cloud::agentregistry::v1::CreateBindingRequest const& request) + override; + + future> CreateBinding( + google::longrunning::Operation const& operation) override; + + future> UpdateBinding( + google::cloud::agentregistry::v1::UpdateBindingRequest const& request) + override; + + StatusOr UpdateBinding( + NoAwaitTag, + google::cloud::agentregistry::v1::UpdateBindingRequest const& request) + override; + + future> UpdateBinding( + google::longrunning::Operation const& operation) override; + + future> + DeleteBinding(google::cloud::agentregistry::v1::DeleteBindingRequest const& + request) override; + + StatusOr DeleteBinding( + NoAwaitTag, + google::cloud::agentregistry::v1::DeleteBindingRequest const& request) + override; + + future> + DeleteBinding(google::longrunning::Operation const& operation) override; + + StreamRange FetchAvailableBindings( + google::cloud::agentregistry::v1::FetchAvailableBindingsRequest request) + override; + + StreamRange ListLocations( + google::cloud::location::ListLocationsRequest request) override; + + StatusOr GetLocation( + google::cloud::location::GetLocationRequest const& request) override; + + StreamRange ListOperations( + google::longrunning::ListOperationsRequest request) override; + + StatusOr GetOperation( + google::longrunning::GetOperationRequest const& request) override; + + Status DeleteOperation( + google::longrunning::DeleteOperationRequest const& request) override; + + Status CancelOperation( + google::longrunning::CancelOperationRequest 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 +MakeAgentRegistryTracingConnection( + std::shared_ptr conn); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentregistry_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_TRACING_CONNECTION_H diff --git a/google/cloud/agentregistry/v1/internal/agent_registry_tracing_stub.cc b/google/cloud/agentregistry/v1/internal/agent_registry_tracing_stub.cc new file mode 100644 index 0000000000000..912013da99d8e --- /dev/null +++ b/google/cloud/agentregistry/v1/internal/agent_registry_tracing_stub.cc @@ -0,0 +1,457 @@ +// 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/agentregistry/v1/agentregistry_service.proto + +#include "google/cloud/agentregistry/v1/internal/agent_registry_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 agentregistry_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +AgentRegistryTracingStub::AgentRegistryTracingStub( + std::shared_ptr child) + : child_(std::move(child)), propagator_(internal::MakePropagator()) {} + +StatusOr +AgentRegistryTracingStub::ListAgents( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListAgentsRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "ListAgents"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->ListAgents(context, options, request)); +} + +StatusOr +AgentRegistryTracingStub::SearchAgents( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::SearchAgentsRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "SearchAgents"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->SearchAgents(context, options, request)); +} + +StatusOr +AgentRegistryTracingStub::GetAgent( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetAgentRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "GetAgent"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->GetAgent(context, options, request)); +} + +StatusOr +AgentRegistryTracingStub::ListEndpoints( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListEndpointsRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "ListEndpoints"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->ListEndpoints(context, options, request)); +} + +StatusOr +AgentRegistryTracingStub::GetEndpoint( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetEndpointRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "GetEndpoint"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->GetEndpoint(context, options, request)); +} + +StatusOr +AgentRegistryTracingStub::ListMcpServers( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListMcpServersRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "ListMcpServers"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->ListMcpServers(context, options, request)); +} + +StatusOr +AgentRegistryTracingStub::SearchMcpServers( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::SearchMcpServersRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "SearchMcpServers"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->SearchMcpServers(context, options, request)); +} + +StatusOr +AgentRegistryTracingStub::GetMcpServer( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetMcpServerRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "GetMcpServer"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->GetMcpServer(context, options, request)); +} + +StatusOr +AgentRegistryTracingStub::ListServices( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListServicesRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "ListServices"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->ListServices(context, options, request)); +} + +StatusOr +AgentRegistryTracingStub::GetService( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetServiceRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "GetService"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->GetService(context, options, request)); +} + +future> +AgentRegistryTracingStub::AsyncCreateService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::CreateServiceRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "CreateService"); + internal::OTelScope scope(span); + internal::InjectTraceContext(*context, *propagator_); + auto f = child_->AsyncCreateService(cq, context, std::move(options), request); + return internal::EndSpan(std::move(context), std::move(span), std::move(f)); +} + +StatusOr +AgentRegistryTracingStub::CreateService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::CreateServiceRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "CreateService"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->CreateService(context, options, request)); +} + +future> +AgentRegistryTracingStub::AsyncUpdateService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::UpdateServiceRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "UpdateService"); + internal::OTelScope scope(span); + internal::InjectTraceContext(*context, *propagator_); + auto f = child_->AsyncUpdateService(cq, context, std::move(options), request); + return internal::EndSpan(std::move(context), std::move(span), std::move(f)); +} + +StatusOr +AgentRegistryTracingStub::UpdateService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::UpdateServiceRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "UpdateService"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->UpdateService(context, options, request)); +} + +future> +AgentRegistryTracingStub::AsyncDeleteService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::DeleteServiceRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "DeleteService"); + internal::OTelScope scope(span); + internal::InjectTraceContext(*context, *propagator_); + auto f = child_->AsyncDeleteService(cq, context, std::move(options), request); + return internal::EndSpan(std::move(context), std::move(span), std::move(f)); +} + +StatusOr +AgentRegistryTracingStub::DeleteService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::DeleteServiceRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "DeleteService"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->DeleteService(context, options, request)); +} + +StatusOr +AgentRegistryTracingStub::ListBindings( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListBindingsRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "ListBindings"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->ListBindings(context, options, request)); +} + +StatusOr +AgentRegistryTracingStub::GetBinding( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetBindingRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "GetBinding"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->GetBinding(context, options, request)); +} + +future> +AgentRegistryTracingStub::AsyncCreateBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::CreateBindingRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "CreateBinding"); + internal::OTelScope scope(span); + internal::InjectTraceContext(*context, *propagator_); + auto f = child_->AsyncCreateBinding(cq, context, std::move(options), request); + return internal::EndSpan(std::move(context), std::move(span), std::move(f)); +} + +StatusOr +AgentRegistryTracingStub::CreateBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::CreateBindingRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "CreateBinding"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->CreateBinding(context, options, request)); +} + +future> +AgentRegistryTracingStub::AsyncUpdateBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::UpdateBindingRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "UpdateBinding"); + internal::OTelScope scope(span); + internal::InjectTraceContext(*context, *propagator_); + auto f = child_->AsyncUpdateBinding(cq, context, std::move(options), request); + return internal::EndSpan(std::move(context), std::move(span), std::move(f)); +} + +StatusOr +AgentRegistryTracingStub::UpdateBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::UpdateBindingRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "UpdateBinding"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->UpdateBinding(context, options, request)); +} + +future> +AgentRegistryTracingStub::AsyncDeleteBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::DeleteBindingRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "DeleteBinding"); + internal::OTelScope scope(span); + internal::InjectTraceContext(*context, *propagator_); + auto f = child_->AsyncDeleteBinding(cq, context, std::move(options), request); + return internal::EndSpan(std::move(context), std::move(span), std::move(f)); +} + +StatusOr +AgentRegistryTracingStub::DeleteBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::DeleteBindingRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "DeleteBinding"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->DeleteBinding(context, options, request)); +} + +StatusOr +AgentRegistryTracingStub::FetchAvailableBindings( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::FetchAvailableBindingsRequest const& + request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "FetchAvailableBindings"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan( + context, *span, + child_->FetchAvailableBindings(context, options, request)); +} + +StatusOr +AgentRegistryTracingStub::ListLocations( + grpc::ClientContext& context, Options const& options, + google::cloud::location::ListLocationsRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "ListLocations"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->ListLocations(context, options, request)); +} + +StatusOr +AgentRegistryTracingStub::GetLocation( + grpc::ClientContext& context, Options const& options, + google::cloud::location::GetLocationRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "GetLocation"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->GetLocation(context, options, request)); +} + +StatusOr +AgentRegistryTracingStub::ListOperations( + grpc::ClientContext& context, Options const& options, + google::longrunning::ListOperationsRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "ListOperations"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->ListOperations(context, options, request)); +} + +StatusOr AgentRegistryTracingStub::GetOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::GetOperationRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "GetOperation"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->GetOperation(context, options, request)); +} + +Status AgentRegistryTracingStub::DeleteOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::DeleteOperationRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "DeleteOperation"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->DeleteOperation(context, options, request)); +} + +Status AgentRegistryTracingStub::CancelOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::CancelOperationRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.agentregistry.v1.AgentRegistry", "CancelOperation"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->CancelOperation(context, options, request)); +} + +future> +AgentRegistryTracingStub::AsyncGetOperation( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::GetOperationRequest const& request) { + auto span = + internal::MakeSpanGrpc("google.longrunning.Operations", "GetOperation"); + internal::OTelScope scope(span); + internal::InjectTraceContext(*context, *propagator_); + auto f = child_->AsyncGetOperation(cq, context, std::move(options), request); + return internal::EndSpan(std::move(context), std::move(span), std::move(f)); +} + +future AgentRegistryTracingStub::AsyncCancelOperation( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::CancelOperationRequest const& request) { + auto span = internal::MakeSpanGrpc("google.longrunning.Operations", + "CancelOperation"); + internal::OTelScope scope(span); + internal::InjectTraceContext(*context, *propagator_); + auto f = + child_->AsyncCancelOperation(cq, context, std::move(options), request); + return internal::EndSpan(std::move(context), std::move(span), std::move(f)); +} + +std::shared_ptr MakeAgentRegistryTracingStub( + std::shared_ptr stub) { + return std::make_shared(std::move(stub)); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentregistry_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" diff --git a/google/cloud/agentregistry/v1/internal/agent_registry_tracing_stub.h b/google/cloud/agentregistry/v1/internal/agent_registry_tracing_stub.h new file mode 100644 index 0000000000000..76afa53293ca2 --- /dev/null +++ b/google/cloud/agentregistry/v1/internal/agent_registry_tracing_stub.h @@ -0,0 +1,239 @@ +// 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/agentregistry/v1/agentregistry_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_TRACING_STUB_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_TRACING_STUB_H + +#include "google/cloud/agentregistry/v1/internal/agent_registry_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 agentregistry_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class AgentRegistryTracingStub : public AgentRegistryStub { + public: + ~AgentRegistryTracingStub() override = default; + + explicit AgentRegistryTracingStub(std::shared_ptr child); + + StatusOr ListAgents( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListAgentsRequest const& request) + override; + + StatusOr SearchAgents( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::SearchAgentsRequest const& request) + override; + + StatusOr GetAgent( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetAgentRequest const& request) + override; + + StatusOr + ListEndpoints(grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListEndpointsRequest const& + request) override; + + StatusOr GetEndpoint( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetEndpointRequest const& request) + override; + + StatusOr + ListMcpServers(grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListMcpServersRequest const& + request) override; + + StatusOr + SearchMcpServers( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::SearchMcpServersRequest const& request) + override; + + StatusOr GetMcpServer( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetMcpServerRequest const& request) + override; + + StatusOr ListServices( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListServicesRequest const& request) + override; + + StatusOr GetService( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetServiceRequest const& request) + override; + + future> AsyncCreateService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::CreateServiceRequest const& request) + override; + + StatusOr CreateService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::CreateServiceRequest const& request) + override; + + future> AsyncUpdateService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::UpdateServiceRequest const& request) + override; + + StatusOr UpdateService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::UpdateServiceRequest const& request) + override; + + future> AsyncDeleteService( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::DeleteServiceRequest const& request) + override; + + StatusOr DeleteService( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::DeleteServiceRequest const& request) + override; + + StatusOr ListBindings( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::ListBindingsRequest const& request) + override; + + StatusOr GetBinding( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::GetBindingRequest const& request) + override; + + future> AsyncCreateBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::CreateBindingRequest const& request) + override; + + StatusOr CreateBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::CreateBindingRequest const& request) + override; + + future> AsyncUpdateBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::UpdateBindingRequest const& request) + override; + + StatusOr UpdateBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::UpdateBindingRequest const& request) + override; + + future> AsyncDeleteBinding( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::cloud::agentregistry::v1::DeleteBindingRequest const& request) + override; + + StatusOr DeleteBinding( + grpc::ClientContext& context, Options options, + google::cloud::agentregistry::v1::DeleteBindingRequest const& request) + override; + + StatusOr + FetchAvailableBindings( + grpc::ClientContext& context, Options const& options, + google::cloud::agentregistry::v1::FetchAvailableBindingsRequest 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 ListOperations( + grpc::ClientContext& context, Options const& options, + google::longrunning::ListOperationsRequest const& request) override; + + StatusOr GetOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::GetOperationRequest const& request) override; + + Status DeleteOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::DeleteOperationRequest const& request) override; + + Status CancelOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::CancelOperationRequest const& request) override; + + future> AsyncGetOperation( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::GetOperationRequest const& request) override; + + future AsyncCancelOperation( + google::cloud::CompletionQueue& cq, + std::shared_ptr context, + google::cloud::internal::ImmutableOptions options, + google::longrunning::CancelOperationRequest 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 MakeAgentRegistryTracingStub( + std::shared_ptr stub); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentregistry_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_INTERNAL_AGENT_REGISTRY_TRACING_STUB_H diff --git a/google/cloud/agentregistry/v1/mocks/mock_agent_registry_connection.h b/google/cloud/agentregistry/v1/mocks/mock_agent_registry_connection.h new file mode 100644 index 0000000000000..f8bef157739db --- /dev/null +++ b/google/cloud/agentregistry/v1/mocks/mock_agent_registry_connection.h @@ -0,0 +1,382 @@ +// 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/agentregistry/v1/agentregistry_service.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_MOCKS_MOCK_AGENT_REGISTRY_CONNECTION_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_MOCKS_MOCK_AGENT_REGISTRY_CONNECTION_H + +#include "google/cloud/agentregistry/v1/agent_registry_connection.h" +#include + +namespace google { +namespace cloud { +namespace agentregistry_v1_mocks { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +/** + * A class to mock `AgentRegistryConnection`. + * + * Application developers may want to test their code with simulated responses, + * including errors, from an object of type `AgentRegistryClient`. To do so, + * construct an object of type `AgentRegistryClient` 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 MockAgentRegistryConnection + : public agentregistry_v1::AgentRegistryConnection { + public: + MOCK_METHOD(Options, options, (), (override)); + + MOCK_METHOD((StreamRange), + ListAgents, + (google::cloud::agentregistry::v1::ListAgentsRequest request), + (override)); + + MOCK_METHOD((StreamRange), + SearchAgents, + (google::cloud::agentregistry::v1::SearchAgentsRequest request), + (override)); + + MOCK_METHOD( + StatusOr, GetAgent, + (google::cloud::agentregistry::v1::GetAgentRequest const& request), + (override)); + + MOCK_METHOD((StreamRange), + ListEndpoints, + (google::cloud::agentregistry::v1::ListEndpointsRequest request), + (override)); + + MOCK_METHOD( + StatusOr, GetEndpoint, + (google::cloud::agentregistry::v1::GetEndpointRequest const& request), + (override)); + + MOCK_METHOD((StreamRange), + ListMcpServers, + (google::cloud::agentregistry::v1::ListMcpServersRequest request), + (override)); + + MOCK_METHOD( + (StreamRange), + SearchMcpServers, + (google::cloud::agentregistry::v1::SearchMcpServersRequest request), + (override)); + + MOCK_METHOD( + StatusOr, GetMcpServer, + (google::cloud::agentregistry::v1::GetMcpServerRequest const& request), + (override)); + + MOCK_METHOD((StreamRange), + ListServices, + (google::cloud::agentregistry::v1::ListServicesRequest request), + (override)); + + MOCK_METHOD( + StatusOr, GetService, + (google::cloud::agentregistry::v1::GetServiceRequest const& request), + (override)); + + /// To disambiguate calls, use: + /// + /// @code + /// using ::testing::_; + /// using ::testing::Matcher; + /// EXPECT_CALL(*mock, + /// CreateService(Matcher(_))) + /// @endcode + MOCK_METHOD( + future>, + CreateService, + (google::cloud::agentregistry::v1::CreateServiceRequest const& request), + (override)); + + /// To disambiguate calls, use: + /// + /// @code + /// using ::testing::_; + /// EXPECT_CALL(*mock, CreateService(_, _)) + /// @endcode + MOCK_METHOD( + StatusOr, CreateService, + (NoAwaitTag, + google::cloud::agentregistry::v1::CreateServiceRequest const& request), + (override)); + + /// To disambiguate calls, use: + /// + /// @code + /// using ::testing::_; + /// using ::testing::Matcher; + /// EXPECT_CALL(*mock, CreateService(Matcher(_))) + /// @endcode + MOCK_METHOD(future>, + CreateService, (google::longrunning::Operation const& operation), + (override)); + + /// To disambiguate calls, use: + /// + /// @code + /// using ::testing::_; + /// using ::testing::Matcher; + /// EXPECT_CALL(*mock, + /// UpdateService(Matcher(_))) + /// @endcode + MOCK_METHOD( + future>, + UpdateService, + (google::cloud::agentregistry::v1::UpdateServiceRequest const& request), + (override)); + + /// To disambiguate calls, use: + /// + /// @code + /// using ::testing::_; + /// EXPECT_CALL(*mock, UpdateService(_, _)) + /// @endcode + MOCK_METHOD( + StatusOr, UpdateService, + (NoAwaitTag, + google::cloud::agentregistry::v1::UpdateServiceRequest const& request), + (override)); + + /// To disambiguate calls, use: + /// + /// @code + /// using ::testing::_; + /// using ::testing::Matcher; + /// EXPECT_CALL(*mock, UpdateService(Matcher(_))) + /// @endcode + MOCK_METHOD(future>, + UpdateService, (google::longrunning::Operation const& operation), + (override)); + + /// To disambiguate calls, use: + /// + /// @code + /// using ::testing::_; + /// using ::testing::Matcher; + /// EXPECT_CALL(*mock, + /// DeleteService(Matcher(_))) + /// @endcode + MOCK_METHOD( + future>, + DeleteService, + (google::cloud::agentregistry::v1::DeleteServiceRequest const& request), + (override)); + + /// To disambiguate calls, use: + /// + /// @code + /// using ::testing::_; + /// EXPECT_CALL(*mock, DeleteService(_, _)) + /// @endcode + MOCK_METHOD( + StatusOr, DeleteService, + (NoAwaitTag, + google::cloud::agentregistry::v1::DeleteServiceRequest const& request), + (override)); + + /// To disambiguate calls, use: + /// + /// @code + /// using ::testing::_; + /// using ::testing::Matcher; + /// EXPECT_CALL(*mock, DeleteService(Matcher(_))) + /// @endcode + MOCK_METHOD( + future>, + DeleteService, (google::longrunning::Operation const& operation), + (override)); + + MOCK_METHOD((StreamRange), + ListBindings, + (google::cloud::agentregistry::v1::ListBindingsRequest request), + (override)); + + MOCK_METHOD( + StatusOr, GetBinding, + (google::cloud::agentregistry::v1::GetBindingRequest const& request), + (override)); + + /// To disambiguate calls, use: + /// + /// @code + /// using ::testing::_; + /// using ::testing::Matcher; + /// EXPECT_CALL(*mock, + /// CreateBinding(Matcher(_))) + /// @endcode + MOCK_METHOD( + future>, + CreateBinding, + (google::cloud::agentregistry::v1::CreateBindingRequest const& request), + (override)); + + /// To disambiguate calls, use: + /// + /// @code + /// using ::testing::_; + /// EXPECT_CALL(*mock, CreateBinding(_, _)) + /// @endcode + MOCK_METHOD( + StatusOr, CreateBinding, + (NoAwaitTag, + google::cloud::agentregistry::v1::CreateBindingRequest const& request), + (override)); + + /// To disambiguate calls, use: + /// + /// @code + /// using ::testing::_; + /// using ::testing::Matcher; + /// EXPECT_CALL(*mock, CreateBinding(Matcher(_))) + /// @endcode + MOCK_METHOD(future>, + CreateBinding, (google::longrunning::Operation const& operation), + (override)); + + /// To disambiguate calls, use: + /// + /// @code + /// using ::testing::_; + /// using ::testing::Matcher; + /// EXPECT_CALL(*mock, + /// UpdateBinding(Matcher(_))) + /// @endcode + MOCK_METHOD( + future>, + UpdateBinding, + (google::cloud::agentregistry::v1::UpdateBindingRequest const& request), + (override)); + + /// To disambiguate calls, use: + /// + /// @code + /// using ::testing::_; + /// EXPECT_CALL(*mock, UpdateBinding(_, _)) + /// @endcode + MOCK_METHOD( + StatusOr, UpdateBinding, + (NoAwaitTag, + google::cloud::agentregistry::v1::UpdateBindingRequest const& request), + (override)); + + /// To disambiguate calls, use: + /// + /// @code + /// using ::testing::_; + /// using ::testing::Matcher; + /// EXPECT_CALL(*mock, UpdateBinding(Matcher(_))) + /// @endcode + MOCK_METHOD(future>, + UpdateBinding, (google::longrunning::Operation const& operation), + (override)); + + /// To disambiguate calls, use: + /// + /// @code + /// using ::testing::_; + /// using ::testing::Matcher; + /// EXPECT_CALL(*mock, + /// DeleteBinding(Matcher(_))) + /// @endcode + MOCK_METHOD( + future>, + DeleteBinding, + (google::cloud::agentregistry::v1::DeleteBindingRequest const& request), + (override)); + + /// To disambiguate calls, use: + /// + /// @code + /// using ::testing::_; + /// EXPECT_CALL(*mock, DeleteBinding(_, _)) + /// @endcode + MOCK_METHOD( + StatusOr, DeleteBinding, + (NoAwaitTag, + google::cloud::agentregistry::v1::DeleteBindingRequest const& request), + (override)); + + /// To disambiguate calls, use: + /// + /// @code + /// using ::testing::_; + /// using ::testing::Matcher; + /// EXPECT_CALL(*mock, DeleteBinding(Matcher(_))) + /// @endcode + MOCK_METHOD( + future>, + DeleteBinding, (google::longrunning::Operation const& operation), + (override)); + + MOCK_METHOD( + (StreamRange), + FetchAvailableBindings, + (google::cloud::agentregistry::v1::FetchAvailableBindingsRequest 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((StreamRange), ListOperations, + (google::longrunning::ListOperationsRequest request), (override)); + + MOCK_METHOD(StatusOr, GetOperation, + (google::longrunning::GetOperationRequest const& request), + (override)); + + MOCK_METHOD(Status, DeleteOperation, + (google::longrunning::DeleteOperationRequest const& request), + (override)); + + MOCK_METHOD(Status, CancelOperation, + (google::longrunning::CancelOperationRequest const& request), + (override)); +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace agentregistry_v1_mocks +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_AGENTREGISTRY_V1_MOCKS_MOCK_AGENT_REGISTRY_CONNECTION_H diff --git a/google/cloud/agentregistry/v1/samples/agent_registry_client_samples.cc b/google/cloud/agentregistry/v1/samples/agent_registry_client_samples.cc new file mode 100644 index 0000000000000..0d3408f985fc3 --- /dev/null +++ b/google/cloud/agentregistry/v1/samples/agent_registry_client_samples.cc @@ -0,0 +1,229 @@ +// 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/agentregistry/v1/agentregistry_service.proto + +#include "google/cloud/agentregistry/v1/agent_registry_client.h" +#include "google/cloud/agentregistry/v1/agent_registry_connection_idempotency_policy.h" +#include "google/cloud/agentregistry/v1/agent_registry_options.h" +#include "google/cloud/common_options.h" +#include "google/cloud/credentials.h" +#include "google/cloud/internal/getenv.h" +#include "google/cloud/polling_policy.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: agentregistry_v1::AgentRegistryClient +// lro-marker: true +// 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::agentregistry_v1::AgentRegistryClient( + google::cloud::agentregistry_v1::MakeAgentRegistryConnection(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::agentregistry_v1::AgentRegistryClient( + google::cloud::agentregistry_v1::MakeAgentRegistryConnection( + *ud_options)); + //! [set-client-universe-domain] +} + +//! [custom-idempotency-policy] +class CustomIdempotencyPolicy : public google::cloud::agentregistry_v1:: + AgentRegistryConnectionIdempotencyPolicy { + public: + ~CustomIdempotencyPolicy() override = default; + std::unique_ptr< + google::cloud::agentregistry_v1::AgentRegistryConnectionIdempotencyPolicy> + 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::agentregistry_v1:: + AgentRegistryLimitedErrorCountRetryPolicy(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::agentregistry_v1::MakeAgentRegistryConnection(options); + + // c1 and c2 share the same retry policies + auto c1 = google::cloud::agentregistry_v1::AgentRegistryClient(connection); + auto c2 = google::cloud::agentregistry_v1::AgentRegistryClient(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::agentregistry_v1::AgentRegistryClient( + connection, + google::cloud::Options{} + .set( + google::cloud::agentregistry_v1:: + AgentRegistryLimitedTimeRetryPolicy(std::chrono::minutes(5)) + .clone())); + + // You can also override the policies in a single call: + // c3.SomeRpc(..., google::cloud::Options{} + // .set( + // google::cloud::agentregistry_v1::AgentRegistryLimitedErrorCountRetryPolicy(10).clone())); + //! [set-retry-policy] +} + +void SetPollingPolicy(std::vector const& argv) { + if (!argv.empty()) { + throw google::cloud::testing_util::Usage{"set-client-policy-policy"}; + } + //! [set-polling-policy] + + // The polling policy controls how the client waits for long-running + // operations. `GenericPollingPolicy<>` combines existing policies. + // In this case, keep polling until the operation completes (with success + // or error) or 45 minutes, whichever happens first. Initially pause for + // 10 seconds between polling requests, increasing the pause by a factor + // of 4 until it becomes 2 minutes. + auto options = + google::cloud::Options{} + .set( + google::cloud::GenericPollingPolicy< + google::cloud::agentregistry_v1:: + AgentRegistryRetryPolicyOption::Type, + google::cloud::agentregistry_v1:: + AgentRegistryBackoffPolicyOption::Type>( + google::cloud::agentregistry_v1:: + AgentRegistryLimitedTimeRetryPolicy( + /*maximum_duration=*/std::chrono::minutes(45)) + .clone(), + google::cloud::ExponentialBackoffPolicy( + /*initial_delay=*/std::chrono::seconds(10), + /*maximum_delay=*/std::chrono::minutes(2), + /*scaling=*/4.0) + .clone()) + .clone()); + + auto connection = + google::cloud::agentregistry_v1::MakeAgentRegistryConnection(options); + + // c1 and c2 share the same polling policies. + auto c1 = google::cloud::agentregistry_v1::AgentRegistryClient(connection); + auto c2 = google::cloud::agentregistry_v1::AgentRegistryClient(connection); + //! [set-polling-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::agentregistry_v1::AgentRegistryClient( + google::cloud::agentregistry_v1::MakeAgentRegistryConnection(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 SetPollingPolicy() example" << std::endl; + SetPollingPolicy({}); + + 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}, + {"set-polling-policy", SetPollingPolicy}, + {"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 6cf644c241b89..fc399dac6e2dd 100644 --- a/libraries.bzl +++ b/libraries.bzl @@ -28,6 +28,7 @@ GOOGLE_CLOUD_CPP_GA_LIBRARIES = [ "accessapproval", "accesscontextmanager", "advisorynotifications", + "agentregistry", "aiplatform", "alloydb", "apigateway",