google-cloud-recaptcha_enterprise-v1 0.4.3 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -190,6 +190,21 @@ module Google
190
190
  #
191
191
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
192
192
  #
193
+ # @example Basic example
194
+ # require "google/cloud/recaptcha_enterprise/v1"
195
+ #
196
+ # # Create a client object. The client can be reused for multiple calls.
197
+ # client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new
198
+ #
199
+ # # Create a request. To set request fields, pass in keyword arguments.
200
+ # request = Google::Cloud::RecaptchaEnterprise::V1::CreateAssessmentRequest.new
201
+ #
202
+ # # Call the create_assessment method.
203
+ # result = client.create_assessment request
204
+ #
205
+ # # The returned object is of type Google::Cloud::RecaptchaEnterprise::V1::Assessment.
206
+ # p result
207
+ #
193
208
  def create_assessment request, options = nil
194
209
  raise ::ArgumentError, "request must be provided" if request.nil?
195
210
 
@@ -207,9 +222,11 @@ module Google
207
222
  gapic_version: ::Google::Cloud::RecaptchaEnterprise::V1::VERSION
208
223
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
209
224
 
210
- header_params = {
211
- "parent" => request.parent
212
- }
225
+ header_params = {}
226
+ if request.parent
227
+ header_params["parent"] = request.parent
228
+ end
229
+
213
230
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
214
231
  metadata[:"x-goog-request-params"] ||= request_params_header
215
232
 
@@ -231,7 +248,7 @@ module Google
231
248
 
232
249
  ##
233
250
  # Annotates a previously created Assessment to provide additional information
234
- # on whether the event turned out to be authentic or fradulent.
251
+ # on whether the event turned out to be authentic or fraudulent.
235
252
  #
236
253
  # @overload annotate_assessment(request, options = nil)
237
254
  # Pass arguments to `annotate_assessment` via a request object, either of type
@@ -243,7 +260,7 @@ module Google
243
260
  # @param options [::Gapic::CallOptions, ::Hash]
244
261
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
245
262
  #
246
- # @overload annotate_assessment(name: nil, annotation: nil)
263
+ # @overload annotate_assessment(name: nil, annotation: nil, reasons: nil, hashed_account_id: nil)
247
264
  # Pass arguments to `annotate_assessment` via keyword arguments. Note that at
248
265
  # least one keyword argument is required. To specify no parameters, or to keep all
249
266
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -252,7 +269,17 @@ module Google
252
269
  # Required. The resource name of the Assessment, in the format
253
270
  # "projects/\\{project}/assessments/\\{assessment}".
254
271
  # @param annotation [::Google::Cloud::RecaptchaEnterprise::V1::AnnotateAssessmentRequest::Annotation]
255
- # Required. The annotation that will be assigned to the Event.
272
+ # Optional. The annotation that will be assigned to the Event. This field can be left
273
+ # empty to provide reasons that apply to an event without concluding whether
274
+ # the event is legitimate or fraudulent.
275
+ # @param reasons [::Array<::Google::Cloud::RecaptchaEnterprise::V1::AnnotateAssessmentRequest::Reason>]
276
+ # Optional. Optional reasons for the annotation that will be assigned to the Event.
277
+ # @param hashed_account_id [::String]
278
+ # Optional. Optional unique stable hashed user identifier to apply to the assessment.
279
+ # This is an alternative to setting the hashed_account_id in
280
+ # CreateAssessment, for example when the account identifier is not yet known
281
+ # in the initial request. It is recommended that the identifier is hashed
282
+ # using hmac-sha256 with stable secret.
256
283
  #
257
284
  # @yield [response, operation] Access the result along with the RPC operation
258
285
  # @yieldparam response [::Google::Cloud::RecaptchaEnterprise::V1::AnnotateAssessmentResponse]
@@ -262,6 +289,21 @@ module Google
262
289
  #
263
290
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
264
291
  #
292
+ # @example Basic example
293
+ # require "google/cloud/recaptcha_enterprise/v1"
294
+ #
295
+ # # Create a client object. The client can be reused for multiple calls.
296
+ # client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new
297
+ #
298
+ # # Create a request. To set request fields, pass in keyword arguments.
299
+ # request = Google::Cloud::RecaptchaEnterprise::V1::AnnotateAssessmentRequest.new
300
+ #
301
+ # # Call the annotate_assessment method.
302
+ # result = client.annotate_assessment request
303
+ #
304
+ # # The returned object is of type Google::Cloud::RecaptchaEnterprise::V1::AnnotateAssessmentResponse.
305
+ # p result
306
+ #
265
307
  def annotate_assessment request, options = nil
266
308
  raise ::ArgumentError, "request must be provided" if request.nil?
267
309
 
@@ -279,9 +321,11 @@ module Google
279
321
  gapic_version: ::Google::Cloud::RecaptchaEnterprise::V1::VERSION
280
322
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
281
323
 
282
- header_params = {
283
- "name" => request.name
284
- }
324
+ header_params = {}
325
+ if request.name
326
+ header_params["name"] = request.name
327
+ end
328
+
285
329
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
286
330
  metadata[:"x-goog-request-params"] ||= request_params_header
287
331
 
@@ -333,6 +377,21 @@ module Google
333
377
  #
334
378
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
335
379
  #
380
+ # @example Basic example
381
+ # require "google/cloud/recaptcha_enterprise/v1"
382
+ #
383
+ # # Create a client object. The client can be reused for multiple calls.
384
+ # client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new
385
+ #
386
+ # # Create a request. To set request fields, pass in keyword arguments.
387
+ # request = Google::Cloud::RecaptchaEnterprise::V1::CreateKeyRequest.new
388
+ #
389
+ # # Call the create_key method.
390
+ # result = client.create_key request
391
+ #
392
+ # # The returned object is of type Google::Cloud::RecaptchaEnterprise::V1::Key.
393
+ # p result
394
+ #
336
395
  def create_key request, options = nil
337
396
  raise ::ArgumentError, "request must be provided" if request.nil?
338
397
 
@@ -350,9 +409,11 @@ module Google
350
409
  gapic_version: ::Google::Cloud::RecaptchaEnterprise::V1::VERSION
351
410
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
352
411
 
353
- header_params = {
354
- "parent" => request.parent
355
- }
412
+ header_params = {}
413
+ if request.parent
414
+ header_params["parent"] = request.parent
415
+ end
416
+
356
417
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
357
418
  metadata[:"x-goog-request-params"] ||= request_params_header
358
419
 
@@ -408,6 +469,27 @@ module Google
408
469
  #
409
470
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
410
471
  #
472
+ # @example Basic example
473
+ # require "google/cloud/recaptcha_enterprise/v1"
474
+ #
475
+ # # Create a client object. The client can be reused for multiple calls.
476
+ # client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new
477
+ #
478
+ # # Create a request. To set request fields, pass in keyword arguments.
479
+ # request = Google::Cloud::RecaptchaEnterprise::V1::ListKeysRequest.new
480
+ #
481
+ # # Call the list_keys method.
482
+ # result = client.list_keys request
483
+ #
484
+ # # The returned object is of type Gapic::PagedEnumerable. You can
485
+ # # iterate over all elements by calling #each, and the enumerable
486
+ # # will lazily make API calls to fetch subsequent pages. Other
487
+ # # methods are also available for managing paging directly.
488
+ # result.each do |response|
489
+ # # Each element is of type ::Google::Cloud::RecaptchaEnterprise::V1::Key.
490
+ # p response
491
+ # end
492
+ #
411
493
  def list_keys request, options = nil
412
494
  raise ::ArgumentError, "request must be provided" if request.nil?
413
495
 
@@ -425,9 +507,11 @@ module Google
425
507
  gapic_version: ::Google::Cloud::RecaptchaEnterprise::V1::VERSION
426
508
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
427
509
 
428
- header_params = {
429
- "parent" => request.parent
430
- }
510
+ header_params = {}
511
+ if request.parent
512
+ header_params["parent"] = request.parent
513
+ end
514
+
431
515
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
432
516
  metadata[:"x-goog-request-params"] ||= request_params_header
433
517
 
@@ -478,6 +562,21 @@ module Google
478
562
  #
479
563
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
480
564
  #
565
+ # @example Basic example
566
+ # require "google/cloud/recaptcha_enterprise/v1"
567
+ #
568
+ # # Create a client object. The client can be reused for multiple calls.
569
+ # client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new
570
+ #
571
+ # # Create a request. To set request fields, pass in keyword arguments.
572
+ # request = Google::Cloud::RecaptchaEnterprise::V1::GetKeyRequest.new
573
+ #
574
+ # # Call the get_key method.
575
+ # result = client.get_key request
576
+ #
577
+ # # The returned object is of type Google::Cloud::RecaptchaEnterprise::V1::Key.
578
+ # p result
579
+ #
481
580
  def get_key request, options = nil
482
581
  raise ::ArgumentError, "request must be provided" if request.nil?
483
582
 
@@ -495,9 +594,11 @@ module Google
495
594
  gapic_version: ::Google::Cloud::RecaptchaEnterprise::V1::VERSION
496
595
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
497
596
 
498
- header_params = {
499
- "name" => request.name
500
- }
597
+ header_params = {}
598
+ if request.name
599
+ header_params["name"] = request.name
600
+ end
601
+
501
602
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
502
603
  metadata[:"x-goog-request-params"] ||= request_params_header
503
604
 
@@ -538,7 +639,7 @@ module Google
538
639
  # @param key [::Google::Cloud::RecaptchaEnterprise::V1::Key, ::Hash]
539
640
  # Required. The key to update.
540
641
  # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
541
- # Optional. The mask to control which field of the key get updated. If the mask is not
642
+ # Optional. The mask to control which fields of the key get updated. If the mask is not
542
643
  # present, all fields will be updated.
543
644
  #
544
645
  # @yield [response, operation] Access the result along with the RPC operation
@@ -549,6 +650,21 @@ module Google
549
650
  #
550
651
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
551
652
  #
653
+ # @example Basic example
654
+ # require "google/cloud/recaptcha_enterprise/v1"
655
+ #
656
+ # # Create a client object. The client can be reused for multiple calls.
657
+ # client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new
658
+ #
659
+ # # Create a request. To set request fields, pass in keyword arguments.
660
+ # request = Google::Cloud::RecaptchaEnterprise::V1::UpdateKeyRequest.new
661
+ #
662
+ # # Call the update_key method.
663
+ # result = client.update_key request
664
+ #
665
+ # # The returned object is of type Google::Cloud::RecaptchaEnterprise::V1::Key.
666
+ # p result
667
+ #
552
668
  def update_key request, options = nil
553
669
  raise ::ArgumentError, "request must be provided" if request.nil?
554
670
 
@@ -566,9 +682,11 @@ module Google
566
682
  gapic_version: ::Google::Cloud::RecaptchaEnterprise::V1::VERSION
567
683
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
568
684
 
569
- header_params = {
570
- "key.name" => request.key.name
571
- }
685
+ header_params = {}
686
+ if request.key&.name
687
+ header_params["key.name"] = request.key.name
688
+ end
689
+
572
690
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
573
691
  metadata[:"x-goog-request-params"] ||= request_params_header
574
692
 
@@ -618,6 +736,21 @@ module Google
618
736
  #
619
737
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
620
738
  #
739
+ # @example Basic example
740
+ # require "google/cloud/recaptcha_enterprise/v1"
741
+ #
742
+ # # Create a client object. The client can be reused for multiple calls.
743
+ # client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new
744
+ #
745
+ # # Create a request. To set request fields, pass in keyword arguments.
746
+ # request = Google::Cloud::RecaptchaEnterprise::V1::DeleteKeyRequest.new
747
+ #
748
+ # # Call the delete_key method.
749
+ # result = client.delete_key request
750
+ #
751
+ # # The returned object is of type Google::Protobuf::Empty.
752
+ # p result
753
+ #
621
754
  def delete_key request, options = nil
622
755
  raise ::ArgumentError, "request must be provided" if request.nil?
623
756
 
@@ -635,9 +768,11 @@ module Google
635
768
  gapic_version: ::Google::Cloud::RecaptchaEnterprise::V1::VERSION
636
769
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
637
770
 
638
- header_params = {
639
- "name" => request.name
640
- }
771
+ header_params = {}
772
+ if request.name
773
+ header_params["name"] = request.name
774
+ end
775
+
641
776
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
642
777
  metadata[:"x-goog-request-params"] ||= request_params_header
643
778
 
@@ -657,6 +792,504 @@ module Google
657
792
  raise ::Google::Cloud::Error.from_error(e)
658
793
  end
659
794
 
795
+ ##
796
+ # Migrates an existing key from reCAPTCHA to reCAPTCHA Enterprise.
797
+ # Once a key is migrated, it can be used from either product. SiteVerify
798
+ # requests are billed as CreateAssessment calls. You must be
799
+ # authenticated as one of the current owners of the reCAPTCHA Site Key, and
800
+ # your user must have the reCAPTCHA Enterprise Admin IAM role in the
801
+ # destination project.
802
+ #
803
+ # @overload migrate_key(request, options = nil)
804
+ # Pass arguments to `migrate_key` via a request object, either of type
805
+ # {::Google::Cloud::RecaptchaEnterprise::V1::MigrateKeyRequest} or an equivalent Hash.
806
+ #
807
+ # @param request [::Google::Cloud::RecaptchaEnterprise::V1::MigrateKeyRequest, ::Hash]
808
+ # A request object representing the call parameters. Required. To specify no
809
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
810
+ # @param options [::Gapic::CallOptions, ::Hash]
811
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
812
+ #
813
+ # @overload migrate_key(name: nil)
814
+ # Pass arguments to `migrate_key` via keyword arguments. Note that at
815
+ # least one keyword argument is required. To specify no parameters, or to keep all
816
+ # the default parameter values, pass an empty Hash as a request object (see above).
817
+ #
818
+ # @param name [::String]
819
+ # Required. The name of the key to be migrated, in the format
820
+ # "projects/\\{project}/keys/\\{key}".
821
+ #
822
+ # @yield [response, operation] Access the result along with the RPC operation
823
+ # @yieldparam response [::Google::Cloud::RecaptchaEnterprise::V1::Key]
824
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
825
+ #
826
+ # @return [::Google::Cloud::RecaptchaEnterprise::V1::Key]
827
+ #
828
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
829
+ #
830
+ # @example Basic example
831
+ # require "google/cloud/recaptcha_enterprise/v1"
832
+ #
833
+ # # Create a client object. The client can be reused for multiple calls.
834
+ # client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new
835
+ #
836
+ # # Create a request. To set request fields, pass in keyword arguments.
837
+ # request = Google::Cloud::RecaptchaEnterprise::V1::MigrateKeyRequest.new
838
+ #
839
+ # # Call the migrate_key method.
840
+ # result = client.migrate_key request
841
+ #
842
+ # # The returned object is of type Google::Cloud::RecaptchaEnterprise::V1::Key.
843
+ # p result
844
+ #
845
+ def migrate_key request, options = nil
846
+ raise ::ArgumentError, "request must be provided" if request.nil?
847
+
848
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::MigrateKeyRequest
849
+
850
+ # Converts hash and nil to an options object
851
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
852
+
853
+ # Customize the options with defaults
854
+ metadata = @config.rpcs.migrate_key.metadata.to_h
855
+
856
+ # Set x-goog-api-client and x-goog-user-project headers
857
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
858
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
859
+ gapic_version: ::Google::Cloud::RecaptchaEnterprise::V1::VERSION
860
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
861
+
862
+ header_params = {}
863
+ if request.name
864
+ header_params["name"] = request.name
865
+ end
866
+
867
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
868
+ metadata[:"x-goog-request-params"] ||= request_params_header
869
+
870
+ options.apply_defaults timeout: @config.rpcs.migrate_key.timeout,
871
+ metadata: metadata,
872
+ retry_policy: @config.rpcs.migrate_key.retry_policy
873
+
874
+ options.apply_defaults timeout: @config.timeout,
875
+ metadata: @config.metadata,
876
+ retry_policy: @config.retry_policy
877
+
878
+ @recaptcha_enterprise_service_stub.call_rpc :migrate_key, request, options: options do |response, operation|
879
+ yield response, operation if block_given?
880
+ return response
881
+ end
882
+ rescue ::GRPC::BadStatus => e
883
+ raise ::Google::Cloud::Error.from_error(e)
884
+ end
885
+
886
+ ##
887
+ # Get some aggregated metrics for a Key. This data can be used to build
888
+ # dashboards.
889
+ #
890
+ # @overload get_metrics(request, options = nil)
891
+ # Pass arguments to `get_metrics` via a request object, either of type
892
+ # {::Google::Cloud::RecaptchaEnterprise::V1::GetMetricsRequest} or an equivalent Hash.
893
+ #
894
+ # @param request [::Google::Cloud::RecaptchaEnterprise::V1::GetMetricsRequest, ::Hash]
895
+ # A request object representing the call parameters. Required. To specify no
896
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
897
+ # @param options [::Gapic::CallOptions, ::Hash]
898
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
899
+ #
900
+ # @overload get_metrics(name: nil)
901
+ # Pass arguments to `get_metrics` via keyword arguments. Note that at
902
+ # least one keyword argument is required. To specify no parameters, or to keep all
903
+ # the default parameter values, pass an empty Hash as a request object (see above).
904
+ #
905
+ # @param name [::String]
906
+ # Required. The name of the requested metrics, in the format
907
+ # "projects/\\{project}/keys/\\{key}/metrics".
908
+ #
909
+ # @yield [response, operation] Access the result along with the RPC operation
910
+ # @yieldparam response [::Google::Cloud::RecaptchaEnterprise::V1::Metrics]
911
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
912
+ #
913
+ # @return [::Google::Cloud::RecaptchaEnterprise::V1::Metrics]
914
+ #
915
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
916
+ #
917
+ # @example Basic example
918
+ # require "google/cloud/recaptcha_enterprise/v1"
919
+ #
920
+ # # Create a client object. The client can be reused for multiple calls.
921
+ # client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new
922
+ #
923
+ # # Create a request. To set request fields, pass in keyword arguments.
924
+ # request = Google::Cloud::RecaptchaEnterprise::V1::GetMetricsRequest.new
925
+ #
926
+ # # Call the get_metrics method.
927
+ # result = client.get_metrics request
928
+ #
929
+ # # The returned object is of type Google::Cloud::RecaptchaEnterprise::V1::Metrics.
930
+ # p result
931
+ #
932
+ def get_metrics request, options = nil
933
+ raise ::ArgumentError, "request must be provided" if request.nil?
934
+
935
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::GetMetricsRequest
936
+
937
+ # Converts hash and nil to an options object
938
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
939
+
940
+ # Customize the options with defaults
941
+ metadata = @config.rpcs.get_metrics.metadata.to_h
942
+
943
+ # Set x-goog-api-client and x-goog-user-project headers
944
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
945
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
946
+ gapic_version: ::Google::Cloud::RecaptchaEnterprise::V1::VERSION
947
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
948
+
949
+ header_params = {}
950
+ if request.name
951
+ header_params["name"] = request.name
952
+ end
953
+
954
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
955
+ metadata[:"x-goog-request-params"] ||= request_params_header
956
+
957
+ options.apply_defaults timeout: @config.rpcs.get_metrics.timeout,
958
+ metadata: metadata,
959
+ retry_policy: @config.rpcs.get_metrics.retry_policy
960
+
961
+ options.apply_defaults timeout: @config.timeout,
962
+ metadata: @config.metadata,
963
+ retry_policy: @config.retry_policy
964
+
965
+ @recaptcha_enterprise_service_stub.call_rpc :get_metrics, request, options: options do |response, operation|
966
+ yield response, operation if block_given?
967
+ return response
968
+ end
969
+ rescue ::GRPC::BadStatus => e
970
+ raise ::Google::Cloud::Error.from_error(e)
971
+ end
972
+
973
+ ##
974
+ # List groups of related accounts.
975
+ #
976
+ # @overload list_related_account_groups(request, options = nil)
977
+ # Pass arguments to `list_related_account_groups` via a request object, either of type
978
+ # {::Google::Cloud::RecaptchaEnterprise::V1::ListRelatedAccountGroupsRequest} or an equivalent Hash.
979
+ #
980
+ # @param request [::Google::Cloud::RecaptchaEnterprise::V1::ListRelatedAccountGroupsRequest, ::Hash]
981
+ # A request object representing the call parameters. Required. To specify no
982
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
983
+ # @param options [::Gapic::CallOptions, ::Hash]
984
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
985
+ #
986
+ # @overload list_related_account_groups(parent: nil, page_size: nil, page_token: nil)
987
+ # Pass arguments to `list_related_account_groups` via keyword arguments. Note that at
988
+ # least one keyword argument is required. To specify no parameters, or to keep all
989
+ # the default parameter values, pass an empty Hash as a request object (see above).
990
+ #
991
+ # @param parent [::String]
992
+ # Required. The name of the project to list related account groups from, in the format
993
+ # "projects/\\{project}".
994
+ # @param page_size [::Integer]
995
+ # Optional. The maximum number of groups to return. The service may return fewer than
996
+ # this value.
997
+ # If unspecified, at most 50 groups will be returned.
998
+ # The maximum value is 1000; values above 1000 will be coerced to 1000.
999
+ # @param page_token [::String]
1000
+ # Optional. A page token, received from a previous `ListRelatedAccountGroups` call.
1001
+ # Provide this to retrieve the subsequent page.
1002
+ #
1003
+ # When paginating, all other parameters provided to
1004
+ # `ListRelatedAccountGroups` must match the call that provided the page
1005
+ # token.
1006
+ #
1007
+ # @yield [response, operation] Access the result along with the RPC operation
1008
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::RecaptchaEnterprise::V1::RelatedAccountGroup>]
1009
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1010
+ #
1011
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::RecaptchaEnterprise::V1::RelatedAccountGroup>]
1012
+ #
1013
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1014
+ #
1015
+ # @example Basic example
1016
+ # require "google/cloud/recaptcha_enterprise/v1"
1017
+ #
1018
+ # # Create a client object. The client can be reused for multiple calls.
1019
+ # client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new
1020
+ #
1021
+ # # Create a request. To set request fields, pass in keyword arguments.
1022
+ # request = Google::Cloud::RecaptchaEnterprise::V1::ListRelatedAccountGroupsRequest.new
1023
+ #
1024
+ # # Call the list_related_account_groups method.
1025
+ # result = client.list_related_account_groups request
1026
+ #
1027
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1028
+ # # iterate over all elements by calling #each, and the enumerable
1029
+ # # will lazily make API calls to fetch subsequent pages. Other
1030
+ # # methods are also available for managing paging directly.
1031
+ # result.each do |response|
1032
+ # # Each element is of type ::Google::Cloud::RecaptchaEnterprise::V1::RelatedAccountGroup.
1033
+ # p response
1034
+ # end
1035
+ #
1036
+ def list_related_account_groups request, options = nil
1037
+ raise ::ArgumentError, "request must be provided" if request.nil?
1038
+
1039
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::ListRelatedAccountGroupsRequest
1040
+
1041
+ # Converts hash and nil to an options object
1042
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1043
+
1044
+ # Customize the options with defaults
1045
+ metadata = @config.rpcs.list_related_account_groups.metadata.to_h
1046
+
1047
+ # Set x-goog-api-client and x-goog-user-project headers
1048
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1049
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1050
+ gapic_version: ::Google::Cloud::RecaptchaEnterprise::V1::VERSION
1051
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1052
+
1053
+ header_params = {}
1054
+ if request.parent
1055
+ header_params["parent"] = request.parent
1056
+ end
1057
+
1058
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1059
+ metadata[:"x-goog-request-params"] ||= request_params_header
1060
+
1061
+ options.apply_defaults timeout: @config.rpcs.list_related_account_groups.timeout,
1062
+ metadata: metadata,
1063
+ retry_policy: @config.rpcs.list_related_account_groups.retry_policy
1064
+
1065
+ options.apply_defaults timeout: @config.timeout,
1066
+ metadata: @config.metadata,
1067
+ retry_policy: @config.retry_policy
1068
+
1069
+ @recaptcha_enterprise_service_stub.call_rpc :list_related_account_groups, request, options: options do |response, operation|
1070
+ response = ::Gapic::PagedEnumerable.new @recaptcha_enterprise_service_stub, :list_related_account_groups, request, response, operation, options
1071
+ yield response, operation if block_given?
1072
+ return response
1073
+ end
1074
+ rescue ::GRPC::BadStatus => e
1075
+ raise ::Google::Cloud::Error.from_error(e)
1076
+ end
1077
+
1078
+ ##
1079
+ # Get the memberships in a group of related accounts.
1080
+ #
1081
+ # @overload list_related_account_group_memberships(request, options = nil)
1082
+ # Pass arguments to `list_related_account_group_memberships` via a request object, either of type
1083
+ # {::Google::Cloud::RecaptchaEnterprise::V1::ListRelatedAccountGroupMembershipsRequest} or an equivalent Hash.
1084
+ #
1085
+ # @param request [::Google::Cloud::RecaptchaEnterprise::V1::ListRelatedAccountGroupMembershipsRequest, ::Hash]
1086
+ # A request object representing the call parameters. Required. To specify no
1087
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1088
+ # @param options [::Gapic::CallOptions, ::Hash]
1089
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1090
+ #
1091
+ # @overload list_related_account_group_memberships(parent: nil, page_size: nil, page_token: nil)
1092
+ # Pass arguments to `list_related_account_group_memberships` via keyword arguments. Note that at
1093
+ # least one keyword argument is required. To specify no parameters, or to keep all
1094
+ # the default parameter values, pass an empty Hash as a request object (see above).
1095
+ #
1096
+ # @param parent [::String]
1097
+ # Required. The resource name for the related account group in the format
1098
+ # `projects/{project}/relatedaccountgroups/{relatedaccountgroup}`.
1099
+ # @param page_size [::Integer]
1100
+ # Optional. The maximum number of accounts to return. The service may return fewer than
1101
+ # this value.
1102
+ # If unspecified, at most 50 accounts will be returned.
1103
+ # The maximum value is 1000; values above 1000 will be coerced to 1000.
1104
+ # @param page_token [::String]
1105
+ # Optional. A page token, received from a previous `ListRelatedAccountGroupMemberships`
1106
+ # call.
1107
+ #
1108
+ # When paginating, all other parameters provided to
1109
+ # `ListRelatedAccountGroupMemberships` must match the call that provided the
1110
+ # page token.
1111
+ #
1112
+ # @yield [response, operation] Access the result along with the RPC operation
1113
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::RecaptchaEnterprise::V1::RelatedAccountGroupMembership>]
1114
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1115
+ #
1116
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::RecaptchaEnterprise::V1::RelatedAccountGroupMembership>]
1117
+ #
1118
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1119
+ #
1120
+ # @example Basic example
1121
+ # require "google/cloud/recaptcha_enterprise/v1"
1122
+ #
1123
+ # # Create a client object. The client can be reused for multiple calls.
1124
+ # client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new
1125
+ #
1126
+ # # Create a request. To set request fields, pass in keyword arguments.
1127
+ # request = Google::Cloud::RecaptchaEnterprise::V1::ListRelatedAccountGroupMembershipsRequest.new
1128
+ #
1129
+ # # Call the list_related_account_group_memberships method.
1130
+ # result = client.list_related_account_group_memberships request
1131
+ #
1132
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1133
+ # # iterate over all elements by calling #each, and the enumerable
1134
+ # # will lazily make API calls to fetch subsequent pages. Other
1135
+ # # methods are also available for managing paging directly.
1136
+ # result.each do |response|
1137
+ # # Each element is of type ::Google::Cloud::RecaptchaEnterprise::V1::RelatedAccountGroupMembership.
1138
+ # p response
1139
+ # end
1140
+ #
1141
+ def list_related_account_group_memberships request, options = nil
1142
+ raise ::ArgumentError, "request must be provided" if request.nil?
1143
+
1144
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::ListRelatedAccountGroupMembershipsRequest
1145
+
1146
+ # Converts hash and nil to an options object
1147
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1148
+
1149
+ # Customize the options with defaults
1150
+ metadata = @config.rpcs.list_related_account_group_memberships.metadata.to_h
1151
+
1152
+ # Set x-goog-api-client and x-goog-user-project headers
1153
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1154
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1155
+ gapic_version: ::Google::Cloud::RecaptchaEnterprise::V1::VERSION
1156
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1157
+
1158
+ header_params = {}
1159
+ if request.parent
1160
+ header_params["parent"] = request.parent
1161
+ end
1162
+
1163
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1164
+ metadata[:"x-goog-request-params"] ||= request_params_header
1165
+
1166
+ options.apply_defaults timeout: @config.rpcs.list_related_account_group_memberships.timeout,
1167
+ metadata: metadata,
1168
+ retry_policy: @config.rpcs.list_related_account_group_memberships.retry_policy
1169
+
1170
+ options.apply_defaults timeout: @config.timeout,
1171
+ metadata: @config.metadata,
1172
+ retry_policy: @config.retry_policy
1173
+
1174
+ @recaptcha_enterprise_service_stub.call_rpc :list_related_account_group_memberships, request, options: options do |response, operation|
1175
+ response = ::Gapic::PagedEnumerable.new @recaptcha_enterprise_service_stub, :list_related_account_group_memberships, request, response, operation, options
1176
+ yield response, operation if block_given?
1177
+ return response
1178
+ end
1179
+ rescue ::GRPC::BadStatus => e
1180
+ raise ::Google::Cloud::Error.from_error(e)
1181
+ end
1182
+
1183
+ ##
1184
+ # Search group memberships related to a given account.
1185
+ #
1186
+ # @overload search_related_account_group_memberships(request, options = nil)
1187
+ # Pass arguments to `search_related_account_group_memberships` via a request object, either of type
1188
+ # {::Google::Cloud::RecaptchaEnterprise::V1::SearchRelatedAccountGroupMembershipsRequest} or an equivalent Hash.
1189
+ #
1190
+ # @param request [::Google::Cloud::RecaptchaEnterprise::V1::SearchRelatedAccountGroupMembershipsRequest, ::Hash]
1191
+ # A request object representing the call parameters. Required. To specify no
1192
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1193
+ # @param options [::Gapic::CallOptions, ::Hash]
1194
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1195
+ #
1196
+ # @overload search_related_account_group_memberships(parent: nil, hashed_account_id: nil, page_size: nil, page_token: nil)
1197
+ # Pass arguments to `search_related_account_group_memberships` via keyword arguments. Note that at
1198
+ # least one keyword argument is required. To specify no parameters, or to keep all
1199
+ # the default parameter values, pass an empty Hash as a request object (see above).
1200
+ #
1201
+ # @param parent [::String]
1202
+ # Required. The name of the project to search related account group memberships from,
1203
+ # in the format "projects/\\{project}".
1204
+ # @param hashed_account_id [::String]
1205
+ # Optional. The unique stable hashed user identifier we should search connections to.
1206
+ # The identifier should correspond to a `hashed_account_id` provided in a
1207
+ # previous CreateAssessment or AnnotateAssessment call.
1208
+ # @param page_size [::Integer]
1209
+ # Optional. The maximum number of groups to return. The service may return fewer than
1210
+ # this value.
1211
+ # If unspecified, at most 50 groups will be returned.
1212
+ # The maximum value is 1000; values above 1000 will be coerced to 1000.
1213
+ # @param page_token [::String]
1214
+ # Optional. A page token, received from a previous
1215
+ # `SearchRelatedAccountGroupMemberships` call. Provide this to retrieve the
1216
+ # subsequent page.
1217
+ #
1218
+ # When paginating, all other parameters provided to
1219
+ # `SearchRelatedAccountGroupMemberships` must match the call that provided
1220
+ # the page token.
1221
+ #
1222
+ # @yield [response, operation] Access the result along with the RPC operation
1223
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::RecaptchaEnterprise::V1::RelatedAccountGroupMembership>]
1224
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1225
+ #
1226
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::RecaptchaEnterprise::V1::RelatedAccountGroupMembership>]
1227
+ #
1228
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1229
+ #
1230
+ # @example Basic example
1231
+ # require "google/cloud/recaptcha_enterprise/v1"
1232
+ #
1233
+ # # Create a client object. The client can be reused for multiple calls.
1234
+ # client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new
1235
+ #
1236
+ # # Create a request. To set request fields, pass in keyword arguments.
1237
+ # request = Google::Cloud::RecaptchaEnterprise::V1::SearchRelatedAccountGroupMembershipsRequest.new
1238
+ #
1239
+ # # Call the search_related_account_group_memberships method.
1240
+ # result = client.search_related_account_group_memberships request
1241
+ #
1242
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1243
+ # # iterate over all elements by calling #each, and the enumerable
1244
+ # # will lazily make API calls to fetch subsequent pages. Other
1245
+ # # methods are also available for managing paging directly.
1246
+ # result.each do |response|
1247
+ # # Each element is of type ::Google::Cloud::RecaptchaEnterprise::V1::RelatedAccountGroupMembership.
1248
+ # p response
1249
+ # end
1250
+ #
1251
+ def search_related_account_group_memberships request, options = nil
1252
+ raise ::ArgumentError, "request must be provided" if request.nil?
1253
+
1254
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::SearchRelatedAccountGroupMembershipsRequest
1255
+
1256
+ # Converts hash and nil to an options object
1257
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1258
+
1259
+ # Customize the options with defaults
1260
+ metadata = @config.rpcs.search_related_account_group_memberships.metadata.to_h
1261
+
1262
+ # Set x-goog-api-client and x-goog-user-project headers
1263
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1264
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1265
+ gapic_version: ::Google::Cloud::RecaptchaEnterprise::V1::VERSION
1266
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1267
+
1268
+ header_params = {}
1269
+ if request.parent
1270
+ header_params["parent"] = request.parent
1271
+ end
1272
+
1273
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1274
+ metadata[:"x-goog-request-params"] ||= request_params_header
1275
+
1276
+ options.apply_defaults timeout: @config.rpcs.search_related_account_group_memberships.timeout,
1277
+ metadata: metadata,
1278
+ retry_policy: @config.rpcs.search_related_account_group_memberships.retry_policy
1279
+
1280
+ options.apply_defaults timeout: @config.timeout,
1281
+ metadata: @config.metadata,
1282
+ retry_policy: @config.retry_policy
1283
+
1284
+ @recaptcha_enterprise_service_stub.call_rpc :search_related_account_group_memberships, request, options: options do |response, operation|
1285
+ response = ::Gapic::PagedEnumerable.new @recaptcha_enterprise_service_stub, :search_related_account_group_memberships, request, response, operation, options
1286
+ yield response, operation if block_given?
1287
+ return response
1288
+ end
1289
+ rescue ::GRPC::BadStatus => e
1290
+ raise ::Google::Cloud::Error.from_error(e)
1291
+ end
1292
+
660
1293
  ##
661
1294
  # Configuration class for the RecaptchaEnterpriseService API.
662
1295
  #
@@ -827,6 +1460,31 @@ module Google
827
1460
  # @return [::Gapic::Config::Method]
828
1461
  #
829
1462
  attr_reader :delete_key
1463
+ ##
1464
+ # RPC-specific configuration for `migrate_key`
1465
+ # @return [::Gapic::Config::Method]
1466
+ #
1467
+ attr_reader :migrate_key
1468
+ ##
1469
+ # RPC-specific configuration for `get_metrics`
1470
+ # @return [::Gapic::Config::Method]
1471
+ #
1472
+ attr_reader :get_metrics
1473
+ ##
1474
+ # RPC-specific configuration for `list_related_account_groups`
1475
+ # @return [::Gapic::Config::Method]
1476
+ #
1477
+ attr_reader :list_related_account_groups
1478
+ ##
1479
+ # RPC-specific configuration for `list_related_account_group_memberships`
1480
+ # @return [::Gapic::Config::Method]
1481
+ #
1482
+ attr_reader :list_related_account_group_memberships
1483
+ ##
1484
+ # RPC-specific configuration for `search_related_account_group_memberships`
1485
+ # @return [::Gapic::Config::Method]
1486
+ #
1487
+ attr_reader :search_related_account_group_memberships
830
1488
 
831
1489
  # @private
832
1490
  def initialize parent_rpcs = nil
@@ -844,6 +1502,16 @@ module Google
844
1502
  @update_key = ::Gapic::Config::Method.new update_key_config
845
1503
  delete_key_config = parent_rpcs.delete_key if parent_rpcs.respond_to? :delete_key
846
1504
  @delete_key = ::Gapic::Config::Method.new delete_key_config
1505
+ migrate_key_config = parent_rpcs.migrate_key if parent_rpcs.respond_to? :migrate_key
1506
+ @migrate_key = ::Gapic::Config::Method.new migrate_key_config
1507
+ get_metrics_config = parent_rpcs.get_metrics if parent_rpcs.respond_to? :get_metrics
1508
+ @get_metrics = ::Gapic::Config::Method.new get_metrics_config
1509
+ list_related_account_groups_config = parent_rpcs.list_related_account_groups if parent_rpcs.respond_to? :list_related_account_groups
1510
+ @list_related_account_groups = ::Gapic::Config::Method.new list_related_account_groups_config
1511
+ list_related_account_group_memberships_config = parent_rpcs.list_related_account_group_memberships if parent_rpcs.respond_to? :list_related_account_group_memberships
1512
+ @list_related_account_group_memberships = ::Gapic::Config::Method.new list_related_account_group_memberships_config
1513
+ search_related_account_group_memberships_config = parent_rpcs.search_related_account_group_memberships if parent_rpcs.respond_to? :search_related_account_group_memberships
1514
+ @search_related_account_group_memberships = ::Gapic::Config::Method.new search_related_account_group_memberships_config
847
1515
 
848
1516
  yield self if block_given?
849
1517
  end