Class Arn
- All Implemented Interfaces:
ToCopyableBuilder<Arn.Builder,
Arn>
The primary supported Arn format is:
arn:<partition>:<service>:<region>:<account>:<resource>
resourceAsString()
returns everything after the account section of the Arn
as a single string.
However, the following Arn formats are supported where the values are present and well
formatted through resource()
:
arn:<partition>:<service>:<region>:<account>:<resourcetype>/resource arn:<partition>:<service>:<region>:<account>:<resourcetype>/resource/qualifier arn:<partition>:<service>:<region>:<account>:<resourcetype>/resource:qualifier arn:<partition>:<service>:<region>:<account>:<resourcetype>:resource arn:<partition>:<service>:<region>:<account>:<resourcetype>:resource:qualifier
resource()
returns a ArnResource
which has access
to ArnResource.resourceType()
, ArnResource.resource()
and
ArnResource.qualifier()
.
To parse an Arn from a string use Arn.fromString(). To convert an Arn to it's string representation use Arn.toString().
For instance, for a string s, containing a well-formed Arn the following should always be true:
Arn theArn = Arn.fromString(s); s.equals(theArn.toString());
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic Arn.Builder
builder()
boolean
static Arn
fromString
(String arn) Parses a given string into anArn
.int
hashCode()
region()
resource()
service()
Take this object and create a builder that contains all of the current property values of this object.toString()
tryFromString
(String arn) Attempts to parse the given string into anArn
.Methods inherited from interface software.amazon.awssdk.utils.builder.ToCopyableBuilder
copy
-
Method Details
-
partition
- Returns:
- The partition that the resource is in.
-
service
- Returns:
- The service namespace that identifies the AWS product (for example, Amazon S3, IAM, or Amazon RDS).
-
region
-
accountId
-
resource
- Returns:
ArnResource
-
resourceAsString
- Returns:
- the resource as string
-
builder
- Returns:
- a builder for
Arn
.
-
tryFromString
Attempts to parse the given string into anArn
. If the input string is not a valid ARN, this method returnsOptional.empty()
instead of throwing an exception.When successful, the resource is accessible entirely as a string through
resourceAsString()
. Where correctly formatted, a parsed resource containing resource type, resource and qualifier is available throughresource()
.- Parameters:
arn
- A string containing an ARN to parse.- Returns:
- An
Optional
containing the parsedArn
if valid, or empty if invalid. - Throws:
IllegalArgumentException
- if the ARN contains empty partition or service fields
-
fromString
Parses a given string into anArn
. The resource is accessible entirely as a string throughresourceAsString()
. Where correctly formatted, a parsed resource containing resource type, resource and qualifier is available throughresource()
.- Parameters:
arn
- - A string containing an Arn.- Returns:
Arn
- A modeled Arn.
-
toString
-
equals
-
hashCode
-
toBuilder
Description copied from interface:ToCopyableBuilder
Take this object and create a builder that contains all of the current property values of this object.- Specified by:
toBuilder
in interfaceToCopyableBuilder<Arn.Builder,
Arn> - Returns:
- a builder for type T
-