awslabs / aws-sdk-rust

AWS SDK for the Rust Programming Language
https://awslabs.github.io/aws-sdk-rust/
Apache License 2.0
2.91k stars 245 forks source link

SSM GetParametersInputBuilder.names Doesn't Split Parameters #1150

Closed BenD0G closed 4 weeks ago

BenD0G commented 1 month ago

Describe the bug

GetParametersInputBuilder::names takes a String as input, and just appends the string provided to self.names.

This means that you actually can't query for multiple parameters at the same time if you use .names.

Note that .set_names works as expected.

The AWS CLI says, for aws ssm get-parameters help:

Syntax: "string" "string" ...

It seems to me like names() should take something like &[String].

This SDK project is awesome; keep up the great work! 😄

Expected Behavior

GetParametersInputBuilder::names should take an iterator of parameter names.

Current Behavior

It takes a string, which is already confusing, and doesn't split the string on any delimiter.

Reproduction Steps

let config = aws_config::defaults(BehaviorVersion::latest()).load().await;
let ssm_client = aws_sdk_ssm::Client::new(&config);

let params_result = ssm_client
    .get_parameters()
    .names("PARAM_A PARAM_B")
    .send()
    .await
    .unwrap();

Possible Solution

As above, change the signature of GetParametersInputBuilder::names.

Additional Information/Context

No response

Version

aws-config v1.4.0
aws-sdk-ssm v1.28.0

Environment details (OS name and version, etc.)

WSL2

Logs

No response

ysaito1001 commented 1 month ago

Hi @BenD0G, thank you for bringing this to our attention. I assume you're not blocked by this since .set_names works for your use case?

Usually, operation methods, such as names and signatures, are derived from the original service Smithy model (ex. get_parameters). .name, in this case, a method we render as a helper to append an item to the underlying collection. You can see this pattern (XXX for appending, and set_XXX for overrding) in other SDK crates too (example), which is why .name currently takes a single string and is meant to be used as a helper for appending.

github-actions[bot] commented 1 month ago

Greetings! It looks like this issue hasn’t been active in longer than a week. We encourage you to check if this is still an issue in the latest release. Because it has been longer than a week since the last update on this, and in the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or add an upvote to prevent automatic closure, or if the issue is already closed, please feel free to open a new one.

BenD0G commented 1 day ago

Sorry, missed the notification! Yes you're absolutely right, apologies for the silly question 🙂