Skip to content
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

DescribeImagesFluentBuilder's image_ids function does not take a Vec<String> as the docs say #825

Closed
cole-h opened this issue Jun 12, 2023 · 4 comments
Labels
bug This issue is a bug. documentation This is a problem with documentation p2 This is a standard priority issue

Comments

@cole-h
Copy link

cole-h commented Jun 12, 2023

Describe the bug

The docs for Client::describe_images say that the image_ids function should accept a Vec<String>, but the function only accepts impl Into<String>, not impl Into<Vec<String>>. However, set_image_ids accepts an Option<Vec<String>>, so I can work around it for now.

Expected Behavior

I expected to be able to pass a list of image ids to this function, not a single image id.

Current Behavior

error[E0277]: the trait bound `std::string::String: From<Vec<std::string::String>>` is not satisfied
   --> src/main.rs:79:63
    |
79  |             let amis = ec2_client.describe_images().image_ids(amis);
    |                                                     --------- ^^^^ the trait `From<Vec<std::string::String>>` is not implemented for `std::string::String`
    |                                                     |
    |                                                     required by a bound introduced by this call
    |
    = help: the following other types implement trait `From<T>`:
              <std::string::String as From<&mut str>>
              <std::string::String as From<&std::string::String>>
              <std::string::String as From<&str>>
              <std::string::String as From<Box<str>>>
              <std::string::String as From<Cow<'a, str>>>
              <std::string::String as From<Id>>
              <std::string::String as From<Str>>
              <std::string::String as From<char>>
    = note: required for `Vec<std::string::String>` to implement `Into<std::string::String>`
note: required by a bound in `DescribeImagesFluentBuilder::image_ids`
   --> /home/vin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-sdk-ec2-0.28.0/src/operation/describe_images/builders.rs:240:44
    |
240 |     pub fn image_ids(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
    |                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `DescribeImagesFluentBuilder::image_ids`

Reproduction Steps

Try to compile the following:

#[tokio::main]
async fn main() {
    let region_provider =
        aws_config::meta::region::RegionProviderChain::default_provider().or_else("us-east-2");
    let shared_config = aws_config::from_env().region(region_provider).load().await;
    let ec2_client = aws_sdk_ec2::Client::new(&shared_config);

    let amis = vec![String::from("ami-testtest")];

    let amis = ec2_client.describe_images().image_ids(amis); // this fails to compile
    // let amis = ec2_client.describe_images().set_image_ids(Some(amis)); // this works
}

Possible Solution

Just change the type signature to also accept a Vec<String> :D

Additional Information/Context

No response

Version

$ cargo tree | grep aws-
├── aws-config v0.55.3
│   ├── aws-credential-types v0.55.3
│   │   ├── aws-smithy-async v0.55.3
│   │   ├── aws-smithy-types v0.55.3
│   ├── aws-http v0.55.3
│   │   ├── aws-credential-types v0.55.3 (*)
│   │   ├── aws-smithy-http v0.55.3
│   │   │   ├── aws-smithy-types v0.55.3 (*)
│   │   ├── aws-smithy-types v0.55.3 (*)
│   │   ├── aws-types v0.55.3
│   │   │   ├── aws-credential-types v0.55.3 (*)
│   │   │   ├── aws-smithy-async v0.55.3 (*)
│   │   │   ├── aws-smithy-client v0.55.3
│   │   │   │   ├── aws-smithy-async v0.55.3 (*)
│   │   │   │   ├── aws-smithy-http v0.55.3 (*)
│   │   │   │   ├── aws-smithy-http-tower v0.55.3
│   │   │   │   │   ├── aws-smithy-http v0.55.3 (*)
│   │   │   │   │   ├── aws-smithy-types v0.55.3 (*)
│   │   │   │   ├── aws-smithy-types v0.55.3 (*)
│   │   │   ├── aws-smithy-http v0.55.3 (*)
│   │   │   ├── aws-smithy-types v0.55.3 (*)
│   ├── aws-sdk-sso v0.28.0
│   │   ├── aws-credential-types v0.55.3 (*)
│   │   ├── aws-endpoint v0.55.3
│   │   │   ├── aws-smithy-http v0.55.3 (*)
│   │   │   ├── aws-smithy-types v0.55.3 (*)
│   │   │   ├── aws-types v0.55.3 (*)
│   │   ├── aws-http v0.55.3 (*)
│   │   ├── aws-sig-auth v0.55.3
│   │   │   ├── aws-credential-types v0.55.3 (*)
│   │   │   ├── aws-sigv4 v0.55.3
│   │   │   │   ├── aws-smithy-http v0.55.3 (*)
│   │   │   ├── aws-smithy-http v0.55.3 (*)
│   │   │   ├── aws-types v0.55.3 (*)
│   │   ├── aws-smithy-async v0.55.3 (*)
│   │   ├── aws-smithy-client v0.55.3 (*)
│   │   ├── aws-smithy-http v0.55.3 (*)
│   │   ├── aws-smithy-http-tower v0.55.3 (*)
│   │   ├── aws-smithy-json v0.55.3
│   │   │   └── aws-smithy-types v0.55.3 (*)
│   │   ├── aws-smithy-types v0.55.3 (*)
│   │   ├── aws-types v0.55.3 (*)
│   ├── aws-sdk-sts v0.28.0
│   │   ├── aws-credential-types v0.55.3 (*)
│   │   ├── aws-endpoint v0.55.3 (*)
│   │   ├── aws-http v0.55.3 (*)
│   │   ├── aws-sig-auth v0.55.3 (*)
│   │   ├── aws-smithy-async v0.55.3 (*)
│   │   ├── aws-smithy-client v0.55.3 (*)
│   │   ├── aws-smithy-http v0.55.3 (*)
│   │   ├── aws-smithy-http-tower v0.55.3 (*)
│   │   ├── aws-smithy-json v0.55.3 (*)
│   │   ├── aws-smithy-query v0.55.3
│   │   │   ├── aws-smithy-types v0.55.3 (*)
│   │   ├── aws-smithy-types v0.55.3 (*)
│   │   ├── aws-smithy-xml v0.55.3
│   │   ├── aws-types v0.55.3 (*)
│   ├── aws-smithy-async v0.55.3 (*)
│   ├── aws-smithy-client v0.55.3 (*)
│   ├── aws-smithy-http v0.55.3 (*)
│   ├── aws-smithy-http-tower v0.55.3 (*)
│   ├── aws-smithy-json v0.55.3 (*)
│   ├── aws-smithy-types v0.55.3 (*)
│   ├── aws-types v0.55.3 (*)
├── aws-sdk-ec2 v0.28.0
│   ├── aws-credential-types v0.55.3 (*)
│   ├── aws-endpoint v0.55.3 (*)
│   ├── aws-http v0.55.3 (*)
│   ├── aws-sig-auth v0.55.3 (*)
│   ├── aws-smithy-async v0.55.3 (*)
│   ├── aws-smithy-client v0.55.3 (*)
│   ├── aws-smithy-http v0.55.3 (*)
│   ├── aws-smithy-http-tower v0.55.3 (*)
│   ├── aws-smithy-json v0.55.3 (*)
│   ├── aws-smithy-query v0.55.3 (*)
│   ├── aws-smithy-types v0.55.3 (*)
│   ├── aws-smithy-xml v0.55.3 (*)
│   ├── aws-types v0.55.3 (*)

Environment details (OS name and version, etc.)

Linux

Logs

No response

@cole-h cole-h added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jun 12, 2023
@rcoh
Copy link
Contributor

rcoh commented Jun 13, 2023

ah—That looks like a bug in the root docs. If you look at the docs for the function itself you will see:
Screen Shot 2023-06-13 at 9 23 06 AM

the image_ids function appends for you which is often more convenient to use. You'll find this pattern generally across the SDK in all functions that accept collections

@rcoh rcoh added documentation This is a problem with documentation good first issue Good for newcomers and removed needs-triage This issue or PR still needs to be triaged. labels Jun 13, 2023
@cole-h
Copy link
Author

cole-h commented Jun 13, 2023

Ahhh, gotcha. Thanks for the clarification!

@rcoh rcoh added the p2 This is a standard priority issue label Aug 8, 2023
github-merge-queue bot pushed a commit to smithy-lang/smithy-rs that referenced this issue Aug 14, 2023
Previously the docs said `Vec<String>` when the method actually accepted
`String`, similarly for HashMap.

## Motivation and Context
- awslabs/aws-sdk-rust#825

## Description
Fix the generator to be aware of Vec/Hashmap methods

## Testing
- UT
- [x] audit codegen diff

## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
aws-sdk-rust-ci pushed a commit that referenced this issue Aug 23, 2023
…members (#2914)

Previously the docs said `Vec<String>` when the method actually accepted
`String`, similarly for HashMap.

## Motivation and Context
- #825

## Description
Fix the generator to be aware of Vec/Hashmap methods

## Testing
- UT
- [x] audit codegen diff

## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
@rcoh rcoh added pending-release This issue will be fixed by an approved PR that hasn't been released yet. and removed good first issue Good for newcomers labels Aug 29, 2023
@rcoh
Copy link
Contributor

rcoh commented Aug 29, 2023

this was actually released, we're just still in the docs queue

@rcoh rcoh closed this as completed Aug 29, 2023
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@rcoh rcoh removed the pending-release This issue will be fixed by an approved PR that hasn't been released yet. label Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. documentation This is a problem with documentation p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

2 participants