Class: Google::Cloud::SecurityCenter::V2::SecurityCenter::Client

Inherits:
Object
  • Object
show all
Includes:
Paths
Defined in:
lib/google/cloud/security_center/v2/security_center/client.rb

Overview

Client for the SecurityCenter service.

V2 APIs for Security Center service.

Defined Under Namespace

Classes: Configuration

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Paths

#big_query_export_path, #dlp_job_path, #external_system_path, #finding_path, #folder_location_path, #folder_path, #location_path, #mute_config_path, #notification_config_path, #organization_location_path, #organization_path, #organization_valued_resource_path, #policy_path, #project_path, #resource_value_config_path, #security_marks_path, #simulation_path, #source_path, #table_data_profile_path, #topic_path, #valued_resource_path

Constructor Details

#initialize {|config| ... } ⇒ Client

Create a new SecurityCenter client object.

Examples:


# Create a client using the default configuration
client = ::Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

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

Yields:

  • (config)

    Configure the SecurityCenter client.

Yield Parameters:



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 124

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/securitycenter/v2/securitycenter_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
  # 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.nil? ||
                           (@config.endpoint == Configuration::DEFAULT_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

  @operations_client = Operations.new do |config|
    config.credentials = credentials
    config.quota_project = @quota_project_id
    config.endpoint = @config.endpoint
    config.universe_domain = @config.universe_domain
  end

  @security_center_stub = ::Gapic::ServiceStub.new(
    ::Google::Cloud::SecurityCenter::V2::SecurityCenter::Stub,
    credentials: credentials,
    endpoint: @config.endpoint,
    endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
    universe_domain: @config.universe_domain,
    channel_args: @config.channel_args,
    interceptors: @config.interceptors,
    channel_pool_config: @config.channel_pool,
    logger: @config.logger
  )

  @security_center_stub.stub_logger&.info do |entry|
    entry.set_system_name
    entry.set_service
    entry.message = "Created client for #{entry.service}"
    entry.set_credentials_fields credentials
    entry.set "customEndpoint", @config.endpoint if @config.endpoint
    entry.set "defaultTimeout", @config.timeout if @config.timeout
    entry.set "quotaProject", @quota_project_id if @quota_project_id
  end
end

Instance Attribute Details

#operations_client::Google::Cloud::SecurityCenter::V2::SecurityCenter::Operations (readonly)

Get the associated client for long-running operations.



187
188
189
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 187

def operations_client
  @operations_client
end

Class Method Details

.configure {|config| ... } ⇒ Client::Configuration

Configure the SecurityCenter Client class.

See Configuration for a description of the configuration fields.

Examples:


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

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 62

def self.configure
  @configure ||= begin
    namespace = ["Google", "Cloud", "SecurityCenter", "V2"]
    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
  end
  yield @configure if block_given?
  @configure
end

Instance Method Details

#batch_create_resource_value_configs(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::BatchCreateResourceValueConfigsResponse #batch_create_resource_value_configs(parent: nil, requests: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::BatchCreateResourceValueConfigsResponse

Creates a ResourceValueConfig for an organization. Maps user's tags to difference resource values for use by the attack path simulation.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::BatchCreateResourceValueConfigsRequest.new

# Call the batch_create_resource_value_configs method.
result = client.batch_create_resource_value_configs request

# The returned object is of type Google::Cloud::SecurityCenter::V2::BatchCreateResourceValueConfigsResponse.
p result

Overloads:

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 249

def batch_create_resource_value_configs request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::BatchCreateResourceValueConfigsRequest

  # 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
   = @config.rpcs.batch_create_resource_value_configs..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

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

#bulk_mute_findings(request, options = nil) ⇒ ::Gapic::Operation #bulk_mute_findings(parent: nil, filter: nil, mute_state: nil) ⇒ ::Gapic::Operation

Kicks off an LRO to bulk mute findings for a parent based on a filter. If no location is specified, findings are muted in global. The parent can be either an organization, folder, or project. The findings matched by the filter will be muted after the LRO is done.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::BulkMuteFindingsRequest.new

# Call the bulk_mute_findings method.
result = client.bulk_mute_findings request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

Overloads:

  • #bulk_mute_findings(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to bulk_mute_findings via a request object, either of type BulkMuteFindingsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::BulkMuteFindingsRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #bulk_mute_findings(parent: nil, filter: nil, mute_state: nil) ⇒ ::Gapic::Operation

    Pass arguments to bulk_mute_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).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The parent, at which bulk action needs to be applied. If no location is specified, findings are updated in global. The following list shows some examples:

      • organizations/[organization_id]
      • organizations/[organization_id]/locations/[location_id]
      • folders/[folder_id]
      • folders/[folder_id]/locations/[location_id]
      • projects/[project_id]
      • projects/[project_id]/locations/[location_id]
    • filter (::String) (defaults to: nil)

      Expression that identifies findings that should be updated. The expression is a list of zero or more restrictions combined via logical operators AND and OR. Parentheses are supported, and OR has higher precedence than AND.

      Restrictions have the form <field> <operator> <value> and may have a - character in front of them to indicate negation. The fields map to those defined in the corresponding resource.

      The supported operators are:

      • = for all value types.
      • >, <, >=, <= for integer values.
      • :, meaning substring matching, for strings.

      The supported value types are:

      • string literals in quotes.
      • integer literals without quotes.
      • boolean literals true and false without quotes.
    • mute_state (::Google::Cloud::SecurityCenter::V2::BulkMuteFindingsRequest::MuteState) (defaults to: nil)

      Optional. All findings matching the given filter will have their mute state set to this value. The default value is MUTED. Setting this to UNDEFINED will clear the mute state on all matching findings.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)

Returns:

  • (::Gapic::Operation)

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 378

def bulk_mute_findings request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::BulkMuteFindingsRequest

  # 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
   = @config.rpcs.bulk_mute_findings..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

  @security_center_stub.call_rpc :bulk_mute_findings, request, options: options do |response, operation|
    response = ::Gapic::Operation.new response, @operations_client, options: options
    yield response, operation if block_given?
    throw :response, response
  end
rescue ::GRPC::BadStatus => e
  raise ::Google::Cloud::Error.from_error(e)
end

#configure {|config| ... } ⇒ Client::Configuration

Configure the SecurityCenter 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 configure.

See Configuration for a description of the configuration fields.

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



94
95
96
97
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 94

def configure
  yield @config if block_given?
  @config
end

#create_big_query_export(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::BigQueryExport #create_big_query_export(parent: nil, big_query_export: nil, big_query_export_id: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::BigQueryExport

Creates a BigQuery export.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::CreateBigQueryExportRequest.new

# Call the create_big_query_export method.
result = client.create_big_query_export request

# The returned object is of type Google::Cloud::SecurityCenter::V2::BigQueryExport.
p result

Overloads:

  • #create_big_query_export(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::BigQueryExport

    Pass arguments to create_big_query_export via a request object, either of type CreateBigQueryExportRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::CreateBigQueryExportRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_big_query_export(parent: nil, big_query_export: nil, big_query_export_id: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::BigQueryExport

    Pass arguments to create_big_query_export 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).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The name of the parent resource of the new BigQuery export. Its format is organizations/[organization_id]/locations/[location_id], folders/[folder_id]/locations/[location_id], or projects/[project_id]/locations/[location_id].

    • big_query_export (::Google::Cloud::SecurityCenter::V2::BigQueryExport, ::Hash) (defaults to: nil)

      Required. The BigQuery export being created.

    • big_query_export_id (::String) (defaults to: nil)

      Required. Unique identifier provided by the client within the parent scope. It must consist of only lowercase letters, numbers, and hyphens, must start with a letter, must end with either a letter or a number, and must be 63 characters or less.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 475

def create_big_query_export request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::CreateBigQueryExportRequest

  # 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
   = @config.rpcs.create_big_query_export..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

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

#create_finding(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Finding #create_finding(parent: nil, finding_id: nil, finding: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Finding

Creates a finding in a location. The corresponding source must exist for finding creation to succeed.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::CreateFindingRequest.new

# Call the create_finding method.
result = client.create_finding request

# The returned object is of type Google::Cloud::SecurityCenter::V2::Finding.
p result

Overloads:

  • #create_finding(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Finding

    Pass arguments to create_finding via a request object, either of type CreateFindingRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::CreateFindingRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_finding(parent: nil, finding_id: nil, finding: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Finding

    Pass arguments to create_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).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. Resource name of the new finding's parent. The following list shows some examples of the format: + organizations/[organization_id]/sources/[source_id] + organizations/[organization_id]/sources/[source_id]/locations/[location_id]

    • finding_id (::String) (defaults to: nil)

      Required. Unique identifier provided by the client within the parent scope. It must be alphanumeric and less than or equal to 32 characters and greater than 0 characters in length.

    • finding (::Google::Cloud::SecurityCenter::V2::Finding, ::Hash) (defaults to: nil)

      Required. The Finding being created. The name and security_marks will be ignored as they are both output only fields on this resource.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 573

def create_finding request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::CreateFindingRequest

  # 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
   = @config.rpcs.create_finding..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

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

#create_mute_config(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::MuteConfig #create_mute_config(parent: nil, mute_config: nil, mute_config_id: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::MuteConfig

Creates a mute config.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::CreateMuteConfigRequest.new

# Call the create_mute_config method.
result = client.create_mute_config request

# The returned object is of type Google::Cloud::SecurityCenter::V2::MuteConfig.
p result

Overloads:

  • #create_mute_config(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::MuteConfig

    Pass arguments to create_mute_config via a request object, either of type CreateMuteConfigRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::CreateMuteConfigRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_mute_config(parent: nil, mute_config: nil, mute_config_id: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::MuteConfig

    Pass arguments to create_mute_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).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. Resource name of the new mute configs's parent. Its format is organizations/[organization_id]/locations/[location_id], folders/[folder_id]/locations/[location_id], or projects/[project_id]/locations/[location_id].

    • mute_config (::Google::Cloud::SecurityCenter::V2::MuteConfig, ::Hash) (defaults to: nil)

      Required. The mute config being created.

    • mute_config_id (::String) (defaults to: nil)

      Required. Unique identifier provided by the client within the parent scope. It must consist of only lowercase letters, numbers, and hyphens, must start with a letter, must end with either a letter or a number, and must be 63 characters or less.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 668

def create_mute_config request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::CreateMuteConfigRequest

  # 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
   = @config.rpcs.create_mute_config..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    regex_match = %r{^projects/[^/]+/locations/(?<location>[^/]+)/?$}.match request.parent
    if regex_match
      header_params["location"] = regex_match["location".to_s]
    end
  end
  if request.parent
    regex_match = %r{^organizations/[^/]+/locations/(?<location>[^/]+)/?$}.match request.parent
    if regex_match
      header_params["location"] = regex_match["location".to_s]
    end
  end
  if request.parent
    regex_match = %r{^folders/[^/]+/locations/(?<location>[^/]+)/?$}.match request.parent
    if regex_match
      header_params["location"] = regex_match["location".to_s]
    end
  end

  request_params_header = URI.encode_www_form header_params
  [:"x-goog-request-params"] ||= request_params_header

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

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

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

#create_notification_config(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::NotificationConfig #create_notification_config(parent: nil, config_id: nil, notification_config: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::NotificationConfig

Creates a notification config.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::CreateNotificationConfigRequest.new

# Call the create_notification_config method.
result = client.create_notification_config request

# The returned object is of type Google::Cloud::SecurityCenter::V2::NotificationConfig.
p result

Overloads:

  • #create_notification_config(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::NotificationConfig

    Pass arguments to create_notification_config via a request object, either of type CreateNotificationConfigRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::CreateNotificationConfigRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_notification_config(parent: nil, config_id: nil, notification_config: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::NotificationConfig

    Pass arguments to create_notification_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).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. Resource name of the new notification config's parent. Its format is organizations/[organization_id]/locations/[location_id], folders/[folder_id]/locations/[location_id], or projects/[project_id]/locations/[location_id].

    • config_id (::String) (defaults to: nil)

      Required. Unique identifier provided by the client within the parent scope. It must be between 1 and 128 characters and contain alphanumeric characters, underscores, or hyphens only.

    • notification_config (::Google::Cloud::SecurityCenter::V2::NotificationConfig, ::Hash) (defaults to: nil)

      Required. The notification config being created. The name and the service account will be ignored as they are both output only fields on this resource.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 780

def create_notification_config request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::CreateNotificationConfigRequest

  # 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
   = @config.rpcs.create_notification_config..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

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

#create_source(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Source #create_source(parent: nil, source: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Source

Creates a source.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::CreateSourceRequest.new

# Call the create_source method.
result = client.create_source request

# The returned object is of type Google::Cloud::SecurityCenter::V2::Source.
p result

Overloads:

  • #create_source(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Source

    Pass arguments to create_source via a request object, either of type CreateSourceRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::CreateSourceRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #create_source(parent: nil, source: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Source

    Pass arguments to create_source 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).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. Resource name of the new source's parent. Its format should be organizations/[organization_id].

    • source (::Google::Cloud::SecurityCenter::V2::Source, ::Hash) (defaults to: nil)

      Required. The Source being created, only the display_name and description will be used. All other fields will be ignored.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 869

def create_source request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::CreateSourceRequest

  # 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
   = @config.rpcs.create_source..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

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

#delete_big_query_export(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_big_query_export(name: nil) ⇒ ::Google::Protobuf::Empty

Deletes an existing BigQuery export.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::DeleteBigQueryExportRequest.new

# Call the delete_big_query_export method.
result = client.delete_big_query_export request

# The returned object is of type Google::Protobuf::Empty.
p result

Overloads:

  • #delete_big_query_export(request, options = nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_big_query_export via a request object, either of type DeleteBigQueryExportRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::DeleteBigQueryExportRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #delete_big_query_export(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_big_query_export 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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of the BigQuery export to delete. The following list shows some examples of the format:

      + organizations/{organization}/locations/{location}/bigQueryExports/{export_id}

      • folders/{folder}/locations/{location}/bigQueryExports/{export_id}
      • projects/{project}/locations/{location}/bigQueryExports/{export_id}

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 960

def delete_big_query_export request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::DeleteBigQueryExportRequest

  # 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
   = @config.rpcs.delete_big_query_export..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

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

#delete_mute_config(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_mute_config(name: nil) ⇒ ::Google::Protobuf::Empty

Deletes an existing mute config. If no location is specified, default is global.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::DeleteMuteConfigRequest.new

# Call the delete_mute_config method.
result = client.delete_mute_config request

# The returned object is of type Google::Protobuf::Empty.
p result

Overloads:

  • #delete_mute_config(request, options = nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_mute_config via a request object, either of type DeleteMuteConfigRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::DeleteMuteConfigRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #delete_mute_config(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_mute_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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. Name of the mute config to delete. The following list shows some examples of the format:

      • organizations/{organization}/muteConfigs/{config_id} + organizations/{organization}/locations/{location}/muteConfigs/{config_id}
      • folders/{folder}/muteConfigs/{config_id}
      • folders/{folder}/locations/{location}/muteConfigs/{config_id}
      • projects/{project}/muteConfigs/{config_id}
      • projects/{project}/locations/{location}/muteConfigs/{config_id}

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 1055

def delete_mute_config request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::DeleteMuteConfigRequest

  # 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
   = @config.rpcs.delete_mute_config..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    regex_match = %r{^projects/[^/]+/locations/(?<location>[^/]+)/muteConfigs/[^/]+/?$}.match request.name
    if regex_match
      header_params["location"] = regex_match["location".to_s]
    end
  end
  if request.name
    regex_match = %r{^organizations/[^/]+/locations/(?<location>[^/]+)/muteConfigs/[^/]+/?$}.match request.name
    if regex_match
      header_params["location"] = regex_match["location".to_s]
    end
  end
  if request.name
    regex_match = %r{^folders/[^/]+/locations/(?<location>[^/]+)/muteConfigs/[^/]+/?$}.match request.name
    if regex_match
      header_params["location"] = regex_match["location".to_s]
    end
  end

  request_params_header = URI.encode_www_form header_params
  [:"x-goog-request-params"] ||= request_params_header

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

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

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

#delete_notification_config(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_notification_config(name: nil) ⇒ ::Google::Protobuf::Empty

Deletes a notification config.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::DeleteNotificationConfigRequest.new

# Call the delete_notification_config method.
result = client.delete_notification_config request

# The returned object is of type Google::Protobuf::Empty.
p result

Overloads:

  • #delete_notification_config(request, options = nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_notification_config via a request object, either of type DeleteNotificationConfigRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::DeleteNotificationConfigRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #delete_notification_config(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_notification_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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. Name of the notification config to delete. The following list shows some examples of the format:

      + organizations/[organization_id]/locations/[location_id]/notificationConfigs/[config_id] + folders/[folder_id]/locations/[location_id]notificationConfigs/[config_id] + projects/[project_id]/locations/[location_id]notificationConfigs/[config_id]

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 1163

def delete_notification_config request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::DeleteNotificationConfigRequest

  # 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
   = @config.rpcs.delete_notification_config..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

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

#delete_resource_value_config(request, options = nil) ⇒ ::Google::Protobuf::Empty #delete_resource_value_config(name: nil) ⇒ ::Google::Protobuf::Empty

Deletes a ResourceValueConfig.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::DeleteResourceValueConfigRequest.new

# Call the delete_resource_value_config method.
result = client.delete_resource_value_config request

# The returned object is of type Google::Protobuf::Empty.
p result

Overloads:

  • #delete_resource_value_config(request, options = nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_resource_value_config via a request object, either of type DeleteResourceValueConfigRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::DeleteResourceValueConfigRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #delete_resource_value_config(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_resource_value_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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. Name of the ResourceValueConfig to delete

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 1248

def delete_resource_value_config request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::DeleteResourceValueConfigRequest

  # 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
   = @config.rpcs.delete_resource_value_config..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

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

#get_big_query_export(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::BigQueryExport #get_big_query_export(name: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::BigQueryExport

Gets a BigQuery export.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::GetBigQueryExportRequest.new

# Call the get_big_query_export method.
result = client.get_big_query_export request

# The returned object is of type Google::Cloud::SecurityCenter::V2::BigQueryExport.
p result

Overloads:

  • #get_big_query_export(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::BigQueryExport

    Pass arguments to get_big_query_export via a request object, either of type GetBigQueryExportRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::GetBigQueryExportRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_big_query_export(name: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::BigQueryExport

    Pass arguments to get_big_query_export 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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. Name of the BigQuery export to retrieve. The following list shows some examples of the format:

      + organizations/{organization}/locations/{location}/bigQueryExports/{export_id}

      • folders/{folder}/locations/{location}/bigQueryExports/{export_id}
      • projects/{project}locations/{location}//bigQueryExports/{export_id}

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 1339

def get_big_query_export request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::GetBigQueryExportRequest

  # 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
   = @config.rpcs.get_big_query_export..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

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

#get_iam_policy(request, options = nil) ⇒ ::Google::Iam::V1::Policy #get_iam_policy(resource: nil, options: nil) ⇒ ::Google::Iam::V1::Policy

Gets the access control policy on the specified Source.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V1::GetIamPolicyRequest.new

# Call the get_iam_policy method.
result = client.get_iam_policy request

# The returned object is of type Google::Iam::V1::Policy.
p result

Overloads:

  • #get_iam_policy(request, options = nil) ⇒ ::Google::Iam::V1::Policy

    Pass arguments to get_iam_policy via a request object, either of type Iam::V1::GetIamPolicyRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Iam::V1::GetIamPolicyRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_iam_policy(resource: nil, options: nil) ⇒ ::Google::Iam::V1::Policy

    Pass arguments to get_iam_policy 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).

    Parameters:

    • resource (::String) (defaults to: nil)

      REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

    • options (::Google::Iam::V1::GetPolicyOptions, ::Hash) (defaults to: nil)

      OPTIONAL: A GetPolicyOptions object for specifying options to GetIamPolicy.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 1606

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
   = @config.rpcs.get_iam_policy..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.resource
    header_params["resource"] = request.resource
  end

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

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

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

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

#get_mute_config(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::MuteConfig #get_mute_config(name: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::MuteConfig

Gets a mute config. If no location is specified, default is global.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::GetMuteConfigRequest.new

# Call the get_mute_config method.
result = client.get_mute_config request

# The returned object is of type Google::Cloud::SecurityCenter::V2::MuteConfig.
p result

Overloads:

  • #get_mute_config(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::MuteConfig

    Pass arguments to get_mute_config via a request object, either of type GetMuteConfigRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::GetMuteConfigRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_mute_config(name: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::MuteConfig

    Pass arguments to get_mute_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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. Name of the mute config to retrieve. The following list shows some examples of the format:

      • organizations/{organization}/muteConfigs/{config_id} + organizations/{organization}/locations/{location}/muteConfigs/{config_id}
      • folders/{folder}/muteConfigs/{config_id}
      • folders/{folder}/locations/{location}/muteConfigs/{config_id}
      • projects/{project}/muteConfigs/{config_id}
      • projects/{project}/locations/{location}/muteConfigs/{config_id}

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 1701

def get_mute_config request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::GetMuteConfigRequest

  # 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
   = @config.rpcs.get_mute_config..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    regex_match = %r{^projects/[^/]+/locations/(?<location>[^/]+)/muteConfigs/[^/]+/?$}.match request.name
    if regex_match
      header_params["location"] = regex_match["location".to_s]
    end
  end
  if request.name
    regex_match = %r{^organizations/[^/]+/locations/(?<location>[^/]+)/muteConfigs/[^/]+/?$}.match request.name
    if regex_match
      header_params["location"] = regex_match["location".to_s]
    end
  end
  if request.name
    regex_match = %r{^folders/[^/]+/locations/(?<location>[^/]+)/muteConfigs/[^/]+/?$}.match request.name
    if regex_match
      header_params["location"] = regex_match["location".to_s]
    end
  end

  request_params_header = URI.encode_www_form header_params
  [:"x-goog-request-params"] ||= request_params_header

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

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

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

#get_notification_config(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::NotificationConfig #get_notification_config(name: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::NotificationConfig

Gets a notification config.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::GetNotificationConfigRequest.new

# Call the get_notification_config method.
result = client.get_notification_config request

# The returned object is of type Google::Cloud::SecurityCenter::V2::NotificationConfig.
p result

Overloads:

  • #get_notification_config(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::NotificationConfig

    Pass arguments to get_notification_config via a request object, either of type GetNotificationConfigRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::GetNotificationConfigRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_notification_config(name: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::NotificationConfig

    Pass arguments to get_notification_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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. Name of the notification config to get. The following list shows some examples of the format:

      + organizations/[organization_id]/locations/[location_id]/notificationConfigs/[config_id] + folders/[folder_id]/locations/[location_id]/notificationConfigs/[config_id] + projects/[project_id]/locations/[location_id]/notificationConfigs/[config_id]

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 1809

def get_notification_config request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::GetNotificationConfigRequest

  # 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
   = @config.rpcs.get_notification_config..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

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

#get_resource_value_config(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::ResourceValueConfig #get_resource_value_config(name: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::ResourceValueConfig

Gets a ResourceValueConfig.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::GetResourceValueConfigRequest.new

# Call the get_resource_value_config method.
result = client.get_resource_value_config request

# The returned object is of type Google::Cloud::SecurityCenter::V2::ResourceValueConfig.
p result

Overloads:

  • #get_resource_value_config(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::ResourceValueConfig

    Pass arguments to get_resource_value_config via a request object, either of type GetResourceValueConfigRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::GetResourceValueConfigRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_resource_value_config(name: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::ResourceValueConfig

    Pass arguments to get_resource_value_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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. Name of the resource value config to retrieve. Its format is organizations/{organization}/resourceValueConfigs/{config_id}.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 1895

def get_resource_value_config request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::GetResourceValueConfigRequest

  # 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
   = @config.rpcs.get_resource_value_config..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

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

#get_simulation(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Simulation #get_simulation(name: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Simulation

Get the simulation by name or the latest simulation for the given organization.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::GetSimulationRequest.new

# Call the get_simulation method.
result = client.get_simulation request

# The returned object is of type Google::Cloud::SecurityCenter::V2::Simulation.
p result

Overloads:

  • #get_simulation(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Simulation

    Pass arguments to get_simulation via a request object, either of type GetSimulationRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::GetSimulationRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_simulation(name: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Simulation

    Pass arguments to get_simulation 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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The organization name or simulation name of this simulation

      Valid format: organizations/{organization}/simulations/latest organizations/{organization}/simulations/{simulation}

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 1429

def get_simulation request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::GetSimulationRequest

  # 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
   = @config.rpcs.get_simulation..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

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

#get_source(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Source #get_source(name: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Source

Gets a source.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::GetSourceRequest.new

# Call the get_source method.
result = client.get_source request

# The returned object is of type Google::Cloud::SecurityCenter::V2::Source.
p result

Overloads:

  • #get_source(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Source

    Pass arguments to get_source via a request object, either of type GetSourceRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::GetSourceRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_source(name: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Source

    Pass arguments to get_source 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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. Relative resource name of the source. Its format is organizations/[organization_id]/source/[source_id].

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 1981

def get_source request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::GetSourceRequest

  # 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
   = @config.rpcs.get_source..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

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

#get_valued_resource(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::ValuedResource #get_valued_resource(name: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::ValuedResource

Get the valued resource by name

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::GetValuedResourceRequest.new

# Call the get_valued_resource method.
result = client.get_valued_resource request

# The returned object is of type Google::Cloud::SecurityCenter::V2::ValuedResource.
p result

Overloads:

  • #get_valued_resource(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::ValuedResource

    Pass arguments to get_valued_resource via a request object, either of type GetValuedResourceRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::GetValuedResourceRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #get_valued_resource(name: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::ValuedResource

    Pass arguments to get_valued_resource 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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The name of this valued resource

      Valid format: organizations/{organization}/simulations/{simulation}/valuedResources/{valued_resource}

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 1517

def get_valued_resource request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::GetValuedResourceRequest

  # 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
   = @config.rpcs.get_valued_resource..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

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

#group_findings(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::GroupResult> #group_findings(parent: nil, filter: nil, group_by: nil, page_token: nil, page_size: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::GroupResult>

Filters an organization or source's findings and groups them by their specified properties in a location. If no location is specified, findings are assumed to be in global

To group across all sources provide a - as the source id. The following list shows some examples:

  • /v2/organizations/{organization_id}/sources/-/findings + /v2/organizations/{organization_id}/sources/-/locations/{location_id}/findings
  • /v2/folders/{folder_id}/sources/-/findings
  • /v2/folders/{folder_id}/sources/-/locations/{location_id}/findings
  • /v2/projects/{project_id}/sources/-/findings
  • /v2/projects/{project_id}/sources/-/locations/{location_id}/findings

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::GroupFindingsRequest.new

# Call the group_findings method.
result = client.group_findings request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::SecurityCenter::V2::GroupResult.
  p item
end

Overloads:

  • #group_findings(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::GroupResult>

    Pass arguments to group_findings via a request object, either of type GroupFindingsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::GroupFindingsRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #group_findings(parent: nil, filter: nil, group_by: nil, page_token: nil, page_size: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::GroupResult>

    Pass arguments to group_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).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. Name of the source to groupBy. If no location is specified, finding is assumed to be in global. The following list shows some examples:

      • organizations/[organization_id]/sources/[source_id] + organizations/[organization_id]/sources/[source_id]/locations/[location_id]
      • folders/[folder_id]/sources/[source_id]
      • folders/[folder_id]/sources/[source_id]/locations/[location_id]
      • projects/[project_id]/sources/[source_id]
      • projects/[project_id]/sources/[source_id]/locations/[location_id]

      To groupBy across all sources provide a source_id of -. The following list shows some examples:

      • organizations/{organization_id}/sources/-
      • organizations/{organization_id}/sources/-/locations/[location_id]
      • folders/{folder_id}/sources/-
      • folders/{folder_id}/sources/-/locations/[location_id]
      • projects/{project_id}/sources/-
      • projects/{project_id}/sources/-/locations/[location_id]
    • filter (::String) (defaults to: nil)

      Expression that defines the filter to apply across findings. The expression is a list of one or more restrictions combined via logical operators AND and OR. Parentheses are supported, and OR has higher precedence than AND.

      Restrictions have the form <field> <operator> <value> and may have a - character in front of them to indicate negation. Examples include:

      • name
      • security_marks.marks.marka

      The supported operators are:

      • = for all value types.
      • >, <, >=, <= for integer values.
      • :, meaning substring matching, for strings.

      The supported value types are:

      • string literals in quotes.
      • integer literals without quotes.
      • boolean literals true and false without quotes.

      The following field and operator combinations are supported:

      • name: =
      • parent: =, :
      • resource_name: =, :
      • state: =, :
      • category: =, :
      • external_uri: =, :
      • event_time: =, >, <, >=, <=

      Usage: This should be milliseconds since epoch or an RFC3339 string. Examples: event_time = "2019-06-10T16:07:18-07:00" event_time = 1560208038000

      • severity: =, :
      • security_marks.marks: =, :
      • resource:
        • resource.name: =, :
        • resource.parent_name: =, :
        • resource.parent_display_name: =, :
        • resource.project_name: =, :
        • resource.project_display_name: =, :
        • resource.type: =, :
    • group_by (::String) (defaults to: nil)

      Required. Expression that defines what assets fields to use for grouping. The string value should follow SQL syntax: comma separated list of fields. For example: "parent,resource_name".

    • page_token (::String) (defaults to: nil)

      The value returned by the last GroupFindingsResponse; indicates that this is a continuation of a prior GroupFindings call, and that the system should return the next page of data.

    • page_size (::Integer) (defaults to: nil)

      The maximum number of results to return in a single response. Default is 10, minimum is 1, maximum is 1000.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 2162

def group_findings request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::GroupFindingsRequest

  # 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
   = @config.rpcs.group_findings..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

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

#list_attack_paths(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::AttackPath> #list_attack_paths(parent: nil, filter: nil, page_token: nil, page_size: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::AttackPath>

Lists the attack paths for a set of simulation results or valued resources and filter.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::ListAttackPathsRequest.new

# Call the list_attack_paths method.
result = client.list_attack_paths request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::SecurityCenter::V2::AttackPath.
  p item
end

Overloads:

  • #list_attack_paths(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::AttackPath>

    Pass arguments to list_attack_paths via a request object, either of type ListAttackPathsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::ListAttackPathsRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_attack_paths(parent: nil, filter: nil, page_token: nil, page_size: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::AttackPath>

    Pass arguments to list_attack_paths 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).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. Name of parent to list attack paths.

      Valid formats: organizations/{organization}, organizations/{organization}/simulations/{simulation} organizations/{organization}/simulations/{simulation}/attackExposureResults/{attack_exposure_result_v2} organizations/{organization}/simulations/{simulation}/valuedResources/{valued_resource}

    • filter (::String) (defaults to: nil)

      The filter expression that filters the attack path in the response. Supported fields:

      • valued_resources supports =
    • page_token (::String) (defaults to: nil)

      The value returned by the last ListAttackPathsResponse; indicates that this is a continuation of a prior ListAttackPaths call, and that the system should return the next page of data.

    • page_size (::Integer) (defaults to: nil)

      The maximum number of results to return in a single response. Default is 10, minimum is 1, maximum is 1000.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 2272

def list_attack_paths request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::ListAttackPathsRequest

  # 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
   = @config.rpcs.list_attack_paths..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

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

#list_big_query_exports(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::BigQueryExport> #list_big_query_exports(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::BigQueryExport>

Lists BigQuery exports. Note that when requesting BigQuery exports at a given level all exports under that level are also returned e.g. if requesting BigQuery exports under a folder, then all BigQuery exports immediately under the folder plus the ones created under the projects within the folder are returned.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::ListBigQueryExportsRequest.new

# Call the list_big_query_exports method.
result = client.list_big_query_exports request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::SecurityCenter::V2::BigQueryExport.
  p item
end

Overloads:

  • #list_big_query_exports(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::BigQueryExport>

    Pass arguments to list_big_query_exports via a request object, either of type ListBigQueryExportsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::ListBigQueryExportsRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_big_query_exports(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::BigQueryExport>

    Pass arguments to list_big_query_exports 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).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The parent, which owns the collection of BigQuery exports. Its format is organizations/[organization_id]/locations/[location_id], folders/[folder_id]/locations/[location_id], or projects/[project_id]/locations/[location_id].

    • page_size (::Integer) (defaults to: nil)

      The maximum number of configs to return. The service may return fewer than this value. If unspecified, at most 10 configs will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.

    • page_token (::String) (defaults to: nil)

      A page token, received from a previous ListBigQueryExports call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to ListBigQueryExports must match the call that provided the page token.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 2380

def list_big_query_exports request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::ListBigQueryExportsRequest

  # 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
   = @config.rpcs.list_big_query_exports..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

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

#list_findings(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::ListFindingsResponse::ListFindingsResult> #list_findings(parent: nil, filter: nil, order_by: nil, field_mask: nil, page_token: nil, page_size: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::ListFindingsResponse::ListFindingsResult>

Lists an organization or source's findings.

To list across all sources for a given location provide a - as the source id. If no location is specified, finding are assumed to be in global. The following list shows some examples:

  • /v2/organizations/{organization_id}/sources/-/findings + /v2/organizations/{organization_id}/sources/-/locations/{location_id}/findings

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::ListFindingsRequest.new

# Call the list_findings method.
result = client.list_findings request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::SecurityCenter::V2::ListFindingsResponse::ListFindingsResult.
  p item
end

Overloads:

  • #list_findings(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::ListFindingsResponse::ListFindingsResult>

    Pass arguments to list_findings via a request object, either of type ListFindingsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_findings(parent: nil, filter: nil, order_by: nil, field_mask: nil, page_token: nil, page_size: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::ListFindingsResponse::ListFindingsResult>

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

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. Name of the source the findings belong to. If no location is specified, the default is global. The following list shows some examples:

      • organizations/[organization_id]/sources/[source_id] + organizations/[organization_id]/sources/[source_id]/locations/[location_id]
      • folders/[folder_id]/sources/[source_id]
      • folders/[folder_id]/sources/[source_id]/locations/[location_id]
      • projects/[project_id]/sources/[source_id]
      • projects/[project_id]/sources/[source_id]/locations/[location_id]

      To list across all sources provide a source_id of -. The following list shows some examples:

      • organizations/{organization_id}/sources/-
      • organizations/{organization_id}/sources/-/locations/{location_id}
      • folders/{folder_id}/sources/-
      • folders/{folder_id}/sources/-locations/{location_id}
      • projects/{projects_id}/sources/-
      • projects/{projects_id}/sources/-/locations/{location_id}
    • filter (::String) (defaults to: nil)

      Expression that defines the filter to apply across findings. The expression is a list of one or more restrictions combined via logical operators AND and OR. Parentheses are supported, and OR has higher precedence than AND.

      Restrictions have the form <field> <operator> <value> and may have a - character in front of them to indicate negation. Examples include:

      • name
      • security_marks.marks.marka

      The supported operators are:

      • = for all value types.
      • >, <, >=, <= for integer values.
      • :, meaning substring matching, for strings.

      The supported value types are:

      • string literals in quotes.
      • integer literals without quotes.
      • boolean literals true and false without quotes.

      The following field and operator combinations are supported:

      • name: =
      • parent: =, :
      • resource_name: =, :
      • state: =, :
      • category: =, :
      • external_uri: =, :
      • event_time: =, >, <, >=, <=

      Usage: This should be milliseconds since epoch or an RFC3339 string. Examples: event_time = "2019-06-10T16:07:18-07:00" event_time = 1560208038000

      • severity: =, :
      • security_marks.marks: =, :
      • resource:
        • resource.name: =, :
        • resource.parent_name: =, :
        • resource.parent_display_name: =, :
        • resource.project_name: =, :
        • resource.project_display_name: =, :
        • resource.type: =, :
        • resource.folders.resource_folder: =, :
        • resource.display_name: =, :
    • order_by (::String) (defaults to: nil)

      Expression that defines what fields and order to use for sorting. The string value should follow SQL syntax: comma separated list of fields. For example: "name,parent". The default sorting order is ascending. To specify descending order for a field, a suffix " desc" should be appended to the field name. For example: "name desc,parent". Redundant space characters in the syntax are insignificant. "name desc,parent" and " name desc , parent " are equivalent.

      The following fields are supported: name parent state category resource_name event_time security_marks.marks

    • field_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      A field mask to specify the Finding fields to be listed in the response. An empty field mask will list all fields.

    • page_token (::String) (defaults to: nil)

      The value returned by the last ListFindingsResponse; indicates that this is a continuation of a prior ListFindings call, and that the system should return the next page of data.

    • page_size (::Integer) (defaults to: nil)

      The maximum number of results to return in a single response. Default is 10, minimum is 1, maximum is 1000.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 2576

def list_findings request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::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
   = @config.rpcs.list_findings..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

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

#list_mute_configs(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::MuteConfig> #list_mute_configs(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::MuteConfig>

Lists mute configs. If no location is specified, default is global.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::ListMuteConfigsRequest.new

# Call the list_mute_configs method.
result = client.list_mute_configs request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::SecurityCenter::V2::MuteConfig.
  p item
end

Overloads:

  • #list_mute_configs(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::MuteConfig>

    Pass arguments to list_mute_configs via a request object, either of type ListMuteConfigsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::ListMuteConfigsRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_mute_configs(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::MuteConfig>

    Pass arguments to list_mute_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).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The parent, which owns the collection of mute configs. Its format is organizations/[organization_id]", "folders/[folder_id], projects/[project_id], organizations/[organization_id]/locations/[location_id], folders/[folder_id]/locations/[location_id], projects/[project_id]/locations/[location_id].

    • page_size (::Integer) (defaults to: nil)

      The maximum number of configs to return. The service may return fewer than this value. If unspecified, at most 10 configs will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.

    • page_token (::String) (defaults to: nil)

      A page token, received from a previous ListMuteConfigs call. Provide this to retrieve the subsequent page.

      When paginating, all other parameters provided to ListMuteConfigs must match the call that provided the page token.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 2684

def list_mute_configs request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::ListMuteConfigsRequest

  # 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
   = @config.rpcs.list_mute_configs..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    regex_match = %r{^projects/[^/]+/locations/(?<location>[^/]+)/muteConfigs/?$}.match request.parent
    if regex_match
      header_params["location"] = regex_match["location".to_s]
    end
  end
  if request.parent
    regex_match = %r{^organizations/[^/]+/locations/(?<location>[^/]+)/muteConfigs/?$}.match request.parent
    if regex_match
      header_params["location"] = regex_match["location".to_s]
    end
  end
  if request.parent
    regex_match = %r{^folders/[^/]+/locations/(?<location>[^/]+)/muteConfigs/?$}.match request.parent
    if regex_match
      header_params["location"] = regex_match["location".to_s]
    end
  end

  request_params_header = URI.encode_www_form header_params
  [:"x-goog-request-params"] ||= request_params_header

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

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

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

#list_notification_configs(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::NotificationConfig> #list_notification_configs(parent: nil, page_token: nil, page_size: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::NotificationConfig>

Lists notification configs.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::ListNotificationConfigsRequest.new

# Call the list_notification_configs method.
result = client.list_notification_configs request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::SecurityCenter::V2::NotificationConfig.
  p item
end

Overloads:

  • #list_notification_configs(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::NotificationConfig>

    Pass arguments to list_notification_configs via a request object, either of type ListNotificationConfigsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::ListNotificationConfigsRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_notification_configs(parent: nil, page_token: nil, page_size: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::NotificationConfig>

    Pass arguments to list_notification_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).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The name of the parent in which to list the notification configurations. Its format is "organizations/[organization_id]/locations/[location_id]", "folders/[folder_id]/locations/[location_id]", or "projects/[project_id]/locations/[location_id]".

    • page_token (::String) (defaults to: nil)

      The value returned by the last ListNotificationConfigsResponse; indicates that this is a continuation of a prior ListNotificationConfigs call, and that the system should return the next page of data.

    • page_size (::Integer) (defaults to: nil)

      The maximum number of results to return in a single response. Default is 10, minimum is 1, maximum is 1000.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 2801

def list_notification_configs request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::ListNotificationConfigsRequest

  # 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
   = @config.rpcs.list_notification_configs..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

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

#list_resource_value_configs(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::ResourceValueConfig> #list_resource_value_configs(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::ResourceValueConfig>

Lists all ResourceValueConfigs.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::ListResourceValueConfigsRequest.new

# Call the list_resource_value_configs method.
result = client.list_resource_value_configs request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::SecurityCenter::V2::ResourceValueConfig.
  p item
end

Overloads:

  • #list_resource_value_configs(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::ResourceValueConfig>

    Pass arguments to list_resource_value_configs via a request object, either of type ListResourceValueConfigsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::ListResourceValueConfigsRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_resource_value_configs(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::ResourceValueConfig>

    Pass arguments to list_resource_value_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).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. The parent, which owns the collection of resource value configs. Its format is organizations/[organization_id]

    • page_size (::Integer) (defaults to: nil)

      The maximum number of configs to return. The service may return fewer than this value. If unspecified, at most 10 configs will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.

    • page_token (::String) (defaults to: nil)

      A page token, received from a previous ListResourceValueConfigs call. Provide this to retrieve the subsequent page.

      When paginating, all other parameters provided to ListResourceValueConfigs must match the call that provided the page token.

      page_size can be specified, and the new page_size will be used.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 2908

def list_resource_value_configs request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::ListResourceValueConfigsRequest

  # 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
   = @config.rpcs.list_resource_value_configs..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

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

#list_sources(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::Source> #list_sources(parent: nil, page_token: nil, page_size: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::Source>

Lists all sources belonging to an organization.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::ListSourcesRequest.new

# Call the list_sources method.
result = client.list_sources request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::SecurityCenter::V2::Source.
  p item
end

Overloads:

  • #list_sources(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::Source>

    Pass arguments to list_sources via a request object, either of type ListSourcesRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::ListSourcesRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_sources(parent: nil, page_token: nil, page_size: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::Source>

    Pass arguments to list_sources 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).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. Resource name of the parent of sources to list. Its format should be organizations/[organization_id], folders/[folder_id], or projects/[project_id].

    • page_token (::String) (defaults to: nil)

      The value returned by the last ListSourcesResponse; indicates that this is a continuation of a prior ListSources call, and that the system should return the next page of data.

    • page_size (::Integer) (defaults to: nil)

      The maximum number of results to return in a single response. Default is 10, minimum is 1, maximum is 1000.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 3008

def list_sources request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::ListSourcesRequest

  # 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
   = @config.rpcs.list_sources..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

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

#list_valued_resources(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::ValuedResource> #list_valued_resources(parent: nil, filter: nil, page_token: nil, page_size: nil, order_by: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::ValuedResource>

Lists the valued resources for a set of simulation results and filter.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::ListValuedResourcesRequest.new

# Call the list_valued_resources method.
result = client.list_valued_resources request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::SecurityCenter::V2::ValuedResource.
  p item
end

Overloads:

  • #list_valued_resources(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::ValuedResource>

    Pass arguments to list_valued_resources via a request object, either of type ListValuedResourcesRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::ListValuedResourcesRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #list_valued_resources(parent: nil, filter: nil, page_token: nil, page_size: nil, order_by: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::SecurityCenter::V2::ValuedResource>

    Pass arguments to list_valued_resources 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).

    Parameters:

    • parent (::String) (defaults to: nil)

      Required. Name of parent to list exposed resources.

      Valid formats: organizations/{organization}, organizations/{organization}/simulations/{simulation} organizations/{organization}/simulations/{simulation}/attackExposureResults/{attack_exposure_result_v2}

    • filter (::String) (defaults to: nil)

      The filter expression that filters the valued resources in the response. Supported fields:

      • resource_value supports =
      • resource_type supports =
    • page_token (::String) (defaults to: nil)

      The value returned by the last ListValuedResourcesResponse; indicates that this is a continuation of a prior ListValuedResources call, and that the system should return the next page of data.

    • page_size (::Integer) (defaults to: nil)

      The maximum number of results to return in a single response. Default is 10, minimum is 1, maximum is 1000.

    • order_by (::String) (defaults to: nil)

      Optional. The fields by which to order the valued resources response.

      Supported fields:

      • exposed_score

      • resource_value

      • resource_type

      Values should be a comma separated list of fields. For example: exposed_score,resource_value.

      The default sorting order is descending. To specify ascending or descending order for a field, append a " ASC" or a " DESC" suffix, respectively; for example: exposed_score DESC.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 3134

def list_valued_resources request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::ListValuedResourcesRequest

  # 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
   = @config.rpcs.list_valued_resources..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.parent
    header_params["parent"] = request.parent
  end

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

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

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

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

#loggerLogger

The logger used for request/response debug logging.

Returns:

  • (Logger)


194
195
196
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 194

def logger
  @security_center_stub.logger
end

#set_finding_state(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Finding #set_finding_state(name: nil, state: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Finding

Updates the state of a finding. If no location is specified, finding is assumed to be in global

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::SetFindingStateRequest.new

# Call the set_finding_state method.
result = client.set_finding_state request

# The returned object is of type Google::Cloud::SecurityCenter::V2::Finding.
p result

Overloads:

  • #set_finding_state(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Finding

    Pass arguments to set_finding_state via a request object, either of type Google::Cloud::SecurityCenter::V2::SetFindingStateRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::SetFindingStateRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #set_finding_state(name: nil, state: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Finding

    Pass arguments to set_finding_state 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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The relative resource name of the finding. If no location is specified, finding is assumed to be in global. The following list shows some examples:

      + organizations/{organization_id}/sources/{source_id}/findings/{finding_id} + organizations/{organization_id}/sources/{source_id}/locations/{location_id}/findings/{finding_id}

      • folders/{folder_id}/sources/{source_id}/findings/{finding_id} + folders/{folder_id}/sources/{source_id}/locations/{location_id}/findings/{finding_id}
      • projects/{project_id}/sources/{source_id}/findings/{finding_id} + projects/{project_id}/sources/{source_id}/locations/{location_id}/findings/{finding_id}
    • state (::Google::Cloud::SecurityCenter::V2::Finding::State) (defaults to: nil)

      Required. The desired State of the finding.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 3238

def set_finding_state request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::SetFindingStateRequest

  # 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
   = @config.rpcs.set_finding_state..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

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

#set_iam_policy(request, options = nil) ⇒ ::Google::Iam::V1::Policy #set_iam_policy(resource: nil, policy: nil, update_mask: nil) ⇒ ::Google::Iam::V1::Policy

Sets the access control policy on the specified Source.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V1::SetIamPolicyRequest.new

# Call the set_iam_policy method.
result = client.set_iam_policy request

# The returned object is of type Google::Iam::V1::Policy.
p result

Overloads:

  • #set_iam_policy(request, options = nil) ⇒ ::Google::Iam::V1::Policy

    Pass arguments to set_iam_policy via a request object, either of type Iam::V1::SetIamPolicyRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Iam::V1::SetIamPolicyRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #set_iam_policy(resource: nil, policy: nil, update_mask: nil) ⇒ ::Google::Iam::V1::Policy

    Pass arguments to set_iam_policy 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).

    Parameters:

    • resource (::String) (defaults to: nil)

      REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

    • policy (::Google::Iam::V1::Policy, ::Hash) (defaults to: nil)

      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.

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only the fields in the mask will be modified. If no mask is provided, the following default mask is used:

      paths: "bindings, etag"

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 3335

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
   = @config.rpcs.set_iam_policy..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.resource
    header_params["resource"] = request.resource
  end

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

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

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

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

#set_mute(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Finding #set_mute(name: nil, mute: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Finding

Updates the mute state of a finding. If no location is specified, finding is assumed to be in global

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::SetMuteRequest.new

# Call the set_mute method.
result = client.set_mute request

# The returned object is of type Google::Cloud::SecurityCenter::V2::Finding.
p result

Overloads:

  • #set_mute(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Finding

    Pass arguments to set_mute via a request object, either of type Google::Cloud::SecurityCenter::V2::SetMuteRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::SetMuteRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #set_mute(name: nil, mute: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Finding

    Pass arguments to set_mute 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).

    Parameters:

    • name (::String) (defaults to: nil)

      Required. The relative resource name of the finding. If no location is specified, finding is assumed to be in global. The following list shows some examples:

      + organizations/{organization_id}/sources/{source_id}/findings/{finding_id} + organizations/{organization_id}/sources/{source_id}/locations/{location_id}/findings/{finding_id}

      • folders/{folder_id}/sources/{source_id}/findings/{finding_id} + folders/{folder_id}/sources/{source_id}/locations/{location_id}/findings/{finding_id}
      • projects/{project_id}/sources/{source_id}/findings/{finding_id} + projects/{project_id}/sources/{source_id}/locations/{location_id}/findings/{finding_id}
    • mute (::Google::Cloud::SecurityCenter::V2::Finding::Mute) (defaults to: nil)

      Required. The desired state of the Mute.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 3437

def set_mute request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::SetMuteRequest

  # 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
   = @config.rpcs.set_mute..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.name
    header_params["name"] = request.name
  end

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

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

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

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

#test_iam_permissions(request, options = nil) ⇒ ::Google::Iam::V1::TestIamPermissionsResponse #test_iam_permissions(resource: nil, permissions: nil) ⇒ ::Google::Iam::V1::TestIamPermissionsResponse

Returns the permissions that a caller has on the specified source.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Iam::V1::TestIamPermissionsRequest.new

# Call the test_iam_permissions method.
result = client.test_iam_permissions request

# The returned object is of type Google::Iam::V1::TestIamPermissionsResponse.
p result

Overloads:

  • #test_iam_permissions(request, options = nil) ⇒ ::Google::Iam::V1::TestIamPermissionsResponse

    Pass arguments to test_iam_permissions via a request object, either of type Iam::V1::TestIamPermissionsRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Iam::V1::TestIamPermissionsRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #test_iam_permissions(resource: nil, permissions: nil) ⇒ ::Google::Iam::V1::TestIamPermissionsResponse

    Pass arguments to test_iam_permissions 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).

    Parameters:

    • resource (::String) (defaults to: nil)

      REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.

    • permissions (::Array<::String>) (defaults to: nil)

      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.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 3528

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
   = @config.rpcs.test_iam_permissions..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.resource
    header_params["resource"] = request.resource
  end

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

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

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

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

#universe_domainString

The effective universe domain

Returns:

  • (String)


104
105
106
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 104

def universe_domain
  @security_center_stub.universe_domain
end

#update_big_query_export(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::BigQueryExport #update_big_query_export(big_query_export: nil, update_mask: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::BigQueryExport

Updates a BigQuery export.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::UpdateBigQueryExportRequest.new

# Call the update_big_query_export method.
result = client.update_big_query_export request

# The returned object is of type Google::Cloud::SecurityCenter::V2::BigQueryExport.
p result

Overloads:

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 3616

def update_big_query_export request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::UpdateBigQueryExportRequest

  # 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
   = @config.rpcs.update_big_query_export..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.big_query_export&.name
    header_params["big_query_export.name"] = request.big_query_export.name
  end

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

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

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

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

#update_external_system(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::ExternalSystem #update_external_system(external_system: nil, update_mask: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::ExternalSystem

Updates external system. This is for a given finding. If no location is specified, finding is assumed to be in global

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::UpdateExternalSystemRequest.new

# Call the update_external_system method.
result = client.update_external_system request

# The returned object is of type Google::Cloud::SecurityCenter::V2::ExternalSystem.
p result

Overloads:

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 3706

def update_external_system request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::UpdateExternalSystemRequest

  # 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
   = @config.rpcs.update_external_system..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.external_system&.name
    header_params["external_system.name"] = request.external_system.name
  end

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

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

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

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

#update_finding(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Finding #update_finding(finding: nil, update_mask: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Finding

Creates or updates a finding. If no location is specified, finding is assumed to be in global. The corresponding source must exist for a finding creation to succeed.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::UpdateFindingRequest.new

# Call the update_finding method.
result = client.update_finding request

# The returned object is of type Google::Cloud::SecurityCenter::V2::Finding.
p result

Overloads:

  • #update_finding(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Finding

    Pass arguments to update_finding via a request object, either of type UpdateFindingRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::UpdateFindingRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #update_finding(finding: nil, update_mask: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Finding

    Pass arguments to update_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).

    Parameters:

    • finding (::Google::Cloud::SecurityCenter::V2::Finding, ::Hash) (defaults to: nil)

      Required. The finding resource to update or create if it does not already exist. parent, security_marks, and update_time will be ignored.

      In the case of creation, the finding id portion of the name must be alphanumeric and less than or equal to 32 characters and greater than 0 characters in length.

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      The FieldMask to use when updating the finding resource. This field should not be specified when creating a finding.

      When updating a finding, an empty mask is treated as updating all mutable fields and replacing source_properties. Individual source_properties can be added/updated by using "source_properties." in the field mask.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 3806

def update_finding request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::UpdateFindingRequest

  # 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
   = @config.rpcs.update_finding..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.finding&.name
    header_params["finding.name"] = request.finding.name
  end

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

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

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

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

#update_mute_config(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::MuteConfig #update_mute_config(mute_config: nil, update_mask: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::MuteConfig

Updates a mute config. If no location is specified, default is global.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::UpdateMuteConfigRequest.new

# Call the update_mute_config method.
result = client.update_mute_config request

# The returned object is of type Google::Cloud::SecurityCenter::V2::MuteConfig.
p result

Overloads:

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 3895

def update_mute_config request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::UpdateMuteConfigRequest

  # 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
   = @config.rpcs.update_mute_config..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.mute_config&.name
    regex_match = %r{^projects/[^/]+/locations/(?<location>[^/]+)/muteConfigs/[^/]+/?$}.match request.mute_config.name
    if regex_match
      header_params["location"] = regex_match["location".to_s]
    end
  end
  if request.mute_config&.name
    regex_match = %r{^organizations/[^/]+/locations/(?<location>[^/]+)/muteConfigs/[^/]+/?$}.match request.mute_config.name
    if regex_match
      header_params["location"] = regex_match["location".to_s]
    end
  end
  if request.mute_config&.name
    regex_match = %r{^folders/[^/]+/locations/(?<location>[^/]+)/muteConfigs/[^/]+/?$}.match request.mute_config.name
    if regex_match
      header_params["location"] = regex_match["location".to_s]
    end
  end

  request_params_header = URI.encode_www_form header_params
  [:"x-goog-request-params"] ||= request_params_header

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

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

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

#update_notification_config(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::NotificationConfig #update_notification_config(notification_config: nil, update_mask: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::NotificationConfig

Updates a notification config. The following update fields are allowed: description, pubsub_topic, streaming_config.filter

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::UpdateNotificationConfigRequest.new

# Call the update_notification_config method.
result = client.update_notification_config request

# The returned object is of type Google::Cloud::SecurityCenter::V2::NotificationConfig.
p result

Overloads:

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 4000

def update_notification_config request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::UpdateNotificationConfigRequest

  # 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
   = @config.rpcs.update_notification_config..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.notification_config&.name
    header_params["notification_config.name"] = request.notification_config.name
  end

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

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

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

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

#update_resource_value_config(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::ResourceValueConfig #update_resource_value_config(resource_value_config: nil, update_mask: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::ResourceValueConfig

Updates an existing ResourceValueConfigs with new rules.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::UpdateResourceValueConfigRequest.new

# Call the update_resource_value_config method.
result = client.update_resource_value_config request

# The returned object is of type Google::Cloud::SecurityCenter::V2::ResourceValueConfig.
p result

Overloads:

  • #update_resource_value_config(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::ResourceValueConfig

    Pass arguments to update_resource_value_config via a request object, either of type UpdateResourceValueConfigRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::UpdateResourceValueConfigRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #update_resource_value_config(resource_value_config: nil, update_mask: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::ResourceValueConfig

    Pass arguments to update_resource_value_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).

    Parameters:

    • resource_value_config (::Google::Cloud::SecurityCenter::V2::ResourceValueConfig, ::Hash) (defaults to: nil)

      Required. The resource value config being updated.

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      The list of fields to be updated. If empty all mutable fields will be updated.

      To update nested fields, include the top level field in the mask For example, to update gcp_metadata.resource_type, include the "gcp_metadata" field mask

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 4092

def update_resource_value_config request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::UpdateResourceValueConfigRequest

  # 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
   = @config.rpcs.update_resource_value_config..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.resource_value_config&.name
    header_params["resource_value_config.name"] = request.resource_value_config.name
  end

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

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

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

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

#update_security_marks(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::SecurityMarks #update_security_marks(security_marks: nil, update_mask: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::SecurityMarks

Updates security marks. For Finding Security marks, if no location is specified, finding is assumed to be in global. Assets Security Marks can only be accessed through global endpoint.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::UpdateSecurityMarksRequest.new

# Call the update_security_marks method.
result = client.update_security_marks request

# The returned object is of type Google::Cloud::SecurityCenter::V2::SecurityMarks.
p result

Overloads:

  • #update_security_marks(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::SecurityMarks

    Pass arguments to update_security_marks via a request object, either of type UpdateSecurityMarksRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::UpdateSecurityMarksRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #update_security_marks(security_marks: nil, update_mask: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::SecurityMarks

    Pass arguments to update_security_marks 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).

    Parameters:

    • security_marks (::Google::Cloud::SecurityCenter::V2::SecurityMarks, ::Hash) (defaults to: nil)

      Required. The security marks resource to update.

    • update_mask (::Google::Protobuf::FieldMask, ::Hash) (defaults to: nil)

      The FieldMask to use when updating the security marks resource.

      The field mask must not contain duplicate fields. If empty or set to "marks", all marks will be replaced. Individual marks can be updated using "marks.".

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 4185

def update_security_marks request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::UpdateSecurityMarksRequest

  # 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
   = @config.rpcs.update_security_marks..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.security_marks&.name
    header_params["security_marks.name"] = request.security_marks.name
  end

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

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

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

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

#update_source(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Source #update_source(source: nil, update_mask: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Source

Updates a source.

Examples:

Basic example

require "google/cloud/security_center/v2"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::SecurityCenter::V2::SecurityCenter::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::SecurityCenter::V2::UpdateSourceRequest.new

# Call the update_source method.
result = client.update_source request

# The returned object is of type Google::Cloud::SecurityCenter::V2::Source.
p result

Overloads:

  • #update_source(request, options = nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Source

    Pass arguments to update_source via a request object, either of type UpdateSourceRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::SecurityCenter::V2::UpdateSourceRequest, ::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.

    • options (::Gapic::CallOptions, ::Hash) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.

  • #update_source(source: nil, update_mask: nil) ⇒ ::Google::Cloud::SecurityCenter::V2::Source

    Pass arguments to update_source 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).

    Parameters:

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the RPC is aborted.



4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
# File 'lib/google/cloud/security_center/v2/security_center/client.rb', line 4274

def update_source request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::SecurityCenter::V2::UpdateSourceRequest

  # 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
   = @config.rpcs.update_source..to_h

  # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::SecurityCenter::V2::VERSION
  [:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  header_params = {}
  if request.source&.name
    header_params["source.name"] = request.source.name
  end

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

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

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

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