Class: Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client

Inherits:
Object
  • Object
show all
Includes:
Paths
Defined in:
lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb

Overview

Client for the RecaptchaEnterpriseService service.

Service to determine the likelihood an event is legitimate.

Defined Under Namespace

Classes: Configuration

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Paths

#assessment_path, #firewall_policy_path, #key_path, #metrics_path, #project_path, #related_account_group_path

Constructor Details

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

Create a new RecaptchaEnterpriseService client object.

Examples:


# Create a client using the default configuration
client = ::Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new

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

Yields:

  • (config)

    Configure the RecaptchaEnterpriseService client.

Yield Parameters:



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
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 138

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/recaptchaenterprise/v1/recaptchaenterprise_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

  @recaptcha_enterprise_service_stub = ::Gapic::ServiceStub.new(
    ::Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::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
  )
end

Class Method Details

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

Configure the RecaptchaEnterpriseService Client class.

See Configuration for a description of the configuration fields.

Examples:


# Modify the configuration for all RecaptchaEnterpriseService clients
::Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 62

def self.configure
  @configure ||= begin
    namespace = ["Google", "Cloud", "RecaptchaEnterprise", "V1"]
    parent_config = while namespace.any?
                      parent_name = namespace.join "::"
                      parent_const = const_get parent_name
                      break parent_const.configure if parent_const.respond_to? :configure
                      namespace.pop
                    end
    default_config = Client::Configuration.new parent_config

    default_config.rpcs.create_assessment.timeout = 600.0

    default_config.rpcs.annotate_assessment.timeout = 600.0

    default_config.rpcs.create_key.timeout = 600.0

    default_config.rpcs.list_keys.timeout = 600.0

    default_config.rpcs.get_key.timeout = 600.0

    default_config.rpcs.update_key.timeout = 600.0

    default_config.rpcs.delete_key.timeout = 600.0

    default_config
  end
  yield @configure if block_given?
  @configure
end

Instance Method Details

#add_ip_override(request, options = nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::AddIpOverrideResponse #add_ip_override(name: nil, ip_override_data: nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::AddIpOverrideResponse

Adds an IP override to a key. The following restrictions hold:

  • The maximum number of IP overrides per key is 100.
  • For any conflict (such as IP already exists or IP part of an existing IP range), an error is returned.

Examples:

Basic example

require "google/cloud/recaptcha_enterprise/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::RecaptchaEnterprise::V1::AddIpOverrideRequest.new

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

# The returned object is of type Google::Cloud::RecaptchaEnterprise::V1::AddIpOverrideResponse.
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.



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
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 1065

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::AddIpOverrideRequest

  # 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.add_ip_override..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::RecaptchaEnterprise::V1::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.add_ip_override.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.add_ip_override.retry_policy

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

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

#annotate_assessment(request, options = nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::AnnotateAssessmentResponse #annotate_assessment(name: nil, annotation: nil, reasons: nil, account_id: nil, hashed_account_id: nil, transaction_event: nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::AnnotateAssessmentResponse

Annotates a previously created Assessment to provide additional information on whether the event turned out to be authentic or fraudulent.

Examples:

Basic example

require "google/cloud/recaptcha_enterprise/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::RecaptchaEnterprise::V1::AnnotateAssessmentRequest.new

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

# The returned object is of type Google::Cloud::RecaptchaEnterprise::V1::AnnotateAssessmentResponse.
p result

Overloads:

  • #annotate_assessment(request, options = nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::AnnotateAssessmentResponse

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

    Parameters:

    • request (::Google::Cloud::RecaptchaEnterprise::V1::AnnotateAssessmentRequest, ::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.

  • #annotate_assessment(name: nil, annotation: nil, reasons: nil, account_id: nil, hashed_account_id: nil, transaction_event: nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::AnnotateAssessmentResponse

    Pass arguments to annotate_assessment 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 resource name of the Assessment, in the format projects/{project}/assessments/{assessment}.

    • annotation (::Google::Cloud::RecaptchaEnterprise::V1::AnnotateAssessmentRequest::Annotation) (defaults to: nil)

      Optional. The annotation that is assigned to the Event. This field can be left empty to provide reasons that apply to an event without concluding whether the event is legitimate or fraudulent.

    • reasons (::Array<::Google::Cloud::RecaptchaEnterprise::V1::AnnotateAssessmentRequest::Reason>) (defaults to: nil)

      Optional. Reasons for the annotation that are assigned to the event.

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

      Optional. A stable account identifier to apply to the assessment. This is an alternative to setting account_id in CreateAssessment, for example when a stable account identifier is not yet known in the initial request.

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

      Optional. A stable hashed account identifier to apply to the assessment. This is an alternative to setting hashed_account_id in CreateAssessment, for example when a stable account identifier is not yet known in the initial request.

    • transaction_event (::Google::Cloud::RecaptchaEnterprise::V1::TransactionEvent, ::Hash) (defaults to: nil)

      Optional. If the assessment is part of a payment transaction, provide details on payment lifecycle events that occur in the transaction.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 333

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::AnnotateAssessmentRequest

  # 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.annotate_assessment..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::RecaptchaEnterprise::V1::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.annotate_assessment.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.annotate_assessment.retry_policy

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

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

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

Configure the RecaptchaEnterpriseService 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:



108
109
110
111
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 108

def configure
  yield @config if block_given?
  @config
end

#create_assessment(request, options = nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::Assessment #create_assessment(parent: nil, assessment: nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::Assessment

Creates an Assessment of the likelihood an event is legitimate.

Examples:

Basic example

require "google/cloud/recaptcha_enterprise/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::RecaptchaEnterprise::V1::CreateAssessmentRequest.new

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

# The returned object is of type Google::Cloud::RecaptchaEnterprise::V1::Assessment.
p result

Overloads:

  • #create_assessment(request, options = nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::Assessment

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

    Parameters:

    • request (::Google::Cloud::RecaptchaEnterprise::V1::CreateAssessmentRequest, ::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_assessment(parent: nil, assessment: nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::Assessment

    Pass arguments to create_assessment 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 project in which the assessment is created, in the format projects/{project}.

    • assessment (::Google::Cloud::RecaptchaEnterprise::V1::Assessment, ::Hash) (defaults to: nil)

      Required. The assessment details.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 227

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::CreateAssessmentRequest

  # 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_assessment..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::RecaptchaEnterprise::V1::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_assessment.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_assessment.retry_policy

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

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

#create_firewall_policy(request, options = nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::FirewallPolicy #create_firewall_policy(parent: nil, firewall_policy: nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::FirewallPolicy

Creates a new FirewallPolicy, specifying conditions at which reCAPTCHA Enterprise actions can be executed. A project may have a maximum of 1000 policies.

Examples:

Basic example

require "google/cloud/recaptcha_enterprise/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::RecaptchaEnterprise::V1::CreateFirewallPolicyRequest.new

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

# The returned object is of type Google::Cloud::RecaptchaEnterprise::V1::FirewallPolicy.
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.



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
1469
1470
1471
1472
1473
1474
1475
1476
1477
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 1437

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::CreateFirewallPolicyRequest

  # 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_firewall_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::RecaptchaEnterprise::V1::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_firewall_policy.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_firewall_policy.retry_policy

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

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

#create_key(request, options = nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::Key #create_key(parent: nil, key: nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::Key

Creates a new reCAPTCHA Enterprise key.

Examples:

Basic example

require "google/cloud/recaptcha_enterprise/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::RecaptchaEnterprise::V1::CreateKeyRequest.new

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

# The returned object is of type Google::Cloud::RecaptchaEnterprise::V1::Key.
p result

Overloads:

  • #create_key(request, options = nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::Key

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

    Parameters:

    • request (::Google::Cloud::RecaptchaEnterprise::V1::CreateKeyRequest, ::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_key(parent: nil, key: nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::Key

    Pass arguments to create_key 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 project in which the key is created, in the format projects/{project}.

    • key (::Google::Cloud::RecaptchaEnterprise::V1::Key, ::Hash) (defaults to: nil)

      Required. Information to create a reCAPTCHA Enterprise key.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 422

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::CreateKeyRequest

  # 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_key..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::RecaptchaEnterprise::V1::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_key.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_key.retry_policy

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

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

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

Deletes the specified firewall policy.

Examples:

Basic example

require "google/cloud/recaptcha_enterprise/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::RecaptchaEnterprise::V1::DeleteFirewallPolicyRequest.new

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

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

Overloads:

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

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

    Parameters:

    • request (::Google::Cloud::RecaptchaEnterprise::V1::DeleteFirewallPolicyRequest, ::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_firewall_policy(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_firewall_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:

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

      Required. The name of the policy to be deleted, in the format projects/{project}/firewallpolicies/{firewallpolicy}.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
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
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 1798

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::DeleteFirewallPolicyRequest

  # 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_firewall_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::RecaptchaEnterprise::V1::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_firewall_policy.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_firewall_policy.retry_policy

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

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

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

Deletes the specified key.

Examples:

Basic example

require "google/cloud/recaptcha_enterprise/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::RecaptchaEnterprise::V1::DeleteKeyRequest.new

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

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

Overloads:

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

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

    Parameters:

    • request (::Google::Cloud::RecaptchaEnterprise::V1::DeleteKeyRequest, ::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_key(name: nil) ⇒ ::Google::Protobuf::Empty

    Pass arguments to delete_key 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 key to be deleted, in the format projects/{project}/keys/{key}.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



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
909
910
911
912
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 872

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::DeleteKeyRequest

  # 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_key..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::RecaptchaEnterprise::V1::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_key.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_key.retry_policy

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

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

#get_firewall_policy(request, options = nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::FirewallPolicy #get_firewall_policy(name: nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::FirewallPolicy

Returns the specified firewall policy.

Examples:

Basic example

require "google/cloud/recaptcha_enterprise/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::RecaptchaEnterprise::V1::GetFirewallPolicyRequest.new

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

# The returned object is of type Google::Cloud::RecaptchaEnterprise::V1::FirewallPolicy.
p result

Overloads:

  • #get_firewall_policy(request, options = nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::FirewallPolicy

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

    Parameters:

    • request (::Google::Cloud::RecaptchaEnterprise::V1::GetFirewallPolicyRequest, ::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_firewall_policy(name: nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::FirewallPolicy

    Pass arguments to get_firewall_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:

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

      Required. The name of the requested policy, in the format projects/{project}/firewallpolicies/{firewallpolicy}.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 1622

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::GetFirewallPolicyRequest

  # 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_firewall_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::RecaptchaEnterprise::V1::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_firewall_policy.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_firewall_policy.retry_policy

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

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

#get_key(request, options = nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::Key #get_key(name: nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::Key

Returns the specified key.

Examples:

Basic example

require "google/cloud/recaptcha_enterprise/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::RecaptchaEnterprise::V1::GetKeyRequest.new

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

# The returned object is of type Google::Cloud::RecaptchaEnterprise::V1::Key.
p result

Overloads:

  • #get_key(request, options = nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::Key

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

    Parameters:

    • request (::Google::Cloud::RecaptchaEnterprise::V1::GetKeyRequest, ::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_key(name: nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::Key

    Pass arguments to get_key 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 requested key, in the format projects/{project}/keys/{key}.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



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
723
724
725
726
727
728
729
730
731
732
733
734
735
736
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 696

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::GetKeyRequest

  # 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_key..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::RecaptchaEnterprise::V1::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_key.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_key.retry_policy

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

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

#get_metrics(request, options = nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::Metrics #get_metrics(name: nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::Metrics

Get some aggregated metrics for a Key. This data can be used to build dashboards.

Examples:

Basic example

require "google/cloud/recaptcha_enterprise/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::RecaptchaEnterprise::V1::GetMetricsRequest.new

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

# The returned object is of type Google::Cloud::RecaptchaEnterprise::V1::Metrics.
p result

Overloads:

  • #get_metrics(request, options = nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::Metrics

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

    Parameters:

    • request (::Google::Cloud::RecaptchaEnterprise::V1::GetMetricsRequest, ::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_metrics(name: nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::Metrics

    Pass arguments to get_metrics 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 requested metrics, in the format projects/{project}/keys/{key}/metrics.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



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
1379
1380
1381
1382
1383
1384
1385
1386
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 1346

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::GetMetricsRequest

  # 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_metrics..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::RecaptchaEnterprise::V1::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_metrics.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_metrics.retry_policy

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

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

#list_firewall_policies(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::RecaptchaEnterprise::V1::FirewallPolicy> #list_firewall_policies(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::RecaptchaEnterprise::V1::FirewallPolicy>

Returns the list of all firewall policies that belong to a project.

Examples:

Basic example

require "google/cloud/recaptcha_enterprise/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::RecaptchaEnterprise::V1::ListFirewallPoliciesRequest.new

# Call the list_firewall_policies method.
result = client.list_firewall_policies 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::RecaptchaEnterprise::V1::FirewallPolicy.
  p item
end

Overloads:

  • #list_firewall_policies(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::RecaptchaEnterprise::V1::FirewallPolicy>

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

    Parameters:

    • request (::Google::Cloud::RecaptchaEnterprise::V1::ListFirewallPoliciesRequest, ::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_firewall_policies(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::RecaptchaEnterprise::V1::FirewallPolicy>

    Pass arguments to list_firewall_policies 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 project to list the policies for, in the format projects/{project}.

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

      Optional. The maximum number of policies to return. Default is 10. Max limit is 1000.

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

      Optional. The next_page_token value returned from a previous. ListFirewallPoliciesRequest, if any.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 1534

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::ListFirewallPoliciesRequest

  # 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_firewall_policies..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::RecaptchaEnterprise::V1::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_firewall_policies.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_firewall_policies.retry_policy

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

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

#list_ip_overrides(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::RecaptchaEnterprise::V1::IpOverrideData> #list_ip_overrides(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::RecaptchaEnterprise::V1::IpOverrideData>

Lists all IP overrides for a key.

Examples:

Basic example

require "google/cloud/recaptcha_enterprise/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::RecaptchaEnterprise::V1::ListIpOverridesRequest.new

# Call the list_ip_overrides method.
result = client.list_ip_overrides 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::RecaptchaEnterprise::V1::IpOverrideData.
  p item
end

Overloads:

  • #list_ip_overrides(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::RecaptchaEnterprise::V1::IpOverrideData>

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

    Parameters:

    • request (::Google::Cloud::RecaptchaEnterprise::V1::ListIpOverridesRequest, ::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_ip_overrides(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::RecaptchaEnterprise::V1::IpOverrideData>

    Pass arguments to list_ip_overrides 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 key for which the IP overrides are listed, in the format projects/{project}/keys/{key}.

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

      Optional. The maximum number of overrides to return. Default is 10. Max limit is 100. If the number of overrides is less than the page_size, all overrides are returned. If the page size is more than 100, it is coerced to 100.

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

      Optional. The next_page_token value returned from a previous ListIpOverridesRequest, if any.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



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
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 1257

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::ListIpOverridesRequest

  # 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_ip_overrides..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::RecaptchaEnterprise::V1::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_ip_overrides.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_ip_overrides.retry_policy

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

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

#list_keys(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::RecaptchaEnterprise::V1::Key> #list_keys(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::RecaptchaEnterprise::V1::Key>

Returns the list of all keys that belong to a project.

Examples:

Basic example

require "google/cloud/recaptcha_enterprise/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::RecaptchaEnterprise::V1::ListKeysRequest.new

# Call the list_keys method.
result = client.list_keys 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::RecaptchaEnterprise::V1::Key.
  p item
end

Overloads:

  • #list_keys(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::RecaptchaEnterprise::V1::Key>

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

    Parameters:

    • request (::Google::Cloud::RecaptchaEnterprise::V1::ListKeysRequest, ::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_keys(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::RecaptchaEnterprise::V1::Key>

    Pass arguments to list_keys 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 project that contains the keys that is listed, in the format projects/{project}.

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

      Optional. The maximum number of keys to return. Default is 10. Max limit is 1000.

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

      Optional. The next_page_token value returned from a previous. ListKeysRequest, if any.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 519

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::ListKeysRequest

  # 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_keys..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::RecaptchaEnterprise::V1::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_keys.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_keys.retry_policy

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

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

Get memberships in a group of related accounts.

Examples:

Basic example

require "google/cloud/recaptcha_enterprise/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::RecaptchaEnterprise::V1::ListRelatedAccountGroupMembershipsRequest.new

# Call the list_related_account_group_memberships method.
result = client. 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::RecaptchaEnterprise::V1::RelatedAccountGroupMembership.
  p item
end

Overloads:

  • #list_related_account_group_memberships(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::RecaptchaEnterprise::V1::RelatedAccountGroupMembership>

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

    Parameters:

  • #list_related_account_group_memberships(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::RecaptchaEnterprise::V1::RelatedAccountGroupMembership>

    Pass arguments to list_related_account_group_memberships 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 resource name for the related account group in the format projects/{project}/relatedaccountgroups/{relatedaccountgroup}.

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

      Optional. The maximum number of accounts to return. The service might return fewer than this value. If unspecified, at most 50 accounts are returned. The maximum value is 1000; values above 1000 are coerced to 1000.

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

      Optional. A page token, received from a previous ListRelatedAccountGroupMemberships call.

      When paginating, all other parameters provided to ListRelatedAccountGroupMemberships 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.



2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 2093

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::ListRelatedAccountGroupMembershipsRequest

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

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

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

List groups of related accounts.

Examples:

Basic example

require "google/cloud/recaptcha_enterprise/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::RecaptchaEnterprise::V1::ListRelatedAccountGroupsRequest.new

# Call the list_related_account_groups method.
result = client. 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::RecaptchaEnterprise::V1::RelatedAccountGroup.
  p item
end

Overloads:

  • #list_related_account_groups(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::RecaptchaEnterprise::V1::RelatedAccountGroup>

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

    Parameters:

    • request (::Google::Cloud::RecaptchaEnterprise::V1::ListRelatedAccountGroupsRequest, ::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_related_account_groups(parent: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::RecaptchaEnterprise::V1::RelatedAccountGroup>

    Pass arguments to list_related_account_groups 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 project to list related account groups from, in the format projects/{project}.

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

      Optional. The maximum number of groups to return. The service might return fewer than this value. If unspecified, at most 50 groups are returned. The maximum value is 1000; values above 1000 are coerced to 1000.

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

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

      When paginating, all other parameters provided to ListRelatedAccountGroups 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.



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
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 1990

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::ListRelatedAccountGroupsRequest

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

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

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

#migrate_key(request, options = nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::Key #migrate_key(name: nil, skip_billing_check: nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::Key

Migrates an existing key from reCAPTCHA to reCAPTCHA Enterprise. Once a key is migrated, it can be used from either product. SiteVerify requests are billed as CreateAssessment calls. You must be authenticated as one of the current owners of the reCAPTCHA Key, and your user must have the reCAPTCHA Enterprise Admin IAM role in the destination project.

Examples:

Basic example

require "google/cloud/recaptcha_enterprise/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::RecaptchaEnterprise::V1::MigrateKeyRequest.new

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

# The returned object is of type Google::Cloud::RecaptchaEnterprise::V1::Key.
p result

Overloads:

  • #migrate_key(request, options = nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::Key

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

    Parameters:

    • request (::Google::Cloud::RecaptchaEnterprise::V1::MigrateKeyRequest, ::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.

  • #migrate_key(name: nil, skip_billing_check: nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::Key

    Pass arguments to migrate_key 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 key to be migrated, in the format projects/{project}/keys/{key}.

    • skip_billing_check (::Boolean) (defaults to: nil)

      Optional. If true, skips the billing check. A reCAPTCHA Enterprise key or migrated key behaves differently than a reCAPTCHA (non-Enterprise version) key when you reach a quota limit (see https://cloud.google.com/recaptcha/quotas#quota_limit). To avoid any disruption of your usage, we check that a billing account is present. If your usage of reCAPTCHA is under the free quota, you can safely skip the billing check and proceed with the migration. See https://cloud.google.com/recaptcha/docs/billing-information.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



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
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 973

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::MigrateKeyRequest

  # 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.migrate_key..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::RecaptchaEnterprise::V1::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.migrate_key.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.migrate_key.retry_policy

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

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

#remove_ip_override(request, options = nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::RemoveIpOverrideResponse #remove_ip_override(name: nil, ip_override_data: nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::RemoveIpOverrideResponse

Removes an IP override from a key. The following restrictions hold:

  • If the IP isn't found in an existing IP override, a NOT_FOUND error is returned.
  • If the IP is found in an existing IP override, but the override type does not match, a NOT_FOUND error is returned.

Examples:

Basic example

require "google/cloud/recaptcha_enterprise/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::RecaptchaEnterprise::V1::RemoveIpOverrideRequest.new

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

# The returned object is of type Google::Cloud::RecaptchaEnterprise::V1::RemoveIpOverrideResponse.
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.



1158
1159
1160
1161
1162
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
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 1158

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::RemoveIpOverrideRequest

  # 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.remove_ip_override..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::RecaptchaEnterprise::V1::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.remove_ip_override.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.remove_ip_override.retry_policy

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

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

#reorder_firewall_policies(request, options = nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::ReorderFirewallPoliciesResponse #reorder_firewall_policies(parent: nil, names: nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::ReorderFirewallPoliciesResponse

Reorders all firewall policies.

Examples:

Basic example

require "google/cloud/recaptcha_enterprise/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::RecaptchaEnterprise::V1::ReorderFirewallPoliciesRequest.new

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

# The returned object is of type Google::Cloud::RecaptchaEnterprise::V1::ReorderFirewallPoliciesResponse.
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.



1888
1889
1890
1891
1892
1893
1894
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
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 1888

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::ReorderFirewallPoliciesRequest

  # 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.reorder_firewall_policies..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::RecaptchaEnterprise::V1::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.reorder_firewall_policies.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.reorder_firewall_policies.retry_policy

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

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

#retrieve_legacy_secret_key(request, options = nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::RetrieveLegacySecretKeyResponse #retrieve_legacy_secret_key(key: nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::RetrieveLegacySecretKeyResponse

Returns the secret key related to the specified public key. You must use the legacy secret key only in a 3rd party integration with legacy reCAPTCHA.

Examples:

Basic example

require "google/cloud/recaptcha_enterprise/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::RecaptchaEnterprise::V1::RetrieveLegacySecretKeyRequest.new

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

# The returned object is of type Google::Cloud::RecaptchaEnterprise::V1::RetrieveLegacySecretKeyResponse.
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.



609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 609

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::RetrieveLegacySecretKeyRequest

  # 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.retrieve_legacy_secret_key..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::RecaptchaEnterprise::V1::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.key
    header_params["key"] = request.key
  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.retrieve_legacy_secret_key.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.retrieve_legacy_secret_key.retry_policy

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

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

Search group memberships related to a given account.

Examples:

Basic example

require "google/cloud/recaptcha_enterprise/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::RecaptchaEnterprise::V1::SearchRelatedAccountGroupMembershipsRequest.new

# Call the search_related_account_group_memberships method.
result = client. 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::RecaptchaEnterprise::V1::RelatedAccountGroupMembership.
  p item
end

Overloads:

  • #search_related_account_group_memberships(request, options = nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::RecaptchaEnterprise::V1::RelatedAccountGroupMembership>

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

    Parameters:

  • #search_related_account_group_memberships(project: nil, account_id: nil, hashed_account_id: nil, page_size: nil, page_token: nil) ⇒ ::Gapic::PagedEnumerable<::Google::Cloud::RecaptchaEnterprise::V1::RelatedAccountGroupMembership>

    Pass arguments to search_related_account_group_memberships 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:

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

      Required. The name of the project to search related account group memberships from. Specify the project name in the following format: projects/{project}.

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

      Optional. The unique stable account identifier used to search connections. The identifier should correspond to an account_id provided in a previous CreateAssessment or AnnotateAssessment call. Either hashed_account_id or account_id must be set, but not both.

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

      Optional. Deprecated: use account_id instead. The unique stable hashed account identifier used to search connections. The identifier should correspond to a hashed_account_id provided in a previous CreateAssessment or AnnotateAssessment call. Either hashed_account_id or account_id must be set, but not both.

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

      Optional. The maximum number of groups to return. The service might return fewer than this value. If unspecified, at most 50 groups are returned. The maximum value is 1000; values above 1000 are coerced to 1000.

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

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

      When paginating, all other parameters provided to SearchRelatedAccountGroupMemberships 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.



2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 2209

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::SearchRelatedAccountGroupMembershipsRequest

  # 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...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::RecaptchaEnterprise::V1::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.project
    header_params["project"] = request.project
  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..timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs..retry_policy

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

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

#universe_domainString

The effective universe domain

Returns:

  • (String)


118
119
120
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 118

def universe_domain
  @recaptcha_enterprise_service_stub.universe_domain
end

#update_firewall_policy(request, options = nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::FirewallPolicy #update_firewall_policy(firewall_policy: nil, update_mask: nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::FirewallPolicy

Updates the specified firewall policy.

Examples:

Basic example

require "google/cloud/recaptcha_enterprise/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::RecaptchaEnterprise::V1::UpdateFirewallPolicyRequest.new

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

# The returned object is of type Google::Cloud::RecaptchaEnterprise::V1::FirewallPolicy.
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.



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
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 1711

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::UpdateFirewallPolicyRequest

  # 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_firewall_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::RecaptchaEnterprise::V1::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.firewall_policy&.name
    header_params["firewall_policy.name"] = request.firewall_policy.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_firewall_policy.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_firewall_policy.retry_policy

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

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

#update_key(request, options = nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::Key #update_key(key: nil, update_mask: nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::Key

Updates the specified key.

Examples:

Basic example

require "google/cloud/recaptcha_enterprise/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::RecaptchaEnterprise::V1::UpdateKeyRequest.new

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

# The returned object is of type Google::Cloud::RecaptchaEnterprise::V1::Key.
p result

Overloads:

  • #update_key(request, options = nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::Key

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

    Parameters:

    • request (::Google::Cloud::RecaptchaEnterprise::V1::UpdateKeyRequest, ::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_key(key: nil, update_mask: nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::Key

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



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
820
821
822
823
824
825
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 785

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

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::UpdateKeyRequest

  # 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_key..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::RecaptchaEnterprise::V1::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.key&.name
    header_params["key.name"] = request.key.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_key.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_key.retry_policy

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

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