Interface ArnComponents

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
ArnComponents.Jsii$Proxy

@Generated(value="jsii-pacmak/1.103.1 (build bef2dea)", date="2024-10-11T15:55:51.910Z") @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());
 
  • Method Details

    • getResource

      @Stability(Stable) @NotNull String getResource()
      Resource type (e.g. "table", "autoScalingGroup", "certificate"). For some resource types, e.g. S3 buckets, this field defines the bucket name.
    • getService

      @Stability(Stable) @NotNull String getService()
      The service namespace that identifies the AWS product (for example, 's3', 'iam', 'codepipeline').
    • getAccount

      @Stability(Stable) @Nullable default String 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

      @Stability(Stable) @Nullable default ArnFormat 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

      @Stability(Stable) @Nullable default String 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

      @Stability(Stable) @Nullable default String 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

      @Stability(Stable) @Nullable default String getResourceName()
      Resource name or path within the resource (i.e. S3 bucket object key) or a wildcard such as "*". This is service-dependent.
    • builder

      @Stability(Stable) static ArnComponents.Builder builder()
      Returns:
      a ArnComponents.Builder of ArnComponents