google-cloud-recaptcha_enterprise 0.5.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,222 +0,0 @@
1
- # Copyright 2020 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
@@ -1,113 +0,0 @@
1
- # Copyright 2020 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 Timestamp represents a point in time independent of any time zone or local
19
- # calendar, encoded as a count of seconds and fractions of seconds at
20
- # nanosecond resolution. The count is relative to an epoch at UTC midnight on
21
- # January 1, 1970, in the proleptic Gregorian calendar which extends the
22
- # Gregorian calendar backwards to year one.
23
- #
24
- # All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
25
- # second table is needed for interpretation, using a [24-hour linear
26
- # smear](https://developers.google.com/time/smear).
27
- #
28
- # The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
29
- # restricting to that range, we ensure that we can convert to and from [RFC
30
- # 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
31
- #
32
- # = Examples
33
- #
34
- # Example 1: Compute Timestamp from POSIX `time()`.
35
- #
36
- # Timestamp timestamp;
37
- # timestamp.set_seconds(time(NULL));
38
- # timestamp.set_nanos(0);
39
- #
40
- # Example 2: Compute Timestamp from POSIX `gettimeofday()`.
41
- #
42
- # struct timeval tv;
43
- # gettimeofday(&tv, NULL);
44
- #
45
- # Timestamp timestamp;
46
- # timestamp.set_seconds(tv.tv_sec);
47
- # timestamp.set_nanos(tv.tv_usec * 1000);
48
- #
49
- # Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
50
- #
51
- # FILETIME ft;
52
- # GetSystemTimeAsFileTime(&ft);
53
- # UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
54
- #
55
- # // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
56
- # // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
57
- # Timestamp timestamp;
58
- # timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
59
- # timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
60
- #
61
- # Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
62
- #
63
- # long millis = System.currentTimeMillis();
64
- #
65
- # Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
66
- # .setNanos((int) ((millis % 1000) * 1000000)).build();
67
- #
68
- #
69
- # Example 5: Compute Timestamp from current time in Python.
70
- #
71
- # timestamp = Timestamp()
72
- # timestamp.GetCurrentTime()
73
- #
74
- # = JSON Mapping
75
- #
76
- # In JSON format, the Timestamp type is encoded as a string in the
77
- # [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
78
- # format is "\\{year}-\\{month}-\\{day}T\\{hour}:\\{min}:\\{sec}[.\\{frac_sec}]Z"
79
- # where \\{year} is always expressed using four digits while \\{month}, \\{day},
80
- # \\{hour}, \\{min}, and \\{sec} are zero-padded to two digits each. The fractional
81
- # seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
82
- # are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
83
- # is required. A proto3 JSON serializer should always use UTC (as indicated by
84
- # "Z") when printing the Timestamp type and a proto3 JSON parser should be
85
- # able to accept both UTC and other timezones (as indicated by an offset).
86
- #
87
- # For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
88
- # 01:30 UTC on January 15, 2017.
89
- #
90
- # In JavaScript, one can convert a Date object to this format using the
91
- # standard
92
- # [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
93
- # method. In Python, a standard `datetime.datetime` object can be converted
94
- # to this format using
95
- # [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
96
- # the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
97
- # the Joda Time's [`ISODateTimeFormat.dateTime()`](
98
- # http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
99
- # ) to obtain a formatter capable of generating timestamps in this format.
100
- # @!attribute [rw] seconds
101
- # @return [Integer]
102
- # Represents seconds of UTC time since Unix epoch
103
- # 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
104
- # 9999-12-31T23:59:59Z inclusive.
105
- # @!attribute [rw] nanos
106
- # @return [Integer]
107
- # Non-negative fractions of a second at nanosecond resolution. Negative
108
- # second values with fractions must still have non-negative nanos values
109
- # that count forward in time. Must be from 0 to 999,999,999
110
- # inclusive.
111
- class Timestamp; end
112
- end
113
- end
@@ -1,47 +0,0 @@
1
- # Copyright 2018 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
- module Google
16
- module Cloud
17
- module RecaptchaEnterprise
18
- module V1beta1
19
- class RecaptchaEnterpriseClient
20
-
21
- # Alias for Google::Cloud::RecaptchaEnterprise::V1beta1::RecaptchaEnterpriseClient.assessment_path.
22
- # @param project [String]
23
- # @param assessment [String]
24
- # @return [String]
25
- def assessment_path project, assessment
26
- self.class.assessment_path project, assessment
27
- end
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
-
37
- # Alias for Google::Cloud::RecaptchaEnterprise::V1beta1::RecaptchaEnterpriseClient.project_path.
38
- # @param project [String]
39
- # @return [String]
40
- def project_path project
41
- self.class.project_path project
42
- end
43
- end
44
- end
45
- end
46
- end
47
- end
@@ -1,572 +0,0 @@
1
- # Copyright 2020 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
- # EDITING INSTRUCTIONS
16
- # This file was generated from the file
17
- # https://github.com/googleapis/googleapis/blob/master/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto,
18
- # and updates to that file get reflected here through a refresh process.
19
- # For the short term, the refresh process will only be runnable by Google
20
- # engineers.
21
-
22
-
23
- require "json"
24
- require "pathname"
25
-
26
- require "google/gax"
27
-
28
- require "google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise_pb"
29
- require "google/cloud/recaptcha_enterprise/v1beta1/credentials"
30
- require "google/cloud/recaptcha_enterprise/version"
31
-
32
- module Google
33
- module Cloud
34
- module RecaptchaEnterprise
35
- module V1beta1
36
- # Service to determine the likelihood an event is legitimate.
37
- #
38
- # @!attribute [r] recaptcha_enterprise_stub
39
- # @return [Google::Cloud::Recaptchaenterprise::V1beta1::RecaptchaEnterprise::Stub]
40
- class RecaptchaEnterpriseClient
41
- # @private
42
- attr_reader :recaptcha_enterprise_stub
43
-
44
- # The default address of the service.
45
- SERVICE_ADDRESS = "recaptchaenterprise.googleapis.com".freeze
46
-
47
- # The default port of the service.
48
- DEFAULT_SERVICE_PORT = 443
49
-
50
- # The default set of gRPC interceptors.
51
- GRPC_INTERCEPTORS = []
52
-
53
- DEFAULT_TIMEOUT = 30
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
-
64
- # The scopes needed to make gRPC calls to all of the methods defined in
65
- # this service.
66
- ALL_SCOPES = [
67
- "https://www.googleapis.com/auth/cloud-platform"
68
- ].freeze
69
-
70
-
71
- ASSESSMENT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
72
- "projects/{project}/assessments/{assessment}"
73
- )
74
-
75
- private_constant :ASSESSMENT_PATH_TEMPLATE
76
-
77
- KEY_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
78
- "projects/{project}/keys/{key}"
79
- )
80
-
81
- private_constant :KEY_PATH_TEMPLATE
82
-
83
- PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
84
- "projects/{project}"
85
- )
86
-
87
- private_constant :PROJECT_PATH_TEMPLATE
88
-
89
- # Returns a fully-qualified assessment resource name string.
90
- # @param project [String]
91
- # @param assessment [String]
92
- # @return [String]
93
- def self.assessment_path project, assessment
94
- ASSESSMENT_PATH_TEMPLATE.render(
95
- :"project" => project,
96
- :"assessment" => assessment
97
- )
98
- end
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
-
111
- # Returns a fully-qualified project resource name string.
112
- # @param project [String]
113
- # @return [String]
114
- def self.project_path project
115
- PROJECT_PATH_TEMPLATE.render(
116
- :"project" => project
117
- )
118
- end
119
-
120
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
121
- # Provides the means for authenticating requests made by the client. This parameter can
122
- # be many types.
123
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
124
- # authenticating requests made by this client.
125
- # A `String` will be treated as the path to the keyfile to be used for the construction of
126
- # credentials for this client.
127
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
128
- # credentials for this client.
129
- # A `GRPC::Core::Channel` will be used to make calls through.
130
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
131
- # should already be composed with a `GRPC::Core::CallCredentials` object.
132
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
133
- # metadata for requests, generally, to give OAuth credentials.
134
- # @param scopes [Array<String>]
135
- # The OAuth scopes for this service. This parameter is ignored if
136
- # an updater_proc is supplied.
137
- # @param client_config [Hash]
138
- # A Hash for call options for each method. See
139
- # Google::Gax#construct_settings for the structure of
140
- # this data. Falls back to the default config if not specified
141
- # or the specified config is missing data points.
142
- # @param timeout [Numeric]
143
- # The default timeout, in seconds, for calls made through this client.
144
- # @param metadata [Hash]
145
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
146
- # @param service_address [String]
147
- # Override for the service hostname, or `nil` to leave as the default.
148
- # @param service_port [Integer]
149
- # Override for the service port, or `nil` to leave as the default.
150
- # @param exception_transformer [Proc]
151
- # An optional proc that intercepts any exceptions raised during an API call to inject
152
- # custom error handling.
153
- def initialize \
154
- credentials: nil,
155
- scopes: ALL_SCOPES,
156
- client_config: {},
157
- timeout: DEFAULT_TIMEOUT,
158
- metadata: nil,
159
- service_address: nil,
160
- service_port: nil,
161
- exception_transformer: nil,
162
- lib_name: nil,
163
- lib_version: ""
164
- # These require statements are intentionally placed here to initialize
165
- # the gRPC module only when it's required.
166
- # See https://github.com/googleapis/toolkit/issues/446
167
- require "google/gax/grpc"
168
- require "google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise_services_pb"
169
-
170
- credentials ||= Google::Cloud::RecaptchaEnterprise::V1beta1::Credentials.default
171
-
172
- if credentials.is_a?(String) || credentials.is_a?(Hash)
173
- updater_proc = Google::Cloud::RecaptchaEnterprise::V1beta1::Credentials.new(credentials).updater_proc
174
- end
175
- if credentials.is_a?(GRPC::Core::Channel)
176
- channel = credentials
177
- end
178
- if credentials.is_a?(GRPC::Core::ChannelCredentials)
179
- chan_creds = credentials
180
- end
181
- if credentials.is_a?(Proc)
182
- updater_proc = credentials
183
- end
184
- if credentials.is_a?(Google::Auth::Credentials)
185
- updater_proc = credentials.updater_proc
186
- end
187
-
188
- package_version = Google::Cloud::RecaptchaEnterprise::VERSION
189
-
190
- google_api_client = "gl-ruby/#{RUBY_VERSION}"
191
- google_api_client << " #{lib_name}/#{lib_version}" if lib_name
192
- google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
193
- google_api_client << " grpc/#{GRPC::VERSION}"
194
- google_api_client.freeze
195
-
196
- headers = { :"x-goog-api-client" => google_api_client }
197
- if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
198
- headers[:"x-goog-user-project"] = credentials.quota_project_id
199
- end
200
- headers.merge!(metadata) unless metadata.nil?
201
- client_config_file = Pathname.new(__dir__).join(
202
- "recaptcha_enterprise_client_config.json"
203
- )
204
- defaults = client_config_file.open do |f|
205
- Google::Gax.construct_settings(
206
- "google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1",
207
- JSON.parse(f.read),
208
- client_config,
209
- Google::Gax::Grpc::STATUS_CODE_NAMES,
210
- timeout,
211
- page_descriptors: PAGE_DESCRIPTORS,
212
- errors: Google::Gax::Grpc::API_ERRORS,
213
- metadata: headers
214
- )
215
- end
216
-
217
- # Allow overriding the service path/port in subclasses.
218
- service_path = service_address || self.class::SERVICE_ADDRESS
219
- port = service_port || self.class::DEFAULT_SERVICE_PORT
220
- interceptors = self.class::GRPC_INTERCEPTORS
221
- @recaptcha_enterprise_stub = Google::Gax::Grpc.create_stub(
222
- service_path,
223
- port,
224
- chan_creds: chan_creds,
225
- channel: channel,
226
- updater_proc: updater_proc,
227
- scopes: scopes,
228
- interceptors: interceptors,
229
- &Google::Cloud::Recaptchaenterprise::V1beta1::RecaptchaEnterprise::Stub.method(:new)
230
- )
231
-
232
- @create_assessment = Google::Gax.create_api_call(
233
- @recaptcha_enterprise_stub.method(:create_assessment),
234
- defaults["create_assessment"],
235
- exception_transformer: exception_transformer,
236
- params_extractor: proc do |request|
237
- {'parent' => request.parent}
238
- end
239
- )
240
- @annotate_assessment = Google::Gax.create_api_call(
241
- @recaptcha_enterprise_stub.method(:annotate_assessment),
242
- defaults["annotate_assessment"],
243
- exception_transformer: exception_transformer,
244
- params_extractor: proc do |request|
245
- {'name' => request.name}
246
- end
247
- )
248
- @create_key = Google::Gax.create_api_call(
249
- @recaptcha_enterprise_stub.method(:create_key),
250
- defaults["create_key"],
251
- exception_transformer: exception_transformer,
252
- params_extractor: proc do |request|
253
- {'parent' => request.parent}
254
- end
255
- )
256
- @list_keys = Google::Gax.create_api_call(
257
- @recaptcha_enterprise_stub.method(:list_keys),
258
- defaults["list_keys"],
259
- exception_transformer: exception_transformer,
260
- params_extractor: proc do |request|
261
- {'parent' => request.parent}
262
- end
263
- )
264
- @get_key = Google::Gax.create_api_call(
265
- @recaptcha_enterprise_stub.method(:get_key),
266
- defaults["get_key"],
267
- exception_transformer: exception_transformer,
268
- params_extractor: proc do |request|
269
- {'name' => request.name}
270
- end
271
- )
272
- @update_key = Google::Gax.create_api_call(
273
- @recaptcha_enterprise_stub.method(:update_key),
274
- defaults["update_key"],
275
- exception_transformer: exception_transformer,
276
- params_extractor: proc do |request|
277
- {'key.name' => request.key.name}
278
- end
279
- )
280
- @delete_key = Google::Gax.create_api_call(
281
- @recaptcha_enterprise_stub.method(:delete_key),
282
- defaults["delete_key"],
283
- exception_transformer: exception_transformer,
284
- params_extractor: proc do |request|
285
- {'name' => request.name}
286
- end
287
- )
288
- end
289
-
290
- # Service calls
291
-
292
- # Creates an Assessment of the likelihood an event is legitimate.
293
- #
294
- # @param parent [String]
295
- # Required. The name of the project in which the assessment will be created,
296
- # in the format "projects/\\{project_number}".
297
- # @param assessment [Google::Cloud::Recaptchaenterprise::V1beta1::Assessment | Hash]
298
- # Required. The assessment details.
299
- # A hash of the same form as `Google::Cloud::Recaptchaenterprise::V1beta1::Assessment`
300
- # can also be provided.
301
- # @param options [Google::Gax::CallOptions]
302
- # Overrides the default settings for this call, e.g, timeout,
303
- # retries, etc.
304
- # @yield [result, operation] Access the result along with the RPC operation
305
- # @yieldparam result [Google::Cloud::Recaptchaenterprise::V1beta1::Assessment]
306
- # @yieldparam operation [GRPC::ActiveCall::Operation]
307
- # @return [Google::Cloud::Recaptchaenterprise::V1beta1::Assessment]
308
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
309
- # @example
310
- # require "google/cloud/recaptcha_enterprise"
311
- #
312
- # recaptcha_enterprise_client = Google::Cloud::RecaptchaEnterprise.new(version: :v1beta1)
313
- # formatted_parent = Google::Cloud::RecaptchaEnterprise::V1beta1::RecaptchaEnterpriseClient.project_path("[PROJECT]")
314
- #
315
- # # TODO: Initialize `assessment`:
316
- # assessment = {}
317
- # response = recaptcha_enterprise_client.create_assessment(formatted_parent, assessment)
318
-
319
- def create_assessment \
320
- parent,
321
- assessment,
322
- options: nil,
323
- &block
324
- req = {
325
- parent: parent,
326
- assessment: assessment
327
- }.delete_if { |_, v| v.nil? }
328
- req = Google::Gax::to_proto(req, Google::Cloud::Recaptchaenterprise::V1beta1::CreateAssessmentRequest)
329
- @create_assessment.call(req, options, &block)
330
- end
331
-
332
- # Annotates a previously created Assessment to provide additional information
333
- # on whether the event turned out to be authentic or fradulent.
334
- #
335
- # @param name [String]
336
- # Required. The resource name of the Assessment, in the format
337
- # "projects/\\{project_number}/assessments/\\{assessment_id}".
338
- # @param annotation [Google::Cloud::Recaptchaenterprise::V1beta1::AnnotateAssessmentRequest::Annotation]
339
- # Required. The annotation that will be assigned to the Event.
340
- # @param options [Google::Gax::CallOptions]
341
- # Overrides the default settings for this call, e.g, timeout,
342
- # retries, etc.
343
- # @yield [result, operation] Access the result along with the RPC operation
344
- # @yieldparam result [Google::Cloud::Recaptchaenterprise::V1beta1::AnnotateAssessmentResponse]
345
- # @yieldparam operation [GRPC::ActiveCall::Operation]
346
- # @return [Google::Cloud::Recaptchaenterprise::V1beta1::AnnotateAssessmentResponse]
347
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
348
- # @example
349
- # require "google/cloud/recaptcha_enterprise"
350
- #
351
- # recaptcha_enterprise_client = Google::Cloud::RecaptchaEnterprise.new(version: :v1beta1)
352
- # formatted_name = Google::Cloud::RecaptchaEnterprise::V1beta1::RecaptchaEnterpriseClient.assessment_path("[PROJECT]", "[ASSESSMENT]")
353
- #
354
- # # TODO: Initialize `annotation`:
355
- # annotation = :ANNOTATION_UNSPECIFIED
356
- # response = recaptcha_enterprise_client.annotate_assessment(formatted_name, annotation)
357
-
358
- def annotate_assessment \
359
- name,
360
- annotation,
361
- options: nil,
362
- &block
363
- req = {
364
- name: name,
365
- annotation: annotation
366
- }.delete_if { |_, v| v.nil? }
367
- req = Google::Gax::to_proto(req, Google::Cloud::Recaptchaenterprise::V1beta1::AnnotateAssessmentRequest)
368
- @annotate_assessment.call(req, options, &block)
369
- end
370
-
371
- # Creates a new reCAPTCHA Enterprise key.
372
- #
373
- # @param parent [String]
374
- # Required. The name of the project in which the key will be created, in the
375
- # format "projects/\\{project_number}".
376
- # @param key [Google::Cloud::Recaptchaenterprise::V1beta1::Key | Hash]
377
- # Required. Information to create a reCAPTCHA Enterprise key.
378
- # A hash of the same form as `Google::Cloud::Recaptchaenterprise::V1beta1::Key`
379
- # can also be provided.
380
- # @param options [Google::Gax::CallOptions]
381
- # Overrides the default settings for this call, e.g, timeout,
382
- # retries, etc.
383
- # @yield [result, operation] Access the result along with the RPC operation
384
- # @yieldparam result [Google::Cloud::Recaptchaenterprise::V1beta1::Key]
385
- # @yieldparam operation [GRPC::ActiveCall::Operation]
386
- # @return [Google::Cloud::Recaptchaenterprise::V1beta1::Key]
387
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
388
- # @example
389
- # require "google/cloud/recaptcha_enterprise"
390
- #
391
- # recaptcha_enterprise_client = Google::Cloud::RecaptchaEnterprise.new(version: :v1beta1)
392
- # formatted_parent = Google::Cloud::RecaptchaEnterprise::V1beta1::RecaptchaEnterpriseClient.project_path("[PROJECT]")
393
- #
394
- # # TODO: Initialize `key`:
395
- # key = {}
396
- # response = recaptcha_enterprise_client.create_key(formatted_parent, key)
397
-
398
- def create_key \
399
- parent,
400
- key,
401
- options: nil,
402
- &block
403
- req = {
404
- parent: parent,
405
- key: key
406
- }.delete_if { |_, v| v.nil? }
407
- req = Google::Gax::to_proto(req, Google::Cloud::Recaptchaenterprise::V1beta1::CreateKeyRequest)
408
- @create_key.call(req, options, &block)
409
- end
410
-
411
- # Returns the list of all keys that belong to a project.
412
- #
413
- # @param parent [String]
414
- # Required. The name of the project that contains the keys that will be
415
- # listed, in the format "projects/\\{project_number}".
416
- # @param page_size [Integer]
417
- # The maximum number of resources contained in the underlying API
418
- # response. If page streaming is performed per-resource, this
419
- # parameter does not affect the return value. If page streaming is
420
- # performed per-page, this determines the maximum number of
421
- # resources in a page.
422
- # @param options [Google::Gax::CallOptions]
423
- # Overrides the default settings for this call, e.g, timeout,
424
- # retries, etc.
425
- # @yield [result, operation] Access the result along with the RPC operation
426
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Recaptchaenterprise::V1beta1::Key>]
427
- # @yieldparam operation [GRPC::ActiveCall::Operation]
428
- # @return [Google::Gax::PagedEnumerable<Google::Cloud::Recaptchaenterprise::V1beta1::Key>]
429
- # An enumerable of Google::Cloud::Recaptchaenterprise::V1beta1::Key instances.
430
- # See Google::Gax::PagedEnumerable documentation for other
431
- # operations such as per-page iteration or access to the response
432
- # object.
433
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
434
- # @example
435
- # require "google/cloud/recaptcha_enterprise"
436
- #
437
- # recaptcha_enterprise_client = Google::Cloud::RecaptchaEnterprise.new(version: :v1beta1)
438
- # formatted_parent = Google::Cloud::RecaptchaEnterprise::V1beta1::RecaptchaEnterpriseClient.project_path("[PROJECT]")
439
- #
440
- # # Iterate over all results.
441
- # recaptcha_enterprise_client.list_keys(formatted_parent).each do |element|
442
- # # Process element.
443
- # end
444
- #
445
- # # Or iterate over results one page at a time.
446
- # recaptcha_enterprise_client.list_keys(formatted_parent).each_page do |page|
447
- # # Process each page at a time.
448
- # page.each do |element|
449
- # # Process element.
450
- # end
451
- # end
452
-
453
- def list_keys \
454
- parent,
455
- page_size: nil,
456
- options: nil,
457
- &block
458
- req = {
459
- parent: parent,
460
- page_size: page_size
461
- }.delete_if { |_, v| v.nil? }
462
- req = Google::Gax::to_proto(req, Google::Cloud::Recaptchaenterprise::V1beta1::ListKeysRequest)
463
- @list_keys.call(req, options, &block)
464
- end
465
-
466
- # Returns the specified key.
467
- #
468
- # @param name [String]
469
- # Required. The name of the requested key, in the format
470
- # "projects/\\{project_number}/keys/\\{key_id}".
471
- # @param options [Google::Gax::CallOptions]
472
- # Overrides the default settings for this call, e.g, timeout,
473
- # retries, etc.
474
- # @yield [result, operation] Access the result along with the RPC operation
475
- # @yieldparam result [Google::Cloud::Recaptchaenterprise::V1beta1::Key]
476
- # @yieldparam operation [GRPC::ActiveCall::Operation]
477
- # @return [Google::Cloud::Recaptchaenterprise::V1beta1::Key]
478
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
479
- # @example
480
- # require "google/cloud/recaptcha_enterprise"
481
- #
482
- # recaptcha_enterprise_client = Google::Cloud::RecaptchaEnterprise.new(version: :v1beta1)
483
- # formatted_name = Google::Cloud::RecaptchaEnterprise::V1beta1::RecaptchaEnterpriseClient.key_path("[PROJECT]", "[KEY]")
484
- # response = recaptcha_enterprise_client.get_key(formatted_name)
485
-
486
- def get_key \
487
- name,
488
- options: nil,
489
- &block
490
- req = {
491
- name: name
492
- }.delete_if { |_, v| v.nil? }
493
- req = Google::Gax::to_proto(req, Google::Cloud::Recaptchaenterprise::V1beta1::GetKeyRequest)
494
- @get_key.call(req, options, &block)
495
- end
496
-
497
- # Updates the specified key.
498
- #
499
- # @param key [Google::Cloud::Recaptchaenterprise::V1beta1::Key | Hash]
500
- # Required. The key to update.
501
- # A hash of the same form as `Google::Cloud::Recaptchaenterprise::V1beta1::Key`
502
- # can also be provided.
503
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
504
- # Optional. The mask to control which field of the key get updated. If the mask is not
505
- # present, all fields will be updated.
506
- # A hash of the same form as `Google::Protobuf::FieldMask`
507
- # can also be provided.
508
- # @param options [Google::Gax::CallOptions]
509
- # Overrides the default settings for this call, e.g, timeout,
510
- # retries, etc.
511
- # @yield [result, operation] Access the result along with the RPC operation
512
- # @yieldparam result [Google::Cloud::Recaptchaenterprise::V1beta1::Key]
513
- # @yieldparam operation [GRPC::ActiveCall::Operation]
514
- # @return [Google::Cloud::Recaptchaenterprise::V1beta1::Key]
515
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
516
- # @example
517
- # require "google/cloud/recaptcha_enterprise"
518
- #
519
- # recaptcha_enterprise_client = Google::Cloud::RecaptchaEnterprise.new(version: :v1beta1)
520
- #
521
- # # TODO: Initialize `key`:
522
- # key = {}
523
- # response = recaptcha_enterprise_client.update_key(key)
524
-
525
- def update_key \
526
- key,
527
- update_mask: nil,
528
- options: nil,
529
- &block
530
- req = {
531
- key: key,
532
- update_mask: update_mask
533
- }.delete_if { |_, v| v.nil? }
534
- req = Google::Gax::to_proto(req, Google::Cloud::Recaptchaenterprise::V1beta1::UpdateKeyRequest)
535
- @update_key.call(req, options, &block)
536
- end
537
-
538
- # Deletes the specified key.
539
- #
540
- # @param name [String]
541
- # Required. The name of the key to be deleted, in the format
542
- # "projects/\\{project_number}/keys/\\{key_id}".
543
- # @param options [Google::Gax::CallOptions]
544
- # Overrides the default settings for this call, e.g, timeout,
545
- # retries, etc.
546
- # @yield [result, operation] Access the result along with the RPC operation
547
- # @yieldparam result []
548
- # @yieldparam operation [GRPC::ActiveCall::Operation]
549
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
550
- # @example
551
- # require "google/cloud/recaptcha_enterprise"
552
- #
553
- # recaptcha_enterprise_client = Google::Cloud::RecaptchaEnterprise.new(version: :v1beta1)
554
- # formatted_name = Google::Cloud::RecaptchaEnterprise::V1beta1::RecaptchaEnterpriseClient.key_path("[PROJECT]", "[KEY]")
555
- # recaptcha_enterprise_client.delete_key(formatted_name)
556
-
557
- def delete_key \
558
- name,
559
- options: nil,
560
- &block
561
- req = {
562
- name: name
563
- }.delete_if { |_, v| v.nil? }
564
- req = Google::Gax::to_proto(req, Google::Cloud::Recaptchaenterprise::V1beta1::DeleteKeyRequest)
565
- @delete_key.call(req, options, &block)
566
- nil
567
- end
568
- end
569
- end
570
- end
571
- end
572
- end