Skip to content

Commit 810074f

Browse files
Google APIscopybara-github
authored andcommitted
Synchronize new proto/yaml changes.
PiperOrigin-RevId: 397872721
1 parent 835a0e0 commit 810074f

5 files changed

Lines changed: 1016 additions & 0 deletions

File tree

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
// Copyright 2021 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+
// http://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+
syntax = "proto3";
16+
17+
package google.example.showcase.v1;
18+
19+
import "google/api/annotations.proto";
20+
import "google/api/client.proto";
21+
22+
option go_package = "github.com/googleapis/gapic-showcase/server/genproto";
23+
option java_multiple_files = true;
24+
option java_outer_classname = "ComplicanceProto";
25+
option java_package = "com.google.example.showcase.v1";
26+
27+
// This service is used to test that GAPICs can transcode proto3 requests to
28+
// REST format correctly for various types of HTTP annotations....
29+
service Compliance {
30+
option (google.api.default_host) = "showcase.googleapis.com";
31+
32+
// This method echoes the ComplianceData request. This method exercises
33+
// sending the entire request object in the REST body.
34+
rpc RepeatDataBody(RepeatRequest) returns (RepeatResponse) {
35+
option (google.api.http) = {
36+
post: "/v1/repeat:body"
37+
body: "*"
38+
};
39+
}
40+
41+
// This method echoes the ComplianceData request. This method exercises
42+
// sending the a message-type field in the REST body. Per AIP-127, only
43+
// top-level, non-repeated fields can be sent this way.
44+
rpc RepeatDataBodyInfo(RepeatRequest) returns (RepeatResponse) {
45+
option (google.api.http) = {
46+
post: "/v1/repeat:bodyinfo"
47+
body: "info"
48+
};
49+
}
50+
51+
// This method echoes the ComplianceData request. This method exercises
52+
// sending all request fields as query parameters.
53+
rpc RepeatDataQuery(RepeatRequest) returns (RepeatResponse) {
54+
option (google.api.http) = {
55+
get: "/v1/repeat:query"
56+
};
57+
}
58+
59+
// This method echoes the ComplianceData request. This method exercises
60+
// sending some parameters as "simple" path variables (i.e., of the form
61+
// "/bar/{foo}" rather than "/{foo=bar/*}"), and the rest as query parameters.
62+
rpc RepeatDataSimplePath(RepeatRequest) returns (RepeatResponse) {
63+
option (google.api.http) = {
64+
get: "/v1/repeat/{info.f_string}/{info.f_int32}/{info.f_double}/{info.f_bool}:simplepath"
65+
};
66+
}
67+
68+
// Same as RepeatDataSimplePath, but with a path resource.
69+
rpc RepeatDataPathResource(RepeatRequest) returns (RepeatResponse) {
70+
option (google.api.http) = {
71+
get: "/v1/repeat/{info.f_string=first/*}/{info.f_child.f_string=second/*}/bool/{info.f_bool}:pathresource"
72+
};
73+
}
74+
75+
// Same as RepeatDataSimplePath, but with a trailing resource.
76+
rpc RepeatDataPathTrailingResource(RepeatRequest) returns (RepeatResponse) {
77+
option (google.api.http) = {
78+
get: "/v1/repeat/{info.f_string=first/*}/{info.f_child.f_string=second/**}:pathtrailingresource"
79+
};
80+
}
81+
}
82+
83+
message RepeatRequest {
84+
string name = 1;
85+
86+
ComplianceData info = 2;
87+
}
88+
89+
message RepeatResponse {
90+
ComplianceData info = 1;
91+
}
92+
93+
// ComplianceData is a message used for testing REST transcoding of
94+
// different data types.
95+
message ComplianceData {
96+
string f_string = 1;
97+
98+
int32 f_int32 = 2;
99+
100+
sint32 f_sint32 = 3;
101+
102+
sfixed32 f_sfixed32 = 4;
103+
104+
uint32 f_uint32 = 5;
105+
106+
fixed32 f_fixed32 = 6;
107+
108+
int64 f_int64 = 7;
109+
110+
sint64 f_sint64 = 8;
111+
112+
sfixed64 f_sfixed64 = 9;
113+
114+
uint64 f_uint64 = 10;
115+
116+
fixed64 f_fixed64 = 11;
117+
118+
double f_double = 12;
119+
120+
float f_float = 13;
121+
122+
bool f_bool = 14;
123+
124+
bytes f_bytes = 15;
125+
126+
ComplianceDataChild f_child = 16;
127+
128+
optional string p_string = 17;
129+
130+
optional int32 p_int32 = 18;
131+
132+
optional double p_double = 19;
133+
134+
optional bool p_bool = 20;
135+
136+
optional ComplianceDataChild p_child = 21;
137+
}
138+
139+
message ComplianceDataChild {
140+
string f_string = 1;
141+
142+
float f_float = 2;
143+
144+
double f_double = 3;
145+
146+
bool f_bool = 4;
147+
148+
ComplianceDataGrandchild f_child = 5;
149+
150+
optional string p_string = 6;
151+
152+
optional float p_float = 7;
153+
154+
optional double p_double = 8;
155+
156+
optional bool p_bool = 9;
157+
158+
optional ComplianceDataGrandchild p_child = 10;
159+
}
160+
161+
message ComplianceDataGrandchild {
162+
string f_string = 1;
163+
164+
double f_double = 2;
165+
166+
bool f_bool = 3;
167+
}
Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
// Copyright 2021 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+
// http://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+
syntax = "proto3";
16+
17+
package google.example.showcase.v1;
18+
19+
import "google/api/annotations.proto";
20+
import "google/api/client.proto";
21+
import "google/api/field_behavior.proto";
22+
import "google/longrunning/operations.proto";
23+
import "google/protobuf/duration.proto";
24+
import "google/protobuf/timestamp.proto";
25+
import "google/rpc/status.proto";
26+
27+
option go_package = "github.com/googleapis/gapic-showcase/server/genproto";
28+
option java_multiple_files = true;
29+
option java_outer_classname = "EchoProto";
30+
option java_package = "com.google.example.showcase.v1";
31+
option ruby_package = "Google::Example::Showcase::V1";
32+
33+
// This service is used showcase the four main types of rpcs - unary, server
34+
// side streaming, client side streaming, and bidirectional streaming. This
35+
// service also exposes methods that explicitly implement server delay, and
36+
// paginated calls. Set the 'showcase-trailer' metadata key on any method
37+
// to have the values echoed in the response trailers.
38+
service Echo {
39+
option (google.api.default_host) = "showcase.googleapis.com";
40+
41+
// This method simply echoes the request. This method showcases unary RPCs.
42+
rpc Echo(EchoRequest) returns (EchoResponse) {
43+
option (google.api.http) = {
44+
post: "/v1/echo:echo"
45+
body: "*"
46+
};
47+
}
48+
49+
// This method splits the given content into words and will pass each word
50+
// back through the stream. This method showcases server-side streaming RPCs.
51+
rpc Expand(ExpandRequest) returns (stream EchoResponse) {
52+
option (google.api.http) = {
53+
post: "/v1/echo:expand"
54+
body: "*"
55+
};
56+
option (google.api.method_signature) = "content,error";
57+
}
58+
59+
// This method will collect the words given to it. When the stream is closed
60+
// by the client, this method will return the a concatenation of the strings
61+
// passed to it. This method showcases client-side streaming RPCs.
62+
rpc Collect(stream EchoRequest) returns (EchoResponse) {
63+
option (google.api.http) = {
64+
post: "/v1/echo:collect"
65+
body: "*"
66+
};
67+
}
68+
69+
// This method, upon receiving a request on the stream, will pass the same
70+
// content back on the stream. This method showcases bidirectional
71+
// streaming RPCs.
72+
rpc Chat(stream EchoRequest) returns (stream EchoResponse) {
73+
}
74+
75+
// This is similar to the Expand method but instead of returning a stream of
76+
// expanded words, this method returns a paged list of expanded words.
77+
rpc PagedExpand(PagedExpandRequest) returns (PagedExpandResponse) {
78+
option (google.api.http) = {
79+
post: "/v1/echo:pagedExpand"
80+
body: "*"
81+
};
82+
}
83+
84+
// This method will wait for the requested amount of time and then return.
85+
// This method showcases how a client handles a request timeout.
86+
rpc Wait(WaitRequest) returns (google.longrunning.Operation) {
87+
option (google.api.http) = {
88+
post: "/v1/echo:wait"
89+
body: "*"
90+
};
91+
option (google.longrunning.operation_info) = {
92+
response_type: "WaitResponse"
93+
metadata_type: "WaitMetadata"
94+
};
95+
}
96+
97+
// This method will block (wait) for the requested amount of time
98+
// and then return the response or error.
99+
// This method showcases how a client handles delays or retries.
100+
rpc Block(BlockRequest) returns (BlockResponse) {
101+
option (google.api.http) = {
102+
post: "/v1/echo:block"
103+
body: "*"
104+
};
105+
}
106+
}
107+
108+
// The request message used for the Echo, Collect and Chat methods.
109+
// If content or opt are set in this message then the request will succeed.
110+
// If status is set in this message then the status will be returned as an
111+
// error.
112+
message EchoRequest {
113+
// The response contents.
114+
oneof response {
115+
// The content to be echoed by the server.
116+
string content = 1;
117+
118+
// The error to be thrown by the server.
119+
google.rpc.Status error = 2;
120+
}
121+
122+
// The severity to be echoed by the server.
123+
Severity severity = 3;
124+
}
125+
126+
// A severity enum used to test enum capabilities in GAPIC surfaces.
127+
enum Severity {
128+
// The severity is unnecessary.
129+
UNNECESSARY = 0;
130+
131+
// The severity is necessary.
132+
NECESSARY = 1;
133+
134+
// Urgent.
135+
URGENT = 2;
136+
137+
// Critical.
138+
CRITICAL = 3;
139+
}
140+
141+
// The response message for the Echo methods.
142+
message EchoResponse {
143+
// The content specified in the request.
144+
string content = 1;
145+
146+
// The severity specified in the request.
147+
Severity severity = 2;
148+
}
149+
150+
// The request message for the Expand method.
151+
message ExpandRequest {
152+
// The content that will be split into words and returned on the stream.
153+
string content = 1;
154+
155+
// The error that is thrown after all words are sent on the stream.
156+
google.rpc.Status error = 2;
157+
}
158+
159+
// The request for the PagedExpand method.
160+
message PagedExpandRequest {
161+
// Required. The string to expand.
162+
string content = 1 [(google.api.field_behavior) = REQUIRED];
163+
164+
// The amount of words to returned in each page.
165+
int32 page_size = 2;
166+
167+
// The position of the page to be returned.
168+
string page_token = 3;
169+
}
170+
171+
// The response for the PagedExpand method.
172+
message PagedExpandResponse {
173+
// The words that were expanded.
174+
repeated EchoResponse responses = 1;
175+
176+
// The next page token.
177+
string next_page_token = 2;
178+
}
179+
180+
// The request for Wait method.
181+
message WaitRequest {
182+
// The ending time or duration.
183+
oneof end {
184+
// The time that this operation will complete.
185+
google.protobuf.Timestamp end_time = 1;
186+
187+
// The duration of this operation.
188+
google.protobuf.Duration ttl = 4;
189+
}
190+
191+
// The response.
192+
oneof response {
193+
// The error that will be returned by the server. If this code is specified
194+
// to be the OK rpc code, an empty response will be returned.
195+
google.rpc.Status error = 2;
196+
197+
// The response to be returned on operation completion.
198+
WaitResponse success = 3;
199+
}
200+
}
201+
202+
// The result of the Wait operation.
203+
message WaitResponse {
204+
// This content of the result.
205+
string content = 1;
206+
}
207+
208+
// The request for Block method.
209+
message BlockRequest {
210+
// The response.
211+
oneof response {
212+
// The error that will be returned by the server. If this code is specified
213+
// to be the OK rpc code, an empty response will be returned.
214+
google.rpc.Status error = 2;
215+
216+
// The response to be returned that will signify successful method call.
217+
BlockResponse success = 3;
218+
}
219+
220+
// The amount of time to block before returning a response.
221+
google.protobuf.Duration response_delay = 1;
222+
}
223+
224+
// The response for Block method.
225+
message BlockResponse {
226+
// This content can contain anything, the server will not depend on a value
227+
// here.
228+
string content = 1;
229+
}

0 commit comments

Comments
 (0)