Skip to content

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

Closed
@youngm

Description

@youngm

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

added
feature-requestA feature should be added or improved.
needs-triageThis issue or PR still needs to be triaged.
on Apr 16, 2021
debora-ito

debora-ito commented on Apr 21, 2021

@debora-ito
Member

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.

added
bugThis issue is a bug.
and removed
feature-requestA feature should be added or improved.
needs-triageThis issue or PR still needs to be triaged.
on Apr 21, 2021
added a commit that references this issue on Mar 13, 2023

Merge pull request #2416 from aws/staging/f326f82a-b566-4ebc-8a30-608…

c86624f
rtatton

rtatton commented on Dec 20, 2023

@rtatton

@debora-ito Is there any plan to fix this?

added a commit that references this issue on Feb 20, 2024
9a82896
added a commit that references this issue on Mar 7, 2024
5b7ec50
github-actions

github-actions commented on Mar 7, 2024

@github-actions

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.

added a commit that references this issue on Jun 28, 2024
2157f12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.p2This is a standard priority issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @youngm@debora-ito@rtatton@yasminetalby

      Issue actions

        It would be nice if there were a way to create a canonical arn String from an Arn instance · Issue #2416 · aws/aws-sdk-java-v2