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

Accessing Possible Values of an enum Without an Instance #2388

Closed
1 of 2 tasks
ChihweiLHBird opened this issue Nov 22, 2023 · 3 comments
Closed
1 of 2 tasks

Accessing Possible Values of an enum Without an Instance #2388

ChihweiLHBird opened this issue Nov 22, 2023 · 3 comments
Labels
feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged.

Comments

@ChihweiLHBird
Copy link

ChihweiLHBird commented Nov 22, 2023

Describe the feature

It would be nice if enum values can be accessed without an instance of it.

For example, to get all possible values of BucketLocationConstraint, I have to do:

types.BucketLocationConstraintCaCentral1.Values()

This is not very intuitive because the Values are all available values, not just for a single one. I think a standalone function can be better:

types.BucketLocationConstraintValues()

Use Case

Any case where enum needs to be validated

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

AWS Go SDK V2 Module Versions Used

github.com/aws/aws-sdk-go-v2 v1.23.1

Go version used

go version go1.21.4 darwin/arm64

@ChihweiLHBird ChihweiLHBird added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Nov 22, 2023
@ChihweiLHBird ChihweiLHBird changed the title Accessing Values of enums Without an Instance Accessing Possible Values of an enum Without an Instance Nov 22, 2023
@lucix-aws
Copy link
Contributor

There's an existing idiomatic way to get the desired behavior here - when you need to call some method on a type where the receiver doesn't matter, you can do so on a typecast of the underlying zero value:

types.BucketLocationConstraint("").Values()

I don't see us going the suggested route since there's no value add compared to the above.

I'd also point out that it's in generally in our interest to not introduce our own derived names into codegenned packages since they could conflict with future service updates.

@lucix-aws lucix-aws closed this as not planned Won't fix, can't repro, duplicate, stale Nov 27, 2023
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.

@ChihweiLHBird
Copy link
Author

Hi @lucix-aws,
Thanks for the response. The main problem of this is that it's ugly, but I would respect your decision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

2 participants