MediaPackage examples using SDK for Rust - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

MediaPackage 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 MediaPackage.

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.

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.

Topics

Actions

The following code example shows how to use ListChannels.

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.

List channel ARNs and descriptions.

async fn show_channels(client: &Client) -> Result<(), Error> { let list_channels = client.list_channels().send().await?; println!("Channels:"); for c in list_channels.channels() { let description = c.description().unwrap_or_default(); let arn = c.arn().unwrap_or_default(); println!(" Description : {}", description); println!(" ARN : {}", arn); println!(); } Ok(()) }
  • For API details, see ListChannels in AWS SDK for Rust API reference.

The following code example shows how to use ListOriginEndpoints.

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.

List your endpoint descriptions and URLs.

async fn show_endpoints(client: &Client) -> Result<(), Error> { let or_endpoints = client.list_origin_endpoints().send().await?; println!("Endpoints:"); for e in or_endpoints.origin_endpoints() { let endpoint_url = e.url().unwrap_or_default(); let endpoint_description = e.description().unwrap_or_default(); println!(" Description: {}", endpoint_description); println!(" URL : {}", endpoint_url); println!(); } Ok(()) }