Loading codegen-server-test/model/pokemon.smithy +8 −1 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ use aws.protocols#restJson1 service PokemonService { version: "2021-12-01", resources: [PokemonSpecies, Storage], operations: [GetServerStatistics, EmptyOperation, CapturePokemonOperation], operations: [GetServerStatistics, EmptyOperation, CapturePokemonOperation, HealthCheckOperation], } /// A Pokémon species forms the basis for at least one Pokémon. Loading Loading @@ -241,6 +241,13 @@ structure EmptyOperationInput { } @output structure EmptyOperationOutput { } /// Health check operation, to check the service is up /// Not yet a deep check @readonly @http(uri: "/ping", method: "GET") operation HealthCheckOperation { } @error("client") @httpError(404) structure ResourceNotFoundException { Loading codegen-server-test/python/model/pokemon.smithy +8 −1 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ use aws.protocols#restJson1 service PokemonService { version: "2021-12-01", resources: [PokemonSpecies], operations: [GetServerStatistics, EmptyOperation], operations: [GetServerStatistics, EmptyOperation, HealthCheckOperation], } /// A Pokémon species forms the basis for at least one Pokémon. Loading Loading @@ -123,6 +123,13 @@ structure EmptyOperationInput { } @output structure EmptyOperationOutput { } /// Health check operation, to check the service is up /// Not yet a deep check @readonly @http(uri: "/ping", method: "GET") operation HealthCheckOperation { } @error("client") @httpError(404) structure ResourceNotFoundException { Loading rust-runtime/aws-smithy-http-server-python/examples/pokemon-service-test/tests/simple_integration_test.rs +2 −0 Original line number Diff line number Diff line Loading @@ -47,4 +47,6 @@ async fn simple_integration_test() { let service_statistics_out = client().get_server_statistics().send().await.unwrap(); assert_eq!(2, service_statistics_out.calls_count.unwrap()); let _health_check = client().health_check_operation().send().await.unwrap(); } rust-runtime/aws-smithy-http-server-python/examples/pokemon_service.py +6 −2 Original line number Diff line number Diff line Loading @@ -12,10 +12,10 @@ import threading from libpokemon_service_server_sdk.error import \ ResourceNotFoundException from libpokemon_service_server_sdk.input import ( EmptyOperationInput, GetPokemonSpeciesInput, GetServerStatisticsInput) EmptyOperationInput, GetPokemonSpeciesInput, GetServerStatisticsInput, HealthCheckOperationInput) from libpokemon_service_server_sdk.model import FlavorText, Language from libpokemon_service_server_sdk.output import ( EmptyOperationOutput, GetPokemonSpeciesOutput, GetServerStatisticsOutput) EmptyOperationOutput, GetPokemonSpeciesOutput, GetServerStatisticsOutput, HealthCheckOperationOutput) from libpokemon_service_server_sdk import App Loading Loading @@ -136,6 +136,10 @@ def get_server_statistics( logging.debug("The service handled %d requests", calls_count) return GetServerStatisticsOutput(calls_count=calls_count) @app.health_check_operation def health_check_operation(_: HealthCheckOperationInput) -> HealthCheckOperationOutput: return HealthCheckOperationOutput() ########################################################### # Run the server. ########################################################### Loading rust-runtime/aws-smithy-http-server/examples/pokemon-service/src/lib.rs +5 −0 Original line number Diff line number Diff line Loading @@ -277,6 +277,11 @@ pub async fn empty_operation(_input: input::EmptyOperationInput) -> output::Empt output::EmptyOperationOutput {} } /// Operation used to show the service is running. pub async fn health_check_operation(_input: input::HealthCheckOperationInput) -> output::HealthCheckOperationOutput { output::HealthCheckOperationOutput {} } #[cfg(test)] mod tests { use super::*; Loading Loading
codegen-server-test/model/pokemon.smithy +8 −1 Original line number Diff line number Diff line Loading @@ -10,7 +10,7 @@ use aws.protocols#restJson1 service PokemonService { version: "2021-12-01", resources: [PokemonSpecies, Storage], operations: [GetServerStatistics, EmptyOperation, CapturePokemonOperation], operations: [GetServerStatistics, EmptyOperation, CapturePokemonOperation, HealthCheckOperation], } /// A Pokémon species forms the basis for at least one Pokémon. Loading Loading @@ -241,6 +241,13 @@ structure EmptyOperationInput { } @output structure EmptyOperationOutput { } /// Health check operation, to check the service is up /// Not yet a deep check @readonly @http(uri: "/ping", method: "GET") operation HealthCheckOperation { } @error("client") @httpError(404) structure ResourceNotFoundException { Loading
codegen-server-test/python/model/pokemon.smithy +8 −1 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ use aws.protocols#restJson1 service PokemonService { version: "2021-12-01", resources: [PokemonSpecies], operations: [GetServerStatistics, EmptyOperation], operations: [GetServerStatistics, EmptyOperation, HealthCheckOperation], } /// A Pokémon species forms the basis for at least one Pokémon. Loading Loading @@ -123,6 +123,13 @@ structure EmptyOperationInput { } @output structure EmptyOperationOutput { } /// Health check operation, to check the service is up /// Not yet a deep check @readonly @http(uri: "/ping", method: "GET") operation HealthCheckOperation { } @error("client") @httpError(404) structure ResourceNotFoundException { Loading
rust-runtime/aws-smithy-http-server-python/examples/pokemon-service-test/tests/simple_integration_test.rs +2 −0 Original line number Diff line number Diff line Loading @@ -47,4 +47,6 @@ async fn simple_integration_test() { let service_statistics_out = client().get_server_statistics().send().await.unwrap(); assert_eq!(2, service_statistics_out.calls_count.unwrap()); let _health_check = client().health_check_operation().send().await.unwrap(); }
rust-runtime/aws-smithy-http-server-python/examples/pokemon_service.py +6 −2 Original line number Diff line number Diff line Loading @@ -12,10 +12,10 @@ import threading from libpokemon_service_server_sdk.error import \ ResourceNotFoundException from libpokemon_service_server_sdk.input import ( EmptyOperationInput, GetPokemonSpeciesInput, GetServerStatisticsInput) EmptyOperationInput, GetPokemonSpeciesInput, GetServerStatisticsInput, HealthCheckOperationInput) from libpokemon_service_server_sdk.model import FlavorText, Language from libpokemon_service_server_sdk.output import ( EmptyOperationOutput, GetPokemonSpeciesOutput, GetServerStatisticsOutput) EmptyOperationOutput, GetPokemonSpeciesOutput, GetServerStatisticsOutput, HealthCheckOperationOutput) from libpokemon_service_server_sdk import App Loading Loading @@ -136,6 +136,10 @@ def get_server_statistics( logging.debug("The service handled %d requests", calls_count) return GetServerStatisticsOutput(calls_count=calls_count) @app.health_check_operation def health_check_operation(_: HealthCheckOperationInput) -> HealthCheckOperationOutput: return HealthCheckOperationOutput() ########################################################### # Run the server. ########################################################### Loading
rust-runtime/aws-smithy-http-server/examples/pokemon-service/src/lib.rs +5 −0 Original line number Diff line number Diff line Loading @@ -277,6 +277,11 @@ pub async fn empty_operation(_input: input::EmptyOperationInput) -> output::Empt output::EmptyOperationOutput {} } /// Operation used to show the service is running. pub async fn health_check_operation(_input: input::HealthCheckOperationInput) -> output::HealthCheckOperationOutput { output::HealthCheckOperationOutput {} } #[cfg(test)] mod tests { use super::*; Loading