Package software.amazon.awscdk
Interface ArnComponents
- All Superinterfaces:
software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
ArnComponents.Jsii$Proxy
@Generated(value="jsii-pacmak/1.120.0 (build 192dc88)",
date="2025-12-12T17:54:04.005Z")
@Stability(Stable)
public interface ArnComponents
extends software.amazon.jsii.JsiiSerializable
Example:
import software.amazon.awscdk.aws_apigatewayv2_authorizers.WebSocketIamAuthorizer;
import software.amazon.awscdk.aws_apigatewayv2_integrations.WebSocketLambdaIntegration;
// This function handles your connect route
Function connectHandler;
WebSocketApi webSocketApi = new WebSocketApi(this, "WebSocketApi");
webSocketApi.addRoute("$connect", WebSocketRouteOptions.builder()
.integration(new WebSocketLambdaIntegration("Integration", connectHandler))
.authorizer(new WebSocketIamAuthorizer())
.build());
// Create an IAM user (identity)
User user = new User(this, "User");
String webSocketArn = Stack.of(this).formatArn(ArnComponents.builder()
.service("execute-api")
.resource(webSocketApi.getApiId())
.build());
// Grant access to the IAM user
user.attachInlinePolicy(Policy.Builder.create(this, "AllowInvoke")
.statements(List.of(
PolicyStatement.Builder.create()
.actions(List.of("execute-api:Invoke"))
.effect(Effect.ALLOW)
.resources(List.of(webSocketArn))
.build()))
.build());
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classA builder forArnComponentsstatic final classAn implementation forArnComponents -
Method Summary
Modifier and TypeMethodDescriptionstatic ArnComponents.Builderbuilder()default StringThe ID of the AWS account that owns the resource, without the hyphens.default ArnFormatThe specific ARN format to use for this ARN value.default StringThe partition that the resource is in.default StringThe region the resource resides in.Resource type (e.g.default StringResource name or path within the resource (i.e.The service namespace that identifies the AWS product (for example, 's3', 'iam', 'codepipeline').Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getResource
Resource type (e.g. "table", "autoScalingGroup", "certificate"). For some resource types, e.g. S3 buckets, this field defines the bucket name. -
getService
The service namespace that identifies the AWS product (for example, 's3', 'iam', 'codepipeline'). -
getAccount
The ID of the AWS account that owns the resource, without the hyphens.For example, 123456789012. Note that the ARNs for some resources don't require an account number, so this component might be omitted.
Default: The account the stack is deployed to.
-
getArnFormat
The specific ARN format to use for this ARN value.Default: - uses value of `sep` as the separator for formatting, `ArnFormat.SLASH_RESOURCE_NAME` if that property was also not provided
-
getPartition
The partition that the resource is in.For standard AWS regions, the partition is aws. If you have resources in other partitions, the partition is aws-partitionname. For example, the partition for resources in the China (Beijing) region is aws-cn.
Default: The AWS partition the stack is deployed to.
-
getRegion
The region the resource resides in.Note that the ARNs for some resources do not require a region, so this component might be omitted.
Default: The region the stack is deployed to.
-
getResourceName
Resource name or path within the resource (i.e. S3 bucket object key) or a wildcard such as"*". This is service-dependent. -
builder
- Returns:
- a
ArnComponents.BuilderofArnComponents
-