class Google::Cloud::WebSecurityScanner::V1beta::WebSecurityScanner::Client

Client for the WebSecurityScanner service.

Cloud Web Security Scanner Service identifies security vulnerabilities in web applications hosted on Google Cloud Platform. It crawls your application, and attempts to exercise as many user inputs and event handlers as possible.

Attributes

web_security_scanner_stub[R]

@private

Public Class Methods

configure() { |configure| ... } click to toggle source

Configure the WebSecurityScanner Client class.

See {::Google::Cloud::WebSecurityScanner::V1beta::WebSecurityScanner::Client::Configuration} for a description of the configuration fields.

@example

# Modify the configuration for all WebSecurityScanner clients
::Google::Cloud::WebSecurityScanner::V1beta::WebSecurityScanner::Client.configure do |config|
  config.timeout = 10.0
end

@yield [config] Configure the Client client. @yieldparam config [Client::Configuration]

@return [Client::Configuration]

# File lib/google/cloud/web_security_scanner/v1beta/web_security_scanner/client.rb, line 58
def self.configure
  @configure ||= begin
    namespace = ["Google", "Cloud", "WebSecurityScanner", "V1beta"]
    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
    default_config = Client::Configuration.new parent_config

    default_config.rpcs.create_scan_config.timeout = 600.0

    default_config.rpcs.delete_scan_config.timeout = 600.0
    default_config.rpcs.delete_scan_config.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.get_scan_config.timeout = 600.0
    default_config.rpcs.get_scan_config.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.list_scan_configs.timeout = 600.0
    default_config.rpcs.list_scan_configs.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.update_scan_config.timeout = 600.0

    default_config.rpcs.start_scan_run.timeout = 600.0

    default_config.rpcs.get_scan_run.timeout = 600.0
    default_config.rpcs.get_scan_run.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.list_scan_runs.timeout = 600.0
    default_config.rpcs.list_scan_runs.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.stop_scan_run.timeout = 600.0

    default_config.rpcs.list_crawled_urls.timeout = 600.0
    default_config.rpcs.list_crawled_urls.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.get_finding.timeout = 600.0
    default_config.rpcs.get_finding.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.list_findings.timeout = 600.0
    default_config.rpcs.list_findings.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config.rpcs.list_finding_type_stats.timeout = 600.0
    default_config.rpcs.list_finding_type_stats.retry_policy = {
      initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14]
    }

    default_config
  end
  yield @configure if block_given?
  @configure
end
new() { |config| ... } click to toggle source

Create a new WebSecurityScanner client object.

@example

# Create a client using the default configuration
client = ::Google::Cloud::WebSecurityScanner::V1beta::WebSecurityScanner::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::WebSecurityScanner::V1beta::WebSecurityScanner::Client.new do |config|
  config.timeout = 10.0
end

@yield [config] Configure the WebSecurityScanner client. @yieldparam config [Client::Configuration]

# File lib/google/cloud/web_security_scanner/v1beta/web_security_scanner/client.rb, line 164
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/websecurityscanner/v1beta/web_security_scanner_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
  # Use self-signed JWT if the endpoint is unchanged from default,
  # but only if the default endpoint does not have a region prefix.
  enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
                           !@config.endpoint.split(".").first.include?("-")
  credentials ||= Credentials.default scope: @config.scope,
                                      enable_self_signed_jwt: enable_self_signed_jwt
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
    credentials = Credentials.new credentials, scope: @config.scope
  end
  @quota_project_id = @config.quota_project
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id

  @web_security_scanner_stub = ::Gapic::ServiceStub.new(
    ::Google::Cloud::WebSecurityScanner::V1beta::WebSecurityScanner::Stub,
    credentials:  credentials,
    endpoint:     @config.endpoint,
    channel_args: @config.channel_args,
    interceptors: @config.interceptors
  )
end

Public Instance Methods

configure() { |config| ... } click to toggle source

Configure the WebSecurityScanner 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}.

See {::Google::Cloud::WebSecurityScanner::V1beta::WebSecurityScanner::Client::Configuration} for a description of the configuration fields.

@yield [config] Configure the Client client. @yieldparam config [Client::Configuration]

@return [Client::Configuration]

# File lib/google/cloud/web_security_scanner/v1beta/web_security_scanner/client.rb, line 143
def configure
  yield @config if block_given?
  @config
end
create_scan_config(request, options = nil) { |response, operation| ... } click to toggle source

Creates a new ScanConfig.

@overload create_scan_config(request, options = nil)

Pass arguments to `create_scan_config` via a request object, either of type
{::Google::Cloud::WebSecurityScanner::V1beta::CreateScanConfigRequest} or an equivalent Hash.

@param request [::Google::Cloud::WebSecurityScanner::V1beta::CreateScanConfigRequest, ::Hash]
  A request object representing the call parameters. Required. To specify no
  parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload create_scan_config(parent: nil, scan_config: nil)

Pass arguments to `create_scan_config` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).

@param parent [::String]
  Required. The parent resource name where the scan is created, which should be a
  project resource name in the format 'projects/\\{projectId}'.
@param scan_config [::Google::Cloud::WebSecurityScanner::V1beta::ScanConfig, ::Hash]
  Required. The ScanConfig to be created.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::WebSecurityScanner::V1beta::ScanConfig] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Cloud::WebSecurityScanner::V1beta::ScanConfig]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/web_security_scanner/v1beta/web_security_scanner/client.rb, line 234
def create_scan_config request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebSecurityScanner::V1beta::CreateScanConfigRequest

  # 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_scan_config.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  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::WebSecurityScanner::V1beta::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  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_scan_config.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.create_scan_config.retry_policy

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

  @web_security_scanner_stub.call_rpc :create_scan_config, 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
delete_scan_config(request, options = nil) { |response, operation| ... } click to toggle source

Deletes an existing ScanConfig and its child resources.

@overload delete_scan_config(request, options = nil)

Pass arguments to `delete_scan_config` via a request object, either of type
{::Google::Cloud::WebSecurityScanner::V1beta::DeleteScanConfigRequest} or an equivalent Hash.

@param request [::Google::Cloud::WebSecurityScanner::V1beta::DeleteScanConfigRequest, ::Hash]
  A request object representing the call parameters. Required. To specify no
  parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload delete_scan_config(name: nil)

Pass arguments to `delete_scan_config` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).

@param name [::String]
  Required. The resource name of the ScanConfig to be deleted. The name follows the
  format of 'projects/\\{projectId}/scanConfigs/\\{scanConfigId}'.

@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.

# File lib/google/cloud/web_security_scanner/v1beta/web_security_scanner/client.rb, line 303
def delete_scan_config request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebSecurityScanner::V1beta::DeleteScanConfigRequest

  # 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_scan_config.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  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::WebSecurityScanner::V1beta::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  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_scan_config.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.delete_scan_config.retry_policy

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

  @web_security_scanner_stub.call_rpc :delete_scan_config, 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
get_finding(request, options = nil) { |response, operation| ... } click to toggle source

Gets a Finding.

@overload get_finding(request, options = nil)

Pass arguments to `get_finding` via a request object, either of type
{::Google::Cloud::WebSecurityScanner::V1beta::GetFindingRequest} or an equivalent Hash.

@param request [::Google::Cloud::WebSecurityScanner::V1beta::GetFindingRequest, ::Hash]
  A request object representing the call parameters. Required. To specify no
  parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload get_finding(name: nil)

Pass arguments to `get_finding` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).

@param name [::String]
  Required. The resource name of the Finding to be returned. The name follows the
  format of
  'projects/\\{projectId}/scanConfigs/\\{scanConfigId}/scanRuns/\\{scanRunId}/findings/\\{findingId}'.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::WebSecurityScanner::V1beta::Finding] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Cloud::WebSecurityScanner::V1beta::Finding]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/web_security_scanner/v1beta/web_security_scanner/client.rb, line 961
def get_finding request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebSecurityScanner::V1beta::GetFindingRequest

  # 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_finding.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  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::WebSecurityScanner::V1beta::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  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_finding.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.get_finding.retry_policy

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

  @web_security_scanner_stub.call_rpc :get_finding, 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
get_scan_config(request, options = nil) { |response, operation| ... } click to toggle source

Gets a ScanConfig.

@overload get_scan_config(request, options = nil)

Pass arguments to `get_scan_config` via a request object, either of type
{::Google::Cloud::WebSecurityScanner::V1beta::GetScanConfigRequest} or an equivalent Hash.

@param request [::Google::Cloud::WebSecurityScanner::V1beta::GetScanConfigRequest, ::Hash]
  A request object representing the call parameters. Required. To specify no
  parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload get_scan_config(name: nil)

Pass arguments to `get_scan_config` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).

@param name [::String]
  Required. The resource name of the ScanConfig to be returned. The name follows the
  format of 'projects/\\{projectId}/scanConfigs/\\{scanConfigId}'.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::WebSecurityScanner::V1beta::ScanConfig] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Cloud::WebSecurityScanner::V1beta::ScanConfig]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/web_security_scanner/v1beta/web_security_scanner/client.rb, line 372
def get_scan_config request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebSecurityScanner::V1beta::GetScanConfigRequest

  # 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_scan_config.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  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::WebSecurityScanner::V1beta::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  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_scan_config.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.get_scan_config.retry_policy

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

  @web_security_scanner_stub.call_rpc :get_scan_config, 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
get_scan_run(request, options = nil) { |response, operation| ... } click to toggle source

Gets a ScanRun.

@overload get_scan_run(request, options = nil)

Pass arguments to `get_scan_run` via a request object, either of type
{::Google::Cloud::WebSecurityScanner::V1beta::GetScanRunRequest} or an equivalent Hash.

@param request [::Google::Cloud::WebSecurityScanner::V1beta::GetScanRunRequest, ::Hash]
  A request object representing the call parameters. Required. To specify no
  parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload get_scan_run(name: nil)

Pass arguments to `get_scan_run` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).

@param name [::String]
  Required. The resource name of the ScanRun to be returned. The name follows the
  format of
  'projects/\\{projectId}/scanConfigs/\\{scanConfigId}/scanRuns/\\{scanRunId}'.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::WebSecurityScanner::V1beta::ScanRun] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Cloud::WebSecurityScanner::V1beta::ScanRun]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/web_security_scanner/v1beta/web_security_scanner/client.rb, line 663
def get_scan_run request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebSecurityScanner::V1beta::GetScanRunRequest

  # 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_scan_run.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  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::WebSecurityScanner::V1beta::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  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_scan_run.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.get_scan_run.retry_policy

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

  @web_security_scanner_stub.call_rpc :get_scan_run, 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
list_crawled_urls(request, options = nil) { |response, operation| ... } click to toggle source

List CrawledUrls under a given ScanRun.

@overload list_crawled_urls(request, options = nil)

Pass arguments to `list_crawled_urls` via a request object, either of type
{::Google::Cloud::WebSecurityScanner::V1beta::ListCrawledUrlsRequest} or an equivalent Hash.

@param request [::Google::Cloud::WebSecurityScanner::V1beta::ListCrawledUrlsRequest, ::Hash]
  A request object representing the call parameters. Required. To specify no
  parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload list_crawled_urls(parent: nil, page_token: nil, page_size: nil)

Pass arguments to `list_crawled_urls` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).

@param parent [::String]
  Required. The parent resource name, which should be a scan run resource name in the
  format
  'projects/\\{projectId}/scanConfigs/\\{scanConfigId}/scanRuns/\\{scanRunId}'.
@param page_token [::String]
  A token identifying a page of results to be returned. This should be a
  `next_page_token` value returned from a previous List request.
  If unspecified, the first page of results is returned.
@param page_size [::Integer]
  The maximum number of CrawledUrls to return, can be limited by server.
  If not specified or not positive, the implementation will select a
  reasonable value.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::WebSecurityScanner::V1beta::CrawledUrl>] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::PagedEnumerable<::Google::Cloud::WebSecurityScanner::V1beta::CrawledUrl>]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/web_security_scanner/v1beta/web_security_scanner/client.rb, line 890
def list_crawled_urls request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebSecurityScanner::V1beta::ListCrawledUrlsRequest

  # 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_crawled_urls.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  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::WebSecurityScanner::V1beta::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  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_crawled_urls.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.list_crawled_urls.retry_policy

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

  @web_security_scanner_stub.call_rpc :list_crawled_urls, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @web_security_scanner_stub, :list_crawled_urls, 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
list_finding_type_stats(request, options = nil) { |response, operation| ... } click to toggle source

List all FindingTypeStats under a given ScanRun.

@overload list_finding_type_stats(request, options = nil)

Pass arguments to `list_finding_type_stats` via a request object, either of type
{::Google::Cloud::WebSecurityScanner::V1beta::ListFindingTypeStatsRequest} or an equivalent Hash.

@param request [::Google::Cloud::WebSecurityScanner::V1beta::ListFindingTypeStatsRequest, ::Hash]
  A request object representing the call parameters. Required. To specify no
  parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload list_finding_type_stats(parent: nil)

Pass arguments to `list_finding_type_stats` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).

@param parent [::String]
  Required. The parent resource name, which should be a scan run resource name in the
  format
  'projects/\\{projectId}/scanConfigs/\\{scanConfigId}/scanRuns/\\{scanRunId}'.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::WebSecurityScanner::V1beta::ListFindingTypeStatsResponse] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Cloud::WebSecurityScanner::V1beta::ListFindingTypeStatsResponse]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/web_security_scanner/v1beta/web_security_scanner/client.rb, line 1115
def list_finding_type_stats request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebSecurityScanner::V1beta::ListFindingTypeStatsRequest

  # 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_finding_type_stats.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  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::WebSecurityScanner::V1beta::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  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_finding_type_stats.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.list_finding_type_stats.retry_policy

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

  @web_security_scanner_stub.call_rpc :list_finding_type_stats, 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
list_findings(request, options = nil) { |response, operation| ... } click to toggle source

List Findings under a given ScanRun.

@overload list_findings(request, options = nil)

Pass arguments to `list_findings` via a request object, either of type
{::Google::Cloud::WebSecurityScanner::V1beta::ListFindingsRequest} or an equivalent Hash.

@param request [::Google::Cloud::WebSecurityScanner::V1beta::ListFindingsRequest, ::Hash]
  A request object representing the call parameters. Required. To specify no
  parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload list_findings(parent: nil, filter: nil, page_token: nil, page_size: nil)

Pass arguments to `list_findings` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).

@param parent [::String]
  Required. The parent resource name, which should be a scan run resource name in the
  format
  'projects/\\{projectId}/scanConfigs/\\{scanConfigId}/scanRuns/\\{scanRunId}'.
@param filter [::String]
  Required. The filter expression. The expression must be in the format: <field>
  <operator> <value>.
  Supported field: 'finding_type'.
  Supported operator: '='.
@param page_token [::String]
  A token identifying a page of results to be returned. This should be a
  `next_page_token` value returned from a previous List request.
  If unspecified, the first page of results is returned.
@param page_size [::Integer]
  The maximum number of Findings to return, can be limited by server.
  If not specified or not positive, the implementation will select a
  reasonable value.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::WebSecurityScanner::V1beta::Finding>] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::PagedEnumerable<::Google::Cloud::WebSecurityScanner::V1beta::Finding>]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/web_security_scanner/v1beta/web_security_scanner/client.rb, line 1044
def list_findings request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebSecurityScanner::V1beta::ListFindingsRequest

  # 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_findings.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  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::WebSecurityScanner::V1beta::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  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_findings.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.list_findings.retry_policy

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

  @web_security_scanner_stub.call_rpc :list_findings, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @web_security_scanner_stub, :list_findings, 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
list_scan_configs(request, options = nil) { |response, operation| ... } click to toggle source

Lists ScanConfigs under a given project.

@overload list_scan_configs(request, options = nil)

Pass arguments to `list_scan_configs` via a request object, either of type
{::Google::Cloud::WebSecurityScanner::V1beta::ListScanConfigsRequest} or an equivalent Hash.

@param request [::Google::Cloud::WebSecurityScanner::V1beta::ListScanConfigsRequest, ::Hash]
  A request object representing the call parameters. Required. To specify no
  parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload list_scan_configs(parent: nil, page_token: nil, page_size: nil)

Pass arguments to `list_scan_configs` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).

@param parent [::String]
  Required. The parent resource name, which should be a project resource name in the
  format 'projects/\\{projectId}'.
@param page_token [::String]
  A token identifying a page of results to be returned. This should be a
  `next_page_token` value returned from a previous List request.
  If unspecified, the first page of results is returned.
@param page_size [::Integer]
  The maximum number of ScanConfigs to return, can be limited by server.
  If not specified or not positive, the implementation will select a
  reasonable value.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::WebSecurityScanner::V1beta::ScanConfig>] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::PagedEnumerable<::Google::Cloud::WebSecurityScanner::V1beta::ScanConfig>]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/web_security_scanner/v1beta/web_security_scanner/client.rb, line 449
def list_scan_configs request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebSecurityScanner::V1beta::ListScanConfigsRequest

  # 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_scan_configs.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  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::WebSecurityScanner::V1beta::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  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_scan_configs.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.list_scan_configs.retry_policy

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

  @web_security_scanner_stub.call_rpc :list_scan_configs, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @web_security_scanner_stub, :list_scan_configs, 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
list_scan_runs(request, options = nil) { |response, operation| ... } click to toggle source

Lists ScanRuns under a given ScanConfig, in descending order of ScanRun stop time.

@overload list_scan_runs(request, options = nil)

Pass arguments to `list_scan_runs` via a request object, either of type
{::Google::Cloud::WebSecurityScanner::V1beta::ListScanRunsRequest} or an equivalent Hash.

@param request [::Google::Cloud::WebSecurityScanner::V1beta::ListScanRunsRequest, ::Hash]
  A request object representing the call parameters. Required. To specify no
  parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload list_scan_runs(parent: nil, page_token: nil, page_size: nil)

Pass arguments to `list_scan_runs` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).

@param parent [::String]
  Required. The parent resource name, which should be a scan resource name in the
  format 'projects/\\{projectId}/scanConfigs/\\{scanConfigId}'.
@param page_token [::String]
  A token identifying a page of results to be returned. This should be a
  `next_page_token` value returned from a previous List request.
  If unspecified, the first page of results is returned.
@param page_size [::Integer]
  The maximum number of ScanRuns to return, can be limited by server.
  If not specified or not positive, the implementation will select a
  reasonable value.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::WebSecurityScanner::V1beta::ScanRun>] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Gapic::PagedEnumerable<::Google::Cloud::WebSecurityScanner::V1beta::ScanRun>]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/web_security_scanner/v1beta/web_security_scanner/client.rb, line 741
def list_scan_runs request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebSecurityScanner::V1beta::ListScanRunsRequest

  # 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_scan_runs.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  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::WebSecurityScanner::V1beta::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  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_scan_runs.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.list_scan_runs.retry_policy

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

  @web_security_scanner_stub.call_rpc :list_scan_runs, request, options: options do |response, operation|
    response = ::Gapic::PagedEnumerable.new @web_security_scanner_stub, :list_scan_runs, 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
start_scan_run(request, options = nil) { |response, operation| ... } click to toggle source

Start a ScanRun according to the given ScanConfig.

@overload start_scan_run(request, options = nil)

Pass arguments to `start_scan_run` via a request object, either of type
{::Google::Cloud::WebSecurityScanner::V1beta::StartScanRunRequest} or an equivalent Hash.

@param request [::Google::Cloud::WebSecurityScanner::V1beta::StartScanRunRequest, ::Hash]
  A request object representing the call parameters. Required. To specify no
  parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload start_scan_run(name: nil)

Pass arguments to `start_scan_run` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).

@param name [::String]
  Required. The resource name of the ScanConfig to be used. The name follows the
  format of 'projects/\\{projectId}/scanConfigs/\\{scanConfigId}'.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::WebSecurityScanner::V1beta::ScanRun] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Cloud::WebSecurityScanner::V1beta::ScanRun]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/web_security_scanner/v1beta/web_security_scanner/client.rb, line 593
def start_scan_run request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebSecurityScanner::V1beta::StartScanRunRequest

  # 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.start_scan_run.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  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::WebSecurityScanner::V1beta::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  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.start_scan_run.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.start_scan_run.retry_policy

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

  @web_security_scanner_stub.call_rpc :start_scan_run, 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
stop_scan_run(request, options = nil) { |response, operation| ... } click to toggle source

Stops a ScanRun. The stopped ScanRun is returned.

@overload stop_scan_run(request, options = nil)

Pass arguments to `stop_scan_run` via a request object, either of type
{::Google::Cloud::WebSecurityScanner::V1beta::StopScanRunRequest} or an equivalent Hash.

@param request [::Google::Cloud::WebSecurityScanner::V1beta::StopScanRunRequest, ::Hash]
  A request object representing the call parameters. Required. To specify no
  parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload stop_scan_run(name: nil)

Pass arguments to `stop_scan_run` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).

@param name [::String]
  Required. The resource name of the ScanRun to be stopped. The name follows the
  format of
  'projects/\\{projectId}/scanConfigs/\\{scanConfigId}/scanRuns/\\{scanRunId}'.

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::WebSecurityScanner::V1beta::ScanRun] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Cloud::WebSecurityScanner::V1beta::ScanRun]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/web_security_scanner/v1beta/web_security_scanner/client.rb, line 812
def stop_scan_run request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebSecurityScanner::V1beta::StopScanRunRequest

  # 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.stop_scan_run.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  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::WebSecurityScanner::V1beta::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  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.stop_scan_run.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.stop_scan_run.retry_policy

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

  @web_security_scanner_stub.call_rpc :stop_scan_run, 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
update_scan_config(request, options = nil) { |response, operation| ... } click to toggle source

Updates a ScanConfig. This method support partial update of a ScanConfig.

@overload update_scan_config(request, options = nil)

Pass arguments to `update_scan_config` via a request object, either of type
{::Google::Cloud::WebSecurityScanner::V1beta::UpdateScanConfigRequest} or an equivalent Hash.

@param request [::Google::Cloud::WebSecurityScanner::V1beta::UpdateScanConfigRequest, ::Hash]
  A request object representing the call parameters. Required. To specify no
  parameters, or to keep all the default parameter values, pass an empty Hash.
@param options [::Gapic::CallOptions, ::Hash]
  Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

@overload update_scan_config(scan_config: nil, update_mask: nil)

Pass arguments to `update_scan_config` via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).

@param scan_config [::Google::Cloud::WebSecurityScanner::V1beta::ScanConfig, ::Hash]
  Required. The ScanConfig to be updated. The name field must be set to identify the
  resource to be updated. The values of fields not covered by the mask
  will be ignored.
@param update_mask [::Google::Protobuf::FieldMask, ::Hash]
  Required. The update mask applies to the resource. For the `FieldMask` definition,
  see
  https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask

@yield [response, operation] Access the result along with the RPC operation @yieldparam response [::Google::Cloud::WebSecurityScanner::V1beta::ScanConfig] @yieldparam operation [::GRPC::ActiveCall::Operation]

@return [::Google::Cloud::WebSecurityScanner::V1beta::ScanConfig]

@raise [::Google::Cloud::Error] if the RPC is aborted.

# File lib/google/cloud/web_security_scanner/v1beta/web_security_scanner/client.rb, line 524
def update_scan_config request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::WebSecurityScanner::V1beta::UpdateScanConfigRequest

  # 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_scan_config.metadata.to_h

  # Set x-goog-api-client and x-goog-user-project headers
  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::WebSecurityScanner::V1beta::VERSION
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {
    "scan_config.name" => request.scan_config.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_scan_config.timeout,
                         metadata:     metadata,
                         retry_policy: @config.rpcs.update_scan_config.retry_policy

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

  @web_security_scanner_stub.call_rpc :update_scan_config, 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