// Copyright 2023 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/redis/cluster/v1/cloud_redis_cluster.proto

#include "google/cloud/redis/cluster/v1/internal/cloud_redis_cluster_tracing_stub.h"
#include "google/cloud/internal/grpc_opentelemetry.h"
#include <memory>
#include <utility>

// Must be included last.
#include "google/cloud/ports_def.inc"

namespace google {
namespace cloud {
namespace redis_cluster_v1_internal {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

CloudRedisClusterTracingStub::CloudRedisClusterTracingStub(
    std::shared_ptr<CloudRedisClusterStub> child)
    : child_(std::move(child)), propagator_(internal::MakePropagator()) {}

StatusOr<google::cloud::redis::cluster::v1::ListClustersResponse>
CloudRedisClusterTracingStub::ListClusters(
    grpc::ClientContext& context, Options const& options,
    google::cloud::redis::cluster::v1::ListClustersRequest const& request) {
  auto span = internal::MakeSpanGrpc(
      "google.cloud.redis.cluster.v1.CloudRedisCluster", "ListClusters");
  auto scope = opentelemetry::trace::Scope(span);
  internal::InjectTraceContext(context, *propagator_);
  return internal::EndSpan(context, *span,
                           child_->ListClusters(context, options, request));
}

StatusOr<google::cloud::redis::cluster::v1::Cluster>
CloudRedisClusterTracingStub::GetCluster(
    grpc::ClientContext& context, Options const& options,
    google::cloud::redis::cluster::v1::GetClusterRequest const& request) {
  auto span = internal::MakeSpanGrpc(
      "google.cloud.redis.cluster.v1.CloudRedisCluster", "GetCluster");
  auto scope = opentelemetry::trace::Scope(span);
  internal::InjectTraceContext(context, *propagator_);
  return internal::EndSpan(context, *span,
                           child_->GetCluster(context, options, request));
}

future<StatusOr<google::longrunning::Operation>>
CloudRedisClusterTracingStub::AsyncUpdateCluster(
    google::cloud::CompletionQueue& cq,
    std::shared_ptr<grpc::ClientContext> context,
    google::cloud::internal::ImmutableOptions options,
    google::cloud::redis::cluster::v1::UpdateClusterRequest const& request) {
  auto span = internal::MakeSpanGrpc(
      "google.cloud.redis.cluster.v1.CloudRedisCluster", "UpdateCluster");
  internal::OTelScope scope(span);
  internal::InjectTraceContext(*context, *propagator_);
  auto f = child_->AsyncUpdateCluster(cq, context, std::move(options), request);
  return internal::EndSpan(std::move(context), std::move(span), std::move(f));
}

StatusOr<google::longrunning::Operation>
CloudRedisClusterTracingStub::UpdateCluster(
    grpc::ClientContext& context, Options options,
    google::cloud::redis::cluster::v1::UpdateClusterRequest const& request) {
  auto span = internal::MakeSpanGrpc(
      "google.cloud.redis.cluster.v1.CloudRedisCluster", "UpdateCluster");
  auto scope = opentelemetry::trace::Scope(span);
  internal::InjectTraceContext(context, *propagator_);
  return internal::EndSpan(context, *span,
                           child_->UpdateCluster(context, options, request));
}

future<StatusOr<google::longrunning::Operation>>
CloudRedisClusterTracingStub::AsyncDeleteCluster(
    google::cloud::CompletionQueue& cq,
    std::shared_ptr<grpc::ClientContext> context,
    google::cloud::internal::ImmutableOptions options,
    google::cloud::redis::cluster::v1::DeleteClusterRequest const& request) {
  auto span = internal::MakeSpanGrpc(
      "google.cloud.redis.cluster.v1.CloudRedisCluster", "DeleteCluster");
  internal::OTelScope scope(span);
  internal::InjectTraceContext(*context, *propagator_);
  auto f = child_->AsyncDeleteCluster(cq, context, std::move(options), request);
  return internal::EndSpan(std::move(context), std::move(span), std::move(f));
}

StatusOr<google::longrunning::Operation>
CloudRedisClusterTracingStub::DeleteCluster(
    grpc::ClientContext& context, Options options,
    google::cloud::redis::cluster::v1::DeleteClusterRequest const& request) {
  auto span = internal::MakeSpanGrpc(
      "google.cloud.redis.cluster.v1.CloudRedisCluster", "DeleteCluster");
  auto scope = opentelemetry::trace::Scope(span);
  internal::InjectTraceContext(context, *propagator_);
  return internal::EndSpan(context, *span,
                           child_->DeleteCluster(context, options, request));
}

future<StatusOr<google::longrunning::Operation>>
CloudRedisClusterTracingStub::AsyncCreateCluster(
    google::cloud::CompletionQueue& cq,
    std::shared_ptr<grpc::ClientContext> context,
    google::cloud::internal::ImmutableOptions options,
    google::cloud::redis::cluster::v1::CreateClusterRequest const& request) {
  auto span = internal::MakeSpanGrpc(
      "google.cloud.redis.cluster.v1.CloudRedisCluster", "CreateCluster");
  internal::OTelScope scope(span);
  internal::InjectTraceContext(*context, *propagator_);
  auto f = child_->AsyncCreateCluster(cq, context, std::move(options), request);
  return internal::EndSpan(std::move(context), std::move(span), std::move(f));
}

StatusOr<google::longrunning::Operation>
CloudRedisClusterTracingStub::CreateCluster(
    grpc::ClientContext& context, Options options,
    google::cloud::redis::cluster::v1::CreateClusterRequest const& request) {
  auto span = internal::MakeSpanGrpc(
      "google.cloud.redis.cluster.v1.CloudRedisCluster", "CreateCluster");
  auto scope = opentelemetry::trace::Scope(span);
  internal::InjectTraceContext(context, *propagator_);
  return internal::EndSpan(context, *span,
                           child_->CreateCluster(context, options, request));
}

StatusOr<google::cloud::redis::cluster::v1::CertificateAuthority>
CloudRedisClusterTracingStub::GetClusterCertificateAuthority(
    grpc::ClientContext& context, Options const& options,
    google::cloud::redis::cluster::v1::
        GetClusterCertificateAuthorityRequest const& request) {
  auto span =
      internal::MakeSpanGrpc("google.cloud.redis.cluster.v1.CloudRedisCluster",
                             "GetClusterCertificateAuthority");
  auto scope = opentelemetry::trace::Scope(span);
  internal::InjectTraceContext(context, *propagator_);
  return internal::EndSpan(
      context, *span,
      child_->GetClusterCertificateAuthority(context, options, request));
}

future<StatusOr<google::longrunning::Operation>>
CloudRedisClusterTracingStub::AsyncRescheduleClusterMaintenance(
    google::cloud::CompletionQueue& cq,
    std::shared_ptr<grpc::ClientContext> context,
    google::cloud::internal::ImmutableOptions options,
    google::cloud::redis::cluster::v1::
        RescheduleClusterMaintenanceRequest const& request) {
  auto span =
      internal::MakeSpanGrpc("google.cloud.redis.cluster.v1.CloudRedisCluster",
                             "RescheduleClusterMaintenance");
  internal::OTelScope scope(span);
  internal::InjectTraceContext(*context, *propagator_);
  auto f = child_->AsyncRescheduleClusterMaintenance(
      cq, context, std::move(options), request);
  return internal::EndSpan(std::move(context), std::move(span), std::move(f));
}

StatusOr<google::longrunning::Operation>
CloudRedisClusterTracingStub::RescheduleClusterMaintenance(
    grpc::ClientContext& context, Options options,
    google::cloud::redis::cluster::v1::
        RescheduleClusterMaintenanceRequest const& request) {
  auto span =
      internal::MakeSpanGrpc("google.cloud.redis.cluster.v1.CloudRedisCluster",
                             "RescheduleClusterMaintenance");
  auto scope = opentelemetry::trace::Scope(span);
  internal::InjectTraceContext(context, *propagator_);
  return internal::EndSpan(
      context, *span,
      child_->RescheduleClusterMaintenance(context, options, request));
}

StatusOr<google::cloud::redis::cluster::v1::ListBackupCollectionsResponse>
CloudRedisClusterTracingStub::ListBackupCollections(
    grpc::ClientContext& context, Options const& options,
    google::cloud::redis::cluster::v1::ListBackupCollectionsRequest const&
        request) {
  auto span =
      internal::MakeSpanGrpc("google.cloud.redis.cluster.v1.CloudRedisCluster",
                             "ListBackupCollections");
  auto scope = opentelemetry::trace::Scope(span);
  internal::InjectTraceContext(context, *propagator_);
  return internal::EndSpan(
      context, *span, child_->ListBackupCollections(context, options, request));
}

StatusOr<google::cloud::redis::cluster::v1::BackupCollection>
CloudRedisClusterTracingStub::GetBackupCollection(
    grpc::ClientContext& context, Options const& options,
    google::cloud::redis::cluster::v1::GetBackupCollectionRequest const&
        request) {
  auto span = internal::MakeSpanGrpc(
      "google.cloud.redis.cluster.v1.CloudRedisCluster", "GetBackupCollection");
  auto scope = opentelemetry::trace::Scope(span);
  internal::InjectTraceContext(context, *propagator_);
  return internal::EndSpan(
      context, *span, child_->GetBackupCollection(context, options, request));
}

StatusOr<google::cloud::redis::cluster::v1::ListBackupsResponse>
CloudRedisClusterTracingStub::ListBackups(
    grpc::ClientContext& context, Options const& options,
    google::cloud::redis::cluster::v1::ListBackupsRequest const& request) {
  auto span = internal::MakeSpanGrpc(
      "google.cloud.redis.cluster.v1.CloudRedisCluster", "ListBackups");
  auto scope = opentelemetry::trace::Scope(span);
  internal::InjectTraceContext(context, *propagator_);
  return internal::EndSpan(context, *span,
                           child_->ListBackups(context, options, request));
}

StatusOr<google::cloud::redis::cluster::v1::Backup>
CloudRedisClusterTracingStub::GetBackup(
    grpc::ClientContext& context, Options const& options,
    google::cloud::redis::cluster::v1::GetBackupRequest const& request) {
  auto span = internal::MakeSpanGrpc(
      "google.cloud.redis.cluster.v1.CloudRedisCluster", "GetBackup");
  auto scope = opentelemetry::trace::Scope(span);
  internal::InjectTraceContext(context, *propagator_);
  return internal::EndSpan(context, *span,
                           child_->GetBackup(context, options, request));
}

future<StatusOr<google::longrunning::Operation>>
CloudRedisClusterTracingStub::AsyncDeleteBackup(
    google::cloud::CompletionQueue& cq,
    std::shared_ptr<grpc::ClientContext> context,
    google::cloud::internal::ImmutableOptions options,
    google::cloud::redis::cluster::v1::DeleteBackupRequest const& request) {
  auto span = internal::MakeSpanGrpc(
      "google.cloud.redis.cluster.v1.CloudRedisCluster", "DeleteBackup");
  internal::OTelScope scope(span);
  internal::InjectTraceContext(*context, *propagator_);
  auto f = child_->AsyncDeleteBackup(cq, context, std::move(options), request);
  return internal::EndSpan(std::move(context), std::move(span), std::move(f));
}

StatusOr<google::longrunning::Operation>
CloudRedisClusterTracingStub::DeleteBackup(
    grpc::ClientContext& context, Options options,
    google::cloud::redis::cluster::v1::DeleteBackupRequest const& request) {
  auto span = internal::MakeSpanGrpc(
      "google.cloud.redis.cluster.v1.CloudRedisCluster", "DeleteBackup");
  auto scope = opentelemetry::trace::Scope(span);
  internal::InjectTraceContext(context, *propagator_);
  return internal::EndSpan(context, *span,
                           child_->DeleteBackup(context, options, request));
}

future<StatusOr<google::longrunning::Operation>>
CloudRedisClusterTracingStub::AsyncExportBackup(
    google::cloud::CompletionQueue& cq,
    std::shared_ptr<grpc::ClientContext> context,
    google::cloud::internal::ImmutableOptions options,
    google::cloud::redis::cluster::v1::ExportBackupRequest const& request) {
  auto span = internal::MakeSpanGrpc(
      "google.cloud.redis.cluster.v1.CloudRedisCluster", "ExportBackup");
  internal::OTelScope scope(span);
  internal::InjectTraceContext(*context, *propagator_);
  auto f = child_->AsyncExportBackup(cq, context, std::move(options), request);
  return internal::EndSpan(std::move(context), std::move(span), std::move(f));
}

StatusOr<google::longrunning::Operation>
CloudRedisClusterTracingStub::ExportBackup(
    grpc::ClientContext& context, Options options,
    google::cloud::redis::cluster::v1::ExportBackupRequest const& request) {
  auto span = internal::MakeSpanGrpc(
      "google.cloud.redis.cluster.v1.CloudRedisCluster", "ExportBackup");
  auto scope = opentelemetry::trace::Scope(span);
  internal::InjectTraceContext(context, *propagator_);
  return internal::EndSpan(context, *span,
                           child_->ExportBackup(context, options, request));
}

future<StatusOr<google::longrunning::Operation>>
CloudRedisClusterTracingStub::AsyncBackupCluster(
    google::cloud::CompletionQueue& cq,
    std::shared_ptr<grpc::ClientContext> context,
    google::cloud::internal::ImmutableOptions options,
    google::cloud::redis::cluster::v1::BackupClusterRequest const& request) {
  auto span = internal::MakeSpanGrpc(
      "google.cloud.redis.cluster.v1.CloudRedisCluster", "BackupCluster");
  internal::OTelScope scope(span);
  internal::InjectTraceContext(*context, *propagator_);
  auto f = child_->AsyncBackupCluster(cq, context, std::move(options), request);
  return internal::EndSpan(std::move(context), std::move(span), std::move(f));
}

StatusOr<google::longrunning::Operation>
CloudRedisClusterTracingStub::BackupCluster(
    grpc::ClientContext& context, Options options,
    google::cloud::redis::cluster::v1::BackupClusterRequest const& request) {
  auto span = internal::MakeSpanGrpc(
      "google.cloud.redis.cluster.v1.CloudRedisCluster", "BackupCluster");
  auto scope = opentelemetry::trace::Scope(span);
  internal::InjectTraceContext(context, *propagator_);
  return internal::EndSpan(context, *span,
                           child_->BackupCluster(context, options, request));
}

StatusOr<google::cloud::location::ListLocationsResponse>
CloudRedisClusterTracingStub::ListLocations(
    grpc::ClientContext& context, Options const& options,
    google::cloud::location::ListLocationsRequest const& request) {
  auto span = internal::MakeSpanGrpc(
      "google.cloud.redis.cluster.v1.CloudRedisCluster", "ListLocations");
  auto scope = opentelemetry::trace::Scope(span);
  internal::InjectTraceContext(context, *propagator_);
  return internal::EndSpan(context, *span,
                           child_->ListLocations(context, options, request));
}

StatusOr<google::cloud::location::Location>
CloudRedisClusterTracingStub::GetLocation(
    grpc::ClientContext& context, Options const& options,
    google::cloud::location::GetLocationRequest const& request) {
  auto span = internal::MakeSpanGrpc(
      "google.cloud.redis.cluster.v1.CloudRedisCluster", "GetLocation");
  auto scope = opentelemetry::trace::Scope(span);
  internal::InjectTraceContext(context, *propagator_);
  return internal::EndSpan(context, *span,
                           child_->GetLocation(context, options, request));
}

StatusOr<google::longrunning::ListOperationsResponse>
CloudRedisClusterTracingStub::ListOperations(
    grpc::ClientContext& context, Options const& options,
    google::longrunning::ListOperationsRequest const& request) {
  auto span = internal::MakeSpanGrpc(
      "google.cloud.redis.cluster.v1.CloudRedisCluster", "ListOperations");
  auto scope = opentelemetry::trace::Scope(span);
  internal::InjectTraceContext(context, *propagator_);
  return internal::EndSpan(context, *span,
                           child_->ListOperations(context, options, request));
}

StatusOr<google::longrunning::Operation>
CloudRedisClusterTracingStub::GetOperation(
    grpc::ClientContext& context, Options const& options,
    google::longrunning::GetOperationRequest const& request) {
  auto span = internal::MakeSpanGrpc(
      "google.cloud.redis.cluster.v1.CloudRedisCluster", "GetOperation");
  auto scope = opentelemetry::trace::Scope(span);
  internal::InjectTraceContext(context, *propagator_);
  return internal::EndSpan(context, *span,
                           child_->GetOperation(context, options, request));
}

Status CloudRedisClusterTracingStub::DeleteOperation(
    grpc::ClientContext& context, Options const& options,
    google::longrunning::DeleteOperationRequest const& request) {
  auto span = internal::MakeSpanGrpc(
      "google.cloud.redis.cluster.v1.CloudRedisCluster", "DeleteOperation");
  auto scope = opentelemetry::trace::Scope(span);
  internal::InjectTraceContext(context, *propagator_);
  return internal::EndSpan(context, *span,
                           child_->DeleteOperation(context, options, request));
}

Status CloudRedisClusterTracingStub::CancelOperation(
    grpc::ClientContext& context, Options const& options,
    google::longrunning::CancelOperationRequest const& request) {
  auto span = internal::MakeSpanGrpc(
      "google.cloud.redis.cluster.v1.CloudRedisCluster", "CancelOperation");
  auto scope = opentelemetry::trace::Scope(span);
  internal::InjectTraceContext(context, *propagator_);
  return internal::EndSpan(context, *span,
                           child_->CancelOperation(context, options, request));
}

future<StatusOr<google::longrunning::Operation>>
CloudRedisClusterTracingStub::AsyncGetOperation(
    google::cloud::CompletionQueue& cq,
    std::shared_ptr<grpc::ClientContext> context,
    google::cloud::internal::ImmutableOptions options,
    google::longrunning::GetOperationRequest const& request) {
  auto span =
      internal::MakeSpanGrpc("google.longrunning.Operations", "GetOperation");
  internal::OTelScope scope(span);
  internal::InjectTraceContext(*context, *propagator_);
  auto f = child_->AsyncGetOperation(cq, context, std::move(options), request);
  return internal::EndSpan(std::move(context), std::move(span), std::move(f));
}

future<Status> CloudRedisClusterTracingStub::AsyncCancelOperation(
    google::cloud::CompletionQueue& cq,
    std::shared_ptr<grpc::ClientContext> context,
    google::cloud::internal::ImmutableOptions options,
    google::longrunning::CancelOperationRequest const& request) {
  auto span = internal::MakeSpanGrpc("google.longrunning.Operations",
                                     "CancelOperation");
  internal::OTelScope scope(span);
  internal::InjectTraceContext(*context, *propagator_);
  auto f =
      child_->AsyncCancelOperation(cq, context, std::move(options), request);
  return internal::EndSpan(std::move(context), std::move(span), std::move(f));
}

std::shared_ptr<CloudRedisClusterStub> MakeCloudRedisClusterTracingStub(
    std::shared_ptr<CloudRedisClusterStub> stub) {
  return std::make_shared<CloudRedisClusterTracingStub>(std::move(stub));
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
}  // namespace redis_cluster_v1_internal
}  // namespace cloud
}  // namespace google

#include "google/cloud/ports_undef.inc"
