diff --git a/CHANGELOG.md b/CHANGELOG.md index 629e1dc9479c5..d94b6ef7d3657 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ for details on updating existing applications using v1.x.y or v2.x.y. ## v3.4.0 - TBD +### [Data Catalog](/google/cloud/datacatalog/README.md) + +- Added Data Lineage Config Management library. + ## v3.3.0 - 2026-03 ### New Libraries diff --git a/ci/abi-dumps/google_cloud_cpp_datacatalog.expected.abi.dump.gz b/ci/abi-dumps/google_cloud_cpp_datacatalog.expected.abi.dump.gz index a26637a629cd3..5007590e26555 100644 Binary files a/ci/abi-dumps/google_cloud_cpp_datacatalog.expected.abi.dump.gz and b/ci/abi-dumps/google_cloud_cpp_datacatalog.expected.abi.dump.gz differ diff --git a/ci/etc/expected_install_directories b/ci/etc/expected_install_directories index d3818966f52a2..5e38dd32f7cc5 100644 --- a/ci/etc/expected_install_directories +++ b/ci/etc/expected_install_directories @@ -669,6 +669,10 @@ ./include/google/cloud/contentwarehouse/v1/mocks ./include/google/cloud/datacatalog ./include/google/cloud/datacatalog/lineage +./include/google/cloud/datacatalog/lineage/configmanagement +./include/google/cloud/datacatalog/lineage/configmanagement/v1 +./include/google/cloud/datacatalog/lineage/configmanagement/v1/internal +./include/google/cloud/datacatalog/lineage/configmanagement/v1/mocks ./include/google/cloud/datacatalog/lineage/v1 ./include/google/cloud/datacatalog/lineage/v1/internal ./include/google/cloud/datacatalog/lineage/v1/mocks diff --git a/external/googleapis/protolists/datacatalog.list b/external/googleapis/protolists/datacatalog.list index f801de4561991..ddff1eff21222 100644 --- a/external/googleapis/protolists/datacatalog.list +++ b/external/googleapis/protolists/datacatalog.list @@ -1,3 +1,4 @@ +@googleapis//google/cloud/datacatalog/lineage/configmanagement/v1:configmanagement.proto @googleapis//google/cloud/datacatalog/lineage/v1:lineage.proto @googleapis//google/cloud/datacatalog/v1:bigquery.proto @googleapis//google/cloud/datacatalog/v1:common.proto diff --git a/external/googleapis/update_libraries.sh b/external/googleapis/update_libraries.sh index e7ff82d878410..61ffb2995d108 100755 --- a/external/googleapis/update_libraries.sh +++ b/external/googleapis/update_libraries.sh @@ -118,7 +118,8 @@ declare -A -r LIBRARIES=( ["datacatalog"]="$( printf ",%s" \ "@googleapis//google/cloud/datacatalog/v1:datacatalog_cc_grpc" \ - "@googleapis//google/cloud/datacatalog/lineage/v1:lineage_cc_grpc" + "@googleapis//google/cloud/datacatalog/lineage/v1:lineage_cc_grpc" \ + "@googleapis//google/cloud/datacatalog/lineage/configmanagement/v1:configmanagement_cc_grpc" )" ["dataform"]="$( printf ",%s" \ diff --git a/generator/generator_config.textproto b/generator/generator_config.textproto index 974f331b9ee20..228dad8503b98 100644 --- a/generator/generator_config.textproto +++ b/generator/generator_config.textproto @@ -1934,6 +1934,20 @@ service { retryable_status_codes: ["kUnavailable"] } +service { + service_proto_path: "google/cloud/datacatalog/lineage/v1/lineage.proto" + product_path: "google/cloud/datacatalog/lineage/v1" + initial_copyright_year: "2023" + retryable_status_codes: ["kUnavailable"] +} + +service { + service_proto_path: "google/cloud/datacatalog/lineage/configmanagement/v1/configmanagement.proto" + product_path: "google/cloud/datacatalog/lineage/configmanagement/v1" + initial_copyright_year: "2026" + retryable_status_codes: ["kUnavailable"] +} + # Database Migration service { service_proto_path: "google/cloud/clouddms/v1/clouddms.proto" diff --git a/google/cloud/datacatalog/BUILD.bazel b/google/cloud/datacatalog/BUILD.bazel index 33b9439cb6b3d..10cd1d1e5138b 100644 --- a/google/cloud/datacatalog/BUILD.bazel +++ b/google/cloud/datacatalog/BUILD.bazel @@ -19,11 +19,13 @@ package(default_visibility = ["//visibility:private"]) licenses(["notice"]) # Apache 2.0 service_dirs = [ + "lineage/configmanagement/v1/", "lineage/v1/", "v1/", ] googleapis_deps = [ + "@googleapis//google/cloud/datacatalog/lineage/configmanagement/v1:configmanagement_cc_grpc", "@googleapis//google/cloud/datacatalog/lineage/v1:lineage_cc_grpc", "@googleapis//google/cloud/datacatalog/v1:datacatalog_cc_grpc", ] diff --git a/google/cloud/datacatalog/CMakeLists.txt b/google/cloud/datacatalog/CMakeLists.txt index bb913f2394157..324697bd195c9 100644 --- a/google/cloud/datacatalog/CMakeLists.txt +++ b/google/cloud/datacatalog/CMakeLists.txt @@ -16,8 +16,9 @@ include(GoogleCloudCppLibrary) -google_cloud_cpp_add_gapic_library(datacatalog "Google Cloud Data Catalog API" - SERVICE_DIRS "lineage/v1/" "v1/") +google_cloud_cpp_add_gapic_library( + datacatalog "Google Cloud Data Catalog API" + SERVICE_DIRS "lineage/configmanagement/v1/" "lineage/v1/" "v1/") if (BUILD_TESTING AND GOOGLE_CLOUD_CPP_ENABLE_CXX_EXCEPTIONS) add_executable(datacatalog_quickstart "quickstart/quickstart.cc") diff --git a/google/cloud/datacatalog/doc/environment-variables.dox b/google/cloud/datacatalog/doc/environment-variables.dox index 983ee273118d0..f3a8039ec5e69 100644 --- a/google/cloud/datacatalog/doc/environment-variables.dox +++ b/google/cloud/datacatalog/doc/environment-variables.dox @@ -9,6 +9,10 @@ environment variables are convenient when troubleshooting problems. +- `GOOGLE_CLOUD_CPP_CONFIG_MANAGEMENT_SERVICE_ENDPOINT=...` overrides the + `EndpointOption` (which defaults to "datalineage.googleapis.com") + used by `MakeConfigManagementServiceConnection()`. + - `GOOGLE_CLOUD_CPP_DATA_CATALOG_ENDPOINT=...` overrides the `EndpointOption` (which defaults to "datacatalog.googleapis.com") used by `MakeDataCatalogConnection()`. diff --git a/google/cloud/datacatalog/doc/main.dox b/google/cloud/datacatalog/doc/main.dox index 5967e5f99c355..2846331da10ee 100644 --- a/google/cloud/datacatalog/doc/main.dox +++ b/google/cloud/datacatalog/doc/main.dox @@ -30,6 +30,7 @@ The library also has other classes that provide helpers, configuration parameters, and infrastructure to mock the `*Client` classes when testing your application. +- [\c datacatalog_lineage_configmanagement_v1::ConfigManagementServiceClient](@ref google::cloud::datacatalog_lineage_configmanagement_v1::ConfigManagementServiceClient) - [\c datacatalog_lineage_v1::LineageClient](@ref google::cloud::datacatalog_lineage_v1::LineageClient) - [\c datacatalog_v1::DataCatalogClient](@ref google::cloud::datacatalog_v1::DataCatalogClient) - [\c datacatalog_v1::PolicyTagManagerClient](@ref google::cloud::datacatalog_v1::PolicyTagManagerClient) diff --git a/google/cloud/datacatalog/doc/override-authentication.dox b/google/cloud/datacatalog/doc/override-authentication.dox index d12cc31e5c5ea..a72b45e109551 100644 --- a/google/cloud/datacatalog/doc/override-authentication.dox +++ b/google/cloud/datacatalog/doc/override-authentication.dox @@ -9,10 +9,11 @@ this default. You can do so by providing the The following example shows how to explicitly load a service account key file: -@snippet lineage_client_samples.cc with-service-account +@snippet config_management_client_samples.cc with-service-account Follow these links to find examples for other \c *Client classes: +- [\c datacatalog_lineage_configmanagement_v1::ConfigManagementServiceClient](@ref datacatalog_lineage_configmanagement_v1::ConfigManagementServiceClient-service-account-snippet) - [\c datacatalog_lineage_v1::LineageClient](@ref datacatalog_lineage_v1::LineageClient-service-account-snippet) - [\c datacatalog_v1::DataCatalogClient](@ref datacatalog_v1::DataCatalogClient-service-account-snippet) - [\c datacatalog_v1::PolicyTagManagerClient](@ref datacatalog_v1::PolicyTagManagerClient-service-account-snippet) @@ -34,6 +35,12 @@ guide for more details. // +/*! @page datacatalog_lineage_configmanagement_v1::ConfigManagementServiceClient-service-account-snippet Override datacatalog_lineage_configmanagement_v1::ConfigManagementServiceClient Authentication Defaults + +@snippet google/cloud/datacatalog/lineage/configmanagement/v1/samples/config_management_client_samples.cc with-service-account + +*/ + /*! @page datacatalog_lineage_v1::LineageClient-service-account-snippet Override datacatalog_lineage_v1::LineageClient Authentication Defaults @snippet google/cloud/datacatalog/lineage/v1/samples/lineage_client_samples.cc with-service-account diff --git a/google/cloud/datacatalog/doc/override-endpoint.dox b/google/cloud/datacatalog/doc/override-endpoint.dox index a525548e6f516..6545fc0e7c27f 100644 --- a/google/cloud/datacatalog/doc/override-endpoint.dox +++ b/google/cloud/datacatalog/doc/override-endpoint.dox @@ -7,12 +7,13 @@ library. Use the client library to change this default. -For example, this will override the default endpoint for `datacatalog_lineage_v1::LineageClient`: +For example, this will override the default endpoint for `datacatalog_lineage_configmanagement_v1::ConfigManagementServiceClient`: -@snippet lineage_client_samples.cc set-client-endpoint +@snippet config_management_client_samples.cc set-client-endpoint Follow these links to find examples for other \c *Client classes: +- [\c datacatalog_lineage_configmanagement_v1::ConfigManagementServiceClient](@ref datacatalog_lineage_configmanagement_v1::ConfigManagementServiceClient-endpoint-snippet) - [\c datacatalog_lineage_v1::LineageClient](@ref datacatalog_lineage_v1::LineageClient-endpoint-snippet) - [\c datacatalog_v1::DataCatalogClient](@ref datacatalog_v1::DataCatalogClient-endpoint-snippet) - [\c datacatalog_v1::PolicyTagManagerClient](@ref datacatalog_v1::PolicyTagManagerClient-endpoint-snippet) @@ -24,6 +25,12 @@ Follow these links to find examples for other \c *Client classes: // +/*! @page datacatalog_lineage_configmanagement_v1::ConfigManagementServiceClient-endpoint-snippet Override datacatalog_lineage_configmanagement_v1::ConfigManagementServiceClient Endpoint Configuration + +@snippet google/cloud/datacatalog/lineage/configmanagement/v1/samples/config_management_client_samples.cc set-client-endpoint + +*/ + /*! @page datacatalog_lineage_v1::LineageClient-endpoint-snippet Override datacatalog_lineage_v1::LineageClient Endpoint Configuration @snippet google/cloud/datacatalog/lineage/v1/samples/lineage_client_samples.cc set-client-endpoint diff --git a/google/cloud/datacatalog/doc/override-retry-policies.dox b/google/cloud/datacatalog/doc/override-retry-policies.dox index 55e3577996ebb..f6c2d390357cb 100644 --- a/google/cloud/datacatalog/doc/override-retry-policies.dox +++ b/google/cloud/datacatalog/doc/override-retry-policies.dox @@ -67,21 +67,18 @@ will use `FooBarIdempotencyPolicy`. This policy is very conservative. @section datacatalog-override-retry-example Example -For example, this will override the retry policies for `datacatalog_lineage_v1::LineageClient`: +For example, this will override the retry policies for `datacatalog_lineage_configmanagement_v1::ConfigManagementServiceClient`: -@snippet lineage_client_samples.cc set-retry-policy +@snippet config_management_client_samples.cc set-retry-policy This assumes you have created a custom idempotency policy. Such as: -@snippet lineage_client_samples.cc custom-idempotency-policy - -This will override the polling policies for `datacatalog_lineage_v1::LineageClient` - -@snippet lineage_client_samples.cc set-polling-policy +@snippet config_management_client_samples.cc custom-idempotency-policy Follow these links to find examples for other \c *Client classes: +- [\c datacatalog_lineage_configmanagement_v1::ConfigManagementServiceClient](@ref datacatalog_lineage_configmanagement_v1::ConfigManagementServiceClient-retry-snippet) - [\c datacatalog_lineage_v1::LineageClient](@ref datacatalog_lineage_v1::LineageClient-retry-snippet) - [\c datacatalog_v1::DataCatalogClient](@ref datacatalog_v1::DataCatalogClient-retry-snippet) - [\c datacatalog_v1::PolicyTagManagerClient](@ref datacatalog_v1::PolicyTagManagerClient-retry-snippet) @@ -101,6 +98,18 @@ Follow these links to find examples for other \c *Client classes: // +/*! @page datacatalog_lineage_configmanagement_v1::ConfigManagementServiceClient-retry-snippet Override datacatalog_lineage_configmanagement_v1::ConfigManagementServiceClient Retry Policies + +This shows how to override the retry policies for datacatalog_lineage_configmanagement_v1::ConfigManagementServiceClient: + +@snippet google/cloud/datacatalog/lineage/configmanagement/v1/samples/config_management_client_samples.cc set-retry-policy + +Assuming you have created a custom idempotency policy. Such as: + +@snippet google/cloud/datacatalog/lineage/configmanagement/v1/samples/config_management_client_samples.cc custom-idempotency-policy + +*/ + /*! @page datacatalog_lineage_v1::LineageClient-retry-snippet Override datacatalog_lineage_v1::LineageClient Retry Policies This shows how to override the retry policies for datacatalog_lineage_v1::LineageClient: diff --git a/google/cloud/datacatalog/doc/override-universe-domain.dox b/google/cloud/datacatalog/doc/override-universe-domain.dox index f4559c0d40996..f70a7e89f9130 100644 --- a/google/cloud/datacatalog/doc/override-universe-domain.dox +++ b/google/cloud/datacatalog/doc/override-universe-domain.dox @@ -6,12 +6,13 @@ client library. Use `AddUniverseDomainOption` when initializing the client library to change this default. -For example, this will override the default universe domain for `datacatalog_lineage_v1::LineageClient`: +For example, this will override the default universe domain for `datacatalog_lineage_configmanagement_v1::ConfigManagementServiceClient`: -@snippet lineage_client_samples.cc set-client-universe-domain +@snippet config_management_client_samples.cc set-client-universe-domain Follow these links to find examples for other \c *Client classes: +- [\c datacatalog_lineage_configmanagement_v1::ConfigManagementServiceClient](@ref datacatalog_lineage_configmanagement_v1::ConfigManagementServiceClient-universe-domain-snippet) - [\c datacatalog_lineage_v1::LineageClient](@ref datacatalog_lineage_v1::LineageClient-universe-domain-snippet) - [\c datacatalog_v1::DataCatalogClient](@ref datacatalog_v1::DataCatalogClient-universe-domain-snippet) - [\c datacatalog_v1::PolicyTagManagerClient](@ref datacatalog_v1::PolicyTagManagerClient-universe-domain-snippet) @@ -23,6 +24,12 @@ Follow these links to find examples for other \c *Client classes: // +/*! @page datacatalog_lineage_configmanagement_v1::ConfigManagementServiceClient-universe-domain-snippet Override datacatalog_lineage_configmanagement_v1::ConfigManagementServiceClient Universe Domain + +@snippet google/cloud/datacatalog/lineage/configmanagement/v1/samples/config_management_client_samples.cc set-client-universe-domain + +*/ + /*! @page datacatalog_lineage_v1::LineageClient-universe-domain-snippet Override datacatalog_lineage_v1::LineageClient Universe Domain @snippet google/cloud/datacatalog/lineage/v1/samples/lineage_client_samples.cc set-client-universe-domain diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/.repo-metadata.json b/google/cloud/datacatalog/lineage/configmanagement/v1/.repo-metadata.json new file mode 100644 index 0000000000000..00fda96e09562 --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/.repo-metadata.json @@ -0,0 +1,14 @@ +{ + "api_id": "datalineage.googleapis.com", + "api_shortname": "datalineage", + "client_documentation": "https://cloud.google.com/cpp/docs/reference/datacatalog/latest", + "distribution_name": "google-cloud-cpp", + "issue_tracker": "https://issuetracker.google.com/issues?q=componentid:1530027%20status=open", + "language": "cpp", + "library_type": "GAPIC_AUTO", + "name_pretty": "Data Lineage API", + "product_documentation": "https://cloud.google.com/dataplex/docs/about-data-lineage", + "release_level": "stable", + "repo": "googleapis/google-cloud-cpp", + "requires_billing": true +} diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/config_management_client.cc b/google/cloud/datacatalog/lineage/configmanagement/v1/config_management_client.cc new file mode 100644 index 0000000000000..8942eeea70708 --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/config_management_client.cc @@ -0,0 +1,141 @@ +// 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/datacatalog/lineage/configmanagement/v1/configmanagement.proto + +#include "google/cloud/datacatalog/lineage/configmanagement/v1/config_management_client.h" +#include +#include + +namespace google { +namespace cloud { +namespace datacatalog_lineage_configmanagement_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +ConfigManagementServiceClient::ConfigManagementServiceClient( + std::shared_ptr connection, Options opts) + : connection_(std::move(connection)), + options_( + internal::MergeOptions(std::move(opts), connection_->options())) {} +ConfigManagementServiceClient::~ConfigManagementServiceClient() = default; + +StatusOr +ConfigManagementServiceClient::GetConfig(std::string const& name, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::datacatalog::lineage::configmanagement::v1::GetConfigRequest + request; + request.set_name(name); + return connection_->GetConfig(request); +} + +StatusOr +ConfigManagementServiceClient::GetConfig( + google::cloud::datacatalog::lineage::configmanagement::v1:: + GetConfigRequest const& request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->GetConfig(request); +} + +StatusOr +ConfigManagementServiceClient::UpdateConfig( + google::cloud::datacatalog::lineage::configmanagement::v1::Config const& + config, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + google::cloud::datacatalog::lineage::configmanagement::v1::UpdateConfigRequest + request; + *request.mutable_config() = config; + return connection_->UpdateConfig(request); +} + +StatusOr +ConfigManagementServiceClient::UpdateConfig( + google::cloud::datacatalog::lineage::configmanagement::v1:: + UpdateConfigRequest const& request, + Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->UpdateConfig(request); +} + +StreamRange +ConfigManagementServiceClient::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 +ConfigManagementServiceClient::ListOperations( + google::longrunning::ListOperationsRequest request, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->ListOperations(std::move(request)); +} + +StatusOr +ConfigManagementServiceClient::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 +ConfigManagementServiceClient::GetOperation( + google::longrunning::GetOperationRequest const& request, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->GetOperation(request); +} + +Status ConfigManagementServiceClient::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 ConfigManagementServiceClient::DeleteOperation( + google::longrunning::DeleteOperationRequest const& request, Options opts) { + internal::OptionsSpan span(internal::MergeOptions(std::move(opts), options_)); + return connection_->DeleteOperation(request); +} + +Status ConfigManagementServiceClient::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 ConfigManagementServiceClient::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 datacatalog_lineage_configmanagement_v1 +} // namespace cloud +} // namespace google diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/config_management_client.h b/google/cloud/datacatalog/lineage/configmanagement/v1/config_management_client.h new file mode 100644 index 0000000000000..2dbb270c814d3 --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/config_management_client.h @@ -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/datacatalog/lineage/configmanagement/v1/configmanagement.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_CONFIG_MANAGEMENT_CLIENT_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_CONFIG_MANAGEMENT_CLIENT_H + +#include "google/cloud/datacatalog/lineage/configmanagement/v1/config_management_connection.h" +#include "google/cloud/future.h" +#include "google/cloud/options.h" +#include "google/cloud/polling_policy.h" +#include "google/cloud/status_or.h" +#include "google/cloud/version.h" +#include +#include + +namespace google { +namespace cloud { +namespace datacatalog_lineage_configmanagement_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +/// +/// Lineage Config Management service. Config Management service is used to +/// manage the configuration for Data Lineage. These Configs define different +/// configuration options for Lineage customers to control behaviour of lineage +/// systems. +/// +/// @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 ConfigManagementServiceClient { + public: + explicit ConfigManagementServiceClient( + std::shared_ptr connection, + Options opts = {}); + ~ConfigManagementServiceClient(); + + ///@{ + /// @name Copy and move support + ConfigManagementServiceClient(ConfigManagementServiceClient const&) = default; + ConfigManagementServiceClient& operator=( + ConfigManagementServiceClient const&) = default; + ConfigManagementServiceClient(ConfigManagementServiceClient&&) = default; + ConfigManagementServiceClient& operator=(ConfigManagementServiceClient&&) = + default; + ///@} + + ///@{ + /// @name Equality + friend bool operator==(ConfigManagementServiceClient const& a, + ConfigManagementServiceClient const& b) { + return a.connection_ == b.connection_; + } + friend bool operator!=(ConfigManagementServiceClient const& a, + ConfigManagementServiceClient const& b) { + return !(a == b); + } + ///@} + + // clang-format off + /// + /// Get the Config for a given resource. + /// + /// @param name Required. REQUIRED: The resource name of the config to be fetched. + /// Format: + /// `organizations/{organization_id}/locations/global/config` + /// `folders/{folder_id}/locations/global/config` + /// `projects/{project_id}/locations/global/config` + /// `projects/{project_number}/locations/global/config` + /// @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.datacatalog.lineage.configmanagement.v1.Config]) + /// 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.datacatalog.lineage.configmanagement.v1.Config]: @googleapis_reference_link{google/cloud/datacatalog/lineage/configmanagement/v1/configmanagement.proto#L96} + /// [google.cloud.datacatalog.lineage.configmanagement.v1.GetConfigRequest]: @googleapis_reference_link{google/cloud/datacatalog/lineage/configmanagement/v1/configmanagement.proto#L72} + /// + // clang-format on + StatusOr + GetConfig(std::string const& name, Options opts = {}); + + // clang-format off + /// + /// Get the Config for a given resource. + /// + /// @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.datacatalog.lineage.configmanagement.v1.GetConfigRequest]. + /// 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.datacatalog.lineage.configmanagement.v1.Config]) + /// 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.datacatalog.lineage.configmanagement.v1.Config]: @googleapis_reference_link{google/cloud/datacatalog/lineage/configmanagement/v1/configmanagement.proto#L96} + /// [google.cloud.datacatalog.lineage.configmanagement.v1.GetConfigRequest]: @googleapis_reference_link{google/cloud/datacatalog/lineage/configmanagement/v1/configmanagement.proto#L72} + /// + // clang-format on + StatusOr + GetConfig(google::cloud::datacatalog::lineage::configmanagement::v1:: + GetConfigRequest const& request, + Options opts = {}); + + // clang-format off + /// + /// Update the Config for a given resource. + /// + /// @param config Required. REQUIRED: The config to be applied to the resource and all its + /// descendants. + /// @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.datacatalog.lineage.configmanagement.v1.Config]) + /// 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.datacatalog.lineage.configmanagement.v1.Config]: @googleapis_reference_link{google/cloud/datacatalog/lineage/configmanagement/v1/configmanagement.proto#L96} + /// [google.cloud.datacatalog.lineage.configmanagement.v1.UpdateConfigRequest]: @googleapis_reference_link{google/cloud/datacatalog/lineage/configmanagement/v1/configmanagement.proto#L88} + /// + // clang-format on + StatusOr + UpdateConfig( + google::cloud::datacatalog::lineage::configmanagement::v1::Config const& + config, + Options opts = {}); + + // clang-format off + /// + /// Update the Config for a given resource. + /// + /// @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.datacatalog.lineage.configmanagement.v1.UpdateConfigRequest]. + /// 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.datacatalog.lineage.configmanagement.v1.Config]) + /// 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.datacatalog.lineage.configmanagement.v1.Config]: @googleapis_reference_link{google/cloud/datacatalog/lineage/configmanagement/v1/configmanagement.proto#L96} + /// [google.cloud.datacatalog.lineage.configmanagement.v1.UpdateConfigRequest]: @googleapis_reference_link{google/cloud/datacatalog/lineage/configmanagement/v1/configmanagement.proto#L88} + /// + // clang-format on + StatusOr + UpdateConfig(google::cloud::datacatalog::lineage::configmanagement::v1:: + UpdateConfigRequest 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 datacatalog_lineage_configmanagement_v1 +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_CONFIG_MANAGEMENT_CLIENT_H diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/config_management_connection.cc b/google/cloud/datacatalog/lineage/configmanagement/v1/config_management_connection.cc new file mode 100644 index 0000000000000..fa1c31fb738ac --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/config_management_connection.cc @@ -0,0 +1,103 @@ +// 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/datacatalog/lineage/configmanagement/v1/configmanagement.proto + +#include "google/cloud/datacatalog/lineage/configmanagement/v1/config_management_connection.h" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/config_management_options.h" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_connection_impl.h" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_option_defaults.h" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_stub_factory.h" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_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 datacatalog_lineage_configmanagement_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +ConfigManagementServiceConnection::~ConfigManagementServiceConnection() = + default; + +StatusOr +ConfigManagementServiceConnection::GetConfig( + google::cloud::datacatalog::lineage::configmanagement::v1:: + GetConfigRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +StatusOr +ConfigManagementServiceConnection::UpdateConfig( + google::cloud::datacatalog::lineage::configmanagement::v1:: + UpdateConfigRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +StreamRange +ConfigManagementServiceConnection::ListOperations( + google::longrunning:: + ListOperationsRequest) { // NOLINT(performance-unnecessary-value-param) + return google::cloud::internal::MakeUnimplementedPaginationRange< + StreamRange>(); +} + +StatusOr +ConfigManagementServiceConnection::GetOperation( + google::longrunning::GetOperationRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +Status ConfigManagementServiceConnection::DeleteOperation( + google::longrunning::DeleteOperationRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +Status ConfigManagementServiceConnection::CancelOperation( + google::longrunning::CancelOperationRequest const&) { + return Status(StatusCode::kUnimplemented, "not implemented"); +} + +std::shared_ptr +MakeConfigManagementServiceConnection(Options options) { + internal::CheckExpectedOptions( + options, __func__); + options = datacatalog_lineage_configmanagement_v1_internal:: + ConfigManagementServiceDefaultOptions(std::move(options)); + auto background = internal::MakeBackgroundThreadsFactory(options)(); + auto auth = internal::CreateAuthenticationStrategy(background->cq(), options); + auto stub = datacatalog_lineage_configmanagement_v1_internal:: + CreateDefaultConfigManagementServiceStub(std::move(auth), options); + return datacatalog_lineage_configmanagement_v1_internal:: + MakeConfigManagementServiceTracingConnection( + std::make_shared( + std::move(background), std::move(stub), std::move(options))); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace datacatalog_lineage_configmanagement_v1 +} // namespace cloud +} // namespace google diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/config_management_connection.h b/google/cloud/datacatalog/lineage/configmanagement/v1/config_management_connection.h new file mode 100644 index 0000000000000..ac4a123a5d095 --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/config_management_connection.h @@ -0,0 +1,251 @@ +// 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/datacatalog/lineage/configmanagement/v1/configmanagement.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_CONFIG_MANAGEMENT_CONNECTION_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_CONFIG_MANAGEMENT_CONNECTION_H + +#include "google/cloud/datacatalog/lineage/configmanagement/v1/config_management_connection_idempotency_policy.h" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/configmanagement.pb.h" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_retry_traits.h" +#include "google/cloud/backoff_policy.h" +#include "google/cloud/internal/retry_policy_impl.h" +#include "google/cloud/options.h" +#include "google/cloud/status_or.h" +#include "google/cloud/stream_range.h" +#include "google/cloud/version.h" +#include + +namespace google { +namespace cloud { +namespace datacatalog_lineage_configmanagement_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +/// The retry policy for `ConfigManagementServiceConnection`. +class ConfigManagementServiceRetryPolicy : 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 `ConfigManagementServiceConnection` 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 ConfigManagementServiceLimitedErrorCountRetryPolicy + : public ConfigManagementServiceRetryPolicy { + 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 ConfigManagementServiceLimitedErrorCountRetryPolicy( + int maximum_failures) + : impl_(maximum_failures) {} + + ConfigManagementServiceLimitedErrorCountRetryPolicy( + ConfigManagementServiceLimitedErrorCountRetryPolicy&& rhs) noexcept + : ConfigManagementServiceLimitedErrorCountRetryPolicy( + rhs.maximum_failures()) {} + ConfigManagementServiceLimitedErrorCountRetryPolicy( + ConfigManagementServiceLimitedErrorCountRetryPolicy const& rhs) noexcept + : ConfigManagementServiceLimitedErrorCountRetryPolicy( + 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< + ConfigManagementServiceLimitedErrorCountRetryPolicy>( + maximum_failures()); + } + + // This is provided only for backwards compatibility. + using BaseType = ConfigManagementServiceRetryPolicy; + + private: + google::cloud::internal::LimitedErrorCountRetryPolicy< + datacatalog_lineage_configmanagement_v1_internal:: + ConfigManagementServiceRetryTraits> + impl_; +}; + +/** + * A retry policy for `ConfigManagementServiceConnection` 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 ConfigManagementServiceLimitedTimeRetryPolicy + : public ConfigManagementServiceRetryPolicy { + 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 ConfigManagementServiceLimitedTimeRetryPolicy( + std::chrono::duration maximum_duration) + : impl_(maximum_duration) {} + + ConfigManagementServiceLimitedTimeRetryPolicy( + ConfigManagementServiceLimitedTimeRetryPolicy&& rhs) noexcept + : ConfigManagementServiceLimitedTimeRetryPolicy(rhs.maximum_duration()) {} + ConfigManagementServiceLimitedTimeRetryPolicy( + ConfigManagementServiceLimitedTimeRetryPolicy const& rhs) noexcept + : ConfigManagementServiceLimitedTimeRetryPolicy(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 = ConfigManagementServiceRetryPolicy; + + private: + google::cloud::internal::LimitedTimeRetryPolicy< + datacatalog_lineage_configmanagement_v1_internal:: + ConfigManagementServiceRetryTraits> + impl_; +}; + +/** + * The `ConfigManagementServiceConnection` object for + * `ConfigManagementServiceClient`. + * + * This interface defines virtual methods for each of the user-facing overload + * sets in `ConfigManagementServiceClient`. This allows users to inject custom + * behavior (e.g., with a Google Mock object) when writing tests that use + * objects of type `ConfigManagementServiceClient`. + * + * To create a concrete instance, see `MakeConfigManagementServiceConnection()`. + * + * For mocking, see + * `datacatalog_lineage_configmanagement_v1_mocks::MockConfigManagementServiceConnection`. + */ +class ConfigManagementServiceConnection { + public: + virtual ~ConfigManagementServiceConnection() = 0; + + virtual Options options() { return Options{}; } + + virtual StatusOr< + google::cloud::datacatalog::lineage::configmanagement::v1::Config> + GetConfig(google::cloud::datacatalog::lineage::configmanagement::v1:: + GetConfigRequest const& request); + + virtual StatusOr< + google::cloud::datacatalog::lineage::configmanagement::v1::Config> + UpdateConfig(google::cloud::datacatalog::lineage::configmanagement::v1:: + UpdateConfigRequest 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 + * `ConfigManagementServiceConnection`. + * + * The returned connection object should not be used directly; instead it + * should be passed as an argument to the constructor of + * ConfigManagementServiceClient. + * + * The optional @p options argument may be used to configure aspects of the + * returned `ConfigManagementServiceConnection`. Expected options are any of the + * types in the following option lists: + * + * - `google::cloud::CommonOptionList` + * - `google::cloud::GrpcOptionList` + * - `google::cloud::UnifiedCredentialsOptionList` + * - + * `google::cloud::datacatalog_lineage_configmanagement_v1::ConfigManagementServicePolicyOptionList` + * + * @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 `ConfigManagementServiceConnection` + * created by this function. + */ +std::shared_ptr +MakeConfigManagementServiceConnection(Options options = {}); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace datacatalog_lineage_configmanagement_v1 +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_CONFIG_MANAGEMENT_CONNECTION_H diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/config_management_connection_idempotency_policy.cc b/google/cloud/datacatalog/lineage/configmanagement/v1/config_management_connection_idempotency_policy.cc new file mode 100644 index 0000000000000..6a34d7ccbe543 --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/config_management_connection_idempotency_policy.cc @@ -0,0 +1,79 @@ +// 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/datacatalog/lineage/configmanagement/v1/configmanagement.proto + +#include "google/cloud/datacatalog/lineage/configmanagement/v1/config_management_connection_idempotency_policy.h" +#include + +namespace google { +namespace cloud { +namespace datacatalog_lineage_configmanagement_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +using ::google::cloud::Idempotency; + +ConfigManagementServiceConnectionIdempotencyPolicy:: + ~ConfigManagementServiceConnectionIdempotencyPolicy() = default; + +std::unique_ptr +ConfigManagementServiceConnectionIdempotencyPolicy::clone() const { + return std::make_unique( + *this); +} + +Idempotency ConfigManagementServiceConnectionIdempotencyPolicy::GetConfig( + google::cloud::datacatalog::lineage::configmanagement::v1:: + GetConfigRequest const&) { + return Idempotency::kIdempotent; +} + +Idempotency ConfigManagementServiceConnectionIdempotencyPolicy::UpdateConfig( + google::cloud::datacatalog::lineage::configmanagement::v1:: + UpdateConfigRequest const&) { + return Idempotency::kNonIdempotent; +} + +Idempotency ConfigManagementServiceConnectionIdempotencyPolicy::ListOperations( + google::longrunning::ListOperationsRequest) { // NOLINT + return Idempotency::kIdempotent; +} + +Idempotency ConfigManagementServiceConnectionIdempotencyPolicy::GetOperation( + google::longrunning::GetOperationRequest const&) { + return Idempotency::kIdempotent; +} + +Idempotency ConfigManagementServiceConnectionIdempotencyPolicy::DeleteOperation( + google::longrunning::DeleteOperationRequest const&) { + return Idempotency::kNonIdempotent; +} + +Idempotency ConfigManagementServiceConnectionIdempotencyPolicy::CancelOperation( + google::longrunning::CancelOperationRequest const&) { + return Idempotency::kNonIdempotent; +} + +std::unique_ptr +MakeDefaultConfigManagementServiceConnectionIdempotencyPolicy() { + return std::make_unique(); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace datacatalog_lineage_configmanagement_v1 +} // namespace cloud +} // namespace google diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/config_management_connection_idempotency_policy.h b/google/cloud/datacatalog/lineage/configmanagement/v1/config_management_connection_idempotency_policy.h new file mode 100644 index 0000000000000..9562ea7fd6ab9 --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/config_management_connection_idempotency_policy.h @@ -0,0 +1,71 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: +// google/cloud/datacatalog/lineage/configmanagement/v1/configmanagement.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_CONFIG_MANAGEMENT_CONNECTION_IDEMPOTENCY_POLICY_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_CONFIG_MANAGEMENT_CONNECTION_IDEMPOTENCY_POLICY_H + +#include "google/cloud/datacatalog/lineage/configmanagement/v1/configmanagement.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 datacatalog_lineage_configmanagement_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class ConfigManagementServiceConnectionIdempotencyPolicy { + public: + virtual ~ConfigManagementServiceConnectionIdempotencyPolicy(); + + /// Create a new copy of this object. + virtual std::unique_ptr + clone() const; + + virtual google::cloud::Idempotency GetConfig( + google::cloud::datacatalog::lineage::configmanagement::v1:: + GetConfigRequest const& request); + + virtual google::cloud::Idempotency UpdateConfig( + google::cloud::datacatalog::lineage::configmanagement::v1:: + UpdateConfigRequest 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 +MakeDefaultConfigManagementServiceConnectionIdempotencyPolicy(); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace datacatalog_lineage_configmanagement_v1 +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_CONFIG_MANAGEMENT_CONNECTION_IDEMPOTENCY_POLICY_H diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/config_management_options.h b/google/cloud/datacatalog/lineage/configmanagement/v1/config_management_options.h new file mode 100644 index 0000000000000..408ab0fcae5fd --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/config_management_options.h @@ -0,0 +1,78 @@ +// 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/datacatalog/lineage/configmanagement/v1/configmanagement.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_CONFIG_MANAGEMENT_OPTIONS_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_CONFIG_MANAGEMENT_OPTIONS_H + +#include "google/cloud/datacatalog/lineage/configmanagement/v1/config_management_connection.h" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/config_management_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 datacatalog_lineage_configmanagement_v1 { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +/** + * Use with `google::cloud::Options` to configure the retry policy. + * + * @ingroup google-cloud-datacatalog-options + */ +struct ConfigManagementServiceRetryPolicyOption { + using Type = std::shared_ptr; +}; + +/** + * Use with `google::cloud::Options` to configure the backoff policy. + * + * @ingroup google-cloud-datacatalog-options + */ +struct ConfigManagementServiceBackoffPolicyOption { + using Type = std::shared_ptr; +}; + +/** + * Use with `google::cloud::Options` to configure which operations are retried. + * + * @ingroup google-cloud-datacatalog-options + */ +struct ConfigManagementServiceConnectionIdempotencyPolicyOption { + using Type = + std::shared_ptr; +}; + +/** + * The options applicable to ConfigManagementService. + * + * @ingroup google-cloud-datacatalog-options + */ +using ConfigManagementServicePolicyOptionList = + OptionList; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace datacatalog_lineage_configmanagement_v1 +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_CONFIG_MANAGEMENT_OPTIONS_H diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_auth_decorator.cc b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_auth_decorator.cc new file mode 100644 index 0000000000000..33d243689a2d1 --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_auth_decorator.cc @@ -0,0 +1,97 @@ +// 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/datacatalog/lineage/configmanagement/v1/configmanagement.proto + +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_auth_decorator.h" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/configmanagement.grpc.pb.h" +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace datacatalog_lineage_configmanagement_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +ConfigManagementServiceAuth::ConfigManagementServiceAuth( + std::shared_ptr auth, + std::shared_ptr child) + : auth_(std::move(auth)), child_(std::move(child)) {} + +StatusOr +ConfigManagementServiceAuth::GetConfig( + grpc::ClientContext& context, Options const& options, + google::cloud::datacatalog::lineage::configmanagement::v1:: + GetConfigRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->GetConfig(context, options, request); +} + +StatusOr +ConfigManagementServiceAuth::UpdateConfig( + grpc::ClientContext& context, Options const& options, + google::cloud::datacatalog::lineage::configmanagement::v1:: + UpdateConfigRequest const& request) { + auto status = auth_->ConfigureContext(context); + if (!status.ok()) return status; + return child_->UpdateConfig(context, options, request); +} + +StatusOr +ConfigManagementServiceAuth::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 +ConfigManagementServiceAuth::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 ConfigManagementServiceAuth::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 ConfigManagementServiceAuth::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); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace datacatalog_lineage_configmanagement_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_auth_decorator.h b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_auth_decorator.h new file mode 100644 index 0000000000000..9a0c3494241e4 --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_auth_decorator.h @@ -0,0 +1,83 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: +// google/cloud/datacatalog/lineage/configmanagement/v1/configmanagement.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_AUTH_DECORATOR_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_AUTH_DECORATOR_H + +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_stub.h" +#include "google/cloud/internal/unified_grpc_credentials.h" +#include "google/cloud/version.h" +#include +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace datacatalog_lineage_configmanagement_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class ConfigManagementServiceAuth : public ConfigManagementServiceStub { + public: + ~ConfigManagementServiceAuth() override = default; + ConfigManagementServiceAuth( + std::shared_ptr auth, + std::shared_ptr child); + + StatusOr + GetConfig(grpc::ClientContext& context, Options const& options, + google::cloud::datacatalog::lineage::configmanagement::v1:: + GetConfigRequest const& request) override; + + StatusOr + UpdateConfig(grpc::ClientContext& context, Options const& options, + google::cloud::datacatalog::lineage::configmanagement::v1:: + UpdateConfigRequest 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; + + private: + std::shared_ptr auth_; + std::shared_ptr child_; +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace datacatalog_lineage_configmanagement_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_AUTH_DECORATOR_H diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_connection_impl.cc b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_connection_impl.cc new file mode 100644 index 0000000000000..b8a4c542954c9 --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_connection_impl.cc @@ -0,0 +1,183 @@ +// 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/datacatalog/lineage/configmanagement/v1/configmanagement.proto + +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_connection_impl.h" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_option_defaults.h" +#include "google/cloud/background_threads.h" +#include "google/cloud/common_options.h" +#include "google/cloud/grpc_options.h" +#include "google/cloud/internal/pagination_range.h" +#include "google/cloud/internal/retry_loop.h" +#include +#include + +namespace google { +namespace cloud { +namespace datacatalog_lineage_configmanagement_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN +namespace { + +std::unique_ptr< + datacatalog_lineage_configmanagement_v1::ConfigManagementServiceRetryPolicy> +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(); +} + +} // namespace + +ConfigManagementServiceConnectionImpl::ConfigManagementServiceConnectionImpl( + std::unique_ptr background, + std::shared_ptr + stub, + Options options) + : background_(std::move(background)), + stub_(std::move(stub)), + options_(internal::MergeOptions( + std::move(options), ConfigManagementServiceConnection::options())) {} + +StatusOr +ConfigManagementServiceConnectionImpl::GetConfig( + google::cloud::datacatalog::lineage::configmanagement::v1:: + GetConfigRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->GetConfig(request), + [this](grpc::ClientContext& context, Options const& options, + google::cloud::datacatalog::lineage::configmanagement::v1:: + GetConfigRequest const& request) { + return stub_->GetConfig(context, options, request); + }, + *current, request, __func__); +} + +StatusOr +ConfigManagementServiceConnectionImpl::UpdateConfig( + google::cloud::datacatalog::lineage::configmanagement::v1:: + UpdateConfigRequest const& request) { + auto current = google::cloud::internal::SaveCurrentOptions(); + return google::cloud::internal::RetryLoop( + retry_policy(*current), backoff_policy(*current), + idempotency_policy(*current)->UpdateConfig(request), + [this](grpc::ClientContext& context, Options const& options, + google::cloud::datacatalog::lineage::configmanagement::v1:: + UpdateConfigRequest const& request) { + return stub_->UpdateConfig(context, options, request); + }, + *current, request, __func__); +} + +StreamRange +ConfigManagementServiceConnectionImpl::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 +ConfigManagementServiceConnectionImpl::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 ConfigManagementServiceConnectionImpl::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 ConfigManagementServiceConnectionImpl::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 datacatalog_lineage_configmanagement_v1_internal +} // namespace cloud +} // namespace google diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_connection_impl.h b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_connection_impl.h new file mode 100644 index 0000000000000..00f453402e3eb --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_connection_impl.h @@ -0,0 +1,89 @@ +// 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/datacatalog/lineage/configmanagement/v1/configmanagement.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_CONNECTION_IMPL_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_CONNECTION_IMPL_H + +#include "google/cloud/datacatalog/lineage/configmanagement/v1/config_management_connection.h" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/config_management_connection_idempotency_policy.h" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/config_management_options.h" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_retry_traits.h" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_stub.h" +#include "google/cloud/background_threads.h" +#include "google/cloud/backoff_policy.h" +#include "google/cloud/options.h" +#include "google/cloud/status_or.h" +#include "google/cloud/stream_range.h" +#include "google/cloud/version.h" +#include + +namespace google { +namespace cloud { +namespace datacatalog_lineage_configmanagement_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class ConfigManagementServiceConnectionImpl + : public datacatalog_lineage_configmanagement_v1:: + ConfigManagementServiceConnection { + public: + ~ConfigManagementServiceConnectionImpl() override = default; + + ConfigManagementServiceConnectionImpl( + std::unique_ptr background, + std::shared_ptr + stub, + Options options); + + Options options() override { return options_; } + + StatusOr + GetConfig(google::cloud::datacatalog::lineage::configmanagement::v1:: + GetConfigRequest const& request) override; + + StatusOr + UpdateConfig(google::cloud::datacatalog::lineage::configmanagement::v1:: + UpdateConfigRequest 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 datacatalog_lineage_configmanagement_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_CONNECTION_IMPL_H diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_logging_decorator.cc b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_logging_decorator.cc new file mode 100644 index 0000000000000..3e3a72d827545 --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_logging_decorator.cc @@ -0,0 +1,121 @@ +// 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/datacatalog/lineage/configmanagement/v1/configmanagement.proto + +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_logging_decorator.h" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/configmanagement.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 datacatalog_lineage_configmanagement_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +ConfigManagementServiceLogging::ConfigManagementServiceLogging( + std::shared_ptr child, + TracingOptions tracing_options, std::set const&) + : child_(std::move(child)), tracing_options_(std::move(tracing_options)) {} + +StatusOr +ConfigManagementServiceLogging::GetConfig( + grpc::ClientContext& context, Options const& options, + google::cloud::datacatalog::lineage::configmanagement::v1:: + GetConfigRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::datacatalog::lineage::configmanagement::v1:: + GetConfigRequest const& request) { + return child_->GetConfig(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +ConfigManagementServiceLogging::UpdateConfig( + grpc::ClientContext& context, Options const& options, + google::cloud::datacatalog::lineage::configmanagement::v1:: + UpdateConfigRequest const& request) { + return google::cloud::internal::LogWrapper( + [this](grpc::ClientContext& context, Options const& options, + google::cloud::datacatalog::lineage::configmanagement::v1:: + UpdateConfigRequest const& request) { + return child_->UpdateConfig(context, options, request); + }, + context, options, request, __func__, tracing_options_); +} + +StatusOr +ConfigManagementServiceLogging::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 +ConfigManagementServiceLogging::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 ConfigManagementServiceLogging::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 ConfigManagementServiceLogging::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_); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace datacatalog_lineage_configmanagement_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_logging_decorator.h b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_logging_decorator.h new file mode 100644 index 0000000000000..9a2b56b668fb2 --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_logging_decorator.h @@ -0,0 +1,83 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: +// google/cloud/datacatalog/lineage/configmanagement/v1/configmanagement.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_LOGGING_DECORATOR_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_LOGGING_DECORATOR_H + +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_stub.h" +#include "google/cloud/tracing_options.h" +#include "google/cloud/version.h" +#include +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace datacatalog_lineage_configmanagement_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class ConfigManagementServiceLogging : public ConfigManagementServiceStub { + public: + ~ConfigManagementServiceLogging() override = default; + ConfigManagementServiceLogging( + std::shared_ptr child, + TracingOptions tracing_options, std::set const& components); + + StatusOr + GetConfig(grpc::ClientContext& context, Options const& options, + google::cloud::datacatalog::lineage::configmanagement::v1:: + GetConfigRequest const& request) override; + + StatusOr + UpdateConfig(grpc::ClientContext& context, Options const& options, + google::cloud::datacatalog::lineage::configmanagement::v1:: + UpdateConfigRequest 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; + + private: + std::shared_ptr child_; + TracingOptions tracing_options_; +}; // ConfigManagementServiceLogging + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace datacatalog_lineage_configmanagement_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_LOGGING_DECORATOR_H diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_metadata_decorator.cc b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_metadata_decorator.cc new file mode 100644 index 0000000000000..9ca5def2d0fde --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_metadata_decorator.cc @@ -0,0 +1,125 @@ +// 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/datacatalog/lineage/configmanagement/v1/configmanagement.proto + +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_metadata_decorator.h" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/configmanagement.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 datacatalog_lineage_configmanagement_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +ConfigManagementServiceMetadata::ConfigManagementServiceMetadata( + 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 +ConfigManagementServiceMetadata::GetConfig( + grpc::ClientContext& context, Options const& options, + google::cloud::datacatalog::lineage::configmanagement::v1:: + GetConfigRequest const& request) { + SetMetadata(context, options, + absl::StrCat("name=", internal::UrlEncode(request.name()))); + return child_->GetConfig(context, options, request); +} + +StatusOr +ConfigManagementServiceMetadata::UpdateConfig( + grpc::ClientContext& context, Options const& options, + google::cloud::datacatalog::lineage::configmanagement::v1:: + UpdateConfigRequest const& request) { + SetMetadata(context, options, + absl::StrCat("config.name=", + internal::UrlEncode(request.config().name()))); + return child_->UpdateConfig(context, options, request); +} + +StatusOr +ConfigManagementServiceMetadata::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 +ConfigManagementServiceMetadata::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 ConfigManagementServiceMetadata::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 ConfigManagementServiceMetadata::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); +} + +void ConfigManagementServiceMetadata::SetMetadata( + grpc::ClientContext& context, Options const& options, + std::string const& request_params) { + context.AddMetadata("x-goog-request-params", request_params); + SetMetadata(context, options); +} + +void ConfigManagementServiceMetadata::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 datacatalog_lineage_configmanagement_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_metadata_decorator.h b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_metadata_decorator.h new file mode 100644 index 0000000000000..1ef36b7648c8e --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_metadata_decorator.h @@ -0,0 +1,89 @@ +// 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/datacatalog/lineage/configmanagement/v1/configmanagement.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_METADATA_DECORATOR_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_METADATA_DECORATOR_H + +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_stub.h" +#include "google/cloud/options.h" +#include "google/cloud/version.h" +#include +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace datacatalog_lineage_configmanagement_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class ConfigManagementServiceMetadata : public ConfigManagementServiceStub { + public: + ~ConfigManagementServiceMetadata() override = default; + ConfigManagementServiceMetadata( + std::shared_ptr child, + std::multimap fixed_metadata, + std::string api_client_header = ""); + + StatusOr + GetConfig(grpc::ClientContext& context, Options const& options, + google::cloud::datacatalog::lineage::configmanagement::v1:: + GetConfigRequest const& request) override; + + StatusOr + UpdateConfig(grpc::ClientContext& context, Options const& options, + google::cloud::datacatalog::lineage::configmanagement::v1:: + UpdateConfigRequest 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; + + 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 datacatalog_lineage_configmanagement_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_METADATA_DECORATOR_H diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_option_defaults.cc b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_option_defaults.cc new file mode 100644 index 0000000000000..af84d157d7c90 --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_option_defaults.cc @@ -0,0 +1,76 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: +// google/cloud/datacatalog/lineage/configmanagement/v1/configmanagement.proto + +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_option_defaults.h" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/config_management_connection.h" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/config_management_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 datacatalog_lineage_configmanagement_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +namespace { +auto constexpr kBackoffScaling = 2.0; +} // namespace + +Options ConfigManagementServiceDefaultOptions(Options options) { + options = internal::PopulateCommonOptions( + std::move(options), "GOOGLE_CLOUD_CPP_CONFIG_MANAGEMENT_SERVICE_ENDPOINT", + "", "GOOGLE_CLOUD_CPP_CONFIG_MANAGEMENT_SERVICE_AUTHORITY", + "datalineage.googleapis.com"); + options = internal::PopulateGrpcOptions(std::move(options)); + if (!options.has()) { + options.set( + datacatalog_lineage_configmanagement_v1:: + ConfigManagementServiceLimitedTimeRetryPolicy( + 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< + datacatalog_lineage_configmanagement_v1:: + ConfigManagementServiceConnectionIdempotencyPolicyOption>()) { + options.set( + datacatalog_lineage_configmanagement_v1:: + MakeDefaultConfigManagementServiceConnectionIdempotencyPolicy()); + } + + return options; +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace datacatalog_lineage_configmanagement_v1_internal +} // namespace cloud +} // namespace google diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_option_defaults.h b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_option_defaults.h new file mode 100644 index 0000000000000..385c4335f0848 --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_option_defaults.h @@ -0,0 +1,38 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Generated by the Codegen C++ plugin. +// If you make any local changes, they will be lost. +// source: +// google/cloud/datacatalog/lineage/configmanagement/v1/configmanagement.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_OPTION_DEFAULTS_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_OPTION_DEFAULTS_H + +#include "google/cloud/options.h" +#include "google/cloud/version.h" + +namespace google { +namespace cloud { +namespace datacatalog_lineage_configmanagement_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +Options ConfigManagementServiceDefaultOptions(Options options); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace datacatalog_lineage_configmanagement_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_OPTION_DEFAULTS_H diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_retry_traits.h b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_retry_traits.h new file mode 100644 index 0000000000000..31acb10c870ff --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_retry_traits.h @@ -0,0 +1,44 @@ +// 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/datacatalog/lineage/configmanagement/v1/configmanagement.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_RETRY_TRAITS_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_RETRY_TRAITS_H + +#include "google/cloud/status.h" +#include "google/cloud/version.h" + +namespace google { +namespace cloud { +namespace datacatalog_lineage_configmanagement_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +/// Define the gRPC status code semantics for retrying requests. +struct ConfigManagementServiceRetryTraits { + static bool IsPermanentFailure(google::cloud::Status const& status) { + return status.code() != StatusCode::kOk && + status.code() != StatusCode::kUnavailable; + } +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace datacatalog_lineage_configmanagement_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_RETRY_TRAITS_H diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_sources.cc b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_sources.cc new file mode 100644 index 0000000000000..f75da8ba3f494 --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_sources.cc @@ -0,0 +1,33 @@ +// 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/datacatalog/lineage/configmanagement/v1/configmanagement.proto + +// NOLINTBEGIN(bugprone-suspicious-include) +#include "google/cloud/datacatalog/lineage/configmanagement/v1/config_management_client.cc" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/config_management_connection.cc" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/config_management_connection_idempotency_policy.cc" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_auth_decorator.cc" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_connection_impl.cc" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_logging_decorator.cc" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_metadata_decorator.cc" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_option_defaults.cc" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_stub.cc" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_stub_factory.cc" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_tracing_connection.cc" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_tracing_stub.cc" +// NOLINTEND(bugprone-suspicious-include) diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_stub.cc b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_stub.cc new file mode 100644 index 0000000000000..c68ba78482f64 --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_stub.cc @@ -0,0 +1,114 @@ +// 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/datacatalog/lineage/configmanagement/v1/configmanagement.proto + +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_stub.h" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/configmanagement.grpc.pb.h" +#include "google/cloud/grpc_error_delegate.h" +#include "google/cloud/status_or.h" +#include +#include + +// Must be included last. +#include "google/cloud/ports_def.inc" + +namespace google { +namespace cloud { +namespace datacatalog_lineage_configmanagement_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +ConfigManagementServiceStub::~ConfigManagementServiceStub() = default; + +StatusOr +DefaultConfigManagementServiceStub::GetConfig( + grpc::ClientContext& context, Options const&, + google::cloud::datacatalog::lineage::configmanagement::v1:: + GetConfigRequest const& request) { + google::cloud::datacatalog::lineage::configmanagement::v1::Config response; + auto status = grpc_stub_->GetConfig(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultConfigManagementServiceStub::UpdateConfig( + grpc::ClientContext& context, Options const&, + google::cloud::datacatalog::lineage::configmanagement::v1:: + UpdateConfigRequest const& request) { + google::cloud::datacatalog::lineage::configmanagement::v1::Config response; + auto status = grpc_stub_->UpdateConfig(&context, request, &response); + if (!status.ok()) { + return google::cloud::MakeStatusFromRpcError(status); + } + return response; +} + +StatusOr +DefaultConfigManagementServiceStub::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 +DefaultConfigManagementServiceStub::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 DefaultConfigManagementServiceStub::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 DefaultConfigManagementServiceStub::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(); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace datacatalog_lineage_configmanagement_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_stub.h b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_stub.h new file mode 100644 index 0000000000000..20693ee49b451 --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_stub.h @@ -0,0 +1,124 @@ +// 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/datacatalog/lineage/configmanagement/v1/configmanagement.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_STUB_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_STUB_H + +#include "google/cloud/datacatalog/lineage/configmanagement/v1/configmanagement.grpc.pb.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 datacatalog_lineage_configmanagement_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class ConfigManagementServiceStub { + public: + virtual ~ConfigManagementServiceStub() = 0; + + virtual StatusOr< + google::cloud::datacatalog::lineage::configmanagement::v1::Config> + GetConfig(grpc::ClientContext& context, Options const& options, + google::cloud::datacatalog::lineage::configmanagement::v1:: + GetConfigRequest const& request) = 0; + + virtual StatusOr< + google::cloud::datacatalog::lineage::configmanagement::v1::Config> + UpdateConfig(grpc::ClientContext& context, Options const& options, + google::cloud::datacatalog::lineage::configmanagement::v1:: + UpdateConfigRequest 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; +}; + +class DefaultConfigManagementServiceStub : public ConfigManagementServiceStub { + public: + explicit DefaultConfigManagementServiceStub( + std::unique_ptr + grpc_stub, + std::unique_ptr + operations_stub) + : grpc_stub_(std::move(grpc_stub)), + operations_stub_(std::move(operations_stub)) {} + + StatusOr + GetConfig(grpc::ClientContext& context, Options const& options, + google::cloud::datacatalog::lineage::configmanagement::v1:: + GetConfigRequest const& request) override; + + StatusOr + UpdateConfig(grpc::ClientContext& context, Options const& options, + google::cloud::datacatalog::lineage::configmanagement::v1:: + UpdateConfigRequest 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; + + private: + std::unique_ptr + grpc_stub_; + std::unique_ptr + operations_stub_; +}; + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace datacatalog_lineage_configmanagement_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_STUB_H diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_stub_factory.cc b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_stub_factory.cc new file mode 100644 index 0000000000000..8394ad35ea6cd --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_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/datacatalog/lineage/configmanagement/v1/configmanagement.proto + +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_stub_factory.h" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/configmanagement.grpc.pb.h" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_auth_decorator.h" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_logging_decorator.h" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_metadata_decorator.h" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_stub.h" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_tracing_stub.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 datacatalog_lineage_configmanagement_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +std::shared_ptr +CreateDefaultConfigManagementServiceStub( + std::shared_ptr auth, + Options const& options) { + auto channel = auth->CreateChannel(options.get(), + internal::MakeChannelArguments(options)); + auto service_grpc_stub = google::cloud::datacatalog::lineage:: + configmanagement::v1::ConfigManagementService::NewStub(channel); + auto service_operations_stub = + google::longrunning::Operations::NewStub(channel); + std::shared_ptr stub = + std::make_shared( + std::move(service_grpc_stub), std::move(service_operations_stub)); + + if (auth->RequiresConfigureContext()) { + stub = std::make_shared(std::move(auth), + std::move(stub)); + } + stub = std::make_shared( + std::move(stub), std::multimap{}); + if (internal::Contains(options.get(), "rpc")) { + GCP_LOG(INFO) << "Enabled logging for gRPC calls"; + stub = std::make_shared( + std::move(stub), options.get(), + options.get()); + } + if (internal::TracingEnabled(options)) { + stub = MakeConfigManagementServiceTracingStub(std::move(stub)); + } + return stub; +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace datacatalog_lineage_configmanagement_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_stub_factory.h b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_stub_factory.h new file mode 100644 index 0000000000000..f2edb0fd6daae --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_stub_factory.h @@ -0,0 +1,49 @@ +// 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/datacatalog/lineage/configmanagement/v1/configmanagement.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_STUB_FACTORY_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_STUB_FACTORY_H + +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_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 datacatalog_lineage_configmanagement_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +std::shared_ptr +CreateDefaultConfigManagementServiceStub( + std::shared_ptr auth, + Options const& options); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace datacatalog_lineage_configmanagement_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_STUB_FACTORY_H diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_tracing_connection.cc b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_tracing_connection.cc new file mode 100644 index 0000000000000..141175e74acaa --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_tracing_connection.cc @@ -0,0 +1,116 @@ +// 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/datacatalog/lineage/configmanagement/v1/configmanagement.proto + +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_tracing_connection.h" +#include "google/cloud/internal/opentelemetry.h" +#include "google/cloud/internal/traced_stream_range.h" +#include +#include + +namespace google { +namespace cloud { +namespace datacatalog_lineage_configmanagement_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +ConfigManagementServiceTracingConnection:: + ConfigManagementServiceTracingConnection( + std::shared_ptr + child) + : child_(std::move(child)) {} + +StatusOr +ConfigManagementServiceTracingConnection::GetConfig( + google::cloud::datacatalog::lineage::configmanagement::v1:: + GetConfigRequest const& request) { + auto span = internal::MakeSpan( + "datacatalog_lineage_configmanagement_v1::" + "ConfigManagementServiceConnection::GetConfig"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->GetConfig(request)); +} + +StatusOr +ConfigManagementServiceTracingConnection::UpdateConfig( + google::cloud::datacatalog::lineage::configmanagement::v1:: + UpdateConfigRequest const& request) { + auto span = internal::MakeSpan( + "datacatalog_lineage_configmanagement_v1::" + "ConfigManagementServiceConnection::UpdateConfig"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->UpdateConfig(request)); +} + +StreamRange +ConfigManagementServiceTracingConnection::ListOperations( + google::longrunning::ListOperationsRequest request) { + auto span = internal::MakeSpan( + "datacatalog_lineage_configmanagement_v1::" + "ConfigManagementServiceConnection::ListOperations"); + internal::OTelScope scope(span); + auto sr = child_->ListOperations(std::move(request)); + return internal::MakeTracedStreamRange( + std::move(span), std::move(sr)); +} + +StatusOr +ConfigManagementServiceTracingConnection::GetOperation( + google::longrunning::GetOperationRequest const& request) { + auto span = internal::MakeSpan( + "datacatalog_lineage_configmanagement_v1::" + "ConfigManagementServiceConnection::GetOperation"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->GetOperation(request)); +} + +Status ConfigManagementServiceTracingConnection::DeleteOperation( + google::longrunning::DeleteOperationRequest const& request) { + auto span = internal::MakeSpan( + "datacatalog_lineage_configmanagement_v1::" + "ConfigManagementServiceConnection::DeleteOperation"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->DeleteOperation(request)); +} + +Status ConfigManagementServiceTracingConnection::CancelOperation( + google::longrunning::CancelOperationRequest const& request) { + auto span = internal::MakeSpan( + "datacatalog_lineage_configmanagement_v1::" + "ConfigManagementServiceConnection::CancelOperation"); + auto scope = opentelemetry::trace::Scope(span); + return internal::EndSpan(*span, child_->CancelOperation(request)); +} + +std::shared_ptr< + datacatalog_lineage_configmanagement_v1::ConfigManagementServiceConnection> +MakeConfigManagementServiceTracingConnection( + 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 datacatalog_lineage_configmanagement_v1_internal +} // namespace cloud +} // namespace google diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_tracing_connection.h b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_tracing_connection.h new file mode 100644 index 0000000000000..fd2d4eaab863d --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_tracing_connection.h @@ -0,0 +1,89 @@ +// 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/datacatalog/lineage/configmanagement/v1/configmanagement.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_TRACING_CONNECTION_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_TRACING_CONNECTION_H + +#include "google/cloud/datacatalog/lineage/configmanagement/v1/config_management_connection.h" +#include "google/cloud/version.h" +#include + +namespace google { +namespace cloud { +namespace datacatalog_lineage_configmanagement_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class ConfigManagementServiceTracingConnection + : public datacatalog_lineage_configmanagement_v1:: + ConfigManagementServiceConnection { + public: + ~ConfigManagementServiceTracingConnection() override = default; + + explicit ConfigManagementServiceTracingConnection( + std::shared_ptr + child); + + Options options() override { return child_->options(); } + + StatusOr + GetConfig(google::cloud::datacatalog::lineage::configmanagement::v1:: + GetConfigRequest const& request) override; + + StatusOr + UpdateConfig(google::cloud::datacatalog::lineage::configmanagement::v1:: + UpdateConfigRequest 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< + datacatalog_lineage_configmanagement_v1::ConfigManagementServiceConnection> +MakeConfigManagementServiceTracingConnection( + std::shared_ptr + conn); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace datacatalog_lineage_configmanagement_v1_internal +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_TRACING_CONNECTION_H diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_tracing_stub.cc b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_tracing_stub.cc new file mode 100644 index 0000000000000..d7540885e76b4 --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_tracing_stub.cc @@ -0,0 +1,132 @@ +// 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/datacatalog/lineage/configmanagement/v1/configmanagement.proto + +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_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 datacatalog_lineage_configmanagement_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +ConfigManagementServiceTracingStub::ConfigManagementServiceTracingStub( + std::shared_ptr child) + : child_(std::move(child)), propagator_(internal::MakePropagator()) {} + +StatusOr +ConfigManagementServiceTracingStub::GetConfig( + grpc::ClientContext& context, Options const& options, + google::cloud::datacatalog::lineage::configmanagement::v1:: + GetConfigRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.datacatalog.lineage.configmanagement.v1." + "ConfigManagementService", + "GetConfig"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->GetConfig(context, options, request)); +} + +StatusOr +ConfigManagementServiceTracingStub::UpdateConfig( + grpc::ClientContext& context, Options const& options, + google::cloud::datacatalog::lineage::configmanagement::v1:: + UpdateConfigRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.datacatalog.lineage.configmanagement.v1." + "ConfigManagementService", + "UpdateConfig"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->UpdateConfig(context, options, request)); +} + +StatusOr +ConfigManagementServiceTracingStub::ListOperations( + grpc::ClientContext& context, Options const& options, + google::longrunning::ListOperationsRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.datacatalog.lineage.configmanagement.v1." + "ConfigManagementService", + "ListOperations"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->ListOperations(context, options, request)); +} + +StatusOr +ConfigManagementServiceTracingStub::GetOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::GetOperationRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.datacatalog.lineage.configmanagement.v1." + "ConfigManagementService", + "GetOperation"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->GetOperation(context, options, request)); +} + +Status ConfigManagementServiceTracingStub::DeleteOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::DeleteOperationRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.datacatalog.lineage.configmanagement.v1." + "ConfigManagementService", + "DeleteOperation"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->DeleteOperation(context, options, request)); +} + +Status ConfigManagementServiceTracingStub::CancelOperation( + grpc::ClientContext& context, Options const& options, + google::longrunning::CancelOperationRequest const& request) { + auto span = internal::MakeSpanGrpc( + "google.cloud.datacatalog.lineage.configmanagement.v1." + "ConfigManagementService", + "CancelOperation"); + auto scope = opentelemetry::trace::Scope(span); + internal::InjectTraceContext(context, *propagator_); + return internal::EndSpan(context, *span, + child_->CancelOperation(context, options, request)); +} + +std::shared_ptr +MakeConfigManagementServiceTracingStub( + std::shared_ptr stub) { + return std::make_shared(std::move(stub)); +} + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace datacatalog_lineage_configmanagement_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_tracing_stub.h b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_tracing_stub.h new file mode 100644 index 0000000000000..2fa7a6190e48d --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_tracing_stub.h @@ -0,0 +1,93 @@ +// 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/datacatalog/lineage/configmanagement/v1/configmanagement.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_TRACING_STUB_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_TRACING_STUB_H + +#include "google/cloud/datacatalog/lineage/configmanagement/v1/internal/config_management_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 datacatalog_lineage_configmanagement_v1_internal { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +class ConfigManagementServiceTracingStub : public ConfigManagementServiceStub { + public: + ~ConfigManagementServiceTracingStub() override = default; + + explicit ConfigManagementServiceTracingStub( + std::shared_ptr child); + + StatusOr + GetConfig(grpc::ClientContext& context, Options const& options, + google::cloud::datacatalog::lineage::configmanagement::v1:: + GetConfigRequest const& request) override; + + StatusOr + UpdateConfig(grpc::ClientContext& context, Options const& options, + google::cloud::datacatalog::lineage::configmanagement::v1:: + UpdateConfigRequest 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; + + 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 +MakeConfigManagementServiceTracingStub( + std::shared_ptr stub); + +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END +} // namespace datacatalog_lineage_configmanagement_v1_internal +} // namespace cloud +} // namespace google + +#include "google/cloud/ports_undef.inc" + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_INTERNAL_CONFIG_MANAGEMENT_TRACING_STUB_H diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/mocks/mock_config_management_connection.h b/google/cloud/datacatalog/lineage/configmanagement/v1/mocks/mock_config_management_connection.h new file mode 100644 index 0000000000000..12dccf059a47b --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/mocks/mock_config_management_connection.h @@ -0,0 +1,89 @@ +// 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/datacatalog/lineage/configmanagement/v1/configmanagement.proto + +#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_MOCKS_MOCK_CONFIG_MANAGEMENT_CONNECTION_H +#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_MOCKS_MOCK_CONFIG_MANAGEMENT_CONNECTION_H + +#include "google/cloud/datacatalog/lineage/configmanagement/v1/config_management_connection.h" +#include + +namespace google { +namespace cloud { +namespace datacatalog_lineage_configmanagement_v1_mocks { +GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN + +/** + * A class to mock `ConfigManagementServiceConnection`. + * + * Application developers may want to test their code with simulated responses, + * including errors, from an object of type `ConfigManagementServiceClient`. To + * do so, construct an object of type `ConfigManagementServiceClient` 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 MockConfigManagementServiceConnection + : public datacatalog_lineage_configmanagement_v1:: + ConfigManagementServiceConnection { + public: + MOCK_METHOD(Options, options, (), (override)); + + MOCK_METHOD( + StatusOr< + google::cloud::datacatalog::lineage::configmanagement::v1::Config>, + GetConfig, + (google::cloud::datacatalog::lineage::configmanagement::v1:: + GetConfigRequest const& request), + (override)); + + MOCK_METHOD( + StatusOr< + google::cloud::datacatalog::lineage::configmanagement::v1::Config>, + UpdateConfig, + (google::cloud::datacatalog::lineage::configmanagement::v1:: + UpdateConfigRequest 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 datacatalog_lineage_configmanagement_v1_mocks +} // namespace cloud +} // namespace google + +#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_DATACATALOG_LINEAGE_CONFIGMANAGEMENT_V1_MOCKS_MOCK_CONFIG_MANAGEMENT_CONNECTION_H diff --git a/google/cloud/datacatalog/lineage/configmanagement/v1/samples/config_management_client_samples.cc b/google/cloud/datacatalog/lineage/configmanagement/v1/samples/config_management_client_samples.cc new file mode 100644 index 0000000000000..c55167e99315d --- /dev/null +++ b/google/cloud/datacatalog/lineage/configmanagement/v1/samples/config_management_client_samples.cc @@ -0,0 +1,195 @@ +// 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/datacatalog/lineage/configmanagement/v1/configmanagement.proto + +#include "google/cloud/datacatalog/lineage/configmanagement/v1/config_management_client.h" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/config_management_connection_idempotency_policy.h" +#include "google/cloud/datacatalog/lineage/configmanagement/v1/config_management_options.h" +#include "google/cloud/common_options.h" +#include "google/cloud/credentials.h" +#include "google/cloud/internal/getenv.h" +#include "google/cloud/testing_util/example_driver.h" +#include "google/cloud/universe_domain.h" +#include +#include +#include +#include + +// clang-format off +// main-dox-marker: datacatalog_lineage_configmanagement_v1::ConfigManagementServiceClient +// 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::datacatalog_lineage_configmanagement_v1:: + ConfigManagementServiceClient( + google::cloud::datacatalog_lineage_configmanagement_v1:: + MakeConfigManagementServiceConnection(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::datacatalog_lineage_configmanagement_v1:: + ConfigManagementServiceClient( + google::cloud::datacatalog_lineage_configmanagement_v1:: + MakeConfigManagementServiceConnection(*ud_options)); + //! [set-client-universe-domain] +} + +//! [custom-idempotency-policy] +class CustomIdempotencyPolicy + : public google::cloud::datacatalog_lineage_configmanagement_v1:: + ConfigManagementServiceConnectionIdempotencyPolicy { + public: + ~CustomIdempotencyPolicy() override = default; + std::unique_ptr + clone() const override { + return std::make_unique(*this); + } + // Override inherited functions to define as needed. +}; +//! [custom-idempotency-policy] + +void SetRetryPolicy(std::vector const& argv) { + if (!argv.empty()) { + throw google::cloud::testing_util::Usage{"set-client-retry-policy"}; + } + //! [set-retry-policy] + auto options = + google::cloud::Options{} + .set( + CustomIdempotencyPolicy().clone()) + .set( + google::cloud::datacatalog_lineage_configmanagement_v1:: + ConfigManagementServiceLimitedErrorCountRetryPolicy(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::datacatalog_lineage_configmanagement_v1:: + MakeConfigManagementServiceConnection(options); + + // c1 and c2 share the same retry policies + auto c1 = google::cloud::datacatalog_lineage_configmanagement_v1:: + ConfigManagementServiceClient(connection); + auto c2 = google::cloud::datacatalog_lineage_configmanagement_v1:: + ConfigManagementServiceClient(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::datacatalog_lineage_configmanagement_v1:: + ConfigManagementServiceClient( + connection, + google::cloud::Options{} + .set( + google::cloud::datacatalog_lineage_configmanagement_v1:: + ConfigManagementServiceLimitedTimeRetryPolicy( + std::chrono::minutes(5)) + .clone())); + + // You can also override the policies in a single call: + // c3.SomeRpc(..., google::cloud::Options{} + // .set( + // google::cloud::datacatalog_lineage_configmanagement_v1::ConfigManagementServiceLimitedErrorCountRetryPolicy(10).clone())); + //! [set-retry-policy] +} + +void WithServiceAccount(std::vector const& argv) { + if (argv.size() != 1 || argv[0] == "--help") { + throw google::cloud::testing_util::Usage{"with-service-account "}; + } + //! [with-service-account] + [](std::string const& keyfile) { + auto is = std::ifstream(keyfile); + is.exceptions(std::ios::badbit); // Minimal error handling in examples + auto contents = std::string(std::istreambuf_iterator(is.rdbuf()), {}); + auto options = + google::cloud::Options{}.set( + google::cloud::MakeServiceAccountCredentials(contents)); + return google::cloud::datacatalog_lineage_configmanagement_v1:: + ConfigManagementServiceClient( + google::cloud::datacatalog_lineage_configmanagement_v1:: + MakeConfigManagementServiceConnection(options)); + } + //! [with-service-account] + (argv.at(0)); +} + +void AutoRun(std::vector const& argv) { + namespace examples = ::google::cloud::testing_util; + using ::google::cloud::internal::GetEnv; + if (!argv.empty()) throw examples::Usage{"auto"}; + examples::CheckEnvironmentVariablesAreSet( + {"GOOGLE_CLOUD_CPP_TEST_SERVICE_ACCOUNT_KEYFILE"}); + auto const keyfile = + GetEnv("GOOGLE_CLOUD_CPP_TEST_SERVICE_ACCOUNT_KEYFILE").value(); + + std::cout << "\nRunning SetClientEndpoint() example" << std::endl; + SetClientEndpoint({}); + + std::cout << "\nRunning SetRetryPolicy() example" << std::endl; + SetRetryPolicy({}); + + std::cout << "\nRunning WithServiceAccount() example" << std::endl; + WithServiceAccount({keyfile}); + + std::cout << "\nRunning SetClientUniverseDomain() example" << std::endl; + SetClientUniverseDomain({}); +} + +} // namespace + +int main(int argc, char* argv[]) { // NOLINT(bugprone-exception-escape) + google::cloud::testing_util::Example example({ + {"set-client-endpoint", SetClientEndpoint}, + {"set-retry-policy", SetRetryPolicy}, + {"with-service-account", WithServiceAccount}, + {"set-client-universe-domain", SetClientUniverseDomain}, + {"auto", AutoRun}, + }); + return example.Run(argc, argv); +}