Class Arn
Inheritance
Namespace: Amazon.CDK
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class Arn : DeputyBase
Syntax (vb)
Public Class Arn
Inherits DeputyBase
Synopsis
Constructors
Arn(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
Arn(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Methods
ExtractResourceName(String, String) | Extract the full resource name from an ARN. |
Format(IArnComponents, Stack) | Creates an ARN from components. |
Split(String, ArnFormat) | Splits the provided ARN into its components. |
Constructors
Arn(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected Arn(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
Arn(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected Arn(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Methods
ExtractResourceName(String, String)
Extract the full resource name from an ARN.
public static string ExtractResourceName(string arn, string resourceType)
Parameters
- arn System.String
- resourceType System.String
Returns
System.String
Remarks
Necessary for resource names (paths) that may contain the separator, like
arn:aws:iam::111111111111:role/path/to/role/name
.
Only works if we statically know the expected resourceType
beforehand, since we're going
to use that to split the string on ':<resourceType>/' (and take the right-hand side).
We can't extract the 'resourceType' from the ARN at hand, because CloudFormation Expressions
only allow literals in the 'separator' argument to { Fn::Split }
, and so it can't be
{ Fn::Select: [5, { Fn::Split: [':', ARN] }}
.
Only necessary for ARN formats for which the type-name separator is /
.
Format(IArnComponents, Stack)
Creates an ARN from components.
public static string Format(IArnComponents components, Stack stack = null)
Parameters
- components IArnComponents
- stack Stack
Returns
System.String
Remarks
If partition
, region
or account
are not specified, the stack's
partition, region and account will be used.
If any component is the empty string, an empty string will be inserted into the generated ARN at the location that component corresponds to.
The ARN will be formatted as follows:
arn:{partition}:{service}:{region}:{account}:{resource}{sep}{resource-name}
The required ARN pieces that are omitted will be taken from the stack that the 'scope' is attached to. If all ARN pieces are supplied, the supplied scope can be 'undefined'.
Split(String, ArnFormat)
Splits the provided ARN into its components.
public static IArnComponents Split(string arn, ArnFormat arnFormat)
Parameters
- arn System.String
the ARN to split into its components.
- arnFormat ArnFormat
the expected format of 'arn' - depends on what format the service 'arn' represents uses.
Returns
Remarks
Works both if 'arn' is a string like 'arn:aws:s3:::bucket', and a Token representing a dynamic CloudFormation expression (in which case the returned components will also be dynamic CloudFormation expressions, encoded as Tokens).