Skip to content
This repository was archived by the owner on Jul 13, 2023. It is now read-only.

Commit b216630

Browse files
yoshi-automationJustinBeckwith
authored andcommitted
feat: update scopes and classifications (#60)
1 parent 0786044 commit b216630

File tree

7 files changed

+16733
-63
lines changed

7 files changed

+16733
-63
lines changed

protos/google/cloud/recaptchaenterprise/v1beta1/recaptchaenterprise.proto

Lines changed: 54 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ syntax = "proto3";
1818
package google.cloud.recaptchaenterprise.v1beta1;
1919

2020
import "google/api/annotations.proto";
21+
import "google/api/client.proto";
22+
import "google/api/field_behavior.proto";
23+
import "google/api/resource.proto";
2124
import "google/protobuf/timestamp.proto";
2225

2326
option csharp_namespace = "Google.Cloud.RecaptchaEnterprise.V1Beta1";
@@ -28,15 +31,18 @@ option java_package = "com.google.recaptchaenterprise.v1beta1";
2831
option objc_class_prefix = "GCRE";
2932
option php_namespace = "Google\\Cloud\\RecaptchaEnterprise\\V1beta1";
3033

31-
3234
// Service to determine the likelihood an event is legitimate.
3335
service RecaptchaEnterpriseServiceV1Beta1 {
36+
option (google.api.default_host) = "recaptchaenterprise.googleapis.com";
37+
option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
38+
3439
// Creates an Assessment of the likelihood an event is legitimate.
3540
rpc CreateAssessment(CreateAssessmentRequest) returns (Assessment) {
3641
option (google.api.http) = {
3742
post: "/v1beta1/{parent=projects/*}/assessments"
3843
body: "assessment"
3944
};
45+
option (google.api.method_signature) = "parent,assessment";
4046
}
4147

4248
// Annotates a previously created Assessment to provide additional information
@@ -46,17 +52,23 @@ service RecaptchaEnterpriseServiceV1Beta1 {
4652
post: "/v1beta1/{name=projects/*/assessments/*}:annotate"
4753
body: "*"
4854
};
55+
option (google.api.method_signature) = "name,annotation";
4956
}
5057
}
5158

5259
// The create assessment request message.
5360
message CreateAssessmentRequest {
5461
// Required. The name of the project in which the assessment will be created,
5562
// in the format "projects/{project_number}".
56-
string parent = 1;
57-
58-
// The asessment details.
59-
Assessment assessment = 2;
63+
string parent = 1 [
64+
(google.api.field_behavior) = REQUIRED,
65+
(google.api.resource_reference) = {
66+
type: "cloudresourcemanager.googleapis.com/Project"
67+
}
68+
];
69+
70+
// Required. The assessment details.
71+
Assessment assessment = 2 [(google.api.field_behavior) = REQUIRED];
6072
}
6173

6274
// The request message to annotate an Assessment.
@@ -75,10 +87,15 @@ message AnnotateAssessmentRequest {
7587

7688
// Required. The resource name of the Assessment, in the format
7789
// "projects/{project_number}/assessments/{assessment_id}".
78-
string name = 1;
79-
80-
// The annotation that will be assigned to the Event.
81-
Annotation annotation = 2;
90+
string name = 1 [
91+
(google.api.field_behavior) = REQUIRED,
92+
(google.api.resource_reference) = {
93+
type: "recaptchaenterprise.googleapis.com/Assessment"
94+
}
95+
];
96+
97+
// Required. The annotation that will be assigned to the Event.
98+
Annotation annotation = 2 [(google.api.field_behavior) = REQUIRED];
8299
}
83100

84101
// Empty response for AnnotateAssessment.
@@ -88,57 +105,66 @@ message AnnotateAssessmentResponse {
88105

89106
// A recaptcha assessment resource.
90107
message Assessment {
108+
option (google.api.resource) = {
109+
type: "recaptchaenterprise.googleapis.com/Assessment"
110+
pattern: "projects/{project}/assessments/{assessment}"
111+
};
112+
91113
// LINT.IfChange(classification_reason)
92114
// Reasons contributing to the risk analysis verdict.
93115
enum ClassificationReason {
94116
// Default unspecified type.
95117
CLASSIFICATION_REASON_UNSPECIFIED = 0;
96118

97-
// The event appeared to be automated.
119+
// Interactions matched the behavior of an automated agent.
98120
AUTOMATION = 1;
99121

100-
// The event was not made from the proper context on the real site.
122+
// The event originated from an illegitimate environment.
101123
UNEXPECTED_ENVIRONMENT = 2;
102124

103-
// Browsing behavior leading up to the event was generated was out of the
104-
// ordinary.
125+
// Traffic volume from the event source is higher than normal.
126+
TOO_MUCH_TRAFFIC = 3;
127+
128+
// Interactions with the site were significantly different than expected
129+
// patterns.
105130
UNEXPECTED_USAGE_PATTERNS = 4;
106131

107132
// Too little traffic has been received from this site thus far to generate
108133
// quality risk analysis.
109-
PROVISIONAL_RISK_ANALYSIS = 5;
134+
LOW_CONFIDENCE_SCORE = 5;
110135
}
111136

112137
// Output only. The resource name for the Assessment in the format
113138
// "projects/{project_number}/assessments/{assessment_id}".
114-
string name = 1;
139+
string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
115140

116141
// The event being assessed.
117142
Event event = 2;
118143

119144
// Output only. Legitimate event score from 0.0 to 1.0.
120145
// (1.0 means very likely legitimate traffic while 0.0 means very likely
121146
// non-legitimate traffic).
122-
float score = 3;
147+
float score = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
123148

124149
// Output only. Properties of the provided event token.
125-
TokenProperties token_properties = 4;
150+
TokenProperties token_properties = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
126151

127152
// Output only. Reasons contributing to the risk analysis verdict.
128-
repeated ClassificationReason reasons = 5;
153+
repeated ClassificationReason reasons = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
129154
}
130155

131156
message Event {
132-
// The user response token provided by the reCAPTCHA client-side integration
157+
// Required. The user response token provided by the reCAPTCHA client-side integration
133158
// on your site.
134-
string token = 1;
159+
string token = 1 [(google.api.field_behavior) = REQUIRED];
135160

136-
// The site key that was used to invoke reCAPTCHA on your site and generate
161+
// Required. The site key that was used to invoke reCAPTCHA on your site and generate
137162
// the token.
138-
string site_key = 2;
163+
string site_key = 2 [(google.api.field_behavior) = REQUIRED];
139164
}
140165

141166
message TokenProperties {
167+
// LINT.IfChange
142168
// Enum that represents the types of invalid token reasons.
143169
enum InvalidReason {
144170
// Default unspecified type.
@@ -156,7 +182,7 @@ message TokenProperties {
156182
// The user verification had already been seen.
157183
DUPE = 4;
158184

159-
// The user verification token did not match the provided site secret.
185+
// The user verification token did not match the provided site key.
160186
// This may be a configuration error (e.g. development keys used in
161187
// production) or end users trying to use verification tokens from other
162188
// sites.
@@ -166,18 +192,18 @@ message TokenProperties {
166192
MISSING = 6;
167193
}
168194

169-
// Output only. Whether the provided user response token is valid.
195+
// Whether the provided user response token is valid.
170196
bool valid = 1;
171197

172-
// Output only. Reason associated with the response when valid = false.
198+
// Reason associated with the response when valid = false.
173199
InvalidReason invalid_reason = 2;
174200

175-
// Output only. The timestamp corresponding to the generation of the token.
201+
// The timestamp corresponding to the generation of the token.
176202
google.protobuf.Timestamp create_time = 3;
177203

178-
// Output only. The hostname of the page on which the token was generated.
204+
// The hostname of the page on which the token was generated.
179205
string hostname = 4;
180206

181-
// Output only. Action name provided at token generation.
207+
// Action name provided at token generation.
182208
string action = 5;
183209
}

0 commit comments

Comments
 (0)