Arn
Static Functions
| Name | Description |
|---|---|
ExtractResourceName | Extract the full resource name from an ARN. |
Format | Creates an ARN from components. |
Split | Splits the provided ARN into its components. |
ExtractResourceName
import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Arn_ExtractResourceName(arn *string, resourceType *string) *string
Extract the full resource name from an ARN.
Necessary for resource names (paths) that may contain the separator, like acs:ram::123456789012****:role/adminrole/alice.
Only works if we statically know the expected resourceType beforehand, since we're going to use that to split the string on ':
We can't extract the 'resourceType' from the ARN at hand, because ROS 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 /.
- Type: *string
- Type: *string
Format
import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Arn_Format(components ArnComponents, stack Stack) *string
Creates an ARN from components.
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:
{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'.
- Type: ArnComponents
- Type: Stack
Split
import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.Arn_Split(arn interface{}, arnFormat ArnFormat) ArnComponents
Splits the provided ARN into its components.
Works both if 'arn' is a string like 'acs:oss:::bucket', and a Token representing a dynamic CloudFormation expression (in which case the returned components will also be dynamic ROS expressions, encoded as Tokens).
- Type: interface{}
the ARN to split into its components.
- Type: ArnFormat
the expected format of 'arn' - depends on what format the service 'arn' represents uses.