Closed
Description
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.
- 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?
Activity
debora-ito commentedon Apr 21, 2021
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.Merge pull request #2416 from aws/staging/f326f82a-b566-4ebc-8a30-608…
rtatton commentedon Dec 20, 2023
@debora-ito Is there any plan to fix this?
Modify ARN toString to print a valid ARN when there's no region or ac…
Modify ARN toString to print a valid ARN when there's no region or ac…
github-actions commentedon Mar 7, 2024
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.
Modify ARN toString to print a valid ARN when there's no region or ac…