-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
`simple.smithy` is currently not that simple. Besides, it serves no effective purpose: everything that the model exercises is already exercised in a clearer and more orderly manner in other integration tests. This PR makes the model minimal, so that it recovers its purpose as a simple smoke test. Contributors can also use the model as a scratchpad for features or bugfixs they're working on.
- Loading branch information
1 parent
5486693
commit 20263de
Showing
1 changed file
with
9 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,136 +1,22 @@ | ||
$version: "1.0" | ||
$version: "2.0" | ||
|
||
namespace com.amazonaws.simple | ||
|
||
use aws.protocols#restJson1 | ||
use smithy.test#httpRequestTests | ||
use smithy.test#httpResponseTests | ||
use smithy.framework#ValidationException | ||
|
||
@restJson1 | ||
@title("SimpleService") | ||
@documentation("A simple service example, with a Service resource that can be registered and a readonly healthcheck") | ||
service SimpleService { | ||
version: "2022-01-01", | ||
resources: [ | ||
Service, | ||
], | ||
operations: [ | ||
Healthcheck, | ||
StoreServiceBlob, | ||
], | ||
Operation | ||
] | ||
} | ||
|
||
@documentation("Id of the service that will be registered") | ||
string ServiceId | ||
|
||
@documentation("Name of the service that will be registered") | ||
string ServiceName | ||
|
||
@error("client") | ||
@documentation( | ||
""" | ||
Returned when a new resource cannot be created because one already exists. | ||
""" | ||
) | ||
structure ResourceAlreadyExists { | ||
@required | ||
message: String | ||
} | ||
|
||
@documentation("A resource that can register services") | ||
resource Service { | ||
identifiers: { id: ServiceId }, | ||
put: RegisterService, | ||
} | ||
|
||
@idempotent | ||
@http(method: "PUT", uri: "/service/{id}") | ||
@documentation("Service register operation") | ||
@httpRequestTests([ | ||
{ | ||
id: "RegisterServiceRequestTest", | ||
protocol: "aws.protocols#restJson1", | ||
uri: "/service/1", | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
params: { id: "1", name: "TestService" }, | ||
body: "{\"name\":\"TestService\"}", | ||
method: "PUT", | ||
} | ||
]) | ||
@httpResponseTests([ | ||
{ | ||
id: "RegisterServiceResponseTest", | ||
protocol: "aws.protocols#restJson1", | ||
params: { id: "1", name: "TestService" }, | ||
body: "{\"id\":\"1\",\"name\":\"TestService\"}", | ||
code: 200, | ||
headers: { | ||
"Content-Length": "31" | ||
} | ||
} | ||
]) | ||
operation RegisterService { | ||
input: RegisterServiceInputRequest, | ||
output: RegisterServiceOutputResponse, | ||
errors: [ResourceAlreadyExists, ValidationException] | ||
} | ||
|
||
@documentation("Service register input structure") | ||
structure RegisterServiceInputRequest { | ||
@required | ||
@httpLabel | ||
id: ServiceId, | ||
name: ServiceName, | ||
} | ||
|
||
@documentation("Service register output structure") | ||
structure RegisterServiceOutputResponse { | ||
@required | ||
id: ServiceId, | ||
name: ServiceName, | ||
} | ||
|
||
@readonly | ||
@http(uri: "/healthcheck", method: "GET") | ||
@documentation("Read-only healthcheck operation") | ||
operation Healthcheck { | ||
input: HealthcheckInputRequest, | ||
output: HealthcheckOutputResponse | ||
@http(uri: "/operation", method: "POST") | ||
operation Operation { | ||
input: OperationInputOutput | ||
output: OperationInputOutput | ||
} | ||
|
||
@documentation("Service healthcheck output structure") | ||
structure HealthcheckInputRequest { | ||
|
||
} | ||
|
||
@documentation("Service healthcheck input structure") | ||
structure HealthcheckOutputResponse { | ||
|
||
} | ||
|
||
@readonly | ||
@http(method: "POST", uri: "/service/{id}/blob") | ||
@documentation("Stores a blob for a service id") | ||
operation StoreServiceBlob { | ||
input: StoreServiceBlobInput, | ||
output: StoreServiceBlobOutput, | ||
errors: [ValidationException] | ||
} | ||
|
||
@documentation("Store a blob for a service id input structure") | ||
structure StoreServiceBlobInput { | ||
@required | ||
@httpLabel | ||
id: ServiceId, | ||
@required | ||
@httpPayload | ||
content: Blob, | ||
} | ||
|
||
@documentation("Store a blob for a service id output structure") | ||
structure StoreServiceBlobOutput { | ||
|
||
structure OperationInputOutput { | ||
message: String | ||
} |