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, #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:



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 123

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 == Client.configure.endpoint &&
                           !@config.endpoint.split(".").first.include?("-")
  credentials ||= Credentials.default scope: @config.scope,
                                      enable_self_signed_jwt: enable_self_signed_jwt
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
    credentials = Credentials.new credentials, scope: @config.scope
  end
  @quota_project_id = @config.quota_project
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id

  @recaptcha_enterprise_service_stub = ::Gapic::ServiceStub.new(
    ::Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Stub,
    credentials:  credentials,
    endpoint:     @config.endpoint,
    channel_args: @config.channel_args,
    interceptors: @config.interceptors
  )
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:



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 56

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

#annotate_assessment(request, options = nil) ⇒ ::Google::Cloud::RecaptchaEnterprise::V1::AnnotateAssessmentResponse #annotate_assessment(name: nil, annotation: nil, reasons: nil, hashed_account_id: 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, hashed_account_id: 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 will be 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. Optional reasons for the annotation that will be assigned to the Event.

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

      Optional. Unique stable hashed user identifier to apply to the assessment. This is an alternative to setting the hashed_account_id in CreateAssessment, for example when the account identifier is not yet known in the initial request. It is recommended that the identifier is hashed using hmac-sha256 with stable secret.

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 307

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 and x-goog-user-project 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-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:



102
103
104
105
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 102

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 will be 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.



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 208

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 and x-goog-user-project 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-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_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 will be 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.



395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 395

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 and x-goog-user-project 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-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_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.



842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 842

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 and x-goog-user-project 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-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_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.



668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 668

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 and x-goog-user-project 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-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.



1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 1020

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 and x-goog-user-project 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-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_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 all elements by calling #each, and the enumerable
# will lazily make API calls to fetch subsequent pages. Other
# methods are also available for managing paging directly.
result.each do |response|
  # Each element is of type ::Google::Cloud::RecaptchaEnterprise::V1::Key.
  p response
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 will be 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.



493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 493

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 and x-goog-user-project 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-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 all elements by calling #each, and the enumerable
# will lazily make API calls to fetch subsequent pages. Other
# methods are also available for managing paging directly.
result.each do |response|
  # Each element is of type ::Google::Cloud::RecaptchaEnterprise::V1::RelatedAccountGroupMembership.
  p response
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.



1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 1229

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 and x-goog-user-project 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-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 all elements by calling #each, and the enumerable
# will lazily make API calls to fetch subsequent pages. Other
# methods are also available for managing paging directly.
result.each do |response|
  # Each element is of type ::Google::Cloud::RecaptchaEnterprise::V1::RelatedAccountGroup.
  p response
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.



1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 1124

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 and x-goog-user-project 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-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) ⇒ ::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 Site 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) ⇒ ::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}".

Yields:

  • (response, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

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

    if the RPC is aborted.



933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 933

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 and x-goog-user-project 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-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

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



582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 582

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 and x-goog-user-project 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-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 all elements by calling #each, and the enumerable
# will lazily make API calls to fetch subsequent pages. Other
# methods are also available for managing paging directly.
result.each do |response|
  # Each element is of type ::Google::Cloud::RecaptchaEnterprise::V1::RelatedAccountGroupMembership.
  p response
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, 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}".

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

      Optional. The unique stable hashed user identifier we should search connections to. The identifier should correspond to a hashed_account_id provided in a previous CreateAssessment or AnnotateAssessment call.

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



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

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 and x-goog-user-project 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-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

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



756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
# File 'lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb', line 756

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 and x-goog-user-project 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-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