There doesn't seem to be a way to build a ArnResource with useful output.
- Lingua principale
- Java
- Stelle
- 2.6k
- Fork
- 1k
- Merge medio
- 2g 9h
- PR unite (30g)
- 51
Descrizione
The ArnResource.toString() returns - this.resourceType + ":" + this.resource + ":" + this.qualifier
However, the resourceType isn't always required and neither is the qualifer. If these values are not provided, you end up with "null:resource:null". This is particularly an issue with things like lambda arns, where you can't use the resource, or you get "function:my_lambda:null", which makes the ArnResource almost completely useless.
ArnResource resource = ArnResource.builder().resourceType("function").resource("my_lambda").build();
Arn arn = Arn.builder()
.partition("aws")
.service("lambda")
.region(oktaRegion)
.accountId(oktaAccount)
.resource(resource.toString()) //Does not work
.build();
Also, there are several resources where the resourceType is followed by a slash, like with roles, where again, this resource builder is not helpful or even useful.
## Describe the bug
The ArnResource.toString() function does not return a useful value.
## Expected Behavior
I would expect the ArnResource to return something meaningful so that the Arn.Builder is able to use the output.
I would also expect the Arn.Builder to accept the ArnResource as an input, instead of being required to convert it to a string.
I would also expect the ArnResource.Builder (or another implementation of this) to be able to understand how to build a lambda or role resource, or other variants, without having to specify all of the values where they are already known and constant ("function:", "role/", etc).
## Current Behavior
ArnResource.builder().resource("lambda").build().toString() returns "null:lambda:null", when it should be either "function:lambda" or at least just "lambda".
ArnResource.builder().resourceType("role").resource("my_role").build().toString() returns "role:my_role:null", when it should be "role/my_role".
## Steps to Reproduce
System.out.println(ArnResource.builder().resource("lambda").build().toString());
## Possible Solution
Update the toString() method to not output the null values.
Create other implementations, such as a LambdaResource and RoleResource, which have known values.
## Context
I am trying to use the tools given in the SDK to build my ARNs, but these are not extremely useful at the moment.
## Your Environment
* AWS Java SDK version used: 2.16.13
* JDK version used: 11
* Operating System and version: Windows 10
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Start with ArnResource.toString() and Arn.Builder, reproducing the lambda and role examples from the issue. Determine the intended resource formatting and input relationship, then verify that built ARNs no longer contain unwanted null values and support the described resource forms.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- aws, java
- Ambito
- api, backend
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100