# frozen_string_literal: true

# Copyright 2020 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.

# Auto-generated by gapic-generator-ruby. DO NOT EDIT!

require "gapic/common"
require "gapic/config"
require "gapic/config/method"

require "google/cloud/errors"
require "google/cloud/secret_manager/v1beta1/version"
require "google/cloud/secrets/v1beta1/service_pb"
require "google/cloud/secret_manager/v1beta1/secret_manager_service/credentials"
require "google/cloud/secret_manager/v1beta1/secret_manager_service/paths"


module Google
  module Cloud
    module SecretManager
      module V1beta1
        module SecretManagerService
          # Service that implements SecretManagerService API.
          class Client
            include Paths

            # @private
            attr_reader :secret_manager_service_stub

            ##
            # Configuration for the SecretManagerService Client API.
            #
            # @yield [config] Configure the Client client.
            # @yieldparam config [Client::Configuration]
            #
            # @return [Client::Configuration]
            #
            def self.configure
              @configure ||= begin
                namespace = ["Google", "Cloud", "SecretManager", "V1beta1"]
                parent_config = while namespace.any?
                                  parent_name = namespace.join "::"
                                  parent_const = const_get parent_name
                                  break parent_const.configure if parent_const&.respond_to? :configure
                                  namespace.pop
                                end
                Client::Configuration.new parent_config
              end
              yield @configure if block_given?
              @configure
            end

            ##
            # Configure the SecretManagerService Client instance.
            #
            # The configuration is set to the derived mode, meaning that values can be changed,
            # but structural changes (adding new fields, etc.) are not allowed. Structural changes
            # should be made on {Client.configure}.
            #
            # @yield [config] Configure the Client client.
            # @yieldparam config [Client::Configuration]
            #
            # @return [Client::Configuration]
            #
            def configure
              yield @config if block_given?
              @config
            end

            ##
            # Create a new Client client object.
            #
            # @yield [config] Configure the Client client.
            # @yieldparam config [Client::Configuration]
            #
            def initialize
              # These require statements are intentionally placed here to initialize
              # the gRPC module only when it's required.
              # See https://github.com/googleapis/toolkit/issues/446
              require "gapic/grpc"
              require "google/cloud/secrets/v1beta1/service_services_pb"

              # Create the configuration object
              @config = Configuration.new Client.configure

              # Yield the configuration if needed
              yield @config if block_given?

              # Create credentials
              credentials = @config.credentials
              credentials ||= Credentials.default scope: @config.scope
              if credentials.is_a?(String) || credentials.is_a?(Hash)
                credentials = Credentials.new credentials, scope: @config.scope
              end


              @secret_manager_service_stub = Gapic::ServiceStub.new(
                Google::Cloud::SecretManager::V1beta1::SecretManagerService::Stub,
                credentials:  credentials,
                endpoint:     @config.endpoint,
                channel_args: @config.channel_args,
                interceptors: @config.interceptors
              )
            end

            # Service calls

            ##
            # Lists [Secrets][google.cloud.secrets.v1beta1.Secret].
            #
            # @overload list_secrets(request, options = nil)
            #   @param request [Google::Cloud::SecretManager::V1beta1::ListSecretsRequest | Hash]
            #     Lists [Secrets][google.cloud.secrets.v1beta1.Secret].
            #   @param options [Gapic::CallOptions, Hash]
            #     Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
            #
            # @overload list_secrets(parent: nil, page_size: nil, page_token: nil)
            #   @param parent [String]
            #     Required. The resource name of the project associated with the
            #     [Secrets][google.cloud.secrets.v1beta1.Secret], in the format `projects/*`.
            #   @param page_size [Integer]
            #     Optional. The maximum number of results to be returned in a single page. If
            #     set to 0, the server decides the number of results to return. If the
            #     number is greater than 25000, it is capped at 25000.
            #   @param page_token [String]
            #     Optional. Pagination token, returned earlier via
            #     [ListSecretsResponse.next_page_token][google.cloud.secrets.v1beta1.ListSecretsResponse.next_page_token].
            #
            #
            # @yield [response, operation] Access the result along with the RPC operation
            # @yieldparam response [Gapic::PagedEnumerable<Google::Cloud::SecretManager::V1beta1::Secret>]
            # @yieldparam operation [GRPC::ActiveCall::Operation]
            #
            # @return [Gapic::PagedEnumerable<Google::Cloud::SecretManager::V1beta1::Secret>]
            #
            # @raise [Google::Cloud::Error] if the RPC is aborted.
            #
            def list_secrets request, options = nil
              raise ArgumentError, "request must be provided" if request.nil?

              request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecretManager::V1beta1::ListSecretsRequest

              # Converts hash and nil to an options object
              options = Gapic::CallOptions.new options.to_h if options.respond_to? :to_h

              # Customize the options with defaults
              metadata = @config.rpcs.list_secrets.metadata.to_h

              # Set x-goog-api-client header
              metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
                lib_name: @config.lib_name, lib_version: @config.lib_version,
                gapic_version: Google::Cloud::SecretManager::V1beta1::VERSION

              header_params = {
                "parent" => request.parent
              }
              request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
              metadata[:"x-goog-request-params"] ||= request_params_header

              options.apply_defaults timeout:      @config.rpcs.list_secrets.timeout,
                                     metadata:     metadata,
                                     retry_policy: @config.rpcs.list_secrets.retry_policy
              options.apply_defaults metadata:     @config.metadata,
                                     retry_policy: @config.retry_policy

              @secret_manager_service_stub.call_rpc :list_secrets, request, options: options do |response, operation|
                response = Gapic::PagedEnumerable.new @secret_manager_service_stub, :list_secrets, request, response, operation, options
                yield response, operation if block_given?
                return response
              end
            rescue GRPC::BadStatus => e
              raise Google::Cloud::Error.from_error(e)
            end

            ##
            # Creates a new [Secret][google.cloud.secrets.v1beta1.Secret] containing no [SecretVersions][google.cloud.secrets.v1beta1.SecretVersion].
            #
            # @overload create_secret(request, options = nil)
            #   @param request [Google::Cloud::SecretManager::V1beta1::CreateSecretRequest | Hash]
            #     Creates a new [Secret][google.cloud.secrets.v1beta1.Secret] containing no [SecretVersions][google.cloud.secrets.v1beta1.SecretVersion].
            #   @param options [Gapic::CallOptions, Hash]
            #     Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
            #
            # @overload create_secret(parent: nil, secret_id: nil, secret: nil)
            #   @param parent [String]
            #     Required. The resource name of the project to associate with the
            #     [Secret][google.cloud.secrets.v1beta1.Secret], in the format `projects/*`.
            #   @param secret_id [String]
            #     Required. This must be unique within the project.
            #   @param secret [Google::Cloud::SecretManager::V1beta1::Secret | Hash]
            #     A [Secret][google.cloud.secrets.v1beta1.Secret] with initial field values.
            #
            #
            # @yield [response, operation] Access the result along with the RPC operation
            # @yieldparam response [Google::Cloud::SecretManager::V1beta1::Secret]
            # @yieldparam operation [GRPC::ActiveCall::Operation]
            #
            # @return [Google::Cloud::SecretManager::V1beta1::Secret]
            #
            # @raise [Google::Cloud::Error] if the RPC is aborted.
            #
            def create_secret request, options = nil
              raise ArgumentError, "request must be provided" if request.nil?

              request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecretManager::V1beta1::CreateSecretRequest

              # Converts hash and nil to an options object
              options = Gapic::CallOptions.new options.to_h if options.respond_to? :to_h

              # Customize the options with defaults
              metadata = @config.rpcs.create_secret.metadata.to_h

              # Set x-goog-api-client header
              metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
                lib_name: @config.lib_name, lib_version: @config.lib_version,
                gapic_version: Google::Cloud::SecretManager::V1beta1::VERSION

              header_params = {
                "parent" => request.parent
              }
              request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
              metadata[:"x-goog-request-params"] ||= request_params_header

              options.apply_defaults timeout:      @config.rpcs.create_secret.timeout,
                                     metadata:     metadata,
                                     retry_policy: @config.rpcs.create_secret.retry_policy
              options.apply_defaults metadata:     @config.metadata,
                                     retry_policy: @config.retry_policy

              @secret_manager_service_stub.call_rpc :create_secret, request, options: options do |response, operation|
                yield response, operation if block_given?
                return response
              end
            rescue GRPC::BadStatus => e
              raise Google::Cloud::Error.from_error(e)
            end

            ##
            # Creates a new [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion] containing secret data and attaches
            # it to an existing [Secret][google.cloud.secrets.v1beta1.Secret].
            #
            # @overload add_secret_version(request, options = nil)
            #   @param request [Google::Cloud::SecretManager::V1beta1::AddSecretVersionRequest | Hash]
            #     Creates a new [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion] containing secret data and attaches
            #     it to an existing [Secret][google.cloud.secrets.v1beta1.Secret].
            #   @param options [Gapic::CallOptions, Hash]
            #     Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
            #
            # @overload add_secret_version(parent: nil, payload: nil)
            #   @param parent [String]
            #     Required. The resource name of the [Secret][google.cloud.secrets.v1beta1.Secret] to associate with the
            #     [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion] in the format `projects/*/secrets/*`.
            #   @param payload [Google::Cloud::SecretManager::V1beta1::SecretPayload | Hash]
            #     Required. The secret payload of the [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion].
            #
            #
            # @yield [response, operation] Access the result along with the RPC operation
            # @yieldparam response [Google::Cloud::SecretManager::V1beta1::SecretVersion]
            # @yieldparam operation [GRPC::ActiveCall::Operation]
            #
            # @return [Google::Cloud::SecretManager::V1beta1::SecretVersion]
            #
            # @raise [Google::Cloud::Error] if the RPC is aborted.
            #
            def add_secret_version request, options = nil
              raise ArgumentError, "request must be provided" if request.nil?

              request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecretManager::V1beta1::AddSecretVersionRequest

              # Converts hash and nil to an options object
              options = Gapic::CallOptions.new options.to_h if options.respond_to? :to_h

              # Customize the options with defaults
              metadata = @config.rpcs.add_secret_version.metadata.to_h

              # Set x-goog-api-client header
              metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
                lib_name: @config.lib_name, lib_version: @config.lib_version,
                gapic_version: Google::Cloud::SecretManager::V1beta1::VERSION

              header_params = {
                "parent" => request.parent
              }
              request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
              metadata[:"x-goog-request-params"] ||= request_params_header

              options.apply_defaults timeout:      @config.rpcs.add_secret_version.timeout,
                                     metadata:     metadata,
                                     retry_policy: @config.rpcs.add_secret_version.retry_policy
              options.apply_defaults metadata:     @config.metadata,
                                     retry_policy: @config.retry_policy

              @secret_manager_service_stub.call_rpc :add_secret_version, request, options: options do |response, operation|
                yield response, operation if block_given?
                return response
              end
            rescue GRPC::BadStatus => e
              raise Google::Cloud::Error.from_error(e)
            end

            ##
            # Gets metadata for a given [Secret][google.cloud.secrets.v1beta1.Secret].
            #
            # @overload get_secret(request, options = nil)
            #   @param request [Google::Cloud::SecretManager::V1beta1::GetSecretRequest | Hash]
            #     Gets metadata for a given [Secret][google.cloud.secrets.v1beta1.Secret].
            #   @param options [Gapic::CallOptions, Hash]
            #     Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
            #
            # @overload get_secret(name: nil)
            #   @param name [String]
            #     Required. The resource name of the [Secret][google.cloud.secrets.v1beta1.Secret], in the format `projects/*/secrets/*`.
            #
            #
            # @yield [response, operation] Access the result along with the RPC operation
            # @yieldparam response [Google::Cloud::SecretManager::V1beta1::Secret]
            # @yieldparam operation [GRPC::ActiveCall::Operation]
            #
            # @return [Google::Cloud::SecretManager::V1beta1::Secret]
            #
            # @raise [Google::Cloud::Error] if the RPC is aborted.
            #
            def get_secret request, options = nil
              raise ArgumentError, "request must be provided" if request.nil?

              request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecretManager::V1beta1::GetSecretRequest

              # Converts hash and nil to an options object
              options = Gapic::CallOptions.new options.to_h if options.respond_to? :to_h

              # Customize the options with defaults
              metadata = @config.rpcs.get_secret.metadata.to_h

              # Set x-goog-api-client header
              metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
                lib_name: @config.lib_name, lib_version: @config.lib_version,
                gapic_version: Google::Cloud::SecretManager::V1beta1::VERSION

              header_params = {
                "name" => request.name
              }
              request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
              metadata[:"x-goog-request-params"] ||= request_params_header

              options.apply_defaults timeout:      @config.rpcs.get_secret.timeout,
                                     metadata:     metadata,
                                     retry_policy: @config.rpcs.get_secret.retry_policy
              options.apply_defaults metadata:     @config.metadata,
                                     retry_policy: @config.retry_policy

              @secret_manager_service_stub.call_rpc :get_secret, request, options: options do |response, operation|
                yield response, operation if block_given?
                return response
              end
            rescue GRPC::BadStatus => e
              raise Google::Cloud::Error.from_error(e)
            end

            ##
            # Updates metadata of an existing [Secret][google.cloud.secrets.v1beta1.Secret].
            #
            # @overload update_secret(request, options = nil)
            #   @param request [Google::Cloud::SecretManager::V1beta1::UpdateSecretRequest | Hash]
            #     Updates metadata of an existing [Secret][google.cloud.secrets.v1beta1.Secret].
            #   @param options [Gapic::CallOptions, Hash]
            #     Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
            #
            # @overload update_secret(secret: nil, update_mask: nil)
            #   @param secret [Google::Cloud::SecretManager::V1beta1::Secret | Hash]
            #     Required. [Secret][google.cloud.secrets.v1beta1.Secret] with updated field values.
            #   @param update_mask [Google::Protobuf::FieldMask | Hash]
            #     Required. Specifies the fields to be updated.
            #
            #
            # @yield [response, operation] Access the result along with the RPC operation
            # @yieldparam response [Google::Cloud::SecretManager::V1beta1::Secret]
            # @yieldparam operation [GRPC::ActiveCall::Operation]
            #
            # @return [Google::Cloud::SecretManager::V1beta1::Secret]
            #
            # @raise [Google::Cloud::Error] if the RPC is aborted.
            #
            def update_secret request, options = nil
              raise ArgumentError, "request must be provided" if request.nil?

              request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecretManager::V1beta1::UpdateSecretRequest

              # Converts hash and nil to an options object
              options = Gapic::CallOptions.new options.to_h if options.respond_to? :to_h

              # Customize the options with defaults
              metadata = @config.rpcs.update_secret.metadata.to_h

              # Set x-goog-api-client header
              metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
                lib_name: @config.lib_name, lib_version: @config.lib_version,
                gapic_version: Google::Cloud::SecretManager::V1beta1::VERSION

              header_params = {
                "secret.name" => request.secret.name
              }
              request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
              metadata[:"x-goog-request-params"] ||= request_params_header

              options.apply_defaults timeout:      @config.rpcs.update_secret.timeout,
                                     metadata:     metadata,
                                     retry_policy: @config.rpcs.update_secret.retry_policy
              options.apply_defaults metadata:     @config.metadata,
                                     retry_policy: @config.retry_policy

              @secret_manager_service_stub.call_rpc :update_secret, request, options: options do |response, operation|
                yield response, operation if block_given?
                return response
              end
            rescue GRPC::BadStatus => e
              raise Google::Cloud::Error.from_error(e)
            end

            ##
            # Deletes a [Secret][google.cloud.secrets.v1beta1.Secret].
            #
            # @overload delete_secret(request, options = nil)
            #   @param request [Google::Cloud::SecretManager::V1beta1::DeleteSecretRequest | Hash]
            #     Deletes a [Secret][google.cloud.secrets.v1beta1.Secret].
            #   @param options [Gapic::CallOptions, Hash]
            #     Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
            #
            # @overload delete_secret(name: nil)
            #   @param name [String]
            #     Required. The resource name of the [Secret][google.cloud.secrets.v1beta1.Secret] to delete in the format
            #     `projects/*/secrets/*`.
            #
            #
            # @yield [response, operation] Access the result along with the RPC operation
            # @yieldparam response [Google::Protobuf::Empty]
            # @yieldparam operation [GRPC::ActiveCall::Operation]
            #
            # @return [Google::Protobuf::Empty]
            #
            # @raise [Google::Cloud::Error] if the RPC is aborted.
            #
            def delete_secret request, options = nil
              raise ArgumentError, "request must be provided" if request.nil?

              request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecretManager::V1beta1::DeleteSecretRequest

              # Converts hash and nil to an options object
              options = Gapic::CallOptions.new options.to_h if options.respond_to? :to_h

              # Customize the options with defaults
              metadata = @config.rpcs.delete_secret.metadata.to_h

              # Set x-goog-api-client header
              metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
                lib_name: @config.lib_name, lib_version: @config.lib_version,
                gapic_version: Google::Cloud::SecretManager::V1beta1::VERSION

              header_params = {
                "name" => request.name
              }
              request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
              metadata[:"x-goog-request-params"] ||= request_params_header

              options.apply_defaults timeout:      @config.rpcs.delete_secret.timeout,
                                     metadata:     metadata,
                                     retry_policy: @config.rpcs.delete_secret.retry_policy
              options.apply_defaults metadata:     @config.metadata,
                                     retry_policy: @config.retry_policy

              @secret_manager_service_stub.call_rpc :delete_secret, request, options: options do |response, operation|
                yield response, operation if block_given?
                return response
              end
            rescue GRPC::BadStatus => e
              raise Google::Cloud::Error.from_error(e)
            end

            ##
            # Lists [SecretVersions][google.cloud.secrets.v1beta1.SecretVersion]. This call does not return secret
            # data.
            #
            # @overload list_secret_versions(request, options = nil)
            #   @param request [Google::Cloud::SecretManager::V1beta1::ListSecretVersionsRequest | Hash]
            #     Lists [SecretVersions][google.cloud.secrets.v1beta1.SecretVersion]. This call does not return secret
            #     data.
            #   @param options [Gapic::CallOptions, Hash]
            #     Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
            #
            # @overload list_secret_versions(parent: nil, page_size: nil, page_token: nil)
            #   @param parent [String]
            #     Required. The resource name of the [Secret][google.cloud.secrets.v1beta1.Secret] associated with the
            #     [SecretVersions][google.cloud.secrets.v1beta1.SecretVersion] to list, in the format
            #     `projects/*/secrets/*`.
            #   @param page_size [Integer]
            #     Optional. The maximum number of results to be returned in a single page. If
            #     set to 0, the server decides the number of results to return. If the
            #     number is greater than 25000, it is capped at 25000.
            #   @param page_token [String]
            #     Optional. Pagination token, returned earlier via
            #     ListSecretVersionsResponse.next_page_token][].
            #
            #
            # @yield [response, operation] Access the result along with the RPC operation
            # @yieldparam response [Gapic::PagedEnumerable<Google::Cloud::SecretManager::V1beta1::SecretVersion>]
            # @yieldparam operation [GRPC::ActiveCall::Operation]
            #
            # @return [Gapic::PagedEnumerable<Google::Cloud::SecretManager::V1beta1::SecretVersion>]
            #
            # @raise [Google::Cloud::Error] if the RPC is aborted.
            #
            def list_secret_versions request, options = nil
              raise ArgumentError, "request must be provided" if request.nil?

              request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecretManager::V1beta1::ListSecretVersionsRequest

              # Converts hash and nil to an options object
              options = Gapic::CallOptions.new options.to_h if options.respond_to? :to_h

              # Customize the options with defaults
              metadata = @config.rpcs.list_secret_versions.metadata.to_h

              # Set x-goog-api-client header
              metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
                lib_name: @config.lib_name, lib_version: @config.lib_version,
                gapic_version: Google::Cloud::SecretManager::V1beta1::VERSION

              header_params = {
                "parent" => request.parent
              }
              request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
              metadata[:"x-goog-request-params"] ||= request_params_header

              options.apply_defaults timeout:      @config.rpcs.list_secret_versions.timeout,
                                     metadata:     metadata,
                                     retry_policy: @config.rpcs.list_secret_versions.retry_policy
              options.apply_defaults metadata:     @config.metadata,
                                     retry_policy: @config.retry_policy

              @secret_manager_service_stub.call_rpc :list_secret_versions, request, options: options do |response, operation|
                response = Gapic::PagedEnumerable.new @secret_manager_service_stub, :list_secret_versions, request, response, operation, options
                yield response, operation if block_given?
                return response
              end
            rescue GRPC::BadStatus => e
              raise Google::Cloud::Error.from_error(e)
            end

            ##
            # Gets metadata for a [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion].
            #
            # `projects/*/secrets/*/versions/latest` is an alias to the `latest`
            # [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion].
            #
            # @overload get_secret_version(request, options = nil)
            #   @param request [Google::Cloud::SecretManager::V1beta1::GetSecretVersionRequest | Hash]
            #     Gets metadata for a [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion].
            #
            #     `projects/*/secrets/*/versions/latest` is an alias to the `latest`
            #     [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion].
            #   @param options [Gapic::CallOptions, Hash]
            #     Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
            #
            # @overload get_secret_version(name: nil)
            #   @param name [String]
            #     Required. The resource name of the [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion] in the format
            #     `projects/*/secrets/*/versions/*`.
            #     `projects/*/secrets/*/versions/latest` is an alias to the `latest`
            #     [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion].
            #
            #
            # @yield [response, operation] Access the result along with the RPC operation
            # @yieldparam response [Google::Cloud::SecretManager::V1beta1::SecretVersion]
            # @yieldparam operation [GRPC::ActiveCall::Operation]
            #
            # @return [Google::Cloud::SecretManager::V1beta1::SecretVersion]
            #
            # @raise [Google::Cloud::Error] if the RPC is aborted.
            #
            def get_secret_version request, options = nil
              raise ArgumentError, "request must be provided" if request.nil?

              request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecretManager::V1beta1::GetSecretVersionRequest

              # Converts hash and nil to an options object
              options = Gapic::CallOptions.new options.to_h if options.respond_to? :to_h

              # Customize the options with defaults
              metadata = @config.rpcs.get_secret_version.metadata.to_h

              # Set x-goog-api-client header
              metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
                lib_name: @config.lib_name, lib_version: @config.lib_version,
                gapic_version: Google::Cloud::SecretManager::V1beta1::VERSION

              header_params = {
                "name" => request.name
              }
              request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
              metadata[:"x-goog-request-params"] ||= request_params_header

              options.apply_defaults timeout:      @config.rpcs.get_secret_version.timeout,
                                     metadata:     metadata,
                                     retry_policy: @config.rpcs.get_secret_version.retry_policy
              options.apply_defaults metadata:     @config.metadata,
                                     retry_policy: @config.retry_policy

              @secret_manager_service_stub.call_rpc :get_secret_version, request, options: options do |response, operation|
                yield response, operation if block_given?
                return response
              end
            rescue GRPC::BadStatus => e
              raise Google::Cloud::Error.from_error(e)
            end

            ##
            # Accesses a [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion]. This call returns the secret data.
            #
            # `projects/*/secrets/*/versions/latest` is an alias to the `latest`
            # [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion].
            #
            # @overload access_secret_version(request, options = nil)
            #   @param request [Google::Cloud::SecretManager::V1beta1::AccessSecretVersionRequest | Hash]
            #     Accesses a [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion]. This call returns the secret data.
            #
            #     `projects/*/secrets/*/versions/latest` is an alias to the `latest`
            #     [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion].
            #   @param options [Gapic::CallOptions, Hash]
            #     Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
            #
            # @overload access_secret_version(name: nil)
            #   @param name [String]
            #     Required. The resource name of the [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion] in the format
            #     `projects/*/secrets/*/versions/*`.
            #
            #
            # @yield [response, operation] Access the result along with the RPC operation
            # @yieldparam response [Google::Cloud::SecretManager::V1beta1::AccessSecretVersionResponse]
            # @yieldparam operation [GRPC::ActiveCall::Operation]
            #
            # @return [Google::Cloud::SecretManager::V1beta1::AccessSecretVersionResponse]
            #
            # @raise [Google::Cloud::Error] if the RPC is aborted.
            #
            def access_secret_version request, options = nil
              raise ArgumentError, "request must be provided" if request.nil?

              request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecretManager::V1beta1::AccessSecretVersionRequest

              # Converts hash and nil to an options object
              options = Gapic::CallOptions.new options.to_h if options.respond_to? :to_h

              # Customize the options with defaults
              metadata = @config.rpcs.access_secret_version.metadata.to_h

              # Set x-goog-api-client header
              metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
                lib_name: @config.lib_name, lib_version: @config.lib_version,
                gapic_version: Google::Cloud::SecretManager::V1beta1::VERSION

              header_params = {
                "name" => request.name
              }
              request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
              metadata[:"x-goog-request-params"] ||= request_params_header

              options.apply_defaults timeout:      @config.rpcs.access_secret_version.timeout,
                                     metadata:     metadata,
                                     retry_policy: @config.rpcs.access_secret_version.retry_policy
              options.apply_defaults metadata:     @config.metadata,
                                     retry_policy: @config.retry_policy

              @secret_manager_service_stub.call_rpc :access_secret_version, request, options: options do |response, operation|
                yield response, operation if block_given?
                return response
              end
            rescue GRPC::BadStatus => e
              raise Google::Cloud::Error.from_error(e)
            end

            ##
            # Disables a [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion].
            #
            # Sets the [state][google.cloud.secrets.v1beta1.SecretVersion.state] of the [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion] to
            # [DISABLED][google.cloud.secrets.v1beta1.SecretVersion.State.DISABLED].
            #
            # @overload disable_secret_version(request, options = nil)
            #   @param request [Google::Cloud::SecretManager::V1beta1::DisableSecretVersionRequest | Hash]
            #     Disables a [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion].
            #
            #     Sets the [state][google.cloud.secrets.v1beta1.SecretVersion.state] of the [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion] to
            #     [DISABLED][google.cloud.secrets.v1beta1.SecretVersion.State.DISABLED].
            #   @param options [Gapic::CallOptions, Hash]
            #     Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
            #
            # @overload disable_secret_version(name: nil)
            #   @param name [String]
            #     Required. The resource name of the [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion] to disable in the format
            #     `projects/*/secrets/*/versions/*`.
            #
            #
            # @yield [response, operation] Access the result along with the RPC operation
            # @yieldparam response [Google::Cloud::SecretManager::V1beta1::SecretVersion]
            # @yieldparam operation [GRPC::ActiveCall::Operation]
            #
            # @return [Google::Cloud::SecretManager::V1beta1::SecretVersion]
            #
            # @raise [Google::Cloud::Error] if the RPC is aborted.
            #
            def disable_secret_version request, options = nil
              raise ArgumentError, "request must be provided" if request.nil?

              request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecretManager::V1beta1::DisableSecretVersionRequest

              # Converts hash and nil to an options object
              options = Gapic::CallOptions.new options.to_h if options.respond_to? :to_h

              # Customize the options with defaults
              metadata = @config.rpcs.disable_secret_version.metadata.to_h

              # Set x-goog-api-client header
              metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
                lib_name: @config.lib_name, lib_version: @config.lib_version,
                gapic_version: Google::Cloud::SecretManager::V1beta1::VERSION

              header_params = {
                "name" => request.name
              }
              request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
              metadata[:"x-goog-request-params"] ||= request_params_header

              options.apply_defaults timeout:      @config.rpcs.disable_secret_version.timeout,
                                     metadata:     metadata,
                                     retry_policy: @config.rpcs.disable_secret_version.retry_policy
              options.apply_defaults metadata:     @config.metadata,
                                     retry_policy: @config.retry_policy

              @secret_manager_service_stub.call_rpc :disable_secret_version, request, options: options do |response, operation|
                yield response, operation if block_given?
                return response
              end
            rescue GRPC::BadStatus => e
              raise Google::Cloud::Error.from_error(e)
            end

            ##
            # Enables a [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion].
            #
            # Sets the [state][google.cloud.secrets.v1beta1.SecretVersion.state] of the [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion] to
            # [ENABLED][google.cloud.secrets.v1beta1.SecretVersion.State.ENABLED].
            #
            # @overload enable_secret_version(request, options = nil)
            #   @param request [Google::Cloud::SecretManager::V1beta1::EnableSecretVersionRequest | Hash]
            #     Enables a [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion].
            #
            #     Sets the [state][google.cloud.secrets.v1beta1.SecretVersion.state] of the [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion] to
            #     [ENABLED][google.cloud.secrets.v1beta1.SecretVersion.State.ENABLED].
            #   @param options [Gapic::CallOptions, Hash]
            #     Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
            #
            # @overload enable_secret_version(name: nil)
            #   @param name [String]
            #     Required. The resource name of the [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion] to enable in the format
            #     `projects/*/secrets/*/versions/*`.
            #
            #
            # @yield [response, operation] Access the result along with the RPC operation
            # @yieldparam response [Google::Cloud::SecretManager::V1beta1::SecretVersion]
            # @yieldparam operation [GRPC::ActiveCall::Operation]
            #
            # @return [Google::Cloud::SecretManager::V1beta1::SecretVersion]
            #
            # @raise [Google::Cloud::Error] if the RPC is aborted.
            #
            def enable_secret_version request, options = nil
              raise ArgumentError, "request must be provided" if request.nil?

              request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecretManager::V1beta1::EnableSecretVersionRequest

              # Converts hash and nil to an options object
              options = Gapic::CallOptions.new options.to_h if options.respond_to? :to_h

              # Customize the options with defaults
              metadata = @config.rpcs.enable_secret_version.metadata.to_h

              # Set x-goog-api-client header
              metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
                lib_name: @config.lib_name, lib_version: @config.lib_version,
                gapic_version: Google::Cloud::SecretManager::V1beta1::VERSION

              header_params = {
                "name" => request.name
              }
              request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
              metadata[:"x-goog-request-params"] ||= request_params_header

              options.apply_defaults timeout:      @config.rpcs.enable_secret_version.timeout,
                                     metadata:     metadata,
                                     retry_policy: @config.rpcs.enable_secret_version.retry_policy
              options.apply_defaults metadata:     @config.metadata,
                                     retry_policy: @config.retry_policy

              @secret_manager_service_stub.call_rpc :enable_secret_version, request, options: options do |response, operation|
                yield response, operation if block_given?
                return response
              end
            rescue GRPC::BadStatus => e
              raise Google::Cloud::Error.from_error(e)
            end

            ##
            # Destroys a [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion].
            #
            # Sets the [state][google.cloud.secrets.v1beta1.SecretVersion.state] of the [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion] to
            # [DESTROYED][google.cloud.secrets.v1beta1.SecretVersion.State.DESTROYED] and irrevocably destroys the
            # secret data.
            #
            # @overload destroy_secret_version(request, options = nil)
            #   @param request [Google::Cloud::SecretManager::V1beta1::DestroySecretVersionRequest | Hash]
            #     Destroys a [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion].
            #
            #     Sets the [state][google.cloud.secrets.v1beta1.SecretVersion.state] of the [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion] to
            #     [DESTROYED][google.cloud.secrets.v1beta1.SecretVersion.State.DESTROYED] and irrevocably destroys the
            #     secret data.
            #   @param options [Gapic::CallOptions, Hash]
            #     Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
            #
            # @overload destroy_secret_version(name: nil)
            #   @param name [String]
            #     Required. The resource name of the [SecretVersion][google.cloud.secrets.v1beta1.SecretVersion] to destroy in the format
            #     `projects/*/secrets/*/versions/*`.
            #
            #
            # @yield [response, operation] Access the result along with the RPC operation
            # @yieldparam response [Google::Cloud::SecretManager::V1beta1::SecretVersion]
            # @yieldparam operation [GRPC::ActiveCall::Operation]
            #
            # @return [Google::Cloud::SecretManager::V1beta1::SecretVersion]
            #
            # @raise [Google::Cloud::Error] if the RPC is aborted.
            #
            def destroy_secret_version request, options = nil
              raise ArgumentError, "request must be provided" if request.nil?

              request = Gapic::Protobuf.coerce request, to: Google::Cloud::SecretManager::V1beta1::DestroySecretVersionRequest

              # Converts hash and nil to an options object
              options = Gapic::CallOptions.new options.to_h if options.respond_to? :to_h

              # Customize the options with defaults
              metadata = @config.rpcs.destroy_secret_version.metadata.to_h

              # Set x-goog-api-client header
              metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
                lib_name: @config.lib_name, lib_version: @config.lib_version,
                gapic_version: Google::Cloud::SecretManager::V1beta1::VERSION

              header_params = {
                "name" => request.name
              }
              request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
              metadata[:"x-goog-request-params"] ||= request_params_header

              options.apply_defaults timeout:      @config.rpcs.destroy_secret_version.timeout,
                                     metadata:     metadata,
                                     retry_policy: @config.rpcs.destroy_secret_version.retry_policy
              options.apply_defaults metadata:     @config.metadata,
                                     retry_policy: @config.retry_policy

              @secret_manager_service_stub.call_rpc :destroy_secret_version, request, options: options do |response, operation|
                yield response, operation if block_given?
                return response
              end
            rescue GRPC::BadStatus => e
              raise Google::Cloud::Error.from_error(e)
            end

            ##
            # Sets the access control policy on the specified secret. Replaces any
            # existing policy.
            #
            # Permissions on [SecretVersions][google.cloud.secrets.v1beta1.SecretVersion] are enforced according
            # to the policy set on the associated [Secret][google.cloud.secrets.v1beta1.Secret].
            #
            # @overload set_iam_policy(request, options = nil)
            #   @param request [Google::Iam::V1::SetIamPolicyRequest | Hash]
            #     Sets the access control policy on the specified secret. Replaces any
            #     existing policy.
            #
            #     Permissions on [SecretVersions][google.cloud.secrets.v1beta1.SecretVersion] are enforced according
            #     to the policy set on the associated [Secret][google.cloud.secrets.v1beta1.Secret].
            #   @param options [Gapic::CallOptions, Hash]
            #     Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
            #
            # @overload set_iam_policy(resource: nil, policy: nil)
            #   @param resource [String]
            #     REQUIRED: The resource for which the policy is being specified.
            #     `resource` is usually specified as a path. For example, a Project
            #     resource is specified as `projects/\\\{project\}`.
            #   @param policy [Google::Iam::V1::Policy | Hash]
            #     REQUIRED: The complete policy to be applied to the `resource`. The size of
            #     the policy is limited to a few 10s of KB. An empty policy is a
            #     valid policy but certain Cloud Platform services (such as Projects)
            #     might reject them.
            #
            #
            # @yield [response, operation] Access the result along with the RPC operation
            # @yieldparam response [Google::Iam::V1::Policy]
            # @yieldparam operation [GRPC::ActiveCall::Operation]
            #
            # @return [Google::Iam::V1::Policy]
            #
            # @raise [Google::Cloud::Error] if the RPC is aborted.
            #
            def set_iam_policy request, options = nil
              raise ArgumentError, "request must be provided" if request.nil?

              request = Gapic::Protobuf.coerce request, to: Google::Iam::V1::SetIamPolicyRequest

              # Converts hash and nil to an options object
              options = Gapic::CallOptions.new options.to_h if options.respond_to? :to_h

              # Customize the options with defaults
              metadata = @config.rpcs.set_iam_policy.metadata.to_h

              # Set x-goog-api-client header
              metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
                lib_name: @config.lib_name, lib_version: @config.lib_version,
                gapic_version: Google::Cloud::SecretManager::V1beta1::VERSION

              header_params = {
                "resource" => request.resource
              }
              request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
              metadata[:"x-goog-request-params"] ||= request_params_header

              options.apply_defaults timeout:      @config.rpcs.set_iam_policy.timeout,
                                     metadata:     metadata,
                                     retry_policy: @config.rpcs.set_iam_policy.retry_policy
              options.apply_defaults metadata:     @config.metadata,
                                     retry_policy: @config.retry_policy

              @secret_manager_service_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
                yield response, operation if block_given?
                return response
              end
            rescue GRPC::BadStatus => e
              raise Google::Cloud::Error.from_error(e)
            end

            ##
            # Gets the access control policy for a secret.
            # Returns empty policy if the secret exists and does not have a policy set.
            #
            # @overload get_iam_policy(request, options = nil)
            #   @param request [Google::Iam::V1::GetIamPolicyRequest | Hash]
            #     Gets the access control policy for a secret.
            #     Returns empty policy if the secret exists and does not have a policy set.
            #   @param options [Gapic::CallOptions, Hash]
            #     Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
            #
            # @overload get_iam_policy(resource: nil)
            #   @param resource [String]
            #     REQUIRED: The resource for which the policy is being requested.
            #     `resource` is usually specified as a path. For example, a Project
            #     resource is specified as `projects/\\\{project\}`.
            #
            #
            # @yield [response, operation] Access the result along with the RPC operation
            # @yieldparam response [Google::Iam::V1::Policy]
            # @yieldparam operation [GRPC::ActiveCall::Operation]
            #
            # @return [Google::Iam::V1::Policy]
            #
            # @raise [Google::Cloud::Error] if the RPC is aborted.
            #
            def get_iam_policy request, options = nil
              raise ArgumentError, "request must be provided" if request.nil?

              request = Gapic::Protobuf.coerce request, to: Google::Iam::V1::GetIamPolicyRequest

              # Converts hash and nil to an options object
              options = Gapic::CallOptions.new options.to_h if options.respond_to? :to_h

              # Customize the options with defaults
              metadata = @config.rpcs.get_iam_policy.metadata.to_h

              # Set x-goog-api-client header
              metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
                lib_name: @config.lib_name, lib_version: @config.lib_version,
                gapic_version: Google::Cloud::SecretManager::V1beta1::VERSION

              header_params = {
                "resource" => request.resource
              }
              request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
              metadata[:"x-goog-request-params"] ||= request_params_header

              options.apply_defaults timeout:      @config.rpcs.get_iam_policy.timeout,
                                     metadata:     metadata,
                                     retry_policy: @config.rpcs.get_iam_policy.retry_policy
              options.apply_defaults metadata:     @config.metadata,
                                     retry_policy: @config.retry_policy

              @secret_manager_service_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
                yield response, operation if block_given?
                return response
              end
            rescue GRPC::BadStatus => e
              raise Google::Cloud::Error.from_error(e)
            end

            ##
            # Returns permissions that a caller has for the specified secret.
            # If the secret does not exist, this call returns an empty set of
            # permissions, not a NOT_FOUND error.
            #
            # Note: This operation is designed to be used for building permission-aware
            # UIs and command-line tools, not for authorization checking. This operation
            # may "fail open" without warning.
            #
            # @overload test_iam_permissions(request, options = nil)
            #   @param request [Google::Iam::V1::TestIamPermissionsRequest | Hash]
            #     Returns permissions that a caller has for the specified secret.
            #     If the secret does not exist, this call returns an empty set of
            #     permissions, not a NOT_FOUND error.
            #
            #     Note: This operation is designed to be used for building permission-aware
            #     UIs and command-line tools, not for authorization checking. This operation
            #     may "fail open" without warning.
            #   @param options [Gapic::CallOptions, Hash]
            #     Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
            #
            # @overload test_iam_permissions(resource: nil, permissions: nil)
            #   @param resource [String]
            #     REQUIRED: The resource for which the policy detail is being requested.
            #     `resource` is usually specified as a path. For example, a Project
            #     resource is specified as `projects/\\\{project\}`.
            #   @param permissions [Array<String>]
            #     The set of permissions to check for the `resource`. Permissions with
            #     wildcards (such as '*' or 'storage.*') are not allowed. For more
            #     information see
            #     [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
            #
            #
            # @yield [response, operation] Access the result along with the RPC operation
            # @yieldparam response [Google::Iam::V1::TestIamPermissionsResponse]
            # @yieldparam operation [GRPC::ActiveCall::Operation]
            #
            # @return [Google::Iam::V1::TestIamPermissionsResponse]
            #
            # @raise [Google::Cloud::Error] if the RPC is aborted.
            #
            def test_iam_permissions request, options = nil
              raise ArgumentError, "request must be provided" if request.nil?

              request = Gapic::Protobuf.coerce request, to: Google::Iam::V1::TestIamPermissionsRequest

              # Converts hash and nil to an options object
              options = Gapic::CallOptions.new options.to_h if options.respond_to? :to_h

              # Customize the options with defaults
              metadata = @config.rpcs.test_iam_permissions.metadata.to_h

              # Set x-goog-api-client header
              metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
                lib_name: @config.lib_name, lib_version: @config.lib_version,
                gapic_version: Google::Cloud::SecretManager::V1beta1::VERSION

              header_params = {
                "resource" => request.resource
              }
              request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
              metadata[:"x-goog-request-params"] ||= request_params_header

              options.apply_defaults timeout:      @config.rpcs.test_iam_permissions.timeout,
                                     metadata:     metadata,
                                     retry_policy: @config.rpcs.test_iam_permissions.retry_policy
              options.apply_defaults metadata:     @config.metadata,
                                     retry_policy: @config.retry_policy

              @secret_manager_service_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
                yield response, operation if block_given?
                return response
              end
            rescue GRPC::BadStatus => e
              raise Google::Cloud::Error.from_error(e)
            end

            ##
            # Configuration class for the SecretManagerService API.
            class Configuration
              extend Gapic::Config

              config_attr :endpoint,     "secretmanager.googleapis.com", String
              config_attr :credentials,  nil do |value|
                allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
                allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
                allowed.any? { |klass| klass === value }
              end
              config_attr :scope,        nil, String, Array, nil
              config_attr :lib_name,     nil, String, nil
              config_attr :lib_version,  nil, String, nil
              config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, Hash, nil)
              config_attr :interceptors, nil, Array, nil
              config_attr :timeout,      nil, Numeric, nil
              config_attr :metadata,     nil, Hash, nil
              config_attr :retry_policy, nil, Hash, Proc, nil

              def initialize parent_config = nil
                @parent_config = parent_config unless parent_config.nil?

                yield self if block_given?
              end

              def rpcs
                @rpcs ||= begin
                  parent_rpcs = nil
                  parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to? :rpcs
                  Rpcs.new parent_rpcs
                end
              end

              ##
              # Configuration RPC class for the SecretManagerService API.
              class Rpcs
                attr_reader :list_secrets
                attr_reader :create_secret
                attr_reader :add_secret_version
                attr_reader :get_secret
                attr_reader :update_secret
                attr_reader :delete_secret
                attr_reader :list_secret_versions
                attr_reader :get_secret_version
                attr_reader :access_secret_version
                attr_reader :disable_secret_version
                attr_reader :enable_secret_version
                attr_reader :destroy_secret_version
                attr_reader :set_iam_policy
                attr_reader :get_iam_policy
                attr_reader :test_iam_permissions

                def initialize parent_rpcs = nil
                  list_secrets_config = parent_rpcs&.list_secrets if parent_rpcs&.respond_to? :list_secrets
                  @list_secrets = Gapic::Config::Method.new list_secrets_config
                  create_secret_config = parent_rpcs&.create_secret if parent_rpcs&.respond_to? :create_secret
                  @create_secret = Gapic::Config::Method.new create_secret_config
                  add_secret_version_config = parent_rpcs&.add_secret_version if parent_rpcs&.respond_to? :add_secret_version
                  @add_secret_version = Gapic::Config::Method.new add_secret_version_config
                  get_secret_config = parent_rpcs&.get_secret if parent_rpcs&.respond_to? :get_secret
                  @get_secret = Gapic::Config::Method.new get_secret_config
                  update_secret_config = parent_rpcs&.update_secret if parent_rpcs&.respond_to? :update_secret
                  @update_secret = Gapic::Config::Method.new update_secret_config
                  delete_secret_config = parent_rpcs&.delete_secret if parent_rpcs&.respond_to? :delete_secret
                  @delete_secret = Gapic::Config::Method.new delete_secret_config
                  list_secret_versions_config = parent_rpcs&.list_secret_versions if parent_rpcs&.respond_to? :list_secret_versions
                  @list_secret_versions = Gapic::Config::Method.new list_secret_versions_config
                  get_secret_version_config = parent_rpcs&.get_secret_version if parent_rpcs&.respond_to? :get_secret_version
                  @get_secret_version = Gapic::Config::Method.new get_secret_version_config
                  access_secret_version_config = parent_rpcs&.access_secret_version if parent_rpcs&.respond_to? :access_secret_version
                  @access_secret_version = Gapic::Config::Method.new access_secret_version_config
                  disable_secret_version_config = parent_rpcs&.disable_secret_version if parent_rpcs&.respond_to? :disable_secret_version
                  @disable_secret_version = Gapic::Config::Method.new disable_secret_version_config
                  enable_secret_version_config = parent_rpcs&.enable_secret_version if parent_rpcs&.respond_to? :enable_secret_version
                  @enable_secret_version = Gapic::Config::Method.new enable_secret_version_config
                  destroy_secret_version_config = parent_rpcs&.destroy_secret_version if parent_rpcs&.respond_to? :destroy_secret_version
                  @destroy_secret_version = Gapic::Config::Method.new destroy_secret_version_config
                  set_iam_policy_config = parent_rpcs&.set_iam_policy if parent_rpcs&.respond_to? :set_iam_policy
                  @set_iam_policy = Gapic::Config::Method.new set_iam_policy_config
                  get_iam_policy_config = parent_rpcs&.get_iam_policy if parent_rpcs&.respond_to? :get_iam_policy
                  @get_iam_policy = Gapic::Config::Method.new get_iam_policy_config
                  test_iam_permissions_config = parent_rpcs&.test_iam_permissions if parent_rpcs&.respond_to? :test_iam_permissions
                  @test_iam_permissions = Gapic::Config::Method.new test_iam_permissions_config

                  yield self if block_given?
                end
              end
            end
          end
        end
      end
    end
  end
end

# rubocop:disable Lint/HandleExceptions

# Once client is loaded, load helpers.rb if it exists.
begin
  require "google/cloud/secret_manager/v1beta1/secret_manager_service/helpers"
rescue LoadError
end

# rubocop:enable Lint/HandleExceptions