-
Notifications
You must be signed in to change notification settings - Fork 195
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
Conversation
…ist endpoints shows the endpoints
let client = medialive::Client::from_env(); | ||
let input_list = client.list_inputs().send().await?; | ||
|
||
if let Some(inputs) = input_list.inputs { |
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
Looks good—we're trying to migrate to one-crate-per-service with multiple binaries to make it a little more manageable when we have 260 services. Let me know if you need any guidance on making that refactoring. Otherwise LGTM! |
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 comment
The reason will be displayed to describe this comment to others. Learn more.
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); | |
}) | |
} | |
for input in input_list.inputs.unwrap_or_default() { | |
let input_arn = input.arn.as_deref().unwrap_or_default(); | |
let input_name = input.name.as_deref().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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
as_deref()
goes from Option<T>
to Option<&T>
when allows you do unwrap without taking ownership
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.
Awesome, let me make the changes.
Thanks! |
Description of changes:
Adding medialive and mediapackage models with minimal code examples for each.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.