// 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/compute/security_policies/v1/security_policies.proto

#include "google/cloud/compute/security_policies/v1/internal/security_policies_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 compute_security_policies_v1_internal {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

SecurityPoliciesTracingConnection::SecurityPoliciesTracingConnection(
    std::shared_ptr<compute_security_policies_v1::SecurityPoliciesConnection>
        child)
    : child_(std::move(child)) {}

future<StatusOr<google::cloud::cpp::compute::v1::Operation>>
SecurityPoliciesTracingConnection::AddRule(
    google::cloud::cpp::compute::security_policies::v1::AddRuleRequest const&
        request) {
  auto span = internal::MakeSpan(
      "compute_security_policies_v1::SecurityPoliciesConnection::AddRule");
  internal::OTelScope scope(span);
  return internal::EndSpan(std::move(span), child_->AddRule(request));
}

StatusOr<google::cloud::cpp::compute::v1::Operation>
SecurityPoliciesTracingConnection::AddRule(
    NoAwaitTag,
    google::cloud::cpp::compute::security_policies::v1::AddRuleRequest const&
        request) {
  auto span = internal::MakeSpan(
      "compute_security_policies_v1::SecurityPoliciesConnection::AddRule");
  opentelemetry::trace::Scope scope(span);
  return internal::EndSpan(*span, child_->AddRule(NoAwaitTag{}, request));
}

future<StatusOr<google::cloud::cpp::compute::v1::Operation>>
SecurityPoliciesTracingConnection::AddRule(
    google::cloud::cpp::compute::v1::Operation const& operation) {
  auto span = internal::MakeSpan(
      "compute_security_policies_v1::SecurityPoliciesConnection::AddRule");
  internal::OTelScope scope(span);
  return internal::EndSpan(std::move(span), child_->AddRule(operation));
}

StreamRange<std::pair<
    std::string, google::cloud::cpp::compute::v1::SecurityPoliciesScopedList>>
SecurityPoliciesTracingConnection::AggregatedListSecurityPolicies(
    google::cloud::cpp::compute::security_policies::v1::
        AggregatedListSecurityPoliciesRequest request) {
  auto span = internal::MakeSpan(
      "compute_security_policies_v1::SecurityPoliciesConnection::"
      "AggregatedListSecurityPolicies");
  internal::OTelScope scope(span);
  auto sr = child_->AggregatedListSecurityPolicies(std::move(request));
  return internal::MakeTracedStreamRange<
      std::pair<std::string,
                google::cloud::cpp::compute::v1::SecurityPoliciesScopedList>>(
      std::move(span), std::move(sr));
}

future<StatusOr<google::cloud::cpp::compute::v1::Operation>>
SecurityPoliciesTracingConnection::DeleteSecurityPolicy(
    google::cloud::cpp::compute::security_policies::v1::
        DeleteSecurityPolicyRequest const& request) {
  auto span = internal::MakeSpan(
      "compute_security_policies_v1::SecurityPoliciesConnection::"
      "DeleteSecurityPolicy");
  internal::OTelScope scope(span);
  return internal::EndSpan(std::move(span),
                           child_->DeleteSecurityPolicy(request));
}

StatusOr<google::cloud::cpp::compute::v1::Operation>
SecurityPoliciesTracingConnection::DeleteSecurityPolicy(
    NoAwaitTag, google::cloud::cpp::compute::security_policies::v1::
                    DeleteSecurityPolicyRequest const& request) {
  auto span = internal::MakeSpan(
      "compute_security_policies_v1::SecurityPoliciesConnection::"
      "DeleteSecurityPolicy");
  opentelemetry::trace::Scope scope(span);
  return internal::EndSpan(*span,
                           child_->DeleteSecurityPolicy(NoAwaitTag{}, request));
}

future<StatusOr<google::cloud::cpp::compute::v1::Operation>>
SecurityPoliciesTracingConnection::DeleteSecurityPolicy(
    google::cloud::cpp::compute::v1::Operation const& operation) {
  auto span = internal::MakeSpan(
      "compute_security_policies_v1::SecurityPoliciesConnection::"
      "DeleteSecurityPolicy");
  internal::OTelScope scope(span);
  return internal::EndSpan(std::move(span),
                           child_->DeleteSecurityPolicy(operation));
}

StatusOr<google::cloud::cpp::compute::v1::SecurityPolicy>
SecurityPoliciesTracingConnection::GetSecurityPolicy(
    google::cloud::cpp::compute::security_policies::v1::
        GetSecurityPolicyRequest const& request) {
  auto span = internal::MakeSpan(
      "compute_security_policies_v1::SecurityPoliciesConnection::"
      "GetSecurityPolicy");
  auto scope = opentelemetry::trace::Scope(span);
  return internal::EndSpan(*span, child_->GetSecurityPolicy(request));
}

StatusOr<google::cloud::cpp::compute::v1::SecurityPolicyRule>
SecurityPoliciesTracingConnection::GetRule(
    google::cloud::cpp::compute::security_policies::v1::GetRuleRequest const&
        request) {
  auto span = internal::MakeSpan(
      "compute_security_policies_v1::SecurityPoliciesConnection::GetRule");
  auto scope = opentelemetry::trace::Scope(span);
  return internal::EndSpan(*span, child_->GetRule(request));
}

future<StatusOr<google::cloud::cpp::compute::v1::Operation>>
SecurityPoliciesTracingConnection::InsertSecurityPolicy(
    google::cloud::cpp::compute::security_policies::v1::
        InsertSecurityPolicyRequest const& request) {
  auto span = internal::MakeSpan(
      "compute_security_policies_v1::SecurityPoliciesConnection::"
      "InsertSecurityPolicy");
  internal::OTelScope scope(span);
  return internal::EndSpan(std::move(span),
                           child_->InsertSecurityPolicy(request));
}

StatusOr<google::cloud::cpp::compute::v1::Operation>
SecurityPoliciesTracingConnection::InsertSecurityPolicy(
    NoAwaitTag, google::cloud::cpp::compute::security_policies::v1::
                    InsertSecurityPolicyRequest const& request) {
  auto span = internal::MakeSpan(
      "compute_security_policies_v1::SecurityPoliciesConnection::"
      "InsertSecurityPolicy");
  opentelemetry::trace::Scope scope(span);
  return internal::EndSpan(*span,
                           child_->InsertSecurityPolicy(NoAwaitTag{}, request));
}

future<StatusOr<google::cloud::cpp::compute::v1::Operation>>
SecurityPoliciesTracingConnection::InsertSecurityPolicy(
    google::cloud::cpp::compute::v1::Operation const& operation) {
  auto span = internal::MakeSpan(
      "compute_security_policies_v1::SecurityPoliciesConnection::"
      "InsertSecurityPolicy");
  internal::OTelScope scope(span);
  return internal::EndSpan(std::move(span),
                           child_->InsertSecurityPolicy(operation));
}

StreamRange<google::cloud::cpp::compute::v1::SecurityPolicy>
SecurityPoliciesTracingConnection::ListSecurityPolicies(
    google::cloud::cpp::compute::security_policies::v1::
        ListSecurityPoliciesRequest request) {
  auto span = internal::MakeSpan(
      "compute_security_policies_v1::SecurityPoliciesConnection::"
      "ListSecurityPolicies");
  internal::OTelScope scope(span);
  auto sr = child_->ListSecurityPolicies(std::move(request));
  return internal::MakeTracedStreamRange<
      google::cloud::cpp::compute::v1::SecurityPolicy>(std::move(span),
                                                       std::move(sr));
}

StatusOr<google::cloud::cpp::compute::v1::
             SecurityPoliciesListPreconfiguredExpressionSetsResponse>
SecurityPoliciesTracingConnection::ListPreconfiguredExpressionSets(
    google::cloud::cpp::compute::security_policies::v1::
        ListPreconfiguredExpressionSetsRequest const& request) {
  auto span = internal::MakeSpan(
      "compute_security_policies_v1::SecurityPoliciesConnection::"
      "ListPreconfiguredExpressionSets");
  auto scope = opentelemetry::trace::Scope(span);
  return internal::EndSpan(*span,
                           child_->ListPreconfiguredExpressionSets(request));
}

future<StatusOr<google::cloud::cpp::compute::v1::Operation>>
SecurityPoliciesTracingConnection::PatchSecurityPolicy(
    google::cloud::cpp::compute::security_policies::v1::
        PatchSecurityPolicyRequest const& request) {
  auto span = internal::MakeSpan(
      "compute_security_policies_v1::SecurityPoliciesConnection::"
      "PatchSecurityPolicy");
  internal::OTelScope scope(span);
  return internal::EndSpan(std::move(span),
                           child_->PatchSecurityPolicy(request));
}

StatusOr<google::cloud::cpp::compute::v1::Operation>
SecurityPoliciesTracingConnection::PatchSecurityPolicy(
    NoAwaitTag, google::cloud::cpp::compute::security_policies::v1::
                    PatchSecurityPolicyRequest const& request) {
  auto span = internal::MakeSpan(
      "compute_security_policies_v1::SecurityPoliciesConnection::"
      "PatchSecurityPolicy");
  opentelemetry::trace::Scope scope(span);
  return internal::EndSpan(*span,
                           child_->PatchSecurityPolicy(NoAwaitTag{}, request));
}

future<StatusOr<google::cloud::cpp::compute::v1::Operation>>
SecurityPoliciesTracingConnection::PatchSecurityPolicy(
    google::cloud::cpp::compute::v1::Operation const& operation) {
  auto span = internal::MakeSpan(
      "compute_security_policies_v1::SecurityPoliciesConnection::"
      "PatchSecurityPolicy");
  internal::OTelScope scope(span);
  return internal::EndSpan(std::move(span),
                           child_->PatchSecurityPolicy(operation));
}

future<StatusOr<google::cloud::cpp::compute::v1::Operation>>
SecurityPoliciesTracingConnection::PatchRule(
    google::cloud::cpp::compute::security_policies::v1::PatchRuleRequest const&
        request) {
  auto span = internal::MakeSpan(
      "compute_security_policies_v1::SecurityPoliciesConnection::PatchRule");
  internal::OTelScope scope(span);
  return internal::EndSpan(std::move(span), child_->PatchRule(request));
}

StatusOr<google::cloud::cpp::compute::v1::Operation>
SecurityPoliciesTracingConnection::PatchRule(
    NoAwaitTag,
    google::cloud::cpp::compute::security_policies::v1::PatchRuleRequest const&
        request) {
  auto span = internal::MakeSpan(
      "compute_security_policies_v1::SecurityPoliciesConnection::PatchRule");
  opentelemetry::trace::Scope scope(span);
  return internal::EndSpan(*span, child_->PatchRule(NoAwaitTag{}, request));
}

future<StatusOr<google::cloud::cpp::compute::v1::Operation>>
SecurityPoliciesTracingConnection::PatchRule(
    google::cloud::cpp::compute::v1::Operation const& operation) {
  auto span = internal::MakeSpan(
      "compute_security_policies_v1::SecurityPoliciesConnection::PatchRule");
  internal::OTelScope scope(span);
  return internal::EndSpan(std::move(span), child_->PatchRule(operation));
}

future<StatusOr<google::cloud::cpp::compute::v1::Operation>>
SecurityPoliciesTracingConnection::RemoveRule(
    google::cloud::cpp::compute::security_policies::v1::RemoveRuleRequest const&
        request) {
  auto span = internal::MakeSpan(
      "compute_security_policies_v1::SecurityPoliciesConnection::RemoveRule");
  internal::OTelScope scope(span);
  return internal::EndSpan(std::move(span), child_->RemoveRule(request));
}

StatusOr<google::cloud::cpp::compute::v1::Operation>
SecurityPoliciesTracingConnection::RemoveRule(
    NoAwaitTag,
    google::cloud::cpp::compute::security_policies::v1::RemoveRuleRequest const&
        request) {
  auto span = internal::MakeSpan(
      "compute_security_policies_v1::SecurityPoliciesConnection::RemoveRule");
  opentelemetry::trace::Scope scope(span);
  return internal::EndSpan(*span, child_->RemoveRule(NoAwaitTag{}, request));
}

future<StatusOr<google::cloud::cpp::compute::v1::Operation>>
SecurityPoliciesTracingConnection::RemoveRule(
    google::cloud::cpp::compute::v1::Operation const& operation) {
  auto span = internal::MakeSpan(
      "compute_security_policies_v1::SecurityPoliciesConnection::RemoveRule");
  internal::OTelScope scope(span);
  return internal::EndSpan(std::move(span), child_->RemoveRule(operation));
}

future<StatusOr<google::cloud::cpp::compute::v1::Operation>>
SecurityPoliciesTracingConnection::SetLabels(
    google::cloud::cpp::compute::security_policies::v1::SetLabelsRequest const&
        request) {
  auto span = internal::MakeSpan(
      "compute_security_policies_v1::SecurityPoliciesConnection::SetLabels");
  internal::OTelScope scope(span);
  return internal::EndSpan(std::move(span), child_->SetLabels(request));
}

StatusOr<google::cloud::cpp::compute::v1::Operation>
SecurityPoliciesTracingConnection::SetLabels(
    NoAwaitTag,
    google::cloud::cpp::compute::security_policies::v1::SetLabelsRequest const&
        request) {
  auto span = internal::MakeSpan(
      "compute_security_policies_v1::SecurityPoliciesConnection::SetLabels");
  opentelemetry::trace::Scope scope(span);
  return internal::EndSpan(*span, child_->SetLabels(NoAwaitTag{}, request));
}

future<StatusOr<google::cloud::cpp::compute::v1::Operation>>
SecurityPoliciesTracingConnection::SetLabels(
    google::cloud::cpp::compute::v1::Operation const& operation) {
  auto span = internal::MakeSpan(
      "compute_security_policies_v1::SecurityPoliciesConnection::SetLabels");
  internal::OTelScope scope(span);
  return internal::EndSpan(std::move(span), child_->SetLabels(operation));
}

std::shared_ptr<compute_security_policies_v1::SecurityPoliciesConnection>
MakeSecurityPoliciesTracingConnection(
    std::shared_ptr<compute_security_policies_v1::SecurityPoliciesConnection>
        conn) {
  if (internal::TracingEnabled(conn->options())) {
    conn = std::make_shared<SecurityPoliciesTracingConnection>(std::move(conn));
  }
  return conn;
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
}  // namespace compute_security_policies_v1_internal
}  // namespace cloud
}  // namespace google
