Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arn parsing doesn't properly parse the qualifier #5877

Open
1 task done
ynwangn opened this issue Feb 11, 2025 · 2 comments
Open
1 task done

Arn parsing doesn't properly parse the qualifier #5877

ynwangn opened this issue Feb 11, 2025 · 2 comments
Assignees
Labels
bug This issue is a bug. needs-review This issue or PR needs review from the team. p2 This is a standard priority issue

Comments

@ynwangn
Copy link

ynwangn commented Feb 11, 2025

Describe the bug

When I am doing Arn.fromString("arn:aws:ecs:us-east-1:012345678910:task-definition/console-sample-app-dynamic-ports:1"), the resulting arn doesn't properly recognize the qualifier part.

it = {Arn@5622} "arn:aws:ecs:us-east-1:012345678910:task-definition/console-sample-app-dynamic-ports:1"
 partition = "aws"
 service = "ecs"
 region = "us-east-1"
 accountId = "012345678910"
 resource = "task-definition/console-sample-app-dynamic-ports:1"
 arnResource = {ArnResource@7232} "task-definition:console-sample-app-dynamic-ports:1:null"
  resourceType = "task-definition"
  resource = "console-sample-app-dynamic-ports:1"
  qualifier = null

The resource field should be console-sample-app-dynamic-ports and qualifier should be 1.

The Arn parsing was working properly in AWS Java SDK v1.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

According to the javadoc, Arn class should properly handle the arn:<partition>:<service>:<region>:<account>:<resourcetype>/resource:qualifier format arn.

Arn.fromString("arn:aws:ecs:us-east-1:012345678910:task-definition/console-sample-app-dynamic-ports:1") should yield

it = {Arn@5622} "arn:aws:ecs:us-east-1:012345678910:task-definition/console-sample-app-dynamic-ports:1"
 partition = "aws"
 service = "ecs"
 region = "us-east-1"
 accountId = "012345678910"
 resource = "task-definition/console-sample-app-dynamic-ports:1"
 arnResource = {ArnResource@7232} "task-definition:console-sample-app-dynamic-ports:1"
  resourceType = "task-definition"
  resource = "console-sample-app-dynamic-ports"
  qualifier = "1"

Current Behavior

See description above.

Reproduction Steps

Just run Arn.fromString("arn:aws:ecs:us-east-1:012345678910:task-definition/console-sample-app-dynamic-ports:1").

Possible Solution

Arn parsing should properly recognize the qualifier when the arn format is arn:<partition>:<service>:<region>:<account>:<resourcetype>/resource:qualifier

Additional Information/Context

No response

AWS Java SDK version used

2.30.17

JDK version used

21.0.6

Operating System and version

Amazon Linux 2

@ynwangn ynwangn added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 11, 2025
@ynwangn
Copy link
Author

ynwangn commented Feb 11, 2025

Possibly can be fixed in #1890.

@bhoradc bhoradc self-assigned this Feb 11, 2025
@bhoradc
Copy link

bhoradc commented Feb 11, 2025

Hello @ynwangn,

Thank you for reporting the issue. Upon investigation, it appears that the behavior of the qualifier showing as null in SDK version 2.20.135 and above is an expected outcome. This change was introduced by the commit v2.20.135, which intentionally reverted the modifications made in v2.20.132 for handling resource variants in the ArnResource class. Therefore, the null value for the qualifier seems like intended change in behavior after reverting the previous enhancement.

  • With v2.20.132 thru v2.20.134
args = {String[0]@691} []
arnString = "arn:aws:ecs:us-east-1:012345678910:task-definition/console-sample-app-dynamic-ports:10"
arn = {Arn@812} "arn:aws:ecs:us-east-1:012345678910:task-definition/console-sample-app-dynamic-ports:10"
 accountId = "012345678910"
 resource = "task-definition/console-sample-app-dynamic-ports:10"
 partition = "aws"
 service = "ecs"
 region = "us-east-1"
 arnResource = {ArnResource@836} "task-definition:console-sample-app-dynamic-ports:10"
  resourceType = "task-definition"
  resource = "console-sample-app-dynamic-ports"
  qualifier = "10"
  • With v2.20.135 and above
args = {String[0]@691} []
arnString = "arn:aws:ecs:us-east-1:012345678910:task-definition/console-sample-app-dynamic-ports:10"
arn = {Arn@812} "arn:aws:ecs:us-east-1:012345678910:task-definition/console-sample-app-dynamic-ports:10"
 accountId = "012345678910"
 resource = "task-definition/console-sample-app-dynamic-ports:10"
 partition = "aws"
 service = "ecs"
 region = "us-east-1"
 arnResource = {ArnResource@835} "task-definition:console-sample-app-dynamic-ports:10:null"
  resourceType = "task-definition"
  resource = "console-sample-app-dynamic-ports:10"
  qualifier = null

Having said that, I will review this with the team to determine an appropriate course of action.

Regards,
Chaitanya

@bhoradc bhoradc added needs-review This issue or PR needs review from the team. p1 This is a high priority issue p2 This is a standard priority issue and removed needs-triage This issue or PR still needs to be triaged. p1 This is a high priority issue labels Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. needs-review This issue or PR needs review from the team. p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

2 participants