-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Services MediaLive and MediaPackage #449
Changes from 5 commits
ca3a821
8bdced8
581a686
22a37b2
fef3700
a70871a
d06bcf1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[package] | ||
name = "medialive-helloworld" | ||
version = "0.1.0" | ||
authors = ["Alistair McLean <mclean@amazon.com>"] | ||
edition = "2018" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
medialive = { package = "aws-sdk-medialive", path = "../../build/aws-sdk/medialive" } | ||
tokio = { version = "1", features = ["full"] } | ||
# used only to enable basic logging: | ||
env_logger = "0.8.2" |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,16 @@ | ||||||||||||||||||||||||||||
#[tokio::main] | ||||||||||||||||||||||||||||
async fn main() -> Result<(), medialive::Error> { | ||||||||||||||||||||||||||||
let client = medialive::Client::from_env(); | ||||||||||||||||||||||||||||
let input_list = client.list_inputs().send().await?; | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
if let Some(inputs) = input_list.inputs { | ||||||||||||||||||||||||||||
inputs.iter().for_each(|i| { | ||||||||||||||||||||||||||||
let input_arn = i.arn.to_owned().unwrap_or_default(); | ||||||||||||||||||||||||||||
let input_name = i.name.to_owned().unwrap_or_default(); | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
println!("Input Name : {}, Input ARN : {}", input_name, input_arn); | ||||||||||||||||||||||||||||
}) | ||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same pattern can be used in the other example There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Awesome, let me make the changes. |
||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
Ok(()) | ||||||||||||||||||||||||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[package] | ||
name = "mediapackage-helloworld" | ||
version = "0.1.0" | ||
authors = ["Alistair McLean <mclean@amazon.com>"] | ||
edition = "2018" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
mediapackage = { package = "aws-sdk-mediapackage", path = "../../build/aws-sdk/mediapackage" } | ||
### To use native TLS: | ||
# mediapackage = { package = "aws-sdk-mediapackage", path = "../../build/aws-sdk/mediapackage", default-features = false, features = ["native-tls"] } | ||
tokio = { version = "1", features = ["full"] } | ||
# used only to enable basic logging: | ||
env_logger = "0.8.2" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
*/ | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<(), mediapackage::Error> { | ||
let client = mediapackage::Client::from_env(); | ||
let list_channels = client.list_channels().send().await?; | ||
|
||
// List out all the mediapackage channels and display their ARN and description. | ||
if let Some(channels) = list_channels.channels { | ||
channels.iter().for_each(|c| { | ||
let description = c.description.to_owned().unwrap_or_default(); | ||
let arn = c.arn.to_owned().unwrap_or_default(); | ||
|
||
println!( | ||
"Channel Description : {}, Channel ARN : {}", | ||
description, arn | ||
); | ||
}); | ||
} | ||
|
||
Ok(()) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[package] | ||
name = "mediapackage-listendpoints" | ||
version = "0.1.0" | ||
authors = ["Alistair McLean <mclean@amazon.com>"] | ||
edition = "2018" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
mediapackage = { package = "aws-sdk-mediapackage", path = "../../build/aws-sdk/mediapackage" } | ||
### To use native TLS: | ||
# mediapackage = { package = "aws-sdk-mediapackage", path = "../../build/aws-sdk/mediapackage", default-features = false, features = ["native-tls"] } | ||
tokio = { version = "1", features = ["full"] } | ||
# used only to enable basic logging: | ||
env_logger = "0.8.2" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
*/ | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<(), mediapackage::Error> { | ||
let client = mediapackage::Client::from_env(); | ||
let or_endpoints = client.list_origin_endpoints().send().await?; | ||
|
||
if let Some(endpoints) = or_endpoints.origin_endpoints { | ||
endpoints.iter().for_each(|e| { | ||
let endpoint_url = e.url.to_owned().unwrap_or_default(); | ||
let endpoint_description = e.description.to_owned().unwrap_or_default(); | ||
println!( | ||
"Endpoint Description: {}, Endpoint URL : {}", | ||
endpoint_description, endpoint_url | ||
); | ||
}) | ||
} | ||
|
||
Ok(()) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the pattern we use a lot for this is
input_list.unwrap_or_default()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like this ?
input_list.inputs.unwrap_or_default().iter().for_each(f)...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added github suggestion