It would be nice if there were a way to create a canonical arn String from an Arn instance
I love the software.amazon.awssdk.arns.Arn class that exists and use it heavily. with fromString(). However, the toString() method does not create an arn that can then be consumed with fromString() and be equal to eachother if fields are missing.
System.out.println(
Arn.builder().resource("groovy").partition("partition").service("service").build());
Produces the output:
arn:partition:service:null:null:groovy
which when parsed again produces null values for region and such.
Describe the Feature
It would be nice if there were a method (perhaps toString()?) that could produce a properly formatted arn string taking into account null values.
- [X] I may be able to implement this feature request
I'd like to have some guidance though. Should I just modify toString() or make another method?
My Arn syntax knowledge isn't great. Can I just put an empty value between the : for all the non-required fields?
Hi @youngm, thank you for reaching out.
The nulls in arn:partition:service:null:null:groovy do not look good, I'm changing this to a bug report.
Yes, it would be empty values, e.g. this is a valid Arn for an S3 bucket called my-bucket: arn:aws:s3:::my-bucket.
Changing the current toString() method should work.
@debora-ito Is there any plan to fix this?
This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.