google-cloud-recaptcha_enterprise 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b9c252d2a8e4ab80cd095fd8c85c93c831d53bf4e1331aa79a90cd6eb9fc2156
4
- data.tar.gz: a3e6a6d35de8ecf40aed3b57f07d43561303979f85d6bdc9afc3c52aa8a46627
3
+ metadata.gz: f29e5d62c83ec3bbd005f4b8e830bac1d89964d6b299d2e090964c362d19f67c
4
+ data.tar.gz: 6824daf6b768372b79363e1a51d7b54f260b5d90da65fdd1881613f84af37cf7
5
5
  SHA512:
6
- metadata.gz: 9b7e2a4516143ac2456af9d664010aededff7e97ce4f174362b0f00c0cbe3517f16d718438565cdc50776f83c65b6fa5521e99f7e4236749d263f1d109319336
7
- data.tar.gz: 821248ec9188c05719ce6d14c949330e716008dbea4ec949a57ade6386e5930881b0130f87c8e9c047bddc424fff1d86b6fd22c58c1294e43ffdef5102bc04b1
6
+ metadata.gz: 3a5507e996ec9a9d1172d5cb16f9c97630b5905bcd367fca2e71c6bcb3f2bd1f396315e7d6d18c5102d283ad1589fe3e0eaecf12b98b5c7258fa0024d97a1063
7
+ data.tar.gz: 1f554ea582ef577a797b35e922eb2740a2ba8a212da66d89a47e9c793a70ffc201d990a2724bf92aa810f0405c342c91d2d77278c753a7e402b1f09055a1e99c
@@ -99,12 +99,24 @@ module Google
99
99
 
100
100
  # @!attribute [rw] token
101
101
  # @return [String]
102
- # Required. The user response token provided by the reCAPTCHA client-side integration
102
+ # Optional. The user response token provided by the reCAPTCHA client-side integration
103
103
  # on your site.
104
104
  # @!attribute [rw] site_key
105
105
  # @return [String]
106
- # Required. The site key that was used to invoke reCAPTCHA on your site and generate
106
+ # Optional. The site key that was used to invoke reCAPTCHA on your site and generate
107
107
  # the token.
108
+ # @!attribute [rw] user_agent
109
+ # @return [String]
110
+ # Optional. The user agent present in the request from the user's device related to
111
+ # this event.
112
+ # @!attribute [rw] user_ip_address
113
+ # @return [String]
114
+ # Optional. The IP address in the request from the user's device related to this event.
115
+ # @!attribute [rw] expected_action
116
+ # @return [String]
117
+ # Optional. The expected action for this type of event. This should be the same action
118
+ # provided at token generation time on client-side platforms already
119
+ # integrated with recaptcha enterprise.
108
120
  class Event; end
109
121
 
110
122
  # @!attribute [rw] valid
@@ -151,6 +163,158 @@ module Google
151
163
  MISSING = 6
152
164
  end
153
165
  end
166
+
167
+ # The create key request message.
168
+ # @!attribute [rw] parent
169
+ # @return [String]
170
+ # Required. The name of the project in which the key will be created, in the
171
+ # format "projects/\\{project_number}".
172
+ # @!attribute [rw] key
173
+ # @return [Google::Cloud::Recaptchaenterprise::V1beta1::Key]
174
+ # Required. Information to create a reCAPTCHA Enterprise key.
175
+ class CreateKeyRequest; end
176
+
177
+ # The list keys request message.
178
+ # @!attribute [rw] parent
179
+ # @return [String]
180
+ # Required. The name of the project that contains the keys that will be
181
+ # listed, in the format "projects/\\{project_number}".
182
+ # @!attribute [rw] page_size
183
+ # @return [Integer]
184
+ # Optional. The maximum number of keys to return. Default is 10. Max limit is
185
+ # 1000.
186
+ # @!attribute [rw] page_token
187
+ # @return [String]
188
+ # Optional. The next_page_token value returned from a previous.
189
+ # ListKeysRequest, if any.
190
+ class ListKeysRequest; end
191
+
192
+ # Response to request to list keys in a project.
193
+ # @!attribute [rw] keys
194
+ # @return [Array<Google::Cloud::Recaptchaenterprise::V1beta1::Key>]
195
+ # Key details.
196
+ # @!attribute [rw] next_page_token
197
+ # @return [String]
198
+ # Token to retrieve the next page of results. It is set to empty if no keys
199
+ # remain in results.
200
+ class ListKeysResponse; end
201
+
202
+ # The get key request message.
203
+ # @!attribute [rw] name
204
+ # @return [String]
205
+ # Required. The name of the requested key, in the format
206
+ # "projects/\\{project_number}/keys/\\{key_id}".
207
+ class GetKeyRequest; end
208
+
209
+ # The update key request message.
210
+ # @!attribute [rw] key
211
+ # @return [Google::Cloud::Recaptchaenterprise::V1beta1::Key]
212
+ # Required. The key to update.
213
+ # @!attribute [rw] update_mask
214
+ # @return [Google::Protobuf::FieldMask]
215
+ # Optional. The mask to control which field of the key get updated. If the mask is not
216
+ # present, all fields will be updated.
217
+ class UpdateKeyRequest; end
218
+
219
+ # The delete key request message.
220
+ # @!attribute [rw] name
221
+ # @return [String]
222
+ # Required. The name of the key to be deleted, in the format
223
+ # "projects/\\{project_number}/keys/\\{key_id}".
224
+ class DeleteKeyRequest; end
225
+
226
+ # A key used to identify and configure applications (web and/or mobile) that
227
+ # use reCAPTCHA Enterprise.
228
+ # @!attribute [rw] name
229
+ # @return [String]
230
+ # The resource name for the Key in the format
231
+ # "projects/\\{project_number}/keys/\\{key_id}".
232
+ # @!attribute [rw] display_name
233
+ # @return [String]
234
+ # Human-readable display name of this key. Modifiable by user.
235
+ # @!attribute [rw] web_settings
236
+ # @return [Google::Cloud::Recaptchaenterprise::V1beta1::WebKeySettings]
237
+ # Settings for keys that can be used by websites.
238
+ # @!attribute [rw] android_settings
239
+ # @return [Google::Cloud::Recaptchaenterprise::V1beta1::AndroidKeySettings]
240
+ # Settings for keys that can be used by Android apps.
241
+ # @!attribute [rw] ios_settings
242
+ # @return [Google::Cloud::Recaptchaenterprise::V1beta1::IOSKeySettings]
243
+ # Settings for keys that can be used by iOS apps.
244
+ class Key; end
245
+
246
+ # Settings specific to keys that can be used by websites.
247
+ # @!attribute [rw] enforce_allowed_domains
248
+ # @return [true, false]
249
+ # Whether allowed_domains is enforced or not.
250
+ # @!attribute [rw] allowed_domains
251
+ # @return [Array<String>]
252
+ # Domains or subdomains of websites allowed to use the key. All subdomains
253
+ # of an allowed domain are automatically allowed. A valid domain requires a
254
+ # host and must not include any path, port, query or fragment.
255
+ # Examples: 'example.com' or 'subdomain.example.com'
256
+ # @!attribute [rw] allow_amp_traffic
257
+ # @return [true, false]
258
+ # Whether this key can be used on AMP (Accelerated Mobile Pages) websites.
259
+ # @!attribute [rw] integration_type
260
+ # @return [Google::Cloud::Recaptchaenterprise::V1beta1::WebKeySettings::IntegrationType]
261
+ # Required. Describes how this key is integrated with the website.
262
+ # @!attribute [rw] challenge_security_preference
263
+ # @return [Google::Cloud::Recaptchaenterprise::V1beta1::WebKeySettings::ChallengeSecurityPreference]
264
+ # Settings for the frequency and difficulty at which this key triggers
265
+ # captcha challenges. This should only be specified for IntegrationTypes
266
+ # CHECKBOX_CHALLENGE and INVISIBLE_CHALLENGE.
267
+ class WebKeySettings
268
+ # Enum that represents the possible challenge frequency and difficulty
269
+ # configurations for a web key.
270
+ module ChallengeSecurityPreference
271
+ # Default type that indicates this enum hasn't been specified.
272
+ CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED = 0
273
+
274
+ # Key tends to show fewer and easier challenges.
275
+ USABILITY = 1
276
+
277
+ # Key tends to show balanced (in amount and difficulty) challenges.
278
+ BALANCED = 2
279
+
280
+ # Key tends to show more and harder challenges.
281
+ SECURITY = 3
282
+ end
283
+
284
+ # Enum that represents the integration types for web keys.
285
+ module IntegrationType
286
+ # Default type that indicates this enum hasn't been specified. This is not
287
+ # a valid IntegrationType, one of the other types must be specified
288
+ # instead.
289
+ INTEGRATION_TYPE_UNSPECIFIED = 0
290
+
291
+ # Only used to produce scores. It doesn't display the "I'm not a robot"
292
+ # checkbox and never shows captcha challenges.
293
+ SCORE_ONLY = 1
294
+
295
+ # Displays the "I'm not a robot" checkbox and may show captcha challenges
296
+ # after it is checked.
297
+ CHECKBOX_CHALLENGE = 2
298
+
299
+ # Doesn't display the "I'm not a robot" checkbox, but may show captcha
300
+ # challenges after risk analysis.
301
+ INVISIBLE_CHALLENGE = 3
302
+ end
303
+ end
304
+
305
+ # Settings specific to keys that can be used by Android apps.
306
+ # @!attribute [rw] allowed_package_names
307
+ # @return [Array<String>]
308
+ # Android package names of apps allowed to use the key.
309
+ # Example: 'com.companyname.appname'
310
+ class AndroidKeySettings; end
311
+
312
+ # Settings specific to keys that can be used by iOS apps.
313
+ # @!attribute [rw] allowed_bundle_ids
314
+ # @return [Array<String>]
315
+ # iOS bundle ids of apps allowed to use the key.
316
+ # Example: 'com.companyname.productname.appname'
317
+ class IOSKeySettings; end
154
318
  end
155
319
  end
156
320
  end
@@ -0,0 +1,29 @@
1
+ # Copyright 2019 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ module Google
17
+ module Protobuf
18
+ # A generic empty message that you can re-use to avoid defining duplicated
19
+ # empty messages in your APIs. A typical example is to use it as the request
20
+ # or the response type of an API method. For instance:
21
+ #
22
+ # service Foo {
23
+ # rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
24
+ # }
25
+ #
26
+ # The JSON representation for `Empty` is empty JSON object `{}`.
27
+ class Empty; end
28
+ end
29
+ end
@@ -0,0 +1,222 @@
1
+ # Copyright 2019 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ module Google
17
+ module Protobuf
18
+ # `FieldMask` represents a set of symbolic field paths, for example:
19
+ #
20
+ # paths: "f.a"
21
+ # paths: "f.b.d"
22
+ #
23
+ # Here `f` represents a field in some root message, `a` and `b`
24
+ # fields in the message found in `f`, and `d` a field found in the
25
+ # message in `f.b`.
26
+ #
27
+ # Field masks are used to specify a subset of fields that should be
28
+ # returned by a get operation or modified by an update operation.
29
+ # Field masks also have a custom JSON encoding (see below).
30
+ #
31
+ # = Field Masks in Projections
32
+ #
33
+ # When used in the context of a projection, a response message or
34
+ # sub-message is filtered by the API to only contain those fields as
35
+ # specified in the mask. For example, if the mask in the previous
36
+ # example is applied to a response message as follows:
37
+ #
38
+ # f {
39
+ # a : 22
40
+ # b {
41
+ # d : 1
42
+ # x : 2
43
+ # }
44
+ # y : 13
45
+ # }
46
+ # z: 8
47
+ #
48
+ # The result will not contain specific values for fields x,y and z
49
+ # (their value will be set to the default, and omitted in proto text
50
+ # output):
51
+ #
52
+ #
53
+ # f {
54
+ # a : 22
55
+ # b {
56
+ # d : 1
57
+ # }
58
+ # }
59
+ #
60
+ # A repeated field is not allowed except at the last position of a
61
+ # paths string.
62
+ #
63
+ # If a FieldMask object is not present in a get operation, the
64
+ # operation applies to all fields (as if a FieldMask of all fields
65
+ # had been specified).
66
+ #
67
+ # Note that a field mask does not necessarily apply to the
68
+ # top-level response message. In case of a REST get operation, the
69
+ # field mask applies directly to the response, but in case of a REST
70
+ # list operation, the mask instead applies to each individual message
71
+ # in the returned resource list. In case of a REST custom method,
72
+ # other definitions may be used. Where the mask applies will be
73
+ # clearly documented together with its declaration in the API. In
74
+ # any case, the effect on the returned resource/resources is required
75
+ # behavior for APIs.
76
+ #
77
+ # = Field Masks in Update Operations
78
+ #
79
+ # A field mask in update operations specifies which fields of the
80
+ # targeted resource are going to be updated. The API is required
81
+ # to only change the values of the fields as specified in the mask
82
+ # and leave the others untouched. If a resource is passed in to
83
+ # describe the updated values, the API ignores the values of all
84
+ # fields not covered by the mask.
85
+ #
86
+ # If a repeated field is specified for an update operation, new values will
87
+ # be appended to the existing repeated field in the target resource. Note that
88
+ # a repeated field is only allowed in the last position of a `paths` string.
89
+ #
90
+ # If a sub-message is specified in the last position of the field mask for an
91
+ # update operation, then new value will be merged into the existing sub-message
92
+ # in the target resource.
93
+ #
94
+ # For example, given the target message:
95
+ #
96
+ # f {
97
+ # b {
98
+ # d: 1
99
+ # x: 2
100
+ # }
101
+ # c: [1]
102
+ # }
103
+ #
104
+ # And an update message:
105
+ #
106
+ # f {
107
+ # b {
108
+ # d: 10
109
+ # }
110
+ # c: [2]
111
+ # }
112
+ #
113
+ # then if the field mask is:
114
+ #
115
+ # paths: ["f.b", "f.c"]
116
+ #
117
+ # then the result will be:
118
+ #
119
+ # f {
120
+ # b {
121
+ # d: 10
122
+ # x: 2
123
+ # }
124
+ # c: [1, 2]
125
+ # }
126
+ #
127
+ # An implementation may provide options to override this default behavior for
128
+ # repeated and message fields.
129
+ #
130
+ # In order to reset a field's value to the default, the field must
131
+ # be in the mask and set to the default value in the provided resource.
132
+ # Hence, in order to reset all fields of a resource, provide a default
133
+ # instance of the resource and set all fields in the mask, or do
134
+ # not provide a mask as described below.
135
+ #
136
+ # If a field mask is not present on update, the operation applies to
137
+ # all fields (as if a field mask of all fields has been specified).
138
+ # Note that in the presence of schema evolution, this may mean that
139
+ # fields the client does not know and has therefore not filled into
140
+ # the request will be reset to their default. If this is unwanted
141
+ # behavior, a specific service may require a client to always specify
142
+ # a field mask, producing an error if not.
143
+ #
144
+ # As with get operations, the location of the resource which
145
+ # describes the updated values in the request message depends on the
146
+ # operation kind. In any case, the effect of the field mask is
147
+ # required to be honored by the API.
148
+ #
149
+ # == Considerations for HTTP REST
150
+ #
151
+ # The HTTP kind of an update operation which uses a field mask must
152
+ # be set to PATCH instead of PUT in order to satisfy HTTP semantics
153
+ # (PUT must only be used for full updates).
154
+ #
155
+ # = JSON Encoding of Field Masks
156
+ #
157
+ # In JSON, a field mask is encoded as a single string where paths are
158
+ # separated by a comma. Fields name in each path are converted
159
+ # to/from lower-camel naming conventions.
160
+ #
161
+ # As an example, consider the following message declarations:
162
+ #
163
+ # message Profile {
164
+ # User user = 1;
165
+ # Photo photo = 2;
166
+ # }
167
+ # message User {
168
+ # string display_name = 1;
169
+ # string address = 2;
170
+ # }
171
+ #
172
+ # In proto a field mask for `Profile` may look as such:
173
+ #
174
+ # mask {
175
+ # paths: "user.display_name"
176
+ # paths: "photo"
177
+ # }
178
+ #
179
+ # In JSON, the same mask is represented as below:
180
+ #
181
+ # {
182
+ # mask: "user.displayName,photo"
183
+ # }
184
+ #
185
+ # = Field Masks and Oneof Fields
186
+ #
187
+ # Field masks treat fields in oneofs just as regular fields. Consider the
188
+ # following message:
189
+ #
190
+ # message SampleMessage {
191
+ # oneof test_oneof {
192
+ # string name = 4;
193
+ # SubMessage sub_message = 9;
194
+ # }
195
+ # }
196
+ #
197
+ # The field mask can be:
198
+ #
199
+ # mask {
200
+ # paths: "name"
201
+ # }
202
+ #
203
+ # Or:
204
+ #
205
+ # mask {
206
+ # paths: "sub_message"
207
+ # }
208
+ #
209
+ # Note that oneof type names ("test_oneof" in this case) cannot be used in
210
+ # paths.
211
+ #
212
+ # == Field Mask Verification
213
+ #
214
+ # The implementation of any API method which has a FieldMask type field in the
215
+ # request should verify the included field paths, and return an
216
+ # `INVALID_ARGUMENT` error if any path is duplicated or unmappable.
217
+ # @!attribute [rw] paths
218
+ # @return [Array<String>]
219
+ # The set of field mask paths.
220
+ class FieldMask; end
221
+ end
222
+ end
@@ -26,6 +26,14 @@ module Google
26
26
  self.class.assessment_path project, assessment
27
27
  end
28
28
 
29
+ # Alias for Google::Cloud::RecaptchaEnterprise::V1beta1::RecaptchaEnterpriseClient.key_path.
30
+ # @param project [String]
31
+ # @param key [String]
32
+ # @return [String]
33
+ def key_path project, key
34
+ self.class.key_path project, key
35
+ end
36
+
29
37
  # Alias for Google::Cloud::RecaptchaEnterprise::V1beta1::RecaptchaEnterpriseClient.project_path.
30
38
  # @param project [String]
31
39
  # @return [String]
@@ -52,6 +52,15 @@ module Google
52
52
 
53
53
  DEFAULT_TIMEOUT = 30
54
54
 
55
+ PAGE_DESCRIPTORS = {
56
+ "list_keys" => Google::Gax::PageDescriptor.new(
57
+ "page_token",
58
+ "next_page_token",
59
+ "keys")
60
+ }.freeze
61
+
62
+ private_constant :PAGE_DESCRIPTORS
63
+
55
64
  # The scopes needed to make gRPC calls to all of the methods defined in
56
65
  # this service.
57
66
  ALL_SCOPES = [
@@ -65,6 +74,12 @@ module Google
65
74
 
66
75
  private_constant :ASSESSMENT_PATH_TEMPLATE
67
76
 
77
+ KEY_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
78
+ "projects/{project}/keys/{key}"
79
+ )
80
+
81
+ private_constant :KEY_PATH_TEMPLATE
82
+
68
83
  PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
69
84
  "projects/{project}"
70
85
  )
@@ -82,6 +97,17 @@ module Google
82
97
  )
83
98
  end
84
99
 
100
+ # Returns a fully-qualified key resource name string.
101
+ # @param project [String]
102
+ # @param key [String]
103
+ # @return [String]
104
+ def self.key_path project, key
105
+ KEY_PATH_TEMPLATE.render(
106
+ :"project" => project,
107
+ :"key" => key
108
+ )
109
+ end
110
+
85
111
  # Returns a fully-qualified project resource name string.
86
112
  # @param project [String]
87
113
  # @return [String]
@@ -179,6 +205,7 @@ module Google
179
205
  client_config,
180
206
  Google::Gax::Grpc::STATUS_CODE_NAMES,
181
207
  timeout,
208
+ page_descriptors: PAGE_DESCRIPTORS,
182
209
  errors: Google::Gax::Grpc::API_ERRORS,
183
210
  metadata: headers
184
211
  )
@@ -215,6 +242,46 @@ module Google
215
242
  {'name' => request.name}
216
243
  end
217
244
  )
245
+ @create_key = Google::Gax.create_api_call(
246
+ @recaptcha_enterprise_stub.method(:create_key),
247
+ defaults["create_key"],
248
+ exception_transformer: exception_transformer,
249
+ params_extractor: proc do |request|
250
+ {'parent' => request.parent}
251
+ end
252
+ )
253
+ @list_keys = Google::Gax.create_api_call(
254
+ @recaptcha_enterprise_stub.method(:list_keys),
255
+ defaults["list_keys"],
256
+ exception_transformer: exception_transformer,
257
+ params_extractor: proc do |request|
258
+ {'parent' => request.parent}
259
+ end
260
+ )
261
+ @get_key = Google::Gax.create_api_call(
262
+ @recaptcha_enterprise_stub.method(:get_key),
263
+ defaults["get_key"],
264
+ exception_transformer: exception_transformer,
265
+ params_extractor: proc do |request|
266
+ {'name' => request.name}
267
+ end
268
+ )
269
+ @update_key = Google::Gax.create_api_call(
270
+ @recaptcha_enterprise_stub.method(:update_key),
271
+ defaults["update_key"],
272
+ exception_transformer: exception_transformer,
273
+ params_extractor: proc do |request|
274
+ {'key.name' => request.key.name}
275
+ end
276
+ )
277
+ @delete_key = Google::Gax.create_api_call(
278
+ @recaptcha_enterprise_stub.method(:delete_key),
279
+ defaults["delete_key"],
280
+ exception_transformer: exception_transformer,
281
+ params_extractor: proc do |request|
282
+ {'name' => request.name}
283
+ end
284
+ )
218
285
  end
219
286
 
220
287
  # Service calls
@@ -297,6 +364,204 @@ module Google
297
364
  req = Google::Gax::to_proto(req, Google::Cloud::Recaptchaenterprise::V1beta1::AnnotateAssessmentRequest)
298
365
  @annotate_assessment.call(req, options, &block)
299
366
  end
367
+
368
+ # Creates a new reCAPTCHA Enterprise key.
369
+ #
370
+ # @param parent [String]
371
+ # Required. The name of the project in which the key will be created, in the
372
+ # format "projects/\\{project_number}".
373
+ # @param key [Google::Cloud::Recaptchaenterprise::V1beta1::Key | Hash]
374
+ # Required. Information to create a reCAPTCHA Enterprise key.
375
+ # A hash of the same form as `Google::Cloud::Recaptchaenterprise::V1beta1::Key`
376
+ # can also be provided.
377
+ # @param options [Google::Gax::CallOptions]
378
+ # Overrides the default settings for this call, e.g, timeout,
379
+ # retries, etc.
380
+ # @yield [result, operation] Access the result along with the RPC operation
381
+ # @yieldparam result [Google::Cloud::Recaptchaenterprise::V1beta1::Key]
382
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
383
+ # @return [Google::Cloud::Recaptchaenterprise::V1beta1::Key]
384
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
385
+ # @example
386
+ # require "google/cloud/recaptcha_enterprise"
387
+ #
388
+ # recaptcha_enterprise_client = Google::Cloud::RecaptchaEnterprise.new(version: :v1beta1)
389
+ # formatted_parent = Google::Cloud::RecaptchaEnterprise::V1beta1::RecaptchaEnterpriseClient.project_path("[PROJECT]")
390
+ #
391
+ # # TODO: Initialize `key`:
392
+ # key = {}
393
+ # response = recaptcha_enterprise_client.create_key(formatted_parent, key)
394
+
395
+ def create_key \
396
+ parent,
397
+ key,
398
+ options: nil,
399
+ &block
400
+ req = {
401
+ parent: parent,
402
+ key: key
403
+ }.delete_if { |_, v| v.nil? }
404
+ req = Google::Gax::to_proto(req, Google::Cloud::Recaptchaenterprise::V1beta1::CreateKeyRequest)
405
+ @create_key.call(req, options, &block)
406
+ end
407
+
408
+ # Returns the list of all keys that belong to a project.
409
+ #
410
+ # @param parent [String]
411
+ # Required. The name of the project that contains the keys that will be
412
+ # listed, in the format "projects/\\{project_number}".
413
+ # @param page_size [Integer]
414
+ # The maximum number of resources contained in the underlying API
415
+ # response. If page streaming is performed per-resource, this
416
+ # parameter does not affect the return value. If page streaming is
417
+ # performed per-page, this determines the maximum number of
418
+ # resources in a page.
419
+ # @param options [Google::Gax::CallOptions]
420
+ # Overrides the default settings for this call, e.g, timeout,
421
+ # retries, etc.
422
+ # @yield [result, operation] Access the result along with the RPC operation
423
+ # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Recaptchaenterprise::V1beta1::Key>]
424
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
425
+ # @return [Google::Gax::PagedEnumerable<Google::Cloud::Recaptchaenterprise::V1beta1::Key>]
426
+ # An enumerable of Google::Cloud::Recaptchaenterprise::V1beta1::Key instances.
427
+ # See Google::Gax::PagedEnumerable documentation for other
428
+ # operations such as per-page iteration or access to the response
429
+ # object.
430
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
431
+ # @example
432
+ # require "google/cloud/recaptcha_enterprise"
433
+ #
434
+ # recaptcha_enterprise_client = Google::Cloud::RecaptchaEnterprise.new(version: :v1beta1)
435
+ # formatted_parent = Google::Cloud::RecaptchaEnterprise::V1beta1::RecaptchaEnterpriseClient.project_path("[PROJECT]")
436
+ #
437
+ # # Iterate over all results.
438
+ # recaptcha_enterprise_client.list_keys(formatted_parent).each do |element|
439
+ # # Process element.
440
+ # end
441
+ #
442
+ # # Or iterate over results one page at a time.
443
+ # recaptcha_enterprise_client.list_keys(formatted_parent).each_page do |page|
444
+ # # Process each page at a time.
445
+ # page.each do |element|
446
+ # # Process element.
447
+ # end
448
+ # end
449
+
450
+ def list_keys \
451
+ parent,
452
+ page_size: nil,
453
+ options: nil,
454
+ &block
455
+ req = {
456
+ parent: parent,
457
+ page_size: page_size
458
+ }.delete_if { |_, v| v.nil? }
459
+ req = Google::Gax::to_proto(req, Google::Cloud::Recaptchaenterprise::V1beta1::ListKeysRequest)
460
+ @list_keys.call(req, options, &block)
461
+ end
462
+
463
+ # Returns the specified key.
464
+ #
465
+ # @param name [String]
466
+ # Required. The name of the requested key, in the format
467
+ # "projects/\\{project_number}/keys/\\{key_id}".
468
+ # @param options [Google::Gax::CallOptions]
469
+ # Overrides the default settings for this call, e.g, timeout,
470
+ # retries, etc.
471
+ # @yield [result, operation] Access the result along with the RPC operation
472
+ # @yieldparam result [Google::Cloud::Recaptchaenterprise::V1beta1::Key]
473
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
474
+ # @return [Google::Cloud::Recaptchaenterprise::V1beta1::Key]
475
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
476
+ # @example
477
+ # require "google/cloud/recaptcha_enterprise"
478
+ #
479
+ # recaptcha_enterprise_client = Google::Cloud::RecaptchaEnterprise.new(version: :v1beta1)
480
+ # formatted_name = Google::Cloud::RecaptchaEnterprise::V1beta1::RecaptchaEnterpriseClient.key_path("[PROJECT]", "[KEY]")
481
+ # response = recaptcha_enterprise_client.get_key(formatted_name)
482
+
483
+ def get_key \
484
+ name,
485
+ options: nil,
486
+ &block
487
+ req = {
488
+ name: name
489
+ }.delete_if { |_, v| v.nil? }
490
+ req = Google::Gax::to_proto(req, Google::Cloud::Recaptchaenterprise::V1beta1::GetKeyRequest)
491
+ @get_key.call(req, options, &block)
492
+ end
493
+
494
+ # Updates the specified key.
495
+ #
496
+ # @param key [Google::Cloud::Recaptchaenterprise::V1beta1::Key | Hash]
497
+ # Required. The key to update.
498
+ # A hash of the same form as `Google::Cloud::Recaptchaenterprise::V1beta1::Key`
499
+ # can also be provided.
500
+ # @param update_mask [Google::Protobuf::FieldMask | Hash]
501
+ # Optional. The mask to control which field of the key get updated. If the mask is not
502
+ # present, all fields will be updated.
503
+ # A hash of the same form as `Google::Protobuf::FieldMask`
504
+ # can also be provided.
505
+ # @param options [Google::Gax::CallOptions]
506
+ # Overrides the default settings for this call, e.g, timeout,
507
+ # retries, etc.
508
+ # @yield [result, operation] Access the result along with the RPC operation
509
+ # @yieldparam result [Google::Cloud::Recaptchaenterprise::V1beta1::Key]
510
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
511
+ # @return [Google::Cloud::Recaptchaenterprise::V1beta1::Key]
512
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
513
+ # @example
514
+ # require "google/cloud/recaptcha_enterprise"
515
+ #
516
+ # recaptcha_enterprise_client = Google::Cloud::RecaptchaEnterprise.new(version: :v1beta1)
517
+ #
518
+ # # TODO: Initialize `key`:
519
+ # key = {}
520
+ # response = recaptcha_enterprise_client.update_key(key)
521
+
522
+ def update_key \
523
+ key,
524
+ update_mask: nil,
525
+ options: nil,
526
+ &block
527
+ req = {
528
+ key: key,
529
+ update_mask: update_mask
530
+ }.delete_if { |_, v| v.nil? }
531
+ req = Google::Gax::to_proto(req, Google::Cloud::Recaptchaenterprise::V1beta1::UpdateKeyRequest)
532
+ @update_key.call(req, options, &block)
533
+ end
534
+
535
+ # Deletes the specified key.
536
+ #
537
+ # @param name [String]
538
+ # Required. The name of the key to be deleted, in the format
539
+ # "projects/\\{project_number}/keys/\\{key_id}".
540
+ # @param options [Google::Gax::CallOptions]
541
+ # Overrides the default settings for this call, e.g, timeout,
542
+ # retries, etc.
543
+ # @yield [result, operation] Access the result along with the RPC operation
544
+ # @yieldparam result []
545
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
546
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
547
+ # @example
548
+ # require "google/cloud/recaptcha_enterprise"
549
+ #
550
+ # recaptcha_enterprise_client = Google::Cloud::RecaptchaEnterprise.new(version: :v1beta1)
551
+ # formatted_name = Google::Cloud::RecaptchaEnterprise::V1beta1::RecaptchaEnterpriseClient.key_path("[PROJECT]", "[KEY]")
552
+ # recaptcha_enterprise_client.delete_key(formatted_name)
553
+
554
+ def delete_key \
555
+ name,
556
+ options: nil,
557
+ &block
558
+ req = {
559
+ name: name
560
+ }.delete_if { |_, v| v.nil? }
561
+ req = Google::Gax::to_proto(req, Google::Cloud::Recaptchaenterprise::V1beta1::DeleteKeyRequest)
562
+ @delete_key.call(req, options, &block)
563
+ nil
564
+ end
300
565
  end
301
566
  end
302
567
  end
@@ -29,6 +29,31 @@
29
29
  "timeout_millis": 60000,
30
30
  "retry_codes_name": "non_idempotent",
31
31
  "retry_params_name": "default"
32
+ },
33
+ "CreateKey": {
34
+ "timeout_millis": 60000,
35
+ "retry_codes_name": "non_idempotent",
36
+ "retry_params_name": "default"
37
+ },
38
+ "ListKeys": {
39
+ "timeout_millis": 60000,
40
+ "retry_codes_name": "idempotent",
41
+ "retry_params_name": "default"
42
+ },
43
+ "GetKey": {
44
+ "timeout_millis": 60000,
45
+ "retry_codes_name": "idempotent",
46
+ "retry_params_name": "default"
47
+ },
48
+ "UpdateKey": {
49
+ "timeout_millis": 60000,
50
+ "retry_codes_name": "non_idempotent",
51
+ "retry_params_name": "default"
52
+ },
53
+ "DeleteKey": {
54
+ "timeout_millis": 60000,
55
+ "retry_codes_name": "non_idempotent",
56
+ "retry_params_name": "default"
32
57
  }
33
58
  }
34
59
  }
@@ -16,7 +16,7 @@
16
16
  module Google
17
17
  module Cloud
18
18
  module RecaptchaEnterprise
19
- VERSION = "0.3.1".freeze
19
+ VERSION = "0.4.0".freeze
20
20
  end
21
21
  end
22
22
  end
@@ -8,6 +8,8 @@ require 'google/api/annotations_pb'
8
8
  require 'google/api/client_pb'
9
9
  require 'google/api/field_behavior_pb'
10
10
  require 'google/api/resource_pb'
11
+ require 'google/protobuf/empty_pb'
12
+ require 'google/protobuf/field_mask_pb'
11
13
  require 'google/protobuf/timestamp_pb'
12
14
  Google::Protobuf::DescriptorPool.generated_pool.build do
13
15
  add_message "google.cloud.recaptchaenterprise.v1beta1.CreateAssessmentRequest" do
@@ -43,6 +45,9 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
43
45
  add_message "google.cloud.recaptchaenterprise.v1beta1.Event" do
44
46
  optional :token, :string, 1
45
47
  optional :site_key, :string, 2
48
+ optional :user_agent, :string, 3
49
+ optional :user_ip_address, :string, 4
50
+ optional :expected_action, :string, 5
46
51
  end
47
52
  add_message "google.cloud.recaptchaenterprise.v1beta1.TokenProperties" do
48
53
  optional :valid, :bool, 1
@@ -60,6 +65,63 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
60
65
  value :SITE_MISMATCH, 5
61
66
  value :MISSING, 6
62
67
  end
68
+ add_message "google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest" do
69
+ optional :parent, :string, 1
70
+ optional :key, :message, 2, "google.cloud.recaptchaenterprise.v1beta1.Key"
71
+ end
72
+ add_message "google.cloud.recaptchaenterprise.v1beta1.ListKeysRequest" do
73
+ optional :parent, :string, 1
74
+ optional :page_size, :int32, 2
75
+ optional :page_token, :string, 3
76
+ end
77
+ add_message "google.cloud.recaptchaenterprise.v1beta1.ListKeysResponse" do
78
+ repeated :keys, :message, 1, "google.cloud.recaptchaenterprise.v1beta1.Key"
79
+ optional :next_page_token, :string, 2
80
+ end
81
+ add_message "google.cloud.recaptchaenterprise.v1beta1.GetKeyRequest" do
82
+ optional :name, :string, 1
83
+ end
84
+ add_message "google.cloud.recaptchaenterprise.v1beta1.UpdateKeyRequest" do
85
+ optional :key, :message, 1, "google.cloud.recaptchaenterprise.v1beta1.Key"
86
+ optional :update_mask, :message, 2, "google.protobuf.FieldMask"
87
+ end
88
+ add_message "google.cloud.recaptchaenterprise.v1beta1.DeleteKeyRequest" do
89
+ optional :name, :string, 1
90
+ end
91
+ add_message "google.cloud.recaptchaenterprise.v1beta1.Key" do
92
+ optional :name, :string, 1
93
+ optional :display_name, :string, 2
94
+ oneof :platform_settings do
95
+ optional :web_settings, :message, 3, "google.cloud.recaptchaenterprise.v1beta1.WebKeySettings"
96
+ optional :android_settings, :message, 4, "google.cloud.recaptchaenterprise.v1beta1.AndroidKeySettings"
97
+ optional :ios_settings, :message, 5, "google.cloud.recaptchaenterprise.v1beta1.IOSKeySettings"
98
+ end
99
+ end
100
+ add_message "google.cloud.recaptchaenterprise.v1beta1.WebKeySettings" do
101
+ optional :enforce_allowed_domains, :bool, 3
102
+ repeated :allowed_domains, :string, 1
103
+ optional :allow_amp_traffic, :bool, 2
104
+ optional :integration_type, :enum, 4, "google.cloud.recaptchaenterprise.v1beta1.WebKeySettings.IntegrationType"
105
+ optional :challenge_security_preference, :enum, 5, "google.cloud.recaptchaenterprise.v1beta1.WebKeySettings.ChallengeSecurityPreference"
106
+ end
107
+ add_enum "google.cloud.recaptchaenterprise.v1beta1.WebKeySettings.IntegrationType" do
108
+ value :INTEGRATION_TYPE_UNSPECIFIED, 0
109
+ value :SCORE_ONLY, 1
110
+ value :CHECKBOX_CHALLENGE, 2
111
+ value :INVISIBLE_CHALLENGE, 3
112
+ end
113
+ add_enum "google.cloud.recaptchaenterprise.v1beta1.WebKeySettings.ChallengeSecurityPreference" do
114
+ value :CHALLENGE_SECURITY_PREFERENCE_UNSPECIFIED, 0
115
+ value :USABILITY, 1
116
+ value :BALANCED, 2
117
+ value :SECURITY, 3
118
+ end
119
+ add_message "google.cloud.recaptchaenterprise.v1beta1.AndroidKeySettings" do
120
+ repeated :allowed_package_names, :string, 1
121
+ end
122
+ add_message "google.cloud.recaptchaenterprise.v1beta1.IOSKeySettings" do
123
+ repeated :allowed_bundle_ids, :string, 1
124
+ end
63
125
  end
64
126
 
65
127
  module Google
@@ -75,6 +137,18 @@ module Google
75
137
  Event = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recaptchaenterprise.v1beta1.Event").msgclass
76
138
  TokenProperties = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recaptchaenterprise.v1beta1.TokenProperties").msgclass
77
139
  TokenProperties::InvalidReason = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recaptchaenterprise.v1beta1.TokenProperties.InvalidReason").enummodule
140
+ CreateKeyRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recaptchaenterprise.v1beta1.CreateKeyRequest").msgclass
141
+ ListKeysRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recaptchaenterprise.v1beta1.ListKeysRequest").msgclass
142
+ ListKeysResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recaptchaenterprise.v1beta1.ListKeysResponse").msgclass
143
+ GetKeyRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recaptchaenterprise.v1beta1.GetKeyRequest").msgclass
144
+ UpdateKeyRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recaptchaenterprise.v1beta1.UpdateKeyRequest").msgclass
145
+ DeleteKeyRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recaptchaenterprise.v1beta1.DeleteKeyRequest").msgclass
146
+ Key = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recaptchaenterprise.v1beta1.Key").msgclass
147
+ WebKeySettings = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recaptchaenterprise.v1beta1.WebKeySettings").msgclass
148
+ WebKeySettings::IntegrationType = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recaptchaenterprise.v1beta1.WebKeySettings.IntegrationType").enummodule
149
+ WebKeySettings::ChallengeSecurityPreference = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recaptchaenterprise.v1beta1.WebKeySettings.ChallengeSecurityPreference").enummodule
150
+ AndroidKeySettings = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recaptchaenterprise.v1beta1.AndroidKeySettings").msgclass
151
+ IOSKeySettings = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.recaptchaenterprise.v1beta1.IOSKeySettings").msgclass
78
152
  end
79
153
  end
80
154
  end
@@ -40,6 +40,16 @@ module Google
40
40
  # Annotates a previously created Assessment to provide additional information
41
41
  # on whether the event turned out to be authentic or fradulent.
42
42
  rpc :AnnotateAssessment, AnnotateAssessmentRequest, AnnotateAssessmentResponse
43
+ # Creates a new reCAPTCHA Enterprise key.
44
+ rpc :CreateKey, CreateKeyRequest, Key
45
+ # Returns the list of all keys that belong to a project.
46
+ rpc :ListKeys, ListKeysRequest, ListKeysResponse
47
+ # Returns the specified key.
48
+ rpc :GetKey, GetKeyRequest, Key
49
+ # Updates the specified key.
50
+ rpc :UpdateKey, UpdateKeyRequest, Key
51
+ # Deletes the specified key.
52
+ rpc :DeleteKey, DeleteKeyRequest, Google::Protobuf::Empty
43
53
  end
44
54
 
45
55
  Stub = Service.rpc_stub_class
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-recaptcha_enterprise
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-07 00:00:00.000000000 Z
11
+ date: 2019-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-gax
@@ -163,6 +163,8 @@ files:
163
163
  - lib/google/cloud/recaptcha_enterprise/v1beta1.rb
164
164
  - lib/google/cloud/recaptcha_enterprise/v1beta1/credentials.rb
165
165
  - lib/google/cloud/recaptcha_enterprise/v1beta1/doc/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.rb
166
+ - lib/google/cloud/recaptcha_enterprise/v1beta1/doc/google/protobuf/empty.rb
167
+ - lib/google/cloud/recaptcha_enterprise/v1beta1/doc/google/protobuf/field_mask.rb
166
168
  - lib/google/cloud/recaptcha_enterprise/v1beta1/doc/google/protobuf/timestamp.rb
167
169
  - lib/google/cloud/recaptcha_enterprise/v1beta1/helpers.rb
168
170
  - lib/google/cloud/recaptcha_enterprise/v1beta1/recaptcha_enterprise_client.rb