parent
2974b81c6c
commit
99ec928742
5 changed files with 1017 additions and 0 deletions
@ -0,0 +1,168 @@ |
||||
// Copyright 2021 Google LLC |
||||
// |
||||
// Licensed under the Apache License, Version 2.0 (the "License"); |
||||
// you may not use this file except in compliance with the License. |
||||
// You may obtain a copy of the License at |
||||
// |
||||
// http://www.apache.org/licenses/LICENSE-2.0 |
||||
// |
||||
// Unless required by applicable law or agreed to in writing, software |
||||
// distributed under the License is distributed on an "AS IS" BASIS, |
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
// See the License for the specific language governing permissions and |
||||
// limitations under the License. |
||||
|
||||
syntax = "proto3"; |
||||
|
||||
package google.example.showcase.v1beta1; |
||||
|
||||
import "google/api/annotations.proto"; |
||||
import "google/api/client.proto"; |
||||
|
||||
option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; |
||||
option java_multiple_files = true; |
||||
option java_outer_classname = "ComplicanceProto"; |
||||
option java_package = "com.google.example.showcase.v1beta1"; |
||||
|
||||
// This service is used to test that GAPICs can transcode proto3 requests to |
||||
// REST format correctly for various types of HTTP annotations. |
||||
service Compliance { |
||||
option (google.api.default_host) = "showcase.googleapis.com"; |
||||
|
||||
// This method echoes the ComplianceData request. This method exercises |
||||
// sending the entire request object in the REST body. |
||||
rpc RepeatDataBody(RepeatRequest) returns (RepeatResponse) { |
||||
option (google.api.http) = { |
||||
post: "/v1beta1/repeat:body" |
||||
body: "*" |
||||
}; |
||||
} |
||||
|
||||
// This method echoes the ComplianceData request. This method exercises |
||||
// sending the a message-type field in the REST body. Per AIP-127, only |
||||
// top-level, non-repeated fields can be sent this way. |
||||
rpc RepeatDataBodyInfo(RepeatRequest) returns (RepeatResponse) { |
||||
option (google.api.http) = { |
||||
post: "/v1beta1/repeat:bodyinfo" |
||||
body: "info" |
||||
}; |
||||
} |
||||
|
||||
// This method echoes the ComplianceData request. This method exercises |
||||
// sending all request fields as query parameters. |
||||
rpc RepeatDataQuery(RepeatRequest) returns (RepeatResponse) { |
||||
option (google.api.http) = { |
||||
get: "/v1beta1/repeat:query" |
||||
}; |
||||
} |
||||
|
||||
// This method echoes the ComplianceData request. This method exercises |
||||
// sending some parameters as "simple" path variables (i.e., of the form |
||||
// "/bar/{foo}" rather than "/{foo=bar/*}"), and the rest as query parameters. |
||||
rpc RepeatDataSimplePath(RepeatRequest) returns (RepeatResponse) { |
||||
option (google.api.http) = { |
||||
get: "/v1beta1/repeat/{info.f_string}/{info.f_int32}/{info.f_double}/{info.f_bool}:simplepath" |
||||
}; |
||||
} |
||||
|
||||
// Same as RepeatDataSimplePath, but with a path resource. |
||||
rpc RepeatDataPathResource(RepeatRequest) returns (RepeatResponse) { |
||||
option (google.api.http) = { |
||||
get: "/v1beta1/repeat/{info.f_string=first/*}/{info.f_child.f_string=second/*}/bool/{info.f_bool}:pathresource" |
||||
}; |
||||
} |
||||
|
||||
// Same as RepeatDataSimplePath, but with a trailing resource. |
||||
rpc RepeatDataPathTrailingResource(RepeatRequest) returns (RepeatResponse) { |
||||
option (google.api.http) = { |
||||
get: "/v1beta1/repeat/{info.f_string=first/*}/{info.f_child.f_string=second/**}:pathtrailingresource" |
||||
}; |
||||
} |
||||
} |
||||
|
||||
message RepeatRequest { |
||||
string name = 1; |
||||
|
||||
ComplianceData info = 2; |
||||
} |
||||
|
||||
message RepeatResponse { |
||||
ComplianceData info = 1; |
||||
} |
||||
|
||||
// ComplianceData is a message used for testing REST transcoding of |
||||
// different data types. |
||||
// scalar types |
||||
message ComplianceData { |
||||
string f_string = 1; |
||||
|
||||
int32 f_int32 = 2; |
||||
|
||||
sint32 f_sint32 = 3; |
||||
|
||||
sfixed32 f_sfixed32 = 4; |
||||
|
||||
uint32 f_uint32 = 5; |
||||
|
||||
fixed32 f_fixed32 = 6; |
||||
|
||||
int64 f_int64 = 7; |
||||
|
||||
sint64 f_sint64 = 8; |
||||
|
||||
sfixed64 f_sfixed64 = 9; |
||||
|
||||
uint64 f_uint64 = 10; |
||||
|
||||
fixed64 f_fixed64 = 11; |
||||
|
||||
double f_double = 12; |
||||
|
||||
float f_float = 13; |
||||
|
||||
bool f_bool = 14; |
||||
|
||||
bytes f_bytes = 15; |
||||
|
||||
ComplianceDataChild f_child = 16; |
||||
|
||||
optional string p_string = 17; |
||||
|
||||
optional int32 p_int32 = 18; |
||||
|
||||
optional double p_double = 19; |
||||
|
||||
optional bool p_bool = 20; |
||||
|
||||
optional ComplianceDataChild p_child = 21; |
||||
} |
||||
|
||||
message ComplianceDataChild { |
||||
string f_string = 1; |
||||
|
||||
float f_float = 2; |
||||
|
||||
double f_double = 3; |
||||
|
||||
bool f_bool = 4; |
||||
|
||||
ComplianceDataGrandchild f_child = 5; |
||||
|
||||
optional string p_string = 6; |
||||
|
||||
optional float p_float = 7; |
||||
|
||||
optional double p_double = 8; |
||||
|
||||
optional bool p_bool = 9; |
||||
|
||||
optional ComplianceDataGrandchild p_child = 10; |
||||
} |
||||
|
||||
message ComplianceDataGrandchild { |
||||
string f_string = 1; |
||||
|
||||
double f_double = 2; |
||||
|
||||
bool f_bool = 3; |
||||
} |
@ -0,0 +1,229 @@ |
||||
// Copyright 2021 Google LLC |
||||
// |
||||
// Licensed under the Apache License, Version 2.0 (the "License"); |
||||
// you may not use this file except in compliance with the License. |
||||
// You may obtain a copy of the License at |
||||
// |
||||
// http://www.apache.org/licenses/LICENSE-2.0 |
||||
// |
||||
// Unless required by applicable law or agreed to in writing, software |
||||
// distributed under the License is distributed on an "AS IS" BASIS, |
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
// See the License for the specific language governing permissions and |
||||
// limitations under the License. |
||||
|
||||
syntax = "proto3"; |
||||
|
||||
package google.example.showcase.v1beta1; |
||||
|
||||
import "google/api/annotations.proto"; |
||||
import "google/api/client.proto"; |
||||
import "google/api/field_behavior.proto"; |
||||
import "google/longrunning/operations.proto"; |
||||
import "google/protobuf/duration.proto"; |
||||
import "google/protobuf/timestamp.proto"; |
||||
import "google/rpc/status.proto"; |
||||
|
||||
option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; |
||||
option java_multiple_files = true; |
||||
option java_outer_classname = "EchoProto"; |
||||
option java_package = "com.google.example.showcase.v1beta1"; |
||||
option ruby_package = "Google::Example::Showcase::V1Beta1"; |
||||
|
||||
// This service is used showcase the four main types of rpcs - unary, server |
||||
// side streaming, client side streaming, and bidirectional streaming. This |
||||
// service also exposes methods that explicitly implement server delay, and |
||||
// paginated calls. Set the 'showcase-trailer' metadata key on any method |
||||
// to have the values echoed in the response trailers. |
||||
service Echo { |
||||
option (google.api.default_host) = "showcase.googleapis.com"; |
||||
|
||||
// This method simply echoes the request. This method showcases unary RPCs. |
||||
rpc Echo(EchoRequest) returns (EchoResponse) { |
||||
option (google.api.http) = { |
||||
post: "/v1beta1/echo:echo" |
||||
body: "*" |
||||
}; |
||||
} |
||||
|
||||
// This method splits the given content into words and will pass each word |
||||
// back through the stream. This method showcases server-side streaming RPCs. |
||||
rpc Expand(ExpandRequest) returns (stream EchoResponse) { |
||||
option (google.api.http) = { |
||||
post: "/v1beta1/echo:expand" |
||||
body: "*" |
||||
}; |
||||
option (google.api.method_signature) = "content,error"; |
||||
} |
||||
|
||||
// This method will collect the words given to it. When the stream is closed |
||||
// by the client, this method will return the a concatenation of the strings |
||||
// passed to it. This method showcases client-side streaming RPCs. |
||||
rpc Collect(stream EchoRequest) returns (EchoResponse) { |
||||
option (google.api.http) = { |
||||
post: "/v1beta1/echo:collect" |
||||
body: "*" |
||||
}; |
||||
} |
||||
|
||||
// This method, upon receiving a request on the stream, will pass the same |
||||
// content back on the stream. This method showcases bidirectional |
||||
// streaming RPCs. |
||||
rpc Chat(stream EchoRequest) returns (stream EchoResponse) { |
||||
} |
||||
|
||||
// This is similar to the Expand method but instead of returning a stream of |
||||
// expanded words, this method returns a paged list of expanded words. |
||||
rpc PagedExpand(PagedExpandRequest) returns (PagedExpandResponse) { |
||||
option (google.api.http) = { |
||||
post: "/v1beta1/echo:pagedExpand" |
||||
body: "*" |
||||
}; |
||||
} |
||||
|
||||
// This method will wait for the requested amount of time and then return. |
||||
// This method showcases how a client handles a request timeout. |
||||
rpc Wait(WaitRequest) returns (google.longrunning.Operation) { |
||||
option (google.api.http) = { |
||||
post: "/v1beta1/echo:wait" |
||||
body: "*" |
||||
}; |
||||
option (google.longrunning.operation_info) = { |
||||
response_type: "WaitResponse" |
||||
metadata_type: "WaitMetadata" |
||||
}; |
||||
} |
||||
|
||||
// This method will block (wait) for the requested amount of time |
||||
// and then return the response or error. |
||||
// This method showcases how a client handles delays or retries. |
||||
rpc Block(BlockRequest) returns (BlockResponse) { |
||||
option (google.api.http) = { |
||||
post: "/v1beta1/echo:block" |
||||
body: "*" |
||||
}; |
||||
} |
||||
} |
||||
|
||||
// The request message used for the Echo, Collect and Chat methods. |
||||
// If content or opt are set in this message then the request will succeed. |
||||
// If status is set in this message then the status will be returned as an |
||||
// error. |
||||
message EchoRequest { |
||||
// The response contents. |
||||
oneof response { |
||||
// The content to be echoed by the server. |
||||
string content = 1; |
||||
|
||||
// The error to be thrown by the server. |
||||
google.rpc.Status error = 2; |
||||
} |
||||
|
||||
// The severity to be echoed by the server. |
||||
Severity severity = 3; |
||||
} |
||||
|
||||
// The response message for the Echo methods. |
||||
message EchoResponse { |
||||
// The content specified in the request. |
||||
string content = 1; |
||||
|
||||
// The severity specified in the request. |
||||
Severity severity = 2; |
||||
} |
||||
|
||||
// The request message for the Expand method. |
||||
message ExpandRequest { |
||||
// The content that will be split into words and returned on the stream. |
||||
string content = 1; |
||||
|
||||
// The error that is thrown after all words are sent on the stream. |
||||
google.rpc.Status error = 2; |
||||
} |
||||
|
||||
// The request for the PagedExpand method. |
||||
message PagedExpandRequest { |
||||
// Required. The string to expand. |
||||
string content = 1 [(google.api.field_behavior) = REQUIRED]; |
||||
|
||||
// The amount of words to returned in each page. |
||||
int32 page_size = 2; |
||||
|
||||
// The position of the page to be returned. |
||||
string page_token = 3; |
||||
} |
||||
|
||||
// The response for the PagedExpand method. |
||||
message PagedExpandResponse { |
||||
// The words that were expanded. |
||||
repeated EchoResponse responses = 1; |
||||
|
||||
// The next page token. |
||||
string next_page_token = 2; |
||||
} |
||||
|
||||
// The request for Wait method. |
||||
message WaitRequest { |
||||
// The ending time or duration. |
||||
oneof end { |
||||
// The time that this operation will complete. |
||||
google.protobuf.Timestamp end_time = 1; |
||||
|
||||
// The duration of this operation. |
||||
google.protobuf.Duration ttl = 4; |
||||
} |
||||
|
||||
// The response. |
||||
oneof response { |
||||
// The error that will be returned by the server. If this code is specified |
||||
// to be the OK rpc code, an empty response will be returned. |
||||
google.rpc.Status error = 2; |
||||
|
||||
// The response to be returned on operation completion. |
||||
WaitResponse success = 3; |
||||
} |
||||
} |
||||
|
||||
// The result of the Wait operation. |
||||
message WaitResponse { |
||||
// This content of the result. |
||||
string content = 1; |
||||
} |
||||
|
||||
// The request for Block method. |
||||
message BlockRequest { |
||||
// The amount of time to block before returning a response. |
||||
google.protobuf.Duration response_delay = 1; |
||||
|
||||
// The response. |
||||
oneof response { |
||||
// The error that will be returned by the server. If this code is specified |
||||
// to be the OK rpc code, an empty response will be returned. |
||||
google.rpc.Status error = 2; |
||||
|
||||
// The response to be returned that will signify successful method call. |
||||
BlockResponse success = 3; |
||||
} |
||||
} |
||||
|
||||
// The response for Block method. |
||||
message BlockResponse { |
||||
// This content can contain anything, the server will not depend on a value |
||||
// here. |
||||
string content = 1; |
||||
} |
||||
|
||||
// A severity enum used to test enum capabilities in GAPIC surfaces. |
||||
enum Severity { |
||||
// The severity is unnecessary. |
||||
UNNECESSARY = 0; |
||||
|
||||
// The severity is necessary. |
||||
NECESSARY = 1; |
||||
|
||||
// Urgent. |
||||
URGENT = 2; |
||||
|
||||
// Critical. |
||||
CRITICAL = 3; |
||||
} |
@ -0,0 +1,138 @@ |
||||
// Copyright 2021 Google LLC |
||||
// |
||||
// Licensed under the Apache License, Version 2.0 (the "License"); |
||||
// you may not use this file except in compliance with the License. |
||||
// You may obtain a copy of the License at |
||||
// |
||||
// http://www.apache.org/licenses/LICENSE-2.0 |
||||
// |
||||
// Unless required by applicable law or agreed to in writing, software |
||||
// distributed under the License is distributed on an "AS IS" BASIS, |
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
// See the License for the specific language governing permissions and |
||||
// limitations under the License. |
||||
|
||||
syntax = "proto3"; |
||||
|
||||
package google.example.showcase.v1beta1; |
||||
|
||||
import "google/api/annotations.proto"; |
||||
import "google/api/client.proto"; |
||||
import "google/api/field_behavior.proto"; |
||||
import "google/api/resource.proto"; |
||||
import "google/protobuf/duration.proto"; |
||||
import "google/protobuf/empty.proto"; |
||||
import "google/protobuf/timestamp.proto"; |
||||
import "google/rpc/status.proto"; |
||||
|
||||
option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; |
||||
option java_multiple_files = true; |
||||
option java_outer_classname = "SequenceProto"; |
||||
option java_package = "com.google.example.showcase.v1beta1"; |
||||
option ruby_package = "Google::Showcase::V1Beta1"; |
||||
|
||||
service SequenceService { |
||||
option (google.api.default_host) = "showcase.googleapis.com"; |
||||
|
||||
// Creates a sequence. |
||||
rpc CreateSequence(CreateSequenceRequest) returns (Sequence) { |
||||
option (google.api.http) = { |
||||
post: "/v1beta1/sequences" |
||||
body: "sequence" |
||||
}; |
||||
option (google.api.method_signature) = "sequence"; |
||||
} |
||||
|
||||
// Retrieves a sequence. |
||||
rpc GetSequenceReport(GetSequenceReportRequest) returns (SequenceReport) { |
||||
option (google.api.http) = { |
||||
get: "/v1beta1/{name=sequences/*/sequenceReport}" |
||||
}; |
||||
option (google.api.method_signature) = "name"; |
||||
} |
||||
|
||||
// Attempts a sequence. |
||||
rpc AttemptSequence(AttemptSequenceRequest) returns (google.protobuf.Empty) { |
||||
option (google.api.http) = { |
||||
post: "/v1beta1/{name=sequences/*}" |
||||
body: "*" |
||||
}; |
||||
option (google.api.method_signature) = "name"; |
||||
} |
||||
} |
||||
|
||||
message Sequence { |
||||
option (google.api.resource) = { |
||||
type: "showcase.googleapis.com/Sequence" |
||||
pattern: "sequences/{sequence}" |
||||
}; |
||||
|
||||
// A server response to an RPC Attempt in a sequence. |
||||
message Response { |
||||
// The status to return for an individual attempt. |
||||
google.rpc.Status status = 1; |
||||
|
||||
// The amount of time to delay sending the response. |
||||
google.protobuf.Duration delay = 2; |
||||
} |
||||
|
||||
string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; |
||||
|
||||
// Sequence of responses to return in order for each attempt. If empty, the |
||||
// default response is an immediate OK. |
||||
repeated Response responses = 2; |
||||
} |
||||
|
||||
message SequenceReport { |
||||
option (google.api.resource) = { |
||||
type: "showcase.googleapis.com/SequenceReport" |
||||
pattern: "sequences/{sequence}/sequenceReport" |
||||
}; |
||||
|
||||
// Contains metrics on individual RPC Attempts in a sequence. |
||||
message Attempt { |
||||
// The attempt number - starting at 0. |
||||
int32 attempt_number = 1; |
||||
|
||||
// The deadline dictated by the attempt to the server. |
||||
google.protobuf.Timestamp attempt_deadline = 2; |
||||
|
||||
// The time that the server responded to the RPC attempt. Used for |
||||
// calculating attempt_delay. |
||||
google.protobuf.Timestamp response_time = 3; |
||||
|
||||
// The server perceived delay between sending the last response and |
||||
// receiving this attempt. Used for validating attempt delay backoff. |
||||
google.protobuf.Duration attempt_delay = 4; |
||||
|
||||
// The status returned to the attempt. |
||||
google.rpc.Status status = 5; |
||||
} |
||||
|
||||
string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; |
||||
|
||||
// The set of RPC attempts received by the server for a Sequence. |
||||
repeated Attempt attempts = 2; |
||||
} |
||||
|
||||
message CreateSequenceRequest { |
||||
Sequence sequence = 1; |
||||
} |
||||
|
||||
message AttemptSequenceRequest { |
||||
string name = 1 [ |
||||
(google.api.field_behavior) = REQUIRED, |
||||
(google.api.resource_reference) = { |
||||
type: "showcase.googleapis.com/Sequence" |
||||
} |
||||
]; |
||||
} |
||||
|
||||
message GetSequenceReportRequest { |
||||
string name = 1 [ |
||||
(google.api.field_behavior) = REQUIRED, |
||||
(google.api.resource_reference) = { |
||||
type: "showcase.googleapis.com/SequenceReport" |
||||
} |
||||
]; |
||||
} |
@ -0,0 +1,90 @@ |
||||
{ |
||||
"methodConfig": [ |
||||
{ |
||||
"name": [ |
||||
{"service": "google.example.showcase.v1beta1.Echo"}, |
||||
{"service": "google.example.showcase.v1beta1.Messaging"}, |
||||
{"service": "google.example.showcase.v1beta1.SequenceService"} |
||||
], |
||||
"timeout": "5s" |
||||
}, |
||||
{ |
||||
"name": [ |
||||
{ |
||||
"service": "google.example.showcase.v1beta1.Echo", |
||||
"method": "Echo" |
||||
}, |
||||
{ |
||||
"service": "google.example.showcase.v1beta1.Echo", |
||||
"method": "Expand" |
||||
}, |
||||
{ |
||||
"service": "google.example.showcase.v1beta1.Echo", |
||||
"method": "PagedExpand" |
||||
}, |
||||
{ |
||||
"service": "google.example.showcase.v1beta1.Messaging", |
||||
"method": "GetRoom" |
||||
}, |
||||
{ |
||||
"service": "google.example.showcase.v1beta1.Messaging", |
||||
"method": "ListRooms" |
||||
}, |
||||
{ |
||||
"service": "google.example.showcase.v1beta1.Messaging", |
||||
"method": "GetBlurb" |
||||
}, |
||||
{ |
||||
"service": "google.example.showcase.v1beta1.Messaging", |
||||
"method": "ListBlurbs" |
||||
}, |
||||
{ |
||||
"service": "google.example.showcase.v1beta1.Messaging", |
||||
"method": "SearchBlurbs" |
||||
}, |
||||
{ |
||||
"service": "google.example.showcase.v1beta1.Messaging", |
||||
"method": "Connect" |
||||
}, |
||||
{ |
||||
"service": "google.example.showcase.v1beta1.SequenceService", |
||||
"method": "AttemptSequence" |
||||
} |
||||
], |
||||
"retryPolicy": { |
||||
"maxAttempts": 3, |
||||
"maxBackoff": "3s", |
||||
"initialBackoff": "0.1s", |
||||
"backoffMultiplier": 2, |
||||
"retryableStatusCodes": [ |
||||
"UNAVAILABLE", |
||||
"UNKNOWN" |
||||
] |
||||
}, |
||||
"timeout": "10s" |
||||
}, |
||||
{ |
||||
"name": [ |
||||
{ |
||||
"service": "google.example.showcase.v1beta1.Identity", |
||||
"method": "GetUser" |
||||
}, |
||||
{ |
||||
"service": "google.example.showcase.v1beta1.Identity", |
||||
"method": "ListUsers" |
||||
} |
||||
], |
||||
"retryPolicy": { |
||||
"maxAttempts": 5, |
||||
"maxBackoff": "3s", |
||||
"initialBackoff": "0.2s", |
||||
"backoffMultiplier": 2, |
||||
"retryableStatusCodes": [ |
||||
"UNAVAILABLE", |
||||
"UNKNOWN" |
||||
] |
||||
}, |
||||
"timeout": "5s" |
||||
} |
||||
] |
||||
} |
@ -0,0 +1,392 @@ |
||||
// Copyright 2021 Google LLC |
||||
// |
||||
// Licensed under the Apache License, Version 2.0 (the "License"); |
||||
// you may not use this file except in compliance with the License. |
||||
// You may obtain a copy of the License at |
||||
// |
||||
// http://www.apache.org/licenses/LICENSE-2.0 |
||||
// |
||||
// Unless required by applicable law or agreed to in writing, software |
||||
// distributed under the License is distributed on an "AS IS" BASIS, |
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
// See the License for the specific language governing permissions and |
||||
// limitations under the License. |
||||
|
||||
syntax = "proto3"; |
||||
|
||||
package google.example.showcase.v1beta1; |
||||
|
||||
import "google/api/annotations.proto"; |
||||
import "google/api/resource.proto"; |
||||
import "google/protobuf/empty.proto"; |
||||
import "google/api/client.proto"; |
||||
|
||||
option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; |
||||
option java_multiple_files = true; |
||||
option java_outer_classname = "TestingProto"; |
||||
option java_package = "com.google.example.showcase.v1beta1"; |
||||
option ruby_package = "Google::Showcase::V1Beta1"; |
||||
|
||||
// A service to facilitate running discrete sets of tests |
||||
// against Showcase. |
||||
service Testing { |
||||
option (google.api.default_host) = "showcase.googleapis.com"; |
||||
|
||||
// Creates a new testing session. |
||||
rpc CreateSession(CreateSessionRequest) returns (Session) { |
||||
option (google.api.http) = { |
||||
post: "/v1beta1/sessions" |
||||
body: "session" |
||||
}; |
||||
} |
||||
|
||||
// Gets a testing session. |
||||
rpc GetSession(GetSessionRequest) returns (Session) { |
||||
option (google.api.http) = { |
||||
get: "/v1beta1/{name=sessions/*}" |
||||
}; |
||||
} |
||||
|
||||
// Lists the current test sessions. |
||||
rpc ListSessions(ListSessionsRequest) returns (ListSessionsResponse) { |
||||
option (google.api.http) = { |
||||
get: "/v1beta1/sessions" |
||||
}; |
||||
} |
||||
|
||||
// Delete a test session. |
||||
rpc DeleteSession(DeleteSessionRequest) returns (google.protobuf.Empty) { |
||||
option (google.api.http) = { |
||||
delete: "/v1beta1/{name=sessions/*}" |
||||
}; |
||||
} |
||||
|
||||
// Report on the status of a session. |
||||
// This generates a report detailing which tests have been completed, |
||||
// and an overall rollup. |
||||
rpc ReportSession(ReportSessionRequest) returns (ReportSessionResponse) { |
||||
option (google.api.http) = { |
||||
post: "/v1beta1/{name=sessions/*}:report" |
||||
}; |
||||
} |
||||
|
||||
// List the tests of a sessesion. |
||||
rpc ListTests(ListTestsRequest) returns (ListTestsResponse) { |
||||
option (google.api.http) = { |
||||
get: "/v1beta1/{parent=sessions/*}/tests" |
||||
}; |
||||
} |
||||
|
||||
// Explicitly decline to implement a test. |
||||
// |
||||
// This removes the test from subsequent `ListTests` calls, and |
||||
// attempting to do the test will error. |
||||
// |
||||
// This method will error if attempting to delete a required test. |
||||
rpc DeleteTest(DeleteTestRequest) returns (google.protobuf.Empty) { |
||||
option (google.api.http) = { |
||||
delete: "/v1beta1/{name=sessions/*/tests/*}" |
||||
}; |
||||
} |
||||
|
||||
// Register a response to a test. |
||||
// |
||||
// In cases where a test involves registering a final answer at the |
||||
// end of the test, this method provides the means to do so. |
||||
rpc VerifyTest(VerifyTestRequest) returns (VerifyTestResponse) { |
||||
option (google.api.http) = { |
||||
post: "/v1beta1/{name=sessions/*/tests/*}:check" |
||||
}; |
||||
} |
||||
} |
||||
|
||||
// A session is a suite of tests, generally being made in the context |
||||
// of testing code generation. |
||||
// |
||||
// A session defines tests it may expect, based on which version of the |
||||
// code generation spec is in use. |
||||
message Session { |
||||
option (google.api.resource) = { |
||||
type: "showcase.googleapis.com/Session" |
||||
pattern: "sessions/{session}" |
||||
}; |
||||
|
||||
// The specification versions understood by Showcase. |
||||
enum Version { |
||||
// Unspecified version. If passed on creation, the session will default |
||||
// to using the latest stable release. |
||||
VERSION_UNSPECIFIED = 0; |
||||
|
||||
// The latest v1. Currently, this is v1.0. |
||||
V1_LATEST = 1; |
||||
|
||||
// v1.0. (Until the spec is "GA", this will be a moving target.) |
||||
V1_0 = 2; |
||||
} |
||||
|
||||
// The name of the session. The ID must conform to ^[a-z]+$ |
||||
// If this is not provided, Showcase chooses one at random. |
||||
string name = 1; |
||||
|
||||
// Required. The version this session is using. |
||||
Version version = 2; |
||||
} |
||||
|
||||
// The request for the CreateSession method. |
||||
message CreateSessionRequest { |
||||
// The session to be created. |
||||
// Sessions are immutable once they are created (although they can |
||||
// be deleted). |
||||
Session session = 1; |
||||
} |
||||
|
||||
// The request for the GetSession method. |
||||
message GetSessionRequest { |
||||
// The session to be retrieved. |
||||
string name = 1 [(google.api.resource_reference) = { |
||||
type: "showcase.googleapis.com/Session" |
||||
}]; |
||||
} |
||||
|
||||
// The request for the ListSessions method. |
||||
message ListSessionsRequest { |
||||
// The maximum number of sessions to return per page. |
||||
int32 page_size = 1; |
||||
|
||||
// The page token, for retrieving subsequent pages. |
||||
string page_token = 2; |
||||
} |
||||
|
||||
// Response for the ListSessions method. |
||||
message ListSessionsResponse { |
||||
// The sessions being returned. |
||||
repeated Session sessions = 1; |
||||
|
||||
// The next page token, if any. |
||||
// An empty value here means the last page has been reached. |
||||
string next_page_token = 2; |
||||
} |
||||
|
||||
// Request for the DeleteSession method. |
||||
message DeleteSessionRequest { |
||||
// The session to be deleted. |
||||
string name = 1 [(google.api.resource_reference) = { |
||||
type: "showcase.googleapis.com/Session" |
||||
}]; |
||||
} |
||||
|
||||
// Request message for reporting on a session. |
||||
message ReportSessionRequest { |
||||
// The session to be reported on. |
||||
string name = 1 [(google.api.resource_reference) = { |
||||
type: "showcase.googleapis.com/Session" |
||||
}]; |
||||
} |
||||
|
||||
// Response message for reporting on a session. |
||||
message ReportSessionResponse { |
||||
// The topline state of the report. |
||||
enum Result { |
||||
RESULT_UNSPECIFIED = 0; |
||||
|
||||
// The session is complete, and everything passed. |
||||
PASSED = 1; |
||||
|
||||
// The session had an explicit failure. |
||||
FAILED = 2; |
||||
|
||||
// The session is incomplete. This is a failure response. |
||||
INCOMPLETE = 3; |
||||
} |
||||
|
||||
// The state of the report. |
||||
Result result = 1; |
||||
|
||||
// The test runs of this session. |
||||
repeated TestRun test_runs = 2; |
||||
} |
||||
|
||||
message Test { |
||||
option (google.api.resource) = { |
||||
type: "showcase.googleapis.com/Test" |
||||
pattern: "sessions/{session}/tests/{test}" |
||||
}; |
||||
|
||||
// A blueprint is an explicit definition of methods and requests that are |
||||
// needed to be made to test this specific test case. Ideally this would be |
||||
// represented by something more robust like CEL, but as of writing this, I am |
||||
// unsure if CEL is ready. |
||||
message Blueprint { |
||||
option (google.api.resource) = { |
||||
type: "showcase.googleapis.com/Blueprint" |
||||
pattern: "sessions/{session}/tests/{test}/blueprints/{blueprint}" |
||||
}; |
||||
|
||||
// A message representing a method invocation. |
||||
message Invocation { |
||||
// The fully qualified name of the showcase method to be invoked. |
||||
string method = 1; |
||||
|
||||
// The request to be made if a specific request is necessary. |
||||
bytes serialized_request = 2; |
||||
} |
||||
|
||||
// The name of this blueprint. |
||||
string name = 1; |
||||
|
||||
// A description of this blueprint. |
||||
string description = 2; |
||||
|
||||
// The initial request to trigger this test. |
||||
Invocation request = 3; |
||||
|
||||
// An ordered list of method calls that can be called to trigger this test. |
||||
repeated Invocation additional_requests = 4; |
||||
} |
||||
|
||||
// Whether or not a test is required, recommended, or optional. |
||||
enum ExpectationLevel { |
||||
EXPECTATION_LEVEL_UNSPECIFIED = 0; |
||||
|
||||
// This test is strictly required. |
||||
REQUIRED = 1; |
||||
|
||||
// This test is recommended. |
||||
// |
||||
// If a generator explicitly ignores a recommended test (see `DeleteTest`), |
||||
// then the report may still pass, but with a warning. |
||||
// |
||||
// If a generator skips a recommended test and does not explicitly |
||||
// express that intention, the report will fail. |
||||
RECOMMENDED = 2; |
||||
|
||||
// This test is optional. |
||||
// |
||||
// If a generator explicitly ignores an optional test (see `DeleteTest`), |
||||
// then the report may still pass, and no warning will be issued. |
||||
// |
||||
// If a generator skips an optional test and does not explicitly |
||||
// express that intention, the report may still pass, but with a |
||||
// warning. |
||||
OPTIONAL = 3; |
||||
} |
||||
|
||||
// The name of the test. |
||||
// The tests/* portion of the names are hard-coded, and do not change |
||||
// from session to session. |
||||
string name = 1; |
||||
|
||||
// The expectation level for this test. |
||||
ExpectationLevel expectation_level = 2; |
||||
|
||||
// A description of the test. |
||||
string description = 3; |
||||
|
||||
// The blueprints that will satisfy this test. There may be multiple |
||||
// blueprints that can signal to the server that this test case is being |
||||
// exercised. Although multiple blueprints are specified, only a single |
||||
// blueprint needs to be run to signal that the test case was exercised. |
||||
repeated Blueprint blueprints = 4; |
||||
} |
||||
|
||||
// An issue found in the test. |
||||
message Issue { |
||||
// The different potential types of issues. |
||||
enum Type { |
||||
TYPE_UNSPECIFIED = 0; |
||||
|
||||
// The test was never instrumented. |
||||
SKIPPED = 1; |
||||
|
||||
// The test was started but never confirmed. |
||||
PENDING = 2; |
||||
|
||||
// The test was instrumented, but Showcase got an unexpected |
||||
// value when the generator tried to confirm success. |
||||
INCORRECT_CONFIRMATION = 3; |
||||
} |
||||
|
||||
// Severity levels. |
||||
enum Severity { |
||||
SEVERITY_UNSPECIFIED = 0; |
||||
|
||||
// Errors. |
||||
ERROR = 1; |
||||
|
||||
// Warnings. |
||||
WARNING = 2; |
||||
} |
||||
|
||||
// The type of the issue. |
||||
Type type = 1; |
||||
|
||||
// The severity of the issue. |
||||
Severity severity = 2; |
||||
|
||||
// A description of the issue. |
||||
string description = 3; |
||||
} |
||||
|
||||
// The request for the ListTests method. |
||||
message ListTestsRequest { |
||||
// The session. |
||||
string parent = 1 [(google.api.resource_reference) = { |
||||
type: "showcase.googleapis.com/Session" |
||||
}]; |
||||
|
||||
// The maximum number of tests to return per page. |
||||
int32 page_size = 2; |
||||
|
||||
// The page token, for retrieving subsequent pages. |
||||
string page_token = 3; |
||||
} |
||||
|
||||
// The response for the ListTests method. |
||||
message ListTestsResponse { |
||||
// The tests being returned. |
||||
repeated Test tests = 1; |
||||
|
||||
// The next page token, if any. |
||||
// An empty value here means the last page has been reached. |
||||
string next_page_token = 2; |
||||
} |
||||
|
||||
// A TestRun is the result of running a Test. |
||||
message TestRun { |
||||
// The name of the test. |
||||
// The tests/* portion of the names are hard-coded, and do not change |
||||
// from session to session. |
||||
string test = 1 [(google.api.resource_reference) = { |
||||
type: "showcase.googleapis.com/Test" |
||||
}]; |
||||
|
||||
// An issue found with the test run. If empty, this test run was successful. |
||||
Issue issue = 2; |
||||
} |
||||
|
||||
// Request message for deleting a test. |
||||
message DeleteTestRequest { |
||||
// The test to be deleted. |
||||
string name = 1 [(google.api.resource_reference) = { |
||||
type: "showcase.googleapis.com/Test" |
||||
}]; |
||||
} |
||||
|
||||
message VerifyTestRequest { |
||||
// The test to have an answer registered to it. |
||||
string name = 1 [(google.api.resource_reference) = { |
||||
type: "showcase.googleapis.com/Test" |
||||
}]; |
||||
|
||||
// The answer from the test. |
||||
bytes answer = 2; |
||||
|
||||
// The answers from the test if multiple are to be checked |
||||
repeated bytes answers = 3; |
||||
} |
||||
|
||||
message VerifyTestResponse { |
||||
// An issue if check answer was unsuccessful. This will be empty if the check |
||||
// answer succeeded. |
||||
Issue issue = 1; |
||||
} |
Loading…
Reference in new issue