google-cloud-recaptcha_enterprise-v1 0.15.0 → 0.17.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,6 +30,9 @@ module Google
30
30
  # Service to determine the likelihood an event is legitimate.
31
31
  #
32
32
  class Client
33
+ # @private
34
+ DEFAULT_ENDPOINT_TEMPLATE = "recaptchaenterprise.$UNIVERSE_DOMAIN$"
35
+
33
36
  include Paths
34
37
 
35
38
  # @private
@@ -104,6 +107,15 @@ module Google
104
107
  @config
105
108
  end
106
109
 
110
+ ##
111
+ # The effective universe domain
112
+ #
113
+ # @return [String]
114
+ #
115
+ def universe_domain
116
+ @recaptcha_enterprise_service_stub.universe_domain
117
+ end
118
+
107
119
  ##
108
120
  # Create a new RecaptchaEnterpriseService client object.
109
121
  #
@@ -137,8 +149,9 @@ module Google
137
149
  credentials = @config.credentials
138
150
  # Use self-signed JWT if the endpoint is unchanged from default,
139
151
  # but only if the default endpoint does not have a region prefix.
140
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
141
- !@config.endpoint.split(".").first.include?("-")
152
+ enable_self_signed_jwt = @config.endpoint.nil? ||
153
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
154
+ !@config.endpoint.split(".").first.include?("-"))
142
155
  credentials ||= Credentials.default scope: @config.scope,
143
156
  enable_self_signed_jwt: enable_self_signed_jwt
144
157
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -149,8 +162,10 @@ module Google
149
162
 
150
163
  @recaptcha_enterprise_service_stub = ::Gapic::ServiceStub.new(
151
164
  ::Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Stub,
152
- credentials: credentials,
153
- endpoint: @config.endpoint,
165
+ credentials: credentials,
166
+ endpoint: @config.endpoint,
167
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
168
+ universe_domain: @config.universe_domain,
154
169
  channel_args: @config.channel_args,
155
170
  interceptors: @config.interceptors,
156
171
  channel_pool_config: @config.channel_pool
@@ -179,7 +194,7 @@ module Google
179
194
  #
180
195
  # @param parent [::String]
181
196
  # Required. The name of the project in which the assessment will be created,
182
- # in the format "projects/\\{project}".
197
+ # in the format `projects/{project}`.
183
198
  # @param assessment [::Google::Cloud::RecaptchaEnterprise::V1::Assessment, ::Hash]
184
199
  # Required. The assessment details.
185
200
  #
@@ -261,27 +276,29 @@ module Google
261
276
  # @param options [::Gapic::CallOptions, ::Hash]
262
277
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
263
278
  #
264
- # @overload annotate_assessment(name: nil, annotation: nil, reasons: nil, hashed_account_id: nil, transaction_event: nil)
279
+ # @overload annotate_assessment(name: nil, annotation: nil, reasons: nil, account_id: nil, hashed_account_id: nil, transaction_event: nil)
265
280
  # Pass arguments to `annotate_assessment` via keyword arguments. Note that at
266
281
  # least one keyword argument is required. To specify no parameters, or to keep all
267
282
  # the default parameter values, pass an empty Hash as a request object (see above).
268
283
  #
269
284
  # @param name [::String]
270
285
  # Required. The resource name of the Assessment, in the format
271
- # "projects/\\{project}/assessments/\\{assessment}".
286
+ # `projects/{project}/assessments/{assessment}`.
272
287
  # @param annotation [::Google::Cloud::RecaptchaEnterprise::V1::AnnotateAssessmentRequest::Annotation]
273
288
  # Optional. The annotation that will be assigned to the Event. This field can
274
289
  # be left empty to provide reasons that apply to an event without concluding
275
290
  # whether the event is legitimate or fraudulent.
276
291
  # @param reasons [::Array<::Google::Cloud::RecaptchaEnterprise::V1::AnnotateAssessmentRequest::Reason>]
277
- # Optional. Optional reasons for the annotation that will be assigned to the
278
- # Event.
292
+ # Optional. Reasons for the annotation that are assigned to the event.
293
+ # @param account_id [::String]
294
+ # Optional. A stable account identifier to apply to the assessment. This is
295
+ # an alternative to setting `account_id` in `CreateAssessment`, for example
296
+ # when a stable account identifier is not yet known in the initial request.
279
297
  # @param hashed_account_id [::String]
280
- # Optional. Unique stable hashed user identifier to apply to the assessment.
281
- # This is an alternative to setting the hashed_account_id in
282
- # CreateAssessment, for example when the account identifier is not yet known
283
- # in the initial request. It is recommended that the identifier is hashed
284
- # using hmac-sha256 with stable secret.
298
+ # Optional. A stable hashed account identifier to apply to the assessment.
299
+ # This is an alternative to setting `hashed_account_id` in
300
+ # `CreateAssessment`, for example when a stable account identifier is not yet
301
+ # known in the initial request.
285
302
  # @param transaction_event [::Google::Cloud::RecaptchaEnterprise::V1::TransactionEvent, ::Hash]
286
303
  # Optional. If the assessment is part of a payment transaction, provide
287
304
  # details on payment lifecycle events that occur in the transaction.
@@ -370,7 +387,7 @@ module Google
370
387
  #
371
388
  # @param parent [::String]
372
389
  # Required. The name of the project in which the key will be created, in the
373
- # format "projects/\\{project}".
390
+ # format `projects/{project}`.
374
391
  # @param key [::Google::Cloud::RecaptchaEnterprise::V1::Key, ::Hash]
375
392
  # Required. Information to create a reCAPTCHA Enterprise key.
376
393
  #
@@ -458,7 +475,7 @@ module Google
458
475
  #
459
476
  # @param parent [::String]
460
477
  # Required. The name of the project that contains the keys that will be
461
- # listed, in the format "projects/\\{project}".
478
+ # listed, in the format `projects/{project}`.
462
479
  # @param page_size [::Integer]
463
480
  # Optional. The maximum number of keys to return. Default is 10. Max limit is
464
481
  # 1000.
@@ -557,7 +574,7 @@ module Google
557
574
  #
558
575
  # @param key [::String]
559
576
  # Required. The public key name linked to the requested secret key in the
560
- # format "projects/\\{project}/keys/\\{key}".
577
+ # format `projects/{project}/keys/{key}`.
561
578
  #
562
579
  # @yield [response, operation] Access the result along with the RPC operation
563
580
  # @yieldparam response [::Google::Cloud::RecaptchaEnterprise::V1::RetrieveLegacySecretKeyResponse]
@@ -643,7 +660,7 @@ module Google
643
660
  #
644
661
  # @param name [::String]
645
662
  # Required. The name of the requested key, in the format
646
- # "projects/\\{project}/keys/\\{key}".
663
+ # `projects/{project}/keys/{key}`.
647
664
  #
648
665
  # @yield [response, operation] Access the result along with the RPC operation
649
666
  # @yieldparam response [::Google::Cloud::RecaptchaEnterprise::V1::Key]
@@ -817,7 +834,7 @@ module Google
817
834
  #
818
835
  # @param name [::String]
819
836
  # Required. The name of the key to be deleted, in the format
820
- # "projects/\\{project}/keys/\\{key}".
837
+ # `projects/{project}/keys/{key}`.
821
838
  #
822
839
  # @yield [response, operation] Access the result along with the RPC operation
823
840
  # @yieldparam response [::Google::Protobuf::Empty]
@@ -887,7 +904,7 @@ module Google
887
904
  # Migrates an existing key from reCAPTCHA to reCAPTCHA Enterprise.
888
905
  # Once a key is migrated, it can be used from either product. SiteVerify
889
906
  # requests are billed as CreateAssessment calls. You must be
890
- # authenticated as one of the current owners of the reCAPTCHA Site Key, and
907
+ # authenticated as one of the current owners of the reCAPTCHA Key, and
891
908
  # your user must have the reCAPTCHA Enterprise Admin IAM role in the
892
909
  # destination project.
893
910
  #
@@ -908,7 +925,7 @@ module Google
908
925
  #
909
926
  # @param name [::String]
910
927
  # Required. The name of the key to be migrated, in the format
911
- # "projects/\\{project}/keys/\\{key}".
928
+ # `projects/{project}/keys/{key}`.
912
929
  # @param skip_billing_check [::Boolean]
913
930
  # Optional. If true, skips the billing check.
914
931
  # A reCAPTCHA Enterprise key or migrated key behaves differently than a
@@ -1004,7 +1021,7 @@ module Google
1004
1021
  #
1005
1022
  # @param name [::String]
1006
1023
  # Required. The name of the requested metrics, in the format
1007
- # "projects/\\{project}/keys/\\{key}/metrics".
1024
+ # `projects/{project}/keys/{key}/metrics`.
1008
1025
  #
1009
1026
  # @yield [response, operation] Access the result along with the RPC operation
1010
1027
  # @yieldparam response [::Google::Cloud::RecaptchaEnterprise::V1::Metrics]
@@ -1070,6 +1087,453 @@ module Google
1070
1087
  raise ::Google::Cloud::Error.from_error(e)
1071
1088
  end
1072
1089
 
1090
+ ##
1091
+ # Creates a new FirewallPolicy, specifying conditions at which reCAPTCHA
1092
+ # Enterprise actions can be executed.
1093
+ # A project may have a maximum of 1000 policies.
1094
+ #
1095
+ # @overload create_firewall_policy(request, options = nil)
1096
+ # Pass arguments to `create_firewall_policy` via a request object, either of type
1097
+ # {::Google::Cloud::RecaptchaEnterprise::V1::CreateFirewallPolicyRequest} or an equivalent Hash.
1098
+ #
1099
+ # @param request [::Google::Cloud::RecaptchaEnterprise::V1::CreateFirewallPolicyRequest, ::Hash]
1100
+ # A request object representing the call parameters. Required. To specify no
1101
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1102
+ # @param options [::Gapic::CallOptions, ::Hash]
1103
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1104
+ #
1105
+ # @overload create_firewall_policy(parent: nil, firewall_policy: nil)
1106
+ # Pass arguments to `create_firewall_policy` via keyword arguments. Note that at
1107
+ # least one keyword argument is required. To specify no parameters, or to keep all
1108
+ # the default parameter values, pass an empty Hash as a request object (see above).
1109
+ #
1110
+ # @param parent [::String]
1111
+ # Required. The name of the project this policy will apply to, in the format
1112
+ # `projects/{project}`.
1113
+ # @param firewall_policy [::Google::Cloud::RecaptchaEnterprise::V1::FirewallPolicy, ::Hash]
1114
+ # Required. Information to create the policy.
1115
+ #
1116
+ # @yield [response, operation] Access the result along with the RPC operation
1117
+ # @yieldparam response [::Google::Cloud::RecaptchaEnterprise::V1::FirewallPolicy]
1118
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1119
+ #
1120
+ # @return [::Google::Cloud::RecaptchaEnterprise::V1::FirewallPolicy]
1121
+ #
1122
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1123
+ #
1124
+ # @example Basic example
1125
+ # require "google/cloud/recaptcha_enterprise/v1"
1126
+ #
1127
+ # # Create a client object. The client can be reused for multiple calls.
1128
+ # client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new
1129
+ #
1130
+ # # Create a request. To set request fields, pass in keyword arguments.
1131
+ # request = Google::Cloud::RecaptchaEnterprise::V1::CreateFirewallPolicyRequest.new
1132
+ #
1133
+ # # Call the create_firewall_policy method.
1134
+ # result = client.create_firewall_policy request
1135
+ #
1136
+ # # The returned object is of type Google::Cloud::RecaptchaEnterprise::V1::FirewallPolicy.
1137
+ # p result
1138
+ #
1139
+ def create_firewall_policy request, options = nil
1140
+ raise ::ArgumentError, "request must be provided" if request.nil?
1141
+
1142
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::CreateFirewallPolicyRequest
1143
+
1144
+ # Converts hash and nil to an options object
1145
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1146
+
1147
+ # Customize the options with defaults
1148
+ metadata = @config.rpcs.create_firewall_policy.metadata.to_h
1149
+
1150
+ # Set x-goog-api-client and x-goog-user-project headers
1151
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1152
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1153
+ gapic_version: ::Google::Cloud::RecaptchaEnterprise::V1::VERSION
1154
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1155
+
1156
+ header_params = {}
1157
+ if request.parent
1158
+ header_params["parent"] = request.parent
1159
+ end
1160
+
1161
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1162
+ metadata[:"x-goog-request-params"] ||= request_params_header
1163
+
1164
+ options.apply_defaults timeout: @config.rpcs.create_firewall_policy.timeout,
1165
+ metadata: metadata,
1166
+ retry_policy: @config.rpcs.create_firewall_policy.retry_policy
1167
+
1168
+ options.apply_defaults timeout: @config.timeout,
1169
+ metadata: @config.metadata,
1170
+ retry_policy: @config.retry_policy
1171
+
1172
+ @recaptcha_enterprise_service_stub.call_rpc :create_firewall_policy, request, options: options do |response, operation|
1173
+ yield response, operation if block_given?
1174
+ return response
1175
+ end
1176
+ rescue ::GRPC::BadStatus => e
1177
+ raise ::Google::Cloud::Error.from_error(e)
1178
+ end
1179
+
1180
+ ##
1181
+ # Returns the list of all firewall policies that belong to a project.
1182
+ #
1183
+ # @overload list_firewall_policies(request, options = nil)
1184
+ # Pass arguments to `list_firewall_policies` via a request object, either of type
1185
+ # {::Google::Cloud::RecaptchaEnterprise::V1::ListFirewallPoliciesRequest} or an equivalent Hash.
1186
+ #
1187
+ # @param request [::Google::Cloud::RecaptchaEnterprise::V1::ListFirewallPoliciesRequest, ::Hash]
1188
+ # A request object representing the call parameters. Required. To specify no
1189
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1190
+ # @param options [::Gapic::CallOptions, ::Hash]
1191
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1192
+ #
1193
+ # @overload list_firewall_policies(parent: nil, page_size: nil, page_token: nil)
1194
+ # Pass arguments to `list_firewall_policies` via keyword arguments. Note that at
1195
+ # least one keyword argument is required. To specify no parameters, or to keep all
1196
+ # the default parameter values, pass an empty Hash as a request object (see above).
1197
+ #
1198
+ # @param parent [::String]
1199
+ # Required. The name of the project to list the policies for, in the format
1200
+ # `projects/{project}`.
1201
+ # @param page_size [::Integer]
1202
+ # Optional. The maximum number of policies to return. Default is 10. Max
1203
+ # limit is 1000.
1204
+ # @param page_token [::String]
1205
+ # Optional. The next_page_token value returned from a previous.
1206
+ # ListFirewallPoliciesRequest, if any.
1207
+ #
1208
+ # @yield [response, operation] Access the result along with the RPC operation
1209
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::RecaptchaEnterprise::V1::FirewallPolicy>]
1210
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1211
+ #
1212
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::RecaptchaEnterprise::V1::FirewallPolicy>]
1213
+ #
1214
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1215
+ #
1216
+ # @example Basic example
1217
+ # require "google/cloud/recaptcha_enterprise/v1"
1218
+ #
1219
+ # # Create a client object. The client can be reused for multiple calls.
1220
+ # client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new
1221
+ #
1222
+ # # Create a request. To set request fields, pass in keyword arguments.
1223
+ # request = Google::Cloud::RecaptchaEnterprise::V1::ListFirewallPoliciesRequest.new
1224
+ #
1225
+ # # Call the list_firewall_policies method.
1226
+ # result = client.list_firewall_policies request
1227
+ #
1228
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1229
+ # # over elements, and API calls will be issued to fetch pages as needed.
1230
+ # result.each do |item|
1231
+ # # Each element is of type ::Google::Cloud::RecaptchaEnterprise::V1::FirewallPolicy.
1232
+ # p item
1233
+ # end
1234
+ #
1235
+ def list_firewall_policies request, options = nil
1236
+ raise ::ArgumentError, "request must be provided" if request.nil?
1237
+
1238
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::ListFirewallPoliciesRequest
1239
+
1240
+ # Converts hash and nil to an options object
1241
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1242
+
1243
+ # Customize the options with defaults
1244
+ metadata = @config.rpcs.list_firewall_policies.metadata.to_h
1245
+
1246
+ # Set x-goog-api-client and x-goog-user-project headers
1247
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1248
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1249
+ gapic_version: ::Google::Cloud::RecaptchaEnterprise::V1::VERSION
1250
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1251
+
1252
+ header_params = {}
1253
+ if request.parent
1254
+ header_params["parent"] = request.parent
1255
+ end
1256
+
1257
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1258
+ metadata[:"x-goog-request-params"] ||= request_params_header
1259
+
1260
+ options.apply_defaults timeout: @config.rpcs.list_firewall_policies.timeout,
1261
+ metadata: metadata,
1262
+ retry_policy: @config.rpcs.list_firewall_policies.retry_policy
1263
+
1264
+ options.apply_defaults timeout: @config.timeout,
1265
+ metadata: @config.metadata,
1266
+ retry_policy: @config.retry_policy
1267
+
1268
+ @recaptcha_enterprise_service_stub.call_rpc :list_firewall_policies, request, options: options do |response, operation|
1269
+ response = ::Gapic::PagedEnumerable.new @recaptcha_enterprise_service_stub, :list_firewall_policies, request, response, operation, options
1270
+ yield response, operation if block_given?
1271
+ return response
1272
+ end
1273
+ rescue ::GRPC::BadStatus => e
1274
+ raise ::Google::Cloud::Error.from_error(e)
1275
+ end
1276
+
1277
+ ##
1278
+ # Returns the specified firewall policy.
1279
+ #
1280
+ # @overload get_firewall_policy(request, options = nil)
1281
+ # Pass arguments to `get_firewall_policy` via a request object, either of type
1282
+ # {::Google::Cloud::RecaptchaEnterprise::V1::GetFirewallPolicyRequest} or an equivalent Hash.
1283
+ #
1284
+ # @param request [::Google::Cloud::RecaptchaEnterprise::V1::GetFirewallPolicyRequest, ::Hash]
1285
+ # A request object representing the call parameters. Required. To specify no
1286
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1287
+ # @param options [::Gapic::CallOptions, ::Hash]
1288
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1289
+ #
1290
+ # @overload get_firewall_policy(name: nil)
1291
+ # Pass arguments to `get_firewall_policy` via keyword arguments. Note that at
1292
+ # least one keyword argument is required. To specify no parameters, or to keep all
1293
+ # the default parameter values, pass an empty Hash as a request object (see above).
1294
+ #
1295
+ # @param name [::String]
1296
+ # Required. The name of the requested policy, in the format
1297
+ # `projects/{project}/firewallpolicies/{firewallpolicy}`.
1298
+ #
1299
+ # @yield [response, operation] Access the result along with the RPC operation
1300
+ # @yieldparam response [::Google::Cloud::RecaptchaEnterprise::V1::FirewallPolicy]
1301
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1302
+ #
1303
+ # @return [::Google::Cloud::RecaptchaEnterprise::V1::FirewallPolicy]
1304
+ #
1305
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1306
+ #
1307
+ # @example Basic example
1308
+ # require "google/cloud/recaptcha_enterprise/v1"
1309
+ #
1310
+ # # Create a client object. The client can be reused for multiple calls.
1311
+ # client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new
1312
+ #
1313
+ # # Create a request. To set request fields, pass in keyword arguments.
1314
+ # request = Google::Cloud::RecaptchaEnterprise::V1::GetFirewallPolicyRequest.new
1315
+ #
1316
+ # # Call the get_firewall_policy method.
1317
+ # result = client.get_firewall_policy request
1318
+ #
1319
+ # # The returned object is of type Google::Cloud::RecaptchaEnterprise::V1::FirewallPolicy.
1320
+ # p result
1321
+ #
1322
+ def get_firewall_policy request, options = nil
1323
+ raise ::ArgumentError, "request must be provided" if request.nil?
1324
+
1325
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::GetFirewallPolicyRequest
1326
+
1327
+ # Converts hash and nil to an options object
1328
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1329
+
1330
+ # Customize the options with defaults
1331
+ metadata = @config.rpcs.get_firewall_policy.metadata.to_h
1332
+
1333
+ # Set x-goog-api-client and x-goog-user-project headers
1334
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1335
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1336
+ gapic_version: ::Google::Cloud::RecaptchaEnterprise::V1::VERSION
1337
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1338
+
1339
+ header_params = {}
1340
+ if request.name
1341
+ header_params["name"] = request.name
1342
+ end
1343
+
1344
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1345
+ metadata[:"x-goog-request-params"] ||= request_params_header
1346
+
1347
+ options.apply_defaults timeout: @config.rpcs.get_firewall_policy.timeout,
1348
+ metadata: metadata,
1349
+ retry_policy: @config.rpcs.get_firewall_policy.retry_policy
1350
+
1351
+ options.apply_defaults timeout: @config.timeout,
1352
+ metadata: @config.metadata,
1353
+ retry_policy: @config.retry_policy
1354
+
1355
+ @recaptcha_enterprise_service_stub.call_rpc :get_firewall_policy, request, options: options do |response, operation|
1356
+ yield response, operation if block_given?
1357
+ return response
1358
+ end
1359
+ rescue ::GRPC::BadStatus => e
1360
+ raise ::Google::Cloud::Error.from_error(e)
1361
+ end
1362
+
1363
+ ##
1364
+ # Updates the specified firewall policy.
1365
+ #
1366
+ # @overload update_firewall_policy(request, options = nil)
1367
+ # Pass arguments to `update_firewall_policy` via a request object, either of type
1368
+ # {::Google::Cloud::RecaptchaEnterprise::V1::UpdateFirewallPolicyRequest} or an equivalent Hash.
1369
+ #
1370
+ # @param request [::Google::Cloud::RecaptchaEnterprise::V1::UpdateFirewallPolicyRequest, ::Hash]
1371
+ # A request object representing the call parameters. Required. To specify no
1372
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1373
+ # @param options [::Gapic::CallOptions, ::Hash]
1374
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1375
+ #
1376
+ # @overload update_firewall_policy(firewall_policy: nil, update_mask: nil)
1377
+ # Pass arguments to `update_firewall_policy` via keyword arguments. Note that at
1378
+ # least one keyword argument is required. To specify no parameters, or to keep all
1379
+ # the default parameter values, pass an empty Hash as a request object (see above).
1380
+ #
1381
+ # @param firewall_policy [::Google::Cloud::RecaptchaEnterprise::V1::FirewallPolicy, ::Hash]
1382
+ # Required. The policy to update.
1383
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1384
+ # Optional. The mask to control which fields of the policy get updated. If
1385
+ # the mask is not present, all fields will be updated.
1386
+ #
1387
+ # @yield [response, operation] Access the result along with the RPC operation
1388
+ # @yieldparam response [::Google::Cloud::RecaptchaEnterprise::V1::FirewallPolicy]
1389
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1390
+ #
1391
+ # @return [::Google::Cloud::RecaptchaEnterprise::V1::FirewallPolicy]
1392
+ #
1393
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1394
+ #
1395
+ # @example Basic example
1396
+ # require "google/cloud/recaptcha_enterprise/v1"
1397
+ #
1398
+ # # Create a client object. The client can be reused for multiple calls.
1399
+ # client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new
1400
+ #
1401
+ # # Create a request. To set request fields, pass in keyword arguments.
1402
+ # request = Google::Cloud::RecaptchaEnterprise::V1::UpdateFirewallPolicyRequest.new
1403
+ #
1404
+ # # Call the update_firewall_policy method.
1405
+ # result = client.update_firewall_policy request
1406
+ #
1407
+ # # The returned object is of type Google::Cloud::RecaptchaEnterprise::V1::FirewallPolicy.
1408
+ # p result
1409
+ #
1410
+ def update_firewall_policy request, options = nil
1411
+ raise ::ArgumentError, "request must be provided" if request.nil?
1412
+
1413
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::UpdateFirewallPolicyRequest
1414
+
1415
+ # Converts hash and nil to an options object
1416
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1417
+
1418
+ # Customize the options with defaults
1419
+ metadata = @config.rpcs.update_firewall_policy.metadata.to_h
1420
+
1421
+ # Set x-goog-api-client and x-goog-user-project headers
1422
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1423
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1424
+ gapic_version: ::Google::Cloud::RecaptchaEnterprise::V1::VERSION
1425
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1426
+
1427
+ header_params = {}
1428
+ if request.firewall_policy&.name
1429
+ header_params["firewall_policy.name"] = request.firewall_policy.name
1430
+ end
1431
+
1432
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1433
+ metadata[:"x-goog-request-params"] ||= request_params_header
1434
+
1435
+ options.apply_defaults timeout: @config.rpcs.update_firewall_policy.timeout,
1436
+ metadata: metadata,
1437
+ retry_policy: @config.rpcs.update_firewall_policy.retry_policy
1438
+
1439
+ options.apply_defaults timeout: @config.timeout,
1440
+ metadata: @config.metadata,
1441
+ retry_policy: @config.retry_policy
1442
+
1443
+ @recaptcha_enterprise_service_stub.call_rpc :update_firewall_policy, request, options: options do |response, operation|
1444
+ yield response, operation if block_given?
1445
+ return response
1446
+ end
1447
+ rescue ::GRPC::BadStatus => e
1448
+ raise ::Google::Cloud::Error.from_error(e)
1449
+ end
1450
+
1451
+ ##
1452
+ # Deletes the specified firewall policy.
1453
+ #
1454
+ # @overload delete_firewall_policy(request, options = nil)
1455
+ # Pass arguments to `delete_firewall_policy` via a request object, either of type
1456
+ # {::Google::Cloud::RecaptchaEnterprise::V1::DeleteFirewallPolicyRequest} or an equivalent Hash.
1457
+ #
1458
+ # @param request [::Google::Cloud::RecaptchaEnterprise::V1::DeleteFirewallPolicyRequest, ::Hash]
1459
+ # A request object representing the call parameters. Required. To specify no
1460
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1461
+ # @param options [::Gapic::CallOptions, ::Hash]
1462
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1463
+ #
1464
+ # @overload delete_firewall_policy(name: nil)
1465
+ # Pass arguments to `delete_firewall_policy` via keyword arguments. Note that at
1466
+ # least one keyword argument is required. To specify no parameters, or to keep all
1467
+ # the default parameter values, pass an empty Hash as a request object (see above).
1468
+ #
1469
+ # @param name [::String]
1470
+ # Required. The name of the policy to be deleted, in the format
1471
+ # `projects/{project}/firewallpolicies/{firewallpolicy}`.
1472
+ #
1473
+ # @yield [response, operation] Access the result along with the RPC operation
1474
+ # @yieldparam response [::Google::Protobuf::Empty]
1475
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1476
+ #
1477
+ # @return [::Google::Protobuf::Empty]
1478
+ #
1479
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1480
+ #
1481
+ # @example Basic example
1482
+ # require "google/cloud/recaptcha_enterprise/v1"
1483
+ #
1484
+ # # Create a client object. The client can be reused for multiple calls.
1485
+ # client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new
1486
+ #
1487
+ # # Create a request. To set request fields, pass in keyword arguments.
1488
+ # request = Google::Cloud::RecaptchaEnterprise::V1::DeleteFirewallPolicyRequest.new
1489
+ #
1490
+ # # Call the delete_firewall_policy method.
1491
+ # result = client.delete_firewall_policy request
1492
+ #
1493
+ # # The returned object is of type Google::Protobuf::Empty.
1494
+ # p result
1495
+ #
1496
+ def delete_firewall_policy request, options = nil
1497
+ raise ::ArgumentError, "request must be provided" if request.nil?
1498
+
1499
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::RecaptchaEnterprise::V1::DeleteFirewallPolicyRequest
1500
+
1501
+ # Converts hash and nil to an options object
1502
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1503
+
1504
+ # Customize the options with defaults
1505
+ metadata = @config.rpcs.delete_firewall_policy.metadata.to_h
1506
+
1507
+ # Set x-goog-api-client and x-goog-user-project headers
1508
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1509
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1510
+ gapic_version: ::Google::Cloud::RecaptchaEnterprise::V1::VERSION
1511
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1512
+
1513
+ header_params = {}
1514
+ if request.name
1515
+ header_params["name"] = request.name
1516
+ end
1517
+
1518
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1519
+ metadata[:"x-goog-request-params"] ||= request_params_header
1520
+
1521
+ options.apply_defaults timeout: @config.rpcs.delete_firewall_policy.timeout,
1522
+ metadata: metadata,
1523
+ retry_policy: @config.rpcs.delete_firewall_policy.retry_policy
1524
+
1525
+ options.apply_defaults timeout: @config.timeout,
1526
+ metadata: @config.metadata,
1527
+ retry_policy: @config.retry_policy
1528
+
1529
+ @recaptcha_enterprise_service_stub.call_rpc :delete_firewall_policy, request, options: options do |response, operation|
1530
+ yield response, operation if block_given?
1531
+ return response
1532
+ end
1533
+ rescue ::GRPC::BadStatus => e
1534
+ raise ::Google::Cloud::Error.from_error(e)
1535
+ end
1536
+
1073
1537
  ##
1074
1538
  # List groups of related accounts.
1075
1539
  #
@@ -1090,7 +1554,7 @@ module Google
1090
1554
  #
1091
1555
  # @param parent [::String]
1092
1556
  # Required. The name of the project to list related account groups from, in
1093
- # the format "projects/\\{project}".
1557
+ # the format `projects/{project}`.
1094
1558
  # @param page_size [::Integer]
1095
1559
  # Optional. The maximum number of groups to return. The service might return
1096
1560
  # fewer than this value. If unspecified, at most 50 groups are returned. The
@@ -1287,7 +1751,7 @@ module Google
1287
1751
  # @param options [::Gapic::CallOptions, ::Hash]
1288
1752
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1289
1753
  #
1290
- # @overload search_related_account_group_memberships(project: nil, hashed_account_id: nil, page_size: nil, page_token: nil)
1754
+ # @overload search_related_account_group_memberships(project: nil, account_id: nil, hashed_account_id: nil, page_size: nil, page_token: nil)
1291
1755
  # Pass arguments to `search_related_account_group_memberships` via keyword arguments. Note that at
1292
1756
  # least one keyword argument is required. To specify no parameters, or to keep all
1293
1757
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -1295,11 +1759,18 @@ module Google
1295
1759
  # @param project [::String]
1296
1760
  # Required. The name of the project to search related account group
1297
1761
  # memberships from. Specify the project name in the following format:
1298
- # "projects/\\{project}".
1762
+ # `projects/{project}`.
1763
+ # @param account_id [::String]
1764
+ # Optional. The unique stable account identifier used to search connections.
1765
+ # The identifier should correspond to an `account_id` provided in a previous
1766
+ # `CreateAssessment` or `AnnotateAssessment` call. Either hashed_account_id
1767
+ # or account_id must be set, but not both.
1299
1768
  # @param hashed_account_id [::String]
1300
- # Optional. The unique stable hashed user identifier we should search
1301
- # connections to. The identifier should correspond to a `hashed_account_id`
1302
- # provided in a previous `CreateAssessment` or `AnnotateAssessment` call.
1769
+ # Optional. Deprecated: use `account_id` instead.
1770
+ # The unique stable hashed account identifier used to search connections. The
1771
+ # identifier should correspond to a `hashed_account_id` provided in a
1772
+ # previous `CreateAssessment` or `AnnotateAssessment` call. Either
1773
+ # hashed_account_id or account_id must be set, but not both.
1303
1774
  # @param page_size [::Integer]
1304
1775
  # Optional. The maximum number of groups to return. The service might return
1305
1776
  # fewer than this value. If unspecified, at most 50 groups are returned. The
@@ -1412,9 +1883,9 @@ module Google
1412
1883
  # end
1413
1884
  #
1414
1885
  # @!attribute [rw] endpoint
1415
- # The hostname or hostname:port of the service endpoint.
1416
- # Defaults to `"recaptchaenterprise.googleapis.com"`.
1417
- # @return [::String]
1886
+ # A custom service endpoint, as a hostname or hostname:port. The default is
1887
+ # nil, indicating to use the default endpoint in the current universe domain.
1888
+ # @return [::String,nil]
1418
1889
  # @!attribute [rw] credentials
1419
1890
  # Credentials to send with calls. You may provide any of the following types:
1420
1891
  # * (`String`) The path to a service account key file in JSON format
@@ -1460,13 +1931,20 @@ module Google
1460
1931
  # @!attribute [rw] quota_project
1461
1932
  # A separate project against which to charge quota.
1462
1933
  # @return [::String]
1934
+ # @!attribute [rw] universe_domain
1935
+ # The universe domain within which to make requests. This determines the
1936
+ # default endpoint URL. The default value of nil uses the environment
1937
+ # universe (usually the default "googleapis.com" universe).
1938
+ # @return [::String,nil]
1463
1939
  #
1464
1940
  class Configuration
1465
1941
  extend ::Gapic::Config
1466
1942
 
1943
+ # @private
1944
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1467
1945
  DEFAULT_ENDPOINT = "recaptchaenterprise.googleapis.com"
1468
1946
 
1469
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
1947
+ config_attr :endpoint, nil, ::String, nil
1470
1948
  config_attr :credentials, nil do |value|
1471
1949
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1472
1950
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -1481,6 +1959,7 @@ module Google
1481
1959
  config_attr :metadata, nil, ::Hash, nil
1482
1960
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1483
1961
  config_attr :quota_project, nil, ::String, nil
1962
+ config_attr :universe_domain, nil, ::String, nil
1484
1963
 
1485
1964
  # @private
1486
1965
  def initialize parent_config = nil
@@ -1578,6 +2057,31 @@ module Google
1578
2057
  #
1579
2058
  attr_reader :get_metrics
1580
2059
  ##
2060
+ # RPC-specific configuration for `create_firewall_policy`
2061
+ # @return [::Gapic::Config::Method]
2062
+ #
2063
+ attr_reader :create_firewall_policy
2064
+ ##
2065
+ # RPC-specific configuration for `list_firewall_policies`
2066
+ # @return [::Gapic::Config::Method]
2067
+ #
2068
+ attr_reader :list_firewall_policies
2069
+ ##
2070
+ # RPC-specific configuration for `get_firewall_policy`
2071
+ # @return [::Gapic::Config::Method]
2072
+ #
2073
+ attr_reader :get_firewall_policy
2074
+ ##
2075
+ # RPC-specific configuration for `update_firewall_policy`
2076
+ # @return [::Gapic::Config::Method]
2077
+ #
2078
+ attr_reader :update_firewall_policy
2079
+ ##
2080
+ # RPC-specific configuration for `delete_firewall_policy`
2081
+ # @return [::Gapic::Config::Method]
2082
+ #
2083
+ attr_reader :delete_firewall_policy
2084
+ ##
1581
2085
  # RPC-specific configuration for `list_related_account_groups`
1582
2086
  # @return [::Gapic::Config::Method]
1583
2087
  #
@@ -1615,6 +2119,16 @@ module Google
1615
2119
  @migrate_key = ::Gapic::Config::Method.new migrate_key_config
1616
2120
  get_metrics_config = parent_rpcs.get_metrics if parent_rpcs.respond_to? :get_metrics
1617
2121
  @get_metrics = ::Gapic::Config::Method.new get_metrics_config
2122
+ create_firewall_policy_config = parent_rpcs.create_firewall_policy if parent_rpcs.respond_to? :create_firewall_policy
2123
+ @create_firewall_policy = ::Gapic::Config::Method.new create_firewall_policy_config
2124
+ list_firewall_policies_config = parent_rpcs.list_firewall_policies if parent_rpcs.respond_to? :list_firewall_policies
2125
+ @list_firewall_policies = ::Gapic::Config::Method.new list_firewall_policies_config
2126
+ get_firewall_policy_config = parent_rpcs.get_firewall_policy if parent_rpcs.respond_to? :get_firewall_policy
2127
+ @get_firewall_policy = ::Gapic::Config::Method.new get_firewall_policy_config
2128
+ update_firewall_policy_config = parent_rpcs.update_firewall_policy if parent_rpcs.respond_to? :update_firewall_policy
2129
+ @update_firewall_policy = ::Gapic::Config::Method.new update_firewall_policy_config
2130
+ delete_firewall_policy_config = parent_rpcs.delete_firewall_policy if parent_rpcs.respond_to? :delete_firewall_policy
2131
+ @delete_firewall_policy = ::Gapic::Config::Method.new delete_firewall_policy_config
1618
2132
  list_related_account_groups_config = parent_rpcs.list_related_account_groups if parent_rpcs.respond_to? :list_related_account_groups
1619
2133
  @list_related_account_groups = ::Gapic::Config::Method.new list_related_account_groups_config
1620
2134
  list_related_account_group_memberships_config = parent_rpcs.list_related_account_group_memberships if parent_rpcs.respond_to? :list_related_account_group_memberships