Skip to content
v2.276.0

ArnFormat Enum ​

An enum representing the various ARN formats that different services use.

Example ​

ts
declare const stack: Stack;

// Builds "arn:<PARTITION>:lambda:<REGION>:<ACCOUNT>:function:MyFunction"
stack.formatArn({
  service: 'lambda',
  resource: 'function',
  arnFormat: ArnFormat.COLON_RESOURCE_NAME,
  resourceName: 'MyFunction'
});
python
# stack: Stack


# Builds "arn:<PARTITION>:lambda:<REGION>:<ACCOUNT>:function:MyFunction"
stack.format_arn(
    service="lambda",
    resource="function",
    arn_format=ArnFormat.COLON_RESOURCE_NAME,
    resource_name="MyFunction"
)
java
Stack stack;


// Builds "arn:<PARTITION>:lambda:<REGION>:<ACCOUNT>:function:MyFunction"
stack.formatArn(ArnComponents.builder()
        .service("lambda")
        .resource("function")
        .arnFormat(ArnFormat.COLON_RESOURCE_NAME)
        .resourceName("MyFunction")
        .build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
Stack stack;


// Builds "arn:<PARTITION>:lambda:<REGION>:<ACCOUNT>:function:MyFunction"
stack.FormatArn(new ArnComponents {
    Service = "lambda",
    Resource = "function",
    ArnFormat = ArnFormat.COLON_RESOURCE_NAME,
    ResourceName = "MyFunction"
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var stack Stack


// Builds "arn:<PARTITION>:lambda:<REGION>:<ACCOUNT>:function:MyFunction"
stack.FormatArn(&ArnComponents{
	Service: jsii.String("lambda"),
	Resource: jsii.String("function"),
	ArnFormat: awscdk.ArnFormat_COLON_RESOURCE_NAME,
	ResourceName: jsii.String("MyFunction"),
})

Members ​

MemberDescription
NO_RESOURCE_NAMEThis represents a format where there is no 'resourceName' part.
COLON_RESOURCE_NAMEThis represents a format where the 'resource' and 'resourceName' parts are separated with a colon.
SLASH_RESOURCE_NAMEThis represents a format where the 'resource' and 'resourceName' parts are separated with a slash.
SLASH_RESOURCE_SLASH_RESOURCE_NAMEThis represents a format where the 'resource' and 'resourceName' parts are separated with a slash, but there is also an additional slash after the colon separating 'account' from 'resource'.

Referenced by ​