API Gateway examples using SDK for Rust - AWS SDK for Rust

API Gateway examples using SDK for Rust

The following code examples show you how to perform actions and implement common scenarios by using the AWS SDK for Rust with API Gateway.

Actions are code excerpts from larger programs and must be run in context. While actions show you how to call individual service functions, you can see actions in context in their related scenarios.

Scenarios are code examples that show you how to accomplish specific tasks by calling multiple functions within a service or combined with other AWS services.

Each example includes a link to the complete source code, where you can find instructions on how to set up and run the code in context.

Actions

The following code example shows how to use GetRestApis.

SDK for Rust
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

Displays the Amazon API Gateway REST APIs in the Region.

async fn show_apis(client: &Client) -> Result<(), Error> { let resp = client.get_rest_apis().send().await?; for api in resp.items() { println!("ID: {}", api.id().unwrap_or_default()); println!("Name: {}", api.name().unwrap_or_default()); println!("Description: {}", api.description().unwrap_or_default()); println!("Version: {}", api.version().unwrap_or_default()); println!( "Created: {}", api.created_date().unwrap().to_chrono_utc()? ); println!(); } Ok(()) }
  • For API details, see GetRestApis in AWS SDK for Rust API reference.

Scenarios

The following code example shows how to create a serverless application that lets users manage photos using labels.

SDK for Rust

Shows how to develop a photo asset management application that detects labels in images using Amazon Rekognition and stores them for later retrieval.

For complete source code and instructions on how to set up and run, see the full example on GitHub.

For a deep dive into the origin of this example see the post on AWS Community.

Services used in this example
  • API Gateway

  • DynamoDB

  • Lambda

  • Amazon Rekognition

  • Amazon S3

  • Amazon SNS