google-cloud-recaptcha_enterprise-v1 0.5.0 → 0.22.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 +4 -4
- data/.yardopts +1 -1
- data/AUTHENTICATION.md +71 -118
- data/README.md +14 -9
- data/lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/client.rb +1414 -167
- data/lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service/paths.rb +34 -0
- data/lib/google/cloud/recaptcha_enterprise/v1/recaptcha_enterprise_service.rb +1 -1
- data/lib/google/cloud/recaptcha_enterprise/v1/version.rb +1 -1
- data/lib/google/cloud/recaptcha_enterprise/v1.rb +3 -1
- data/lib/google/cloud/recaptchaenterprise/v1/recaptchaenterprise_pb.rb +88 -166
- data/lib/google/cloud/recaptchaenterprise/v1/recaptchaenterprise_services_pb.rb +26 -2
- data/proto_docs/google/api/client.rb +399 -0
- data/proto_docs/google/api/field_behavior.rb +14 -0
- data/proto_docs/google/api/field_info.rb +65 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/api/resource.rb +10 -71
- data/proto_docs/google/cloud/recaptchaenterprise/v1/recaptchaenterprise.rb +1349 -79
- data/proto_docs/google/protobuf/any.rb +145 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/empty.rb +0 -2
- data/proto_docs/google/protobuf/timestamp.rb +1 -3
- data/proto_docs/google/rpc/status.rb +48 -0
- metadata +14 -119
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f6d1bff622942a5067024e21f6c2e05db86436c69d3b3460168b20dc95622ba1
|
|
4
|
+
data.tar.gz: ee7be24b42ec1a9662d304378364feebacbc31c6c03083d4e61a53278ef46c46
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 67e9d04089631269dd3b94e8d88a79ab2739359ff999cf5729d5279303b6da1a3f114c2b9d42058f918747f128a1d1a734ad978103bab352b548d46f1ee657c1
|
|
7
|
+
data.tar.gz: c1c277f6c8e883932c4914fd6443fda4490370d6dfdb94c970ec539a78f6c830213fd56dac3fc9be5afdcb279c24afd9cc5be672b7311b40cd3613eed135eb0d
|
data/.yardopts
CHANGED
data/AUTHENTICATION.md
CHANGED
|
@@ -1,169 +1,122 @@
|
|
|
1
1
|
# Authentication
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[
|
|
5
|
-
|
|
6
|
-
[Google Cloud Platform environments](#google-cloud-platform-environments) the
|
|
7
|
-
credentials will be discovered automatically. When running on other
|
|
8
|
-
environments, the Service Account credentials can be specified by providing the
|
|
9
|
-
path to the
|
|
10
|
-
[JSON keyfile](https://cloud.google.com/iam/docs/managing-service-account-keys)
|
|
11
|
-
for the account (or the JSON itself) in
|
|
12
|
-
[environment variables](#environment-variables). Additionally, Cloud SDK
|
|
13
|
-
credentials can also be discovered automatically, but this is only recommended
|
|
14
|
-
during development.
|
|
3
|
+
The recommended way to authenticate to the google-cloud-recaptcha_enterprise-v1 library is to use
|
|
4
|
+
[Application Default Credentials (ADC)](https://cloud.google.com/docs/authentication/application-default-credentials).
|
|
5
|
+
To review all of your authentication options, see [Credentials lookup](#credential-lookup).
|
|
15
6
|
|
|
16
7
|
## Quickstart
|
|
17
8
|
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
The following example shows how to set up authentication for a local development
|
|
10
|
+
environment with your user credentials.
|
|
20
11
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
3. Initialize the client.
|
|
12
|
+
**NOTE:** This method is _not_ recommended for running in production. User credentials
|
|
13
|
+
should be used only during development.
|
|
26
14
|
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
1. [Download and install the Google Cloud CLI](https://cloud.google.com/sdk).
|
|
16
|
+
2. Set up a local ADC file with your user credentials:
|
|
29
17
|
|
|
30
|
-
|
|
18
|
+
```sh
|
|
19
|
+
gcloud auth application-default login
|
|
31
20
|
```
|
|
32
21
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
The google-cloud-recaptcha_enterprise-v1 library aims to make authentication
|
|
36
|
-
as simple as possible, and provides several mechanisms to configure your system
|
|
37
|
-
without requiring **Service Account Credentials** directly in code.
|
|
38
|
-
|
|
39
|
-
**Credentials** are discovered in the following order:
|
|
40
|
-
|
|
41
|
-
1. Specify credentials in method arguments
|
|
42
|
-
2. Specify credentials in configuration
|
|
43
|
-
3. Discover credentials path in environment variables
|
|
44
|
-
4. Discover credentials JSON in environment variables
|
|
45
|
-
5. Discover credentials file in the Cloud SDK's path
|
|
46
|
-
6. Discover GCP credentials
|
|
47
|
-
|
|
48
|
-
### Google Cloud Platform environments
|
|
49
|
-
|
|
50
|
-
When running on Google Cloud Platform (GCP), including Google Compute Engine
|
|
51
|
-
(GCE), Google Kubernetes Engine (GKE), Google App Engine (GAE), Google Cloud
|
|
52
|
-
Functions (GCF) and Cloud Run, **Credentials** are discovered automatically.
|
|
53
|
-
Code should be written as if already authenticated.
|
|
22
|
+
3. Write code as if already authenticated.
|
|
54
23
|
|
|
55
|
-
|
|
24
|
+
For more information about setting up authentication for a local development environment, see
|
|
25
|
+
[Set up Application Default Credentials](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-dev).
|
|
56
26
|
|
|
57
|
-
|
|
58
|
-
declaring them directly in code. Each service has its own environment variable,
|
|
59
|
-
allowing for different service accounts to be used for different services. (See
|
|
60
|
-
the READMEs for the individual service gems for details.) The path to the
|
|
61
|
-
**Credentials JSON** file can be stored in the environment variable, or the
|
|
62
|
-
**Credentials JSON** itself can be stored for environments such as Docker
|
|
63
|
-
containers where writing files is difficult or not encouraged.
|
|
27
|
+
## Credential Lookup
|
|
64
28
|
|
|
65
|
-
The
|
|
66
|
-
|
|
67
|
-
|
|
29
|
+
The google-cloud-recaptcha_enterprise-v1 library provides several mechanisms to configure your system.
|
|
30
|
+
Generally, using Application Default Credentials to facilitate automatic
|
|
31
|
+
credentials discovery is the easist method. But if you need to explicitly specify
|
|
32
|
+
credentials, there are several methods available to you.
|
|
68
33
|
|
|
69
|
-
|
|
70
|
-
* `RECAPTCHA_ENTERPRISE_KEYFILE` - Path to JSON file, or JSON contents
|
|
71
|
-
* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents
|
|
72
|
-
* `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents
|
|
73
|
-
* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file
|
|
34
|
+
Credentials are accepted in the following ways, in the following order or precedence:
|
|
74
35
|
|
|
75
|
-
|
|
76
|
-
|
|
36
|
+
1. Credentials specified in method arguments
|
|
37
|
+
2. Credentials specified in configuration
|
|
38
|
+
3. Credentials pointed to or included in environment variables
|
|
39
|
+
4. Credentials found in local ADC file
|
|
40
|
+
5. Credentials returned by the metadata server for the attached service account (GCP)
|
|
77
41
|
|
|
78
|
-
|
|
42
|
+
### Configuration
|
|
79
43
|
|
|
80
|
-
client
|
|
81
|
-
|
|
44
|
+
You can configure a path to a JSON credentials file, either for an individual client object or
|
|
45
|
+
globally, for all client objects. The JSON file can contain credentials created for
|
|
46
|
+
[workload identity federation](https://cloud.google.com/iam/docs/workload-identity-federation),
|
|
47
|
+
[workforce identity federation](https://cloud.google.com/iam/docs/workforce-identity-federation), or a
|
|
48
|
+
[service account key](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-key).
|
|
82
49
|
|
|
83
|
-
|
|
50
|
+
Note: Service account keys are a security risk if not managed correctly. You should
|
|
51
|
+
[choose a more secure alternative to service account keys](https://cloud.google.com/docs/authentication#auth-decision-tree)
|
|
52
|
+
whenever possible.
|
|
84
53
|
|
|
85
|
-
|
|
86
|
-
it in an environment variable. Either on an individual client initialization:
|
|
54
|
+
To configure a credentials file for an individual client initialization:
|
|
87
55
|
|
|
88
56
|
```ruby
|
|
89
57
|
require "google/cloud/recaptcha_enterprise/v1"
|
|
90
58
|
|
|
91
59
|
client = ::Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new do |config|
|
|
92
|
-
config.credentials = "path/to/
|
|
60
|
+
config.credentials = "path/to/credentialfile.json"
|
|
93
61
|
end
|
|
94
62
|
```
|
|
95
63
|
|
|
96
|
-
|
|
64
|
+
To configure a credentials file globally for all clients:
|
|
97
65
|
|
|
98
66
|
```ruby
|
|
99
67
|
require "google/cloud/recaptcha_enterprise/v1"
|
|
100
68
|
|
|
101
69
|
::Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.configure do |config|
|
|
102
|
-
config.credentials = "path/to/
|
|
70
|
+
config.credentials = "path/to/credentialfile.json"
|
|
103
71
|
end
|
|
104
72
|
|
|
105
73
|
client = ::Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new
|
|
106
74
|
```
|
|
107
75
|
|
|
108
|
-
###
|
|
109
|
-
|
|
110
|
-
This option allows for an easy way to authenticate during development. If
|
|
111
|
-
credentials are not provided in code or in environment variables, then Cloud SDK
|
|
112
|
-
credentials are discovered.
|
|
113
|
-
|
|
114
|
-
To configure your system for this, simply:
|
|
115
|
-
|
|
116
|
-
1. [Download and install the Cloud SDK](https://cloud.google.com/sdk)
|
|
117
|
-
2. Authenticate using OAuth 2.0 `$ gcloud auth login`
|
|
118
|
-
3. Write code as if already authenticated.
|
|
119
|
-
|
|
120
|
-
**NOTE:** This is _not_ recommended for running in production. The Cloud SDK
|
|
121
|
-
*should* only be used during development.
|
|
122
|
-
|
|
123
|
-
[gce-how-to]: https://cloud.google.com/compute/docs/authentication#using
|
|
124
|
-
[dev-console]: https://console.cloud.google.com/project
|
|
125
|
-
|
|
126
|
-
[enable-apis]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/enable-apis.png
|
|
127
|
-
|
|
128
|
-
[create-new-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account.png
|
|
129
|
-
[create-new-service-account-existing-keys]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account-existing-keys.png
|
|
130
|
-
[reuse-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/reuse-service-account.png
|
|
76
|
+
### Environment Variables
|
|
131
77
|
|
|
132
|
-
|
|
78
|
+
You can also use an environment variable to provide a JSON credentials file.
|
|
79
|
+
The environment variable can contain a path to the credentials file or, for
|
|
80
|
+
environments such as Docker containers where writing files is not encouraged,
|
|
81
|
+
you can include the credentials file itself.
|
|
133
82
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
83
|
+
The JSON file can contain credentials created for
|
|
84
|
+
[workload identity federation](https://cloud.google.com/iam/docs/workload-identity-federation),
|
|
85
|
+
[workforce identity federation](https://cloud.google.com/iam/docs/workforce-identity-federation), or a
|
|
86
|
+
[service account key](https://cloud.google.com/docs/authentication/provide-credentials-adc#local-key).
|
|
137
87
|
|
|
138
|
-
|
|
139
|
-
[
|
|
140
|
-
|
|
88
|
+
Note: Service account keys are a security risk if not managed correctly. You should
|
|
89
|
+
[choose a more secure alternative to service account keys](https://cloud.google.com/docs/authentication#auth-decision-tree)
|
|
90
|
+
whenever possible.
|
|
141
91
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
3. Activate the slide-out navigation tray and select **API Manager**. From
|
|
145
|
-
here, you will enable the APIs that your application requires.
|
|
92
|
+
The environment variables that google-cloud-recaptcha_enterprise-v1
|
|
93
|
+
checks for credentials are:
|
|
146
94
|
|
|
147
|
-
|
|
95
|
+
* `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents
|
|
96
|
+
* `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file
|
|
148
97
|
|
|
149
|
-
|
|
98
|
+
```ruby
|
|
99
|
+
require "google/cloud/recaptcha_enterprise/v1"
|
|
150
100
|
|
|
151
|
-
|
|
101
|
+
ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "path/to/credentialfile.json"
|
|
152
102
|
|
|
153
|
-
|
|
103
|
+
client = ::Google::Cloud::RecaptchaEnterprise::V1::RecaptchaEnterpriseService::Client.new
|
|
104
|
+
```
|
|
154
105
|
|
|
155
|
-
|
|
106
|
+
### Local ADC file
|
|
156
107
|
|
|
157
|
-
|
|
108
|
+
You can set up a local ADC file with your user credentials for authentication during
|
|
109
|
+
development. If credentials are not provided in code or in environment variables,
|
|
110
|
+
then the local ADC credentials are discovered.
|
|
158
111
|
|
|
159
|
-
|
|
160
|
-
guided through downloading a new JSON key file.
|
|
112
|
+
Follow the steps in [Quickstart](#quickstart) to set up a local ADC file.
|
|
161
113
|
|
|
162
|
-
|
|
163
|
-
new key file. Just select the account you wish to re-use, and click "Generate
|
|
164
|
-
new JSON key":
|
|
114
|
+
### Google Cloud Platform environments
|
|
165
115
|
|
|
166
|
-
|
|
116
|
+
When running on Google Cloud Platform (GCP), including Google Compute Engine
|
|
117
|
+
(GCE), Google Kubernetes Engine (GKE), Google App Engine (GAE), Google Cloud
|
|
118
|
+
Functions (GCF) and Cloud Run, credentials are retrieved from the attached
|
|
119
|
+
service account automatically. Code should be written as if already authenticated.
|
|
167
120
|
|
|
168
|
-
|
|
169
|
-
|
|
121
|
+
For more information, see
|
|
122
|
+
[Set up ADC for Google Cloud services](https://cloud.google.com/docs/authentication/provide-credentials-adc#attached-sa).
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Ruby Client for the reCAPTCHA Enterprise V1 API
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Help protect your website from fraudulent activity, spam, and abuse without creating friction.
|
|
4
4
|
|
|
5
5
|
reCAPTCHA Enterprise is a service that protects your site from spam and abuse.
|
|
6
6
|
|
|
@@ -37,7 +37,7 @@ request = ::Google::Cloud::RecaptchaEnterprise::V1::CreateAssessmentRequest.new
|
|
|
37
37
|
response = client.create_assessment request
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
View the [Client Library Documentation](https://
|
|
40
|
+
View the [Client Library Documentation](https://cloud.google.com/ruby/docs/reference/google-cloud-recaptcha_enterprise-v1/latest)
|
|
41
41
|
for class and method documentation.
|
|
42
42
|
|
|
43
43
|
See also the [Product Documentation](https://cloud.google.com/recaptcha-enterprise)
|
|
@@ -46,8 +46,8 @@ for general usage information.
|
|
|
46
46
|
## Enabling Logging
|
|
47
47
|
|
|
48
48
|
To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
|
49
|
-
The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/
|
|
50
|
-
or a [`Google::Cloud::Logging::Logger`](https://
|
|
49
|
+
The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
|
|
50
|
+
or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
|
|
51
51
|
that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
|
52
52
|
and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
|
53
53
|
|
|
@@ -69,16 +69,21 @@ module GRPC
|
|
|
69
69
|
end
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
+
|
|
73
|
+
## Google Cloud Samples
|
|
74
|
+
|
|
75
|
+
To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
|
|
76
|
+
|
|
72
77
|
## Supported Ruby Versions
|
|
73
78
|
|
|
74
|
-
This library is supported on Ruby 2.
|
|
79
|
+
This library is supported on Ruby 2.7+.
|
|
75
80
|
|
|
76
81
|
Google provides official support for Ruby versions that are actively supported
|
|
77
82
|
by Ruby Core—that is, Ruby versions that are either in normal maintenance or
|
|
78
|
-
in security maintenance, and not end of life.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
83
|
+
in security maintenance, and not end of life. Older versions of Ruby _may_
|
|
84
|
+
still work, but are unsupported and not recommended. See
|
|
85
|
+
https://www.ruby-lang.org/en/downloads/branches/ for details about the Ruby
|
|
86
|
+
support schedule.
|
|
82
87
|
|
|
83
88
|
## Which client should I use?
|
|
84
89
|
|