I am prepared to invest in the necessary development effort to at least make a first public version of this available.
A class able to parse the useful pieces of information and delineate them within an ARN string. This does not need to happen automatically to begin with (i.e. where ARNs are represented in API responses, these need not for today have to be converted from the String type they typically are). It would also make sense that the Object also carries a .toString() method that returns the ARN as it's usually transmitted.
Presently the Java SDK provides no means of supporting this as ARNs are typically reprsented as String types within fields.
There is however several examples of prior art: The Go SDK provides the ability to do so, in addition to a 3rd part library in Java.
I propose including a new parser inside of the util package space, as well as a new object to represent all the common fields. Additional classes may be created in their respective service namespaces and extended as needed however I feel that may be outside of scope for the initial work.
N/A as this is a feature request.
Within my organisation I have noticed several different implementations of trying to perform this task (e.g. wanting to extract the account ID from an ARN, or other such values). This reinvention and use of splitting on colon has lead to poor code showing up in our code base and I believe as there is usage elsewhere there would be a benefit to all having it present within the core SDK.
N/A as this is a feature request.
In tigertoes/aws-sdk-java-v2@18f791e I've made a first past go at including this functionality - early feedback on this would be greatly appreciated. I'll be looking to add more tests and address the TODOs that should be removed prior to raising a pull request alongside with any other comments given to me.
@zoewangg @tigertoes please, apply this fix to main branch
@tigertoes, I really like that you have done this. The only feedback that I have is that the "getter" methods do not follow the fairly ubiquitous Java naming conventions for getters, such as "getPartition", "getService", "getRegion", etc., so as a long-time Java developer I was a little confused when trying to pull up the methods with code completion. I recommend naming them to follow the common "Java-isms". The same with the Builder--naming that many Java developers will be familiar with would be "withPartition", "withService", etc. This is nitpicking but might make it a bit easier to use.
@nathanagood thank you for the feedback, I've incorporated those changes into tigertoes/aws-sdk-java-v2@eaf7d1a.
This is implemented in #1462. You can parse an arn string via Arn#fromString
The feature has been released as part of 2.9.18. Closing the issue.
Most helpful comment
In tigertoes/aws-sdk-java-v2@18f791e I've made a first past go at including this functionality - early feedback on this would be greatly appreciated. I'll be looking to add more tests and address the TODOs that should be removed prior to raising a pull request alongside with any other comments given to me.