google-cloud-recaptcha_enterprise-v1 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +169 -0
- data/LICENSE.md +203 -0
- data/README.md +71 -0
- data/lib/google-cloud-recaptcha_enterprise-v1.rb +21 -0
- data/lib/google/cloud/common_resources_pb.rb +15 -0
- data/lib/google/cloud/recaptcha_enterprise/v1.rb +35 -0
- data/lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service.rb +49 -0
- data/lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb +839 -0
- data/lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/credentials.rb +51 -0
- data/lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/paths.rb +81 -0
- data/lib/google/cloud/recaptcha_enterprise/v1/version.rb +28 -0
- data/lib/google/cloud/recaptchaenterprise/v1/recaptchaenterprise_pb.rb +163 -0
- data/lib/google/cloud/recaptchaenterprise/v1/recaptchaenterprise_services_pb.rb +58 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/field_behavior.rb +59 -0
- data/proto_docs/google/api/resource.rb +247 -0
- data/proto_docs/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.rb +404 -0
- data/proto_docs/google/protobuf/empty.rb +36 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- data/proto_docs/google/protobuf/timestamp.rb +120 -0
- metadata +176 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
# This gem does not autoload during Bundler.require. To load this gem,
|
20
|
+
# issue explicit require statements for the packages desired, e.g.:
|
21
|
+
# require "google/cloud/recaptcha_enterprise/v1"
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: google/cloud/common_resources.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
require 'google/api/resource_pb'
|
7
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
8
|
+
add_file("google/cloud/common_resources.proto", :syntax => :proto3) do
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
module Google
|
13
|
+
module Cloud
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service"
|
20
|
+
require "google/cloud/recaptcha_enterprise/v1/version"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module RecaptchaEnterprise
|
25
|
+
##
|
26
|
+
# To load this package, including all its services, and instantiate a client:
|
27
|
+
#
|
28
|
+
# require "google/cloud/recaptcha_enterprise/v1"
|
29
|
+
# client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new
|
30
|
+
#
|
31
|
+
module V1
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "gapic/common"
|
20
|
+
require "gapic/config"
|
21
|
+
require "gapic/config/method"
|
22
|
+
|
23
|
+
require "google/cloud/recaptcha_enterprise/v1/version"
|
24
|
+
|
25
|
+
require "google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/credentials"
|
26
|
+
require "google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/paths"
|
27
|
+
require "google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client"
|
28
|
+
|
29
|
+
module Google
|
30
|
+
module Cloud
|
31
|
+
module RecaptchaEnterprise
|
32
|
+
module V1
|
33
|
+
##
|
34
|
+
# Service to determine the likelihood an event is legitimate.
|
35
|
+
#
|
36
|
+
# To load this service and instantiate a client:
|
37
|
+
#
|
38
|
+
# require "google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service"
|
39
|
+
# client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new
|
40
|
+
#
|
41
|
+
module RecaptchaEnterpriseService
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
helper_path = ::File.join __dir__, "recaptcha_enterprise_service", "helpers.rb"
|
49
|
+
require "google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/helpers" if ::File.file? helper_path
|
@@ -0,0 +1,839 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/cloud/recaptchaenterprise/v1/recaptchaenterprise_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module RecaptchaEnterprise
|
25
|
+
module V1
|
26
|
+
module RecaptchaEnterpriseService
|
27
|
+
##
|
28
|
+
# Client for the RecaptchaEnterpriseService service.
|
29
|
+
#
|
30
|
+
# Service to determine the likelihood an event is legitimate.
|
31
|
+
#
|
32
|
+
class Client
|
33
|
+
include Paths
|
34
|
+
|
35
|
+
# @private
|
36
|
+
attr_reader :recaptcha_enterprise_service_stub
|
37
|
+
|
38
|
+
##
|
39
|
+
# Configure the RecaptchaEnterpriseService Client class.
|
40
|
+
#
|
41
|
+
# See {Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client::Configuration}
|
42
|
+
# for a description of the configuration fields.
|
43
|
+
#
|
44
|
+
# ## Example
|
45
|
+
#
|
46
|
+
# To modify the configuration for all RecaptchaEnterpriseService clients:
|
47
|
+
#
|
48
|
+
# Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.configure do |config|
|
49
|
+
# config.timeout = 10_000
|
50
|
+
# end
|
51
|
+
#
|
52
|
+
# @yield [config] Configure the Client client.
|
53
|
+
# @yieldparam config [Client::Configuration]
|
54
|
+
#
|
55
|
+
# @return [Client::Configuration]
|
56
|
+
#
|
57
|
+
def self.configure
|
58
|
+
@configure ||= begin
|
59
|
+
namespace = ["Google", "Cloud", "RecaptchaEnterprise", "V1"]
|
60
|
+
parent_config = while namespace.any?
|
61
|
+
parent_name = namespace.join "::"
|
62
|
+
parent_const = const_get parent_name
|
63
|
+
break parent_const.configure if parent_const&.respond_to? :configure
|
64
|
+
namespace.pop
|
65
|
+
end
|
66
|
+
default_config = Client::Configuration.new parent_config
|
67
|
+
|
68
|
+
default_config.rpcs.create_assessment.timeout = 600.0
|
69
|
+
|
70
|
+
default_config.rpcs.annotate_assessment.timeout = 600.0
|
71
|
+
|
72
|
+
default_config.rpcs.create_key.timeout = 600.0
|
73
|
+
|
74
|
+
default_config.rpcs.list_keys.timeout = 600.0
|
75
|
+
|
76
|
+
default_config.rpcs.get_key.timeout = 600.0
|
77
|
+
|
78
|
+
default_config.rpcs.update_key.timeout = 600.0
|
79
|
+
|
80
|
+
default_config.rpcs.delete_key.timeout = 600.0
|
81
|
+
|
82
|
+
default_config
|
83
|
+
end
|
84
|
+
yield @configure if block_given?
|
85
|
+
@configure
|
86
|
+
end
|
87
|
+
|
88
|
+
##
|
89
|
+
# Configure the RecaptchaEnterpriseService Client instance.
|
90
|
+
#
|
91
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
92
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
93
|
+
# should be made on {Client.configure}.
|
94
|
+
#
|
95
|
+
# See {Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client::Configuration}
|
96
|
+
# for a description of the configuration fields.
|
97
|
+
#
|
98
|
+
# @yield [config] Configure the Client client.
|
99
|
+
# @yieldparam config [Client::Configuration]
|
100
|
+
#
|
101
|
+
# @return [Client::Configuration]
|
102
|
+
#
|
103
|
+
def configure
|
104
|
+
yield @config if block_given?
|
105
|
+
@config
|
106
|
+
end
|
107
|
+
|
108
|
+
##
|
109
|
+
# Create a new RecaptchaEnterpriseService client object.
|
110
|
+
#
|
111
|
+
# ## Examples
|
112
|
+
#
|
113
|
+
# To create a new RecaptchaEnterpriseService client with the default
|
114
|
+
# configuration:
|
115
|
+
#
|
116
|
+
# client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new
|
117
|
+
#
|
118
|
+
# To create a new RecaptchaEnterpriseService client with a custom
|
119
|
+
# configuration:
|
120
|
+
#
|
121
|
+
# client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new do |config|
|
122
|
+
# config.timeout = 10_000
|
123
|
+
# end
|
124
|
+
#
|
125
|
+
# @yield [config] Configure the RecaptchaEnterpriseService client.
|
126
|
+
# @yieldparam config [Client::Configuration]
|
127
|
+
#
|
128
|
+
def initialize
|
129
|
+
# These require statements are intentionally placed here to initialize
|
130
|
+
# the gRPC module only when it's required.
|
131
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
132
|
+
require "gapic/grpc"
|
133
|
+
require "google/cloud/recaptchaenterprise/v1/recaptchaenterprise_services_pb"
|
134
|
+
|
135
|
+
# Create the configuration object
|
136
|
+
@config = Configuration.new Client.configure
|
137
|
+
|
138
|
+
# Yield the configuration if needed
|
139
|
+
yield @config if block_given?
|
140
|
+
|
141
|
+
# Create credentials
|
142
|
+
credentials = @config.credentials
|
143
|
+
credentials ||= Credentials.default scope: @config.scope
|
144
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
145
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
146
|
+
end
|
147
|
+
@quota_project_id = credentials.respond_to?(:quota_project_id) ? credentials.quota_project_id : nil
|
148
|
+
|
149
|
+
@recaptcha_enterprise_service_stub = Gapic::ServiceStub.new(
|
150
|
+
Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Stub,
|
151
|
+
credentials: credentials,
|
152
|
+
endpoint: @config.endpoint,
|
153
|
+
channel_args: @config.channel_args,
|
154
|
+
interceptors: @config.interceptors
|
155
|
+
)
|
156
|
+
end
|
157
|
+
|
158
|
+
# Service calls
|
159
|
+
|
160
|
+
##
|
161
|
+
# Creates an Assessment of the likelihood an event is legitimate.
|
162
|
+
#
|
163
|
+
# @overload create_assessment(request, options = nil)
|
164
|
+
# Pass arguments to `create_assessment` via a request object, either of type
|
165
|
+
# {Google::Cloud::RecaptchaEnterprise::V1::CreateAssessmentRequest} or an equivalent Hash.
|
166
|
+
#
|
167
|
+
# @param request [Google::Cloud::RecaptchaEnterprise::V1::CreateAssessmentRequest, Hash]
|
168
|
+
# A request object representing the call parameters. Required. To specify no
|
169
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
170
|
+
# @param options [Gapic::CallOptions, Hash]
|
171
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
172
|
+
#
|
173
|
+
# @overload create_assessment(parent: nil, assessment: nil)
|
174
|
+
# Pass arguments to `create_assessment` via keyword arguments. Note that at
|
175
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
176
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
177
|
+
#
|
178
|
+
# @param parent [String]
|
179
|
+
# Required. The name of the project in which the assessment will be created,
|
180
|
+
# in the format "projects/\\{project}".
|
181
|
+
# @param assessment [Google::Cloud::RecaptchaEnterprise::V1::Assessment, Hash]
|
182
|
+
# Required. The assessment details.
|
183
|
+
#
|
184
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
185
|
+
# @yieldparam response [Google::Cloud::RecaptchaEnterprise::V1::Assessment]
|
186
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
187
|
+
#
|
188
|
+
# @return [Google::Cloud::RecaptchaEnterprise::V1::Assessment]
|
189
|
+
#
|
190
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
191
|
+
#
|
192
|
+
def create_assessment request, options = nil
|
193
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
194
|
+
|
195
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::RecaptchaEnterprise::V1::CreateAssessmentRequest
|
196
|
+
|
197
|
+
# Converts hash and nil to an options object
|
198
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
199
|
+
|
200
|
+
# Customize the options with defaults
|
201
|
+
metadata = @config.rpcs.create_assessment.metadata.to_h
|
202
|
+
|
203
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
204
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
205
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
206
|
+
gapic_version: ::Google::Cloud::RecaptchaEnterprise::V1::VERSION
|
207
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
208
|
+
|
209
|
+
header_params = {
|
210
|
+
"parent" => request.parent
|
211
|
+
}
|
212
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
213
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
214
|
+
|
215
|
+
options.apply_defaults timeout: @config.rpcs.create_assessment.timeout,
|
216
|
+
metadata: metadata,
|
217
|
+
retry_policy: @config.rpcs.create_assessment.retry_policy
|
218
|
+
options.apply_defaults metadata: @config.metadata,
|
219
|
+
retry_policy: @config.retry_policy
|
220
|
+
|
221
|
+
@recaptcha_enterprise_service_stub.call_rpc :create_assessment, request, options: options do |response, operation|
|
222
|
+
yield response, operation if block_given?
|
223
|
+
return response
|
224
|
+
end
|
225
|
+
rescue GRPC::BadStatus => e
|
226
|
+
raise Google::Cloud::Error.from_error(e)
|
227
|
+
end
|
228
|
+
|
229
|
+
##
|
230
|
+
# Annotates a previously created Assessment to provide additional information
|
231
|
+
# on whether the event turned out to be authentic or fradulent.
|
232
|
+
#
|
233
|
+
# @overload annotate_assessment(request, options = nil)
|
234
|
+
# Pass arguments to `annotate_assessment` via a request object, either of type
|
235
|
+
# {Google::Cloud::RecaptchaEnterprise::V1::AnnotateAssessmentRequest} or an equivalent Hash.
|
236
|
+
#
|
237
|
+
# @param request [Google::Cloud::RecaptchaEnterprise::V1::AnnotateAssessmentRequest, Hash]
|
238
|
+
# A request object representing the call parameters. Required. To specify no
|
239
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
240
|
+
# @param options [Gapic::CallOptions, Hash]
|
241
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
242
|
+
#
|
243
|
+
# @overload annotate_assessment(name: nil, annotation: nil)
|
244
|
+
# Pass arguments to `annotate_assessment` via keyword arguments. Note that at
|
245
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
246
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
247
|
+
#
|
248
|
+
# @param name [String]
|
249
|
+
# Required. The resource name of the Assessment, in the format
|
250
|
+
# "projects/\\{project}/assessments/\\{assessment}".
|
251
|
+
# @param annotation [Google::Cloud::RecaptchaEnterprise::V1::AnnotateAssessmentRequest::Annotation]
|
252
|
+
# Required. The annotation that will be assigned to the Event.
|
253
|
+
#
|
254
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
255
|
+
# @yieldparam response [Google::Cloud::RecaptchaEnterprise::V1::AnnotateAssessmentResponse]
|
256
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
257
|
+
#
|
258
|
+
# @return [Google::Cloud::RecaptchaEnterprise::V1::AnnotateAssessmentResponse]
|
259
|
+
#
|
260
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
261
|
+
#
|
262
|
+
def annotate_assessment request, options = nil
|
263
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
264
|
+
|
265
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::RecaptchaEnterprise::V1::AnnotateAssessmentRequest
|
266
|
+
|
267
|
+
# Converts hash and nil to an options object
|
268
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
269
|
+
|
270
|
+
# Customize the options with defaults
|
271
|
+
metadata = @config.rpcs.annotate_assessment.metadata.to_h
|
272
|
+
|
273
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
274
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
275
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
276
|
+
gapic_version: ::Google::Cloud::RecaptchaEnterprise::V1::VERSION
|
277
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
278
|
+
|
279
|
+
header_params = {
|
280
|
+
"name" => request.name
|
281
|
+
}
|
282
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
283
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
284
|
+
|
285
|
+
options.apply_defaults timeout: @config.rpcs.annotate_assessment.timeout,
|
286
|
+
metadata: metadata,
|
287
|
+
retry_policy: @config.rpcs.annotate_assessment.retry_policy
|
288
|
+
options.apply_defaults metadata: @config.metadata,
|
289
|
+
retry_policy: @config.retry_policy
|
290
|
+
|
291
|
+
@recaptcha_enterprise_service_stub.call_rpc :annotate_assessment, request, options: options do |response, operation|
|
292
|
+
yield response, operation if block_given?
|
293
|
+
return response
|
294
|
+
end
|
295
|
+
rescue GRPC::BadStatus => e
|
296
|
+
raise Google::Cloud::Error.from_error(e)
|
297
|
+
end
|
298
|
+
|
299
|
+
##
|
300
|
+
# Creates a new reCAPTCHA Enterprise key.
|
301
|
+
#
|
302
|
+
# @overload create_key(request, options = nil)
|
303
|
+
# Pass arguments to `create_key` via a request object, either of type
|
304
|
+
# {Google::Cloud::RecaptchaEnterprise::V1::CreateKeyRequest} or an equivalent Hash.
|
305
|
+
#
|
306
|
+
# @param request [Google::Cloud::RecaptchaEnterprise::V1::CreateKeyRequest, Hash]
|
307
|
+
# A request object representing the call parameters. Required. To specify no
|
308
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
309
|
+
# @param options [Gapic::CallOptions, Hash]
|
310
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
311
|
+
#
|
312
|
+
# @overload create_key(parent: nil, key: nil)
|
313
|
+
# Pass arguments to `create_key` via keyword arguments. Note that at
|
314
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
315
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
316
|
+
#
|
317
|
+
# @param parent [String]
|
318
|
+
# Required. The name of the project in which the key will be created, in the
|
319
|
+
# format "projects/\\{project}".
|
320
|
+
# @param key [Google::Cloud::RecaptchaEnterprise::V1::Key, Hash]
|
321
|
+
# Required. Information to create a reCAPTCHA Enterprise key.
|
322
|
+
#
|
323
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
324
|
+
# @yieldparam response [Google::Cloud::RecaptchaEnterprise::V1::Key]
|
325
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
326
|
+
#
|
327
|
+
# @return [Google::Cloud::RecaptchaEnterprise::V1::Key]
|
328
|
+
#
|
329
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
330
|
+
#
|
331
|
+
def create_key request, options = nil
|
332
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
333
|
+
|
334
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::RecaptchaEnterprise::V1::CreateKeyRequest
|
335
|
+
|
336
|
+
# Converts hash and nil to an options object
|
337
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
338
|
+
|
339
|
+
# Customize the options with defaults
|
340
|
+
metadata = @config.rpcs.create_key.metadata.to_h
|
341
|
+
|
342
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
343
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
344
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
345
|
+
gapic_version: ::Google::Cloud::RecaptchaEnterprise::V1::VERSION
|
346
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
347
|
+
|
348
|
+
header_params = {
|
349
|
+
"parent" => request.parent
|
350
|
+
}
|
351
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
352
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
353
|
+
|
354
|
+
options.apply_defaults timeout: @config.rpcs.create_key.timeout,
|
355
|
+
metadata: metadata,
|
356
|
+
retry_policy: @config.rpcs.create_key.retry_policy
|
357
|
+
options.apply_defaults metadata: @config.metadata,
|
358
|
+
retry_policy: @config.retry_policy
|
359
|
+
|
360
|
+
@recaptcha_enterprise_service_stub.call_rpc :create_key, request, options: options do |response, operation|
|
361
|
+
yield response, operation if block_given?
|
362
|
+
return response
|
363
|
+
end
|
364
|
+
rescue GRPC::BadStatus => e
|
365
|
+
raise Google::Cloud::Error.from_error(e)
|
366
|
+
end
|
367
|
+
|
368
|
+
##
|
369
|
+
# Returns the list of all keys that belong to a project.
|
370
|
+
#
|
371
|
+
# @overload list_keys(request, options = nil)
|
372
|
+
# Pass arguments to `list_keys` via a request object, either of type
|
373
|
+
# {Google::Cloud::RecaptchaEnterprise::V1::ListKeysRequest} or an equivalent Hash.
|
374
|
+
#
|
375
|
+
# @param request [Google::Cloud::RecaptchaEnterprise::V1::ListKeysRequest, Hash]
|
376
|
+
# A request object representing the call parameters. Required. To specify no
|
377
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
378
|
+
# @param options [Gapic::CallOptions, Hash]
|
379
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
380
|
+
#
|
381
|
+
# @overload list_keys(parent: nil, page_size: nil, page_token: nil)
|
382
|
+
# Pass arguments to `list_keys` via keyword arguments. Note that at
|
383
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
384
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
385
|
+
#
|
386
|
+
# @param parent [String]
|
387
|
+
# Required. The name of the project that contains the keys that will be
|
388
|
+
# listed, in the format "projects/\\{project}".
|
389
|
+
# @param page_size [Integer]
|
390
|
+
# Optional. The maximum number of keys to return. Default is 10. Max limit is
|
391
|
+
# 1000.
|
392
|
+
# @param page_token [String]
|
393
|
+
# Optional. The next_page_token value returned from a previous.
|
394
|
+
# ListKeysRequest, if any.
|
395
|
+
#
|
396
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
397
|
+
# @yieldparam response [Gapic::PagedEnumerable<Google::Cloud::RecaptchaEnterprise::V1::Key>]
|
398
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
399
|
+
#
|
400
|
+
# @return [Gapic::PagedEnumerable<Google::Cloud::RecaptchaEnterprise::V1::Key>]
|
401
|
+
#
|
402
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
403
|
+
#
|
404
|
+
def list_keys request, options = nil
|
405
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
406
|
+
|
407
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::RecaptchaEnterprise::V1::ListKeysRequest
|
408
|
+
|
409
|
+
# Converts hash and nil to an options object
|
410
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
411
|
+
|
412
|
+
# Customize the options with defaults
|
413
|
+
metadata = @config.rpcs.list_keys.metadata.to_h
|
414
|
+
|
415
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
416
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
417
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
418
|
+
gapic_version: ::Google::Cloud::RecaptchaEnterprise::V1::VERSION
|
419
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
420
|
+
|
421
|
+
header_params = {
|
422
|
+
"parent" => request.parent
|
423
|
+
}
|
424
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
425
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
426
|
+
|
427
|
+
options.apply_defaults timeout: @config.rpcs.list_keys.timeout,
|
428
|
+
metadata: metadata,
|
429
|
+
retry_policy: @config.rpcs.list_keys.retry_policy
|
430
|
+
options.apply_defaults metadata: @config.metadata,
|
431
|
+
retry_policy: @config.retry_policy
|
432
|
+
|
433
|
+
@recaptcha_enterprise_service_stub.call_rpc :list_keys, request, options: options do |response, operation|
|
434
|
+
response = Gapic::PagedEnumerable.new @recaptcha_enterprise_service_stub, :list_keys, request, response, operation, options
|
435
|
+
yield response, operation if block_given?
|
436
|
+
return response
|
437
|
+
end
|
438
|
+
rescue GRPC::BadStatus => e
|
439
|
+
raise Google::Cloud::Error.from_error(e)
|
440
|
+
end
|
441
|
+
|
442
|
+
##
|
443
|
+
# Returns the specified key.
|
444
|
+
#
|
445
|
+
# @overload get_key(request, options = nil)
|
446
|
+
# Pass arguments to `get_key` via a request object, either of type
|
447
|
+
# {Google::Cloud::RecaptchaEnterprise::V1::GetKeyRequest} or an equivalent Hash.
|
448
|
+
#
|
449
|
+
# @param request [Google::Cloud::RecaptchaEnterprise::V1::GetKeyRequest, Hash]
|
450
|
+
# A request object representing the call parameters. Required. To specify no
|
451
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
452
|
+
# @param options [Gapic::CallOptions, Hash]
|
453
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
454
|
+
#
|
455
|
+
# @overload get_key(name: nil)
|
456
|
+
# Pass arguments to `get_key` via keyword arguments. Note that at
|
457
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
458
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
459
|
+
#
|
460
|
+
# @param name [String]
|
461
|
+
# Required. The name of the requested key, in the format
|
462
|
+
# "projects/\\{project}/keys/\\{key}".
|
463
|
+
#
|
464
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
465
|
+
# @yieldparam response [Google::Cloud::RecaptchaEnterprise::V1::Key]
|
466
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
467
|
+
#
|
468
|
+
# @return [Google::Cloud::RecaptchaEnterprise::V1::Key]
|
469
|
+
#
|
470
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
471
|
+
#
|
472
|
+
def get_key request, options = nil
|
473
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
474
|
+
|
475
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::RecaptchaEnterprise::V1::GetKeyRequest
|
476
|
+
|
477
|
+
# Converts hash and nil to an options object
|
478
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
479
|
+
|
480
|
+
# Customize the options with defaults
|
481
|
+
metadata = @config.rpcs.get_key.metadata.to_h
|
482
|
+
|
483
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
484
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
485
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
486
|
+
gapic_version: ::Google::Cloud::RecaptchaEnterprise::V1::VERSION
|
487
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
488
|
+
|
489
|
+
header_params = {
|
490
|
+
"name" => request.name
|
491
|
+
}
|
492
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
493
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
494
|
+
|
495
|
+
options.apply_defaults timeout: @config.rpcs.get_key.timeout,
|
496
|
+
metadata: metadata,
|
497
|
+
retry_policy: @config.rpcs.get_key.retry_policy
|
498
|
+
options.apply_defaults metadata: @config.metadata,
|
499
|
+
retry_policy: @config.retry_policy
|
500
|
+
|
501
|
+
@recaptcha_enterprise_service_stub.call_rpc :get_key, request, options: options do |response, operation|
|
502
|
+
yield response, operation if block_given?
|
503
|
+
return response
|
504
|
+
end
|
505
|
+
rescue GRPC::BadStatus => e
|
506
|
+
raise Google::Cloud::Error.from_error(e)
|
507
|
+
end
|
508
|
+
|
509
|
+
##
|
510
|
+
# Updates the specified key.
|
511
|
+
#
|
512
|
+
# @overload update_key(request, options = nil)
|
513
|
+
# Pass arguments to `update_key` via a request object, either of type
|
514
|
+
# {Google::Cloud::RecaptchaEnterprise::V1::UpdateKeyRequest} or an equivalent Hash.
|
515
|
+
#
|
516
|
+
# @param request [Google::Cloud::RecaptchaEnterprise::V1::UpdateKeyRequest, Hash]
|
517
|
+
# A request object representing the call parameters. Required. To specify no
|
518
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
519
|
+
# @param options [Gapic::CallOptions, Hash]
|
520
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
521
|
+
#
|
522
|
+
# @overload update_key(key: nil, update_mask: nil)
|
523
|
+
# Pass arguments to `update_key` via keyword arguments. Note that at
|
524
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
525
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
526
|
+
#
|
527
|
+
# @param key [Google::Cloud::RecaptchaEnterprise::V1::Key, Hash]
|
528
|
+
# Required. The key to update.
|
529
|
+
# @param update_mask [Google::Protobuf::FieldMask, Hash]
|
530
|
+
# Optional. The mask to control which field of the key get updated. If the mask is not
|
531
|
+
# present, all fields will be updated.
|
532
|
+
#
|
533
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
534
|
+
# @yieldparam response [Google::Cloud::RecaptchaEnterprise::V1::Key]
|
535
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
536
|
+
#
|
537
|
+
# @return [Google::Cloud::RecaptchaEnterprise::V1::Key]
|
538
|
+
#
|
539
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
540
|
+
#
|
541
|
+
def update_key request, options = nil
|
542
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
543
|
+
|
544
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::RecaptchaEnterprise::V1::UpdateKeyRequest
|
545
|
+
|
546
|
+
# Converts hash and nil to an options object
|
547
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
548
|
+
|
549
|
+
# Customize the options with defaults
|
550
|
+
metadata = @config.rpcs.update_key.metadata.to_h
|
551
|
+
|
552
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
553
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
554
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
555
|
+
gapic_version: ::Google::Cloud::RecaptchaEnterprise::V1::VERSION
|
556
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
557
|
+
|
558
|
+
header_params = {
|
559
|
+
"key.name" => request.key.name
|
560
|
+
}
|
561
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
562
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
563
|
+
|
564
|
+
options.apply_defaults timeout: @config.rpcs.update_key.timeout,
|
565
|
+
metadata: metadata,
|
566
|
+
retry_policy: @config.rpcs.update_key.retry_policy
|
567
|
+
options.apply_defaults metadata: @config.metadata,
|
568
|
+
retry_policy: @config.retry_policy
|
569
|
+
|
570
|
+
@recaptcha_enterprise_service_stub.call_rpc :update_key, request, options: options do |response, operation|
|
571
|
+
yield response, operation if block_given?
|
572
|
+
return response
|
573
|
+
end
|
574
|
+
rescue GRPC::BadStatus => e
|
575
|
+
raise Google::Cloud::Error.from_error(e)
|
576
|
+
end
|
577
|
+
|
578
|
+
##
|
579
|
+
# Deletes the specified key.
|
580
|
+
#
|
581
|
+
# @overload delete_key(request, options = nil)
|
582
|
+
# Pass arguments to `delete_key` via a request object, either of type
|
583
|
+
# {Google::Cloud::RecaptchaEnterprise::V1::DeleteKeyRequest} or an equivalent Hash.
|
584
|
+
#
|
585
|
+
# @param request [Google::Cloud::RecaptchaEnterprise::V1::DeleteKeyRequest, Hash]
|
586
|
+
# A request object representing the call parameters. Required. To specify no
|
587
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
588
|
+
# @param options [Gapic::CallOptions, Hash]
|
589
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
590
|
+
#
|
591
|
+
# @overload delete_key(name: nil)
|
592
|
+
# Pass arguments to `delete_key` via keyword arguments. Note that at
|
593
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
594
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
595
|
+
#
|
596
|
+
# @param name [String]
|
597
|
+
# Required. The name of the key to be deleted, in the format
|
598
|
+
# "projects/\\{project}/keys/\\{key}".
|
599
|
+
#
|
600
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
601
|
+
# @yieldparam response [Google::Protobuf::Empty]
|
602
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
603
|
+
#
|
604
|
+
# @return [Google::Protobuf::Empty]
|
605
|
+
#
|
606
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
607
|
+
#
|
608
|
+
def delete_key request, options = nil
|
609
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
610
|
+
|
611
|
+
request = Gapic::Protobuf.coerce request, to: Google::Cloud::RecaptchaEnterprise::V1::DeleteKeyRequest
|
612
|
+
|
613
|
+
# Converts hash and nil to an options object
|
614
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
615
|
+
|
616
|
+
# Customize the options with defaults
|
617
|
+
metadata = @config.rpcs.delete_key.metadata.to_h
|
618
|
+
|
619
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
620
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
621
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
622
|
+
gapic_version: ::Google::Cloud::RecaptchaEnterprise::V1::VERSION
|
623
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
624
|
+
|
625
|
+
header_params = {
|
626
|
+
"name" => request.name
|
627
|
+
}
|
628
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
629
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
630
|
+
|
631
|
+
options.apply_defaults timeout: @config.rpcs.delete_key.timeout,
|
632
|
+
metadata: metadata,
|
633
|
+
retry_policy: @config.rpcs.delete_key.retry_policy
|
634
|
+
options.apply_defaults metadata: @config.metadata,
|
635
|
+
retry_policy: @config.retry_policy
|
636
|
+
|
637
|
+
@recaptcha_enterprise_service_stub.call_rpc :delete_key, request, options: options do |response, operation|
|
638
|
+
yield response, operation if block_given?
|
639
|
+
return response
|
640
|
+
end
|
641
|
+
rescue GRPC::BadStatus => e
|
642
|
+
raise Google::Cloud::Error.from_error(e)
|
643
|
+
end
|
644
|
+
|
645
|
+
##
|
646
|
+
# Configuration class for the RecaptchaEnterpriseService API.
|
647
|
+
#
|
648
|
+
# This class represents the configuration for RecaptchaEnterpriseService,
|
649
|
+
# providing control over timeouts, retry behavior, logging, transport
|
650
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
651
|
+
# applied individually to specific RPCs. See
|
652
|
+
# {Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client::Configuration::Rpcs}
|
653
|
+
# for a list of RPCs that can be configured independently.
|
654
|
+
#
|
655
|
+
# Configuration can be applied globally to all clients, or to a single client
|
656
|
+
# on construction.
|
657
|
+
#
|
658
|
+
# # Examples
|
659
|
+
#
|
660
|
+
# To modify the global config, setting the timeout for create_assessment
|
661
|
+
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
662
|
+
#
|
663
|
+
# Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.configure do |config|
|
664
|
+
# config.timeout = 10_000
|
665
|
+
# config.rpcs.create_assessment.timeout = 20_000
|
666
|
+
# end
|
667
|
+
#
|
668
|
+
# To apply the above configuration only to a new client:
|
669
|
+
#
|
670
|
+
# client = Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new do |config|
|
671
|
+
# config.timeout = 10_000
|
672
|
+
# config.rpcs.create_assessment.timeout = 20_000
|
673
|
+
# end
|
674
|
+
#
|
675
|
+
# @!attribute [rw] endpoint
|
676
|
+
# The hostname or hostname:port of the service endpoint.
|
677
|
+
# Defaults to `"recaptchaenterprise.googleapis.com"`.
|
678
|
+
# @return [String]
|
679
|
+
# @!attribute [rw] credentials
|
680
|
+
# Credentials to send with calls. You may provide any of the following types:
|
681
|
+
# * (`String`) The path to a service account key file in JSON format
|
682
|
+
# * (`Hash`) A service account key as a Hash
|
683
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
684
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
685
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
686
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
687
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
688
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
689
|
+
# * (`nil`) indicating no credentials
|
690
|
+
# @return [Object]
|
691
|
+
# @!attribute [rw] scope
|
692
|
+
# The OAuth scopes
|
693
|
+
# @return [Array<String>]
|
694
|
+
# @!attribute [rw] lib_name
|
695
|
+
# The library name as recorded in instrumentation and logging
|
696
|
+
# @return [String]
|
697
|
+
# @!attribute [rw] lib_version
|
698
|
+
# The library version as recorded in instrumentation and logging
|
699
|
+
# @return [String]
|
700
|
+
# @!attribute [rw] channel_args
|
701
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
702
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
703
|
+
# @return [Hash]
|
704
|
+
# @!attribute [rw] interceptors
|
705
|
+
# An array of interceptors that are run before calls are executed.
|
706
|
+
# @return [Array<GRPC::ClientInterceptor>]
|
707
|
+
# @!attribute [rw] timeout
|
708
|
+
# The call timeout in milliseconds.
|
709
|
+
# @return [Numeric]
|
710
|
+
# @!attribute [rw] metadata
|
711
|
+
# Additional gRPC headers to be sent with the call.
|
712
|
+
# @return [Hash{Symbol=>String}]
|
713
|
+
# @!attribute [rw] retry_policy
|
714
|
+
# The retry policy. The value is a hash with the following keys:
|
715
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
716
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
717
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
718
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
719
|
+
# trigger a retry.
|
720
|
+
# @return [Hash]
|
721
|
+
#
|
722
|
+
class Configuration
|
723
|
+
extend Gapic::Config
|
724
|
+
|
725
|
+
config_attr :endpoint, "recaptchaenterprise.googleapis.com", String
|
726
|
+
config_attr :credentials, nil do |value|
|
727
|
+
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
728
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
729
|
+
allowed.any? { |klass| klass === value }
|
730
|
+
end
|
731
|
+
config_attr :scope, nil, String, Array, nil
|
732
|
+
config_attr :lib_name, nil, String, nil
|
733
|
+
config_attr :lib_version, nil, String, nil
|
734
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, Hash, nil)
|
735
|
+
config_attr :interceptors, nil, Array, nil
|
736
|
+
config_attr :timeout, nil, Numeric, nil
|
737
|
+
config_attr :metadata, nil, Hash, nil
|
738
|
+
config_attr :retry_policy, nil, Hash, Proc, nil
|
739
|
+
|
740
|
+
# @private
|
741
|
+
def initialize parent_config = nil
|
742
|
+
@parent_config = parent_config unless parent_config.nil?
|
743
|
+
|
744
|
+
yield self if block_given?
|
745
|
+
end
|
746
|
+
|
747
|
+
##
|
748
|
+
# Configurations for individual RPCs
|
749
|
+
# @return [Rpcs]
|
750
|
+
#
|
751
|
+
def rpcs
|
752
|
+
@rpcs ||= begin
|
753
|
+
parent_rpcs = nil
|
754
|
+
parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to? :rpcs
|
755
|
+
Rpcs.new parent_rpcs
|
756
|
+
end
|
757
|
+
end
|
758
|
+
|
759
|
+
##
|
760
|
+
# Configuration RPC class for the RecaptchaEnterpriseService API.
|
761
|
+
#
|
762
|
+
# Includes fields providing the configuration for each RPC in this service.
|
763
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
764
|
+
# the following configuration fields:
|
765
|
+
#
|
766
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
|
767
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
768
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
769
|
+
# include the following keys:
|
770
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
771
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
772
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
773
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
774
|
+
# trigger a retry.
|
775
|
+
#
|
776
|
+
class Rpcs
|
777
|
+
##
|
778
|
+
# RPC-specific configuration for `create_assessment`
|
779
|
+
# @return [Gapic::Config::Method]
|
780
|
+
#
|
781
|
+
attr_reader :create_assessment
|
782
|
+
##
|
783
|
+
# RPC-specific configuration for `annotate_assessment`
|
784
|
+
# @return [Gapic::Config::Method]
|
785
|
+
#
|
786
|
+
attr_reader :annotate_assessment
|
787
|
+
##
|
788
|
+
# RPC-specific configuration for `create_key`
|
789
|
+
# @return [Gapic::Config::Method]
|
790
|
+
#
|
791
|
+
attr_reader :create_key
|
792
|
+
##
|
793
|
+
# RPC-specific configuration for `list_keys`
|
794
|
+
# @return [Gapic::Config::Method]
|
795
|
+
#
|
796
|
+
attr_reader :list_keys
|
797
|
+
##
|
798
|
+
# RPC-specific configuration for `get_key`
|
799
|
+
# @return [Gapic::Config::Method]
|
800
|
+
#
|
801
|
+
attr_reader :get_key
|
802
|
+
##
|
803
|
+
# RPC-specific configuration for `update_key`
|
804
|
+
# @return [Gapic::Config::Method]
|
805
|
+
#
|
806
|
+
attr_reader :update_key
|
807
|
+
##
|
808
|
+
# RPC-specific configuration for `delete_key`
|
809
|
+
# @return [Gapic::Config::Method]
|
810
|
+
#
|
811
|
+
attr_reader :delete_key
|
812
|
+
|
813
|
+
# @private
|
814
|
+
def initialize parent_rpcs = nil
|
815
|
+
create_assessment_config = parent_rpcs&.create_assessment if parent_rpcs&.respond_to? :create_assessment
|
816
|
+
@create_assessment = Gapic::Config::Method.new create_assessment_config
|
817
|
+
annotate_assessment_config = parent_rpcs&.annotate_assessment if parent_rpcs&.respond_to? :annotate_assessment
|
818
|
+
@annotate_assessment = Gapic::Config::Method.new annotate_assessment_config
|
819
|
+
create_key_config = parent_rpcs&.create_key if parent_rpcs&.respond_to? :create_key
|
820
|
+
@create_key = Gapic::Config::Method.new create_key_config
|
821
|
+
list_keys_config = parent_rpcs&.list_keys if parent_rpcs&.respond_to? :list_keys
|
822
|
+
@list_keys = Gapic::Config::Method.new list_keys_config
|
823
|
+
get_key_config = parent_rpcs&.get_key if parent_rpcs&.respond_to? :get_key
|
824
|
+
@get_key = Gapic::Config::Method.new get_key_config
|
825
|
+
update_key_config = parent_rpcs&.update_key if parent_rpcs&.respond_to? :update_key
|
826
|
+
@update_key = Gapic::Config::Method.new update_key_config
|
827
|
+
delete_key_config = parent_rpcs&.delete_key if parent_rpcs&.respond_to? :delete_key
|
828
|
+
@delete_key = Gapic::Config::Method.new delete_key_config
|
829
|
+
|
830
|
+
yield self if block_given?
|
831
|
+
end
|
832
|
+
end
|
833
|
+
end
|
834
|
+
end
|
835
|
+
end
|
836
|
+
end
|
837
|
+
end
|
838
|
+
end
|
839
|
+
end
|