-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable streaming support for AwsJson (#2207)
* Enable streaming support for AwsJson Signed-off-by: Daniele Ahmed <[email protected]>
- Loading branch information
Showing
4 changed files
with
118 additions
and
1 deletion.
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
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 |
---|---|---|
@@ -0,0 +1,104 @@ | ||
$version: "1.0" | ||
|
||
// TODO(https://github.com/awslabs/smithy-rs/issues/2215) | ||
// This is a temporary model to test AwsJson 1.0 with @streaming. | ||
// This model will be removed when protocol tests support @streaming. | ||
|
||
namespace com.aws.example.rust | ||
|
||
use aws.protocols#awsJson1_0 | ||
use smithy.framework#ValidationException | ||
use com.aws.example#PokemonSpecies | ||
use com.aws.example#GetServerStatistics | ||
use com.aws.example#DoNothing | ||
use com.aws.example#CheckHealth | ||
|
||
/// The Pokémon Service allows you to retrieve information about Pokémon species. | ||
@title("Pokémon Service") | ||
@awsJson1_0 | ||
service PokemonService { | ||
version: "2021-12-01", | ||
operations: [ | ||
GetServerStatistics, | ||
DoNothing, | ||
CapturePokemon, | ||
CheckHealth | ||
], | ||
} | ||
|
||
/// Capture Pokémons via event streams. | ||
@http(uri: "/capture-pokemon-event/{region}", method: "POST") | ||
operation CapturePokemon { | ||
input: CapturePokemonEventsInput, | ||
output: CapturePokemonEventsOutput, | ||
errors: [UnsupportedRegionError, ThrottlingError, ValidationException] | ||
} | ||
|
||
@input | ||
structure CapturePokemonEventsInput { | ||
@httpPayload | ||
events: AttemptCapturingPokemonEvent, | ||
|
||
@httpLabel | ||
@required | ||
region: String, | ||
} | ||
|
||
@output | ||
structure CapturePokemonEventsOutput { | ||
@httpPayload | ||
events: CapturePokemonEvents, | ||
} | ||
|
||
@streaming | ||
union AttemptCapturingPokemonEvent { | ||
event: CapturingEvent, | ||
masterball_unsuccessful: MasterBallUnsuccessful, | ||
} | ||
|
||
structure CapturingEvent { | ||
@eventPayload | ||
payload: CapturingPayload, | ||
} | ||
|
||
structure CapturingPayload { | ||
name: String, | ||
pokeball: String, | ||
} | ||
|
||
@streaming | ||
union CapturePokemonEvents { | ||
event: CaptureEvent, | ||
invalid_pokeball: InvalidPokeballError, | ||
throttlingError: ThrottlingError, | ||
} | ||
|
||
structure CaptureEvent { | ||
@eventHeader | ||
name: String, | ||
@eventHeader | ||
captured: Boolean, | ||
@eventHeader | ||
shiny: Boolean, | ||
@eventPayload | ||
pokedex_update: Blob, | ||
} | ||
|
||
@error("server") | ||
structure UnsupportedRegionError { | ||
@required | ||
region: String, | ||
} | ||
|
||
@error("client") | ||
structure InvalidPokeballError { | ||
@required | ||
pokeball: String, | ||
} | ||
@error("server") | ||
structure MasterBallUnsuccessful { | ||
message: String, | ||
} | ||
|
||
@error("client") | ||
structure ThrottlingError {} |
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
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