aws-sdk-java-v2 icon indicating copy to clipboard operation
aws-sdk-java-v2 copied to clipboard

It would be nice if there were a way to create a canonical arn String from an Arn instance

Open youngm opened this issue 3 years ago • 2 comments

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?

youngm avatar Apr 16 '21 21:04 youngm