// Copyright 2025 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/licensemanager/v1/licensemanager.proto

#include "google/cloud/licensemanager/v1/internal/license_manager_tracing_connection.h"
#include "google/cloud/internal/opentelemetry.h"
#include "google/cloud/internal/traced_stream_range.h"
#include <memory>
#include <utility>

namespace google {
namespace cloud {
namespace licensemanager_v1_internal {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

LicenseManagerTracingConnection::LicenseManagerTracingConnection(
    std::shared_ptr<licensemanager_v1::LicenseManagerConnection> child)
    : child_(std::move(child)) {}

StreamRange<google::cloud::licensemanager::v1::Configuration>
LicenseManagerTracingConnection::ListConfigurations(
    google::cloud::licensemanager::v1::ListConfigurationsRequest request) {
  auto span = internal::MakeSpan(
      "licensemanager_v1::LicenseManagerConnection::ListConfigurations");
  internal::OTelScope scope(span);
  auto sr = child_->ListConfigurations(std::move(request));
  return internal::MakeTracedStreamRange<
      google::cloud::licensemanager::v1::Configuration>(std::move(span),
                                                        std::move(sr));
}

StatusOr<google::cloud::licensemanager::v1::Configuration>
LicenseManagerTracingConnection::GetConfiguration(
    google::cloud::licensemanager::v1::GetConfigurationRequest const& request) {
  auto span = internal::MakeSpan(
      "licensemanager_v1::LicenseManagerConnection::GetConfiguration");
  auto scope = opentelemetry::trace::Scope(span);
  return internal::EndSpan(*span, child_->GetConfiguration(request));
}

future<StatusOr<google::cloud::licensemanager::v1::Configuration>>
LicenseManagerTracingConnection::CreateConfiguration(
    google::cloud::licensemanager::v1::CreateConfigurationRequest const&
        request) {
  auto span = internal::MakeSpan(
      "licensemanager_v1::LicenseManagerConnection::CreateConfiguration");
  internal::OTelScope scope(span);
  return internal::EndSpan(std::move(span),
                           child_->CreateConfiguration(request));
}

StatusOr<google::longrunning::Operation>
LicenseManagerTracingConnection::CreateConfiguration(
    NoAwaitTag,
    google::cloud::licensemanager::v1::CreateConfigurationRequest const&
        request) {
  auto span = internal::MakeSpan(
      "licensemanager_v1::LicenseManagerConnection::CreateConfiguration");
  opentelemetry::trace::Scope scope(span);
  return internal::EndSpan(*span,
                           child_->CreateConfiguration(NoAwaitTag{}, request));
}

future<StatusOr<google::cloud::licensemanager::v1::Configuration>>
LicenseManagerTracingConnection::CreateConfiguration(
    google::longrunning::Operation const& operation) {
  auto span = internal::MakeSpan(
      "licensemanager_v1::LicenseManagerConnection::CreateConfiguration");
  internal::OTelScope scope(span);
  return internal::EndSpan(std::move(span),
                           child_->CreateConfiguration(operation));
}

future<StatusOr<google::cloud::licensemanager::v1::Configuration>>
LicenseManagerTracingConnection::UpdateConfiguration(
    google::cloud::licensemanager::v1::UpdateConfigurationRequest const&
        request) {
  auto span = internal::MakeSpan(
      "licensemanager_v1::LicenseManagerConnection::UpdateConfiguration");
  internal::OTelScope scope(span);
  return internal::EndSpan(std::move(span),
                           child_->UpdateConfiguration(request));
}

StatusOr<google::longrunning::Operation>
LicenseManagerTracingConnection::UpdateConfiguration(
    NoAwaitTag,
    google::cloud::licensemanager::v1::UpdateConfigurationRequest const&
        request) {
  auto span = internal::MakeSpan(
      "licensemanager_v1::LicenseManagerConnection::UpdateConfiguration");
  opentelemetry::trace::Scope scope(span);
  return internal::EndSpan(*span,
                           child_->UpdateConfiguration(NoAwaitTag{}, request));
}

future<StatusOr<google::cloud::licensemanager::v1::Configuration>>
LicenseManagerTracingConnection::UpdateConfiguration(
    google::longrunning::Operation const& operation) {
  auto span = internal::MakeSpan(
      "licensemanager_v1::LicenseManagerConnection::UpdateConfiguration");
  internal::OTelScope scope(span);
  return internal::EndSpan(std::move(span),
                           child_->UpdateConfiguration(operation));
}

future<StatusOr<google::cloud::licensemanager::v1::OperationMetadata>>
LicenseManagerTracingConnection::DeleteConfiguration(
    google::cloud::licensemanager::v1::DeleteConfigurationRequest const&
        request) {
  auto span = internal::MakeSpan(
      "licensemanager_v1::LicenseManagerConnection::DeleteConfiguration");
  internal::OTelScope scope(span);
  return internal::EndSpan(std::move(span),
                           child_->DeleteConfiguration(request));
}

StatusOr<google::longrunning::Operation>
LicenseManagerTracingConnection::DeleteConfiguration(
    NoAwaitTag,
    google::cloud::licensemanager::v1::DeleteConfigurationRequest const&
        request) {
  auto span = internal::MakeSpan(
      "licensemanager_v1::LicenseManagerConnection::DeleteConfiguration");
  opentelemetry::trace::Scope scope(span);
  return internal::EndSpan(*span,
                           child_->DeleteConfiguration(NoAwaitTag{}, request));
}

future<StatusOr<google::cloud::licensemanager::v1::OperationMetadata>>
LicenseManagerTracingConnection::DeleteConfiguration(
    google::longrunning::Operation const& operation) {
  auto span = internal::MakeSpan(
      "licensemanager_v1::LicenseManagerConnection::DeleteConfiguration");
  internal::OTelScope scope(span);
  return internal::EndSpan(std::move(span),
                           child_->DeleteConfiguration(operation));
}

StreamRange<google::cloud::licensemanager::v1::Instance>
LicenseManagerTracingConnection::ListInstances(
    google::cloud::licensemanager::v1::ListInstancesRequest request) {
  auto span = internal::MakeSpan(
      "licensemanager_v1::LicenseManagerConnection::ListInstances");
  internal::OTelScope scope(span);
  auto sr = child_->ListInstances(std::move(request));
  return internal::MakeTracedStreamRange<
      google::cloud::licensemanager::v1::Instance>(std::move(span),
                                                   std::move(sr));
}

StatusOr<google::cloud::licensemanager::v1::Instance>
LicenseManagerTracingConnection::GetInstance(
    google::cloud::licensemanager::v1::GetInstanceRequest const& request) {
  auto span = internal::MakeSpan(
      "licensemanager_v1::LicenseManagerConnection::GetInstance");
  auto scope = opentelemetry::trace::Scope(span);
  return internal::EndSpan(*span, child_->GetInstance(request));
}

future<StatusOr<google::cloud::licensemanager::v1::Configuration>>
LicenseManagerTracingConnection::DeactivateConfiguration(
    google::cloud::licensemanager::v1::DeactivateConfigurationRequest const&
        request) {
  auto span = internal::MakeSpan(
      "licensemanager_v1::LicenseManagerConnection::DeactivateConfiguration");
  internal::OTelScope scope(span);
  return internal::EndSpan(std::move(span),
                           child_->DeactivateConfiguration(request));
}

StatusOr<google::longrunning::Operation>
LicenseManagerTracingConnection::DeactivateConfiguration(
    NoAwaitTag,
    google::cloud::licensemanager::v1::DeactivateConfigurationRequest const&
        request) {
  auto span = internal::MakeSpan(
      "licensemanager_v1::LicenseManagerConnection::DeactivateConfiguration");
  opentelemetry::trace::Scope scope(span);
  return internal::EndSpan(
      *span, child_->DeactivateConfiguration(NoAwaitTag{}, request));
}

future<StatusOr<google::cloud::licensemanager::v1::Configuration>>
LicenseManagerTracingConnection::DeactivateConfiguration(
    google::longrunning::Operation const& operation) {
  auto span = internal::MakeSpan(
      "licensemanager_v1::LicenseManagerConnection::DeactivateConfiguration");
  internal::OTelScope scope(span);
  return internal::EndSpan(std::move(span),
                           child_->DeactivateConfiguration(operation));
}

future<StatusOr<google::cloud::licensemanager::v1::Configuration>>
LicenseManagerTracingConnection::ReactivateConfiguration(
    google::cloud::licensemanager::v1::ReactivateConfigurationRequest const&
        request) {
  auto span = internal::MakeSpan(
      "licensemanager_v1::LicenseManagerConnection::ReactivateConfiguration");
  internal::OTelScope scope(span);
  return internal::EndSpan(std::move(span),
                           child_->ReactivateConfiguration(request));
}

StatusOr<google::longrunning::Operation>
LicenseManagerTracingConnection::ReactivateConfiguration(
    NoAwaitTag,
    google::cloud::licensemanager::v1::ReactivateConfigurationRequest const&
        request) {
  auto span = internal::MakeSpan(
      "licensemanager_v1::LicenseManagerConnection::ReactivateConfiguration");
  opentelemetry::trace::Scope scope(span);
  return internal::EndSpan(
      *span, child_->ReactivateConfiguration(NoAwaitTag{}, request));
}

future<StatusOr<google::cloud::licensemanager::v1::Configuration>>
LicenseManagerTracingConnection::ReactivateConfiguration(
    google::longrunning::Operation const& operation) {
  auto span = internal::MakeSpan(
      "licensemanager_v1::LicenseManagerConnection::ReactivateConfiguration");
  internal::OTelScope scope(span);
  return internal::EndSpan(std::move(span),
                           child_->ReactivateConfiguration(operation));
}

StatusOr<
    google::cloud::licensemanager::v1::QueryConfigurationLicenseUsageResponse>
LicenseManagerTracingConnection::QueryConfigurationLicenseUsage(
    google::cloud::licensemanager::v1::
        QueryConfigurationLicenseUsageRequest const& request) {
  auto span = internal::MakeSpan(
      "licensemanager_v1::LicenseManagerConnection::"
      "QueryConfigurationLicenseUsage");
  auto scope = opentelemetry::trace::Scope(span);
  return internal::EndSpan(*span,
                           child_->QueryConfigurationLicenseUsage(request));
}

StreamRange<google::cloud::licensemanager::v1::Usage>
LicenseManagerTracingConnection::AggregateUsage(
    google::cloud::licensemanager::v1::AggregateUsageRequest request) {
  auto span = internal::MakeSpan(
      "licensemanager_v1::LicenseManagerConnection::AggregateUsage");
  internal::OTelScope scope(span);
  auto sr = child_->AggregateUsage(std::move(request));
  return internal::MakeTracedStreamRange<
      google::cloud::licensemanager::v1::Usage>(std::move(span), std::move(sr));
}

StreamRange<google::cloud::licensemanager::v1::Product>
LicenseManagerTracingConnection::ListProducts(
    google::cloud::licensemanager::v1::ListProductsRequest request) {
  auto span = internal::MakeSpan(
      "licensemanager_v1::LicenseManagerConnection::ListProducts");
  internal::OTelScope scope(span);
  auto sr = child_->ListProducts(std::move(request));
  return internal::MakeTracedStreamRange<
      google::cloud::licensemanager::v1::Product>(std::move(span),
                                                  std::move(sr));
}

StatusOr<google::cloud::licensemanager::v1::Product>
LicenseManagerTracingConnection::GetProduct(
    google::cloud::licensemanager::v1::GetProductRequest const& request) {
  auto span = internal::MakeSpan(
      "licensemanager_v1::LicenseManagerConnection::GetProduct");
  auto scope = opentelemetry::trace::Scope(span);
  return internal::EndSpan(*span, child_->GetProduct(request));
}

StreamRange<google::cloud::location::Location>
LicenseManagerTracingConnection::ListLocations(
    google::cloud::location::ListLocationsRequest request) {
  auto span = internal::MakeSpan(
      "licensemanager_v1::LicenseManagerConnection::ListLocations");
  internal::OTelScope scope(span);
  auto sr = child_->ListLocations(std::move(request));
  return internal::MakeTracedStreamRange<google::cloud::location::Location>(
      std::move(span), std::move(sr));
}

StatusOr<google::cloud::location::Location>
LicenseManagerTracingConnection::GetLocation(
    google::cloud::location::GetLocationRequest const& request) {
  auto span = internal::MakeSpan(
      "licensemanager_v1::LicenseManagerConnection::GetLocation");
  auto scope = opentelemetry::trace::Scope(span);
  return internal::EndSpan(*span, child_->GetLocation(request));
}

StreamRange<google::longrunning::Operation>
LicenseManagerTracingConnection::ListOperations(
    google::longrunning::ListOperationsRequest request) {
  auto span = internal::MakeSpan(
      "licensemanager_v1::LicenseManagerConnection::ListOperations");
  internal::OTelScope scope(span);
  auto sr = child_->ListOperations(std::move(request));
  return internal::MakeTracedStreamRange<google::longrunning::Operation>(
      std::move(span), std::move(sr));
}

StatusOr<google::longrunning::Operation>
LicenseManagerTracingConnection::GetOperation(
    google::longrunning::GetOperationRequest const& request) {
  auto span = internal::MakeSpan(
      "licensemanager_v1::LicenseManagerConnection::GetOperation");
  auto scope = opentelemetry::trace::Scope(span);
  return internal::EndSpan(*span, child_->GetOperation(request));
}

Status LicenseManagerTracingConnection::DeleteOperation(
    google::longrunning::DeleteOperationRequest const& request) {
  auto span = internal::MakeSpan(
      "licensemanager_v1::LicenseManagerConnection::DeleteOperation");
  auto scope = opentelemetry::trace::Scope(span);
  return internal::EndSpan(*span, child_->DeleteOperation(request));
}

Status LicenseManagerTracingConnection::CancelOperation(
    google::longrunning::CancelOperationRequest const& request) {
  auto span = internal::MakeSpan(
      "licensemanager_v1::LicenseManagerConnection::CancelOperation");
  auto scope = opentelemetry::trace::Scope(span);
  return internal::EndSpan(*span, child_->CancelOperation(request));
}

std::shared_ptr<licensemanager_v1::LicenseManagerConnection>
MakeLicenseManagerTracingConnection(
    std::shared_ptr<licensemanager_v1::LicenseManagerConnection> conn) {
  if (internal::TracingEnabled(conn->options())) {
    conn = std::make_shared<LicenseManagerTracingConnection>(std::move(conn));
  }
  return conn;
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
}  // namespace licensemanager_v1_internal
}  // namespace cloud
}  // namespace google
