Class Resource

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
All Implemented Interfaces:
IResource, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable
Direct Known Subclasses:
Accelerator, AccessEntry, AccessKey, AccessPoint, AccessPoint, Activity, Addon, AlarmBase, Alias, AliasBase, ApiDestination, ApiKey, ApiMapping, App, Application, Application, Application, AppsyncFunction, Archive, AttributeGroup, Authorizer, AutoScalingConfiguration, AutoScalingGroup, BackupPlan, BackupSelection, BackupVault, BaseDeploymentConfig, BaseListener, BaseLoadBalancer, BasePathMapping, BaseService, BastionHostLinux, BitBucketSourceCredentials, Branch, BucketBase, BucketPolicy, BuildBase, CachePolicy, Canary, Certificate, Channel, ClientVpnAuthorizationRule, ClientVpnEndpoint, ClientVpnRoute, CloudFrontWebDistribution, Cluster, Cluster, Cluster, Cluster, ClusterParameterGroup, ClusterParameterGroup, ClusterParameterGroup, ClusterSubnetGroup, CodeSigningConfig, ConfigurationSet, ConfigurationSetEventDestination, Connection, Connection, CrossAccountDestination, CustomLambdaDeploymentConfig, CustomPolicy, CustomResource, CustomRule, Dashboard, Database, DatabaseCluster, DatabaseClusterBase, DatabaseClusterBase, DatabaseInstance, DatabaseInstanceBase, DatabaseInstanceBase, DatabaseProxy, DataQualityRuleset, DedicatedIpPool, DeliveryStream, Deployment, DeploymentStrategy, DetectorModel, Distribution, DnsValidatedCertificate, Domain, Domain, Domain, DomainName, DomainName, Ec2Environment, EcsApplication, EcsDeploymentGroup, EcsJobDefinition, EdgeFunction, EgressOnlyInternetGateway, EksJobDefinition, EmailIdentity, Endpoint, EndpointConfig, EndpointGroup, Environment, EventBus, EventBusPolicy, EventInvokeConfig, EventSourceMapping, Extension, FairshareSchedulingPolicy, FargateComputeEnvironment, FileSystem, FileSystemBase, FirewallDomainList, FirewallRuleGroup, FirewallRuleGroupAssociation, Fleet, FleetBase, FlowLog, Function, FunctionBase, FunctionUrl, GameServerGroupBase, GameSessionQueueBase, GatewayResponse, GatewayRoute, GeofenceCollection, GitHubEnterpriseSourceCredentials, GitHubRepository, GitHubSourceCredentials, GraphqlApiBase, Group, Group, HostedZone, HttpApi, HttpAuthorizer, HttpIntegration, HttpNamespace, HttpRoute, HttpStage, IdentityPool, IdentityPoolRoleAttachment, Input, Instance, InstanceBase, InstanceProfile, InternetGateway, Ipam, Job, JobQueue, Key, KeyGroup, KeyPair, KeySigningKey, KeyValueStore, LambdaApplication, LambdaDeploymentGroup, LaunchTemplate, LayerVersion, LazyRole, LifecycleHook, Listener, LoadBalancer, Logging, LogGroup, LogStream, ManagedEc2EcsComputeEnvironment, ManagedEc2EksComputeEnvironment, ManagedPolicy, ManagedRule, MatchmakingConfigurationBase, MatchmakingRuleSetBase, Mesh, Method, MetricFilter, Model, Model, MultiNodeJobDefinition, NatGateway, NetworkAcl, NetworkAclEntry, Nodegroup, NotificationRule, ObservabilityConfiguration, OpenIdConnectProvider, OptionGroup, OriginAccessIdentity, OriginRequestPolicy, ParameterGroup, ParameterGroup, Pipe, Pipeline, PlaceIndex, PlacementGroup, PlaybackKeyPair, Policy, Portfolio, PrefixList, PrivateCertificate, PrivateDnsNamespace, Product, ProfilingGroup, Project, PublicDnsNamespace, PublicKey, QueryDefinition, QueueBase, QueuePolicy, RateLimitedApiKey, RealtimeLogConfig, ReceiptFilter, ReceiptRule, ReceiptRuleSet, RecordSet, ReportGroup, Repository, RepositoryBase, RequestValidator, ResourceBase, ResourcePolicy, ResourcePolicy, ResponseHeadersPolicy, RestApiBase, Role, RotationSchedule, Route, Route, RouteCalculator, RouteTable, Rule, S3OriginAccessControl, SamlProvider, ScalableTarget, Schedule, ScheduledAction, ScriptBase, Secret, SecretTargetAttachment, SecurityConfiguration, SecurityGroup, ServerApplication, ServerDeploymentGroup, ServerlessCluster, ServerlessClusterFromSnapshot, Service, Service, SigningProfile, SlackChannelConfiguration, SourceApiAssociation, StageBase, StateMachine, Stream, StreamKey, StringListParameter, StringParameter, Subnet, SubnetGroup, SubnetGroup, SubnetNetworkAclAssociation, SubnetV2, Subscription, SubscriptionFilter, TableBase, TableBase, TableBaseV2, TagOptions, TaskDefinition, TopicBase, TopicPolicy, TopicRule, Trail, TrustStore, TrustStoreRevocation, UnmanagedComputeEnvironment, UsagePlan, User, UserPool, UserPoolClient, UserPoolDomain, UserPoolIdentityProviderAmazon, UserPoolIdentityProviderApple, UserPoolIdentityProviderFacebook, UserPoolIdentityProviderGoogle, UserPoolIdentityProviderOidc, UserPoolIdentityProviderSaml, UserPoolResourceServer, VdmAttributes, VirtualGateway, VirtualNode, VirtualRouter, VirtualService, Volume, Vpc, VpcConnector, VpcEndpoint, VpcEndpointService, VpcLink, VpcLink, VpcV2Base, VpnConnectionBase, VpnGateway, VPNGatewayV2, WarmPool, WebSocketApi, WebSocketAuthorizer, WebSocketIntegration, WebSocketRoute, WebSocketStage

@Generated(value="jsii-pacmak/1.103.1 (build bef2dea)", date="2024-10-05T03:43:37.577Z") @Stability(Stable) public abstract class Resource extends software.constructs.Construct implements IResource
A construct which represents an AWS resource.

Example:

 public class MyConstruct extends Resource implements ITaggable {
     public final Object tags;
     public MyConstruct(Construct scope, String id) {
         super(scope, id);
         CfnResource.Builder.create(this, "Resource")
                 .type("Whatever::The::Type")
                 .properties(Map.of(
                         // ...
                         "Tags", this.tags.getRenderedTags()))
                 .build();
     }
 }
 
  • Nested Class Summary

    Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject

    software.amazon.jsii.JsiiObject.InitializationMode

    Nested classes/interfaces inherited from interface software.constructs.IConstruct

    software.constructs.IConstruct.Jsii$Default

    Nested classes/interfaces inherited from interface software.amazon.awscdk.IResource

    IResource.Jsii$Default
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Resource(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
     
    protected
    Resource(software.amazon.jsii.JsiiObjectRef objRef)
     
    protected
    Resource(software.constructs.Construct scope, String id)
     
    protected
    Resource(software.constructs.Construct scope, String id, ResourceProps props)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Apply the given removal policy to this resource.
    protected String
     
    The environment this resource belongs to.
    protected String
    Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
    protected String
    getResourceArnAttribute(String arnAttr, ArnComponents arnComponents)
    Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g.
    protected String
    Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g.
    The stack in which this resource is defined.
    static Boolean
    isOwnedResource(software.constructs.IConstruct construct)
    Returns true if the construct was created by CDK, and false otherwise.
    static Boolean
    isResource(software.constructs.IConstruct construct)
    Check whether the given construct is a Resource.

    Methods inherited from class software.constructs.Construct

    getNode, isConstruct, toString

    Methods inherited from class software.amazon.jsii.JsiiObject

    jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface software.constructs.IConstruct

    getNode

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Constructor Details

    • Resource

      protected Resource(software.amazon.jsii.JsiiObjectRef objRef)
    • Resource

      protected Resource(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • Resource

      @Stability(Stable) protected Resource(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable ResourceProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props -
    • Resource

      @Stability(Stable) protected Resource(@NotNull software.constructs.Construct scope, @NotNull String id)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
  • Method Details

    • isOwnedResource

      @Stability(Stable) @NotNull public static Boolean isOwnedResource(@NotNull software.constructs.IConstruct construct)
      Returns true if the construct was created by CDK, and false otherwise.

      Parameters:
      construct - This parameter is required.
    • isResource

      @Stability(Stable) @NotNull public static Boolean isResource(@NotNull software.constructs.IConstruct construct)
      Check whether the given construct is a Resource.

      Parameters:
      construct - This parameter is required.
    • applyRemovalPolicy

      @Stability(Stable) public void applyRemovalPolicy(@NotNull RemovalPolicy policy)
      Apply the given removal policy to this resource.

      The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

      The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

      Specified by:
      applyRemovalPolicy in interface IResource
      Parameters:
      policy - This parameter is required.
    • generatePhysicalName

      @Stability(Stable) @NotNull protected String generatePhysicalName()
    • getResourceArnAttribute

      @Stability(Stable) @NotNull protected String getResourceArnAttribute(@NotNull String arnAttr, @NotNull ArnComponents arnComponents)
      Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. bucket.bucketArn).

      Normally, this token will resolve to arnAttr, but if the resource is referenced across environments, arnComponents will be used to synthesize a concrete ARN with the resource's physical name. Make sure to reference this.physicalName in arnComponents.

      Parameters:
      arnAttr - The CFN attribute which resolves to the ARN of the resource. This parameter is required.
      arnComponents - The format of the ARN of this resource. This parameter is required.
    • getResourceNameAttribute

      @Stability(Stable) @NotNull protected String getResourceNameAttribute(@NotNull String nameAttr)
      Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. bucket.bucketName).

      Normally, this token will resolve to nameAttr, but if the resource is referenced across environments, it will be resolved to this.physicalName, which will be a concrete name.

      Parameters:
      nameAttr - The CFN attribute which resolves to the resource's name. This parameter is required.
    • getEnv

      @Stability(Stable) @NotNull public ResourceEnvironment getEnv()
      The environment this resource belongs to.

      For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.

      Specified by:
      getEnv in interface IResource
    • getPhysicalName

      @Stability(Stable) @NotNull protected String getPhysicalName()
      Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.

      This value will resolve to one of the following:

      • a concrete value (e.g. "my-awesome-bucket")
      • undefined, when a name should be generated by CloudFormation
      • a concrete name generated automatically during synthesis, in cross-environment scenarios.
    • getStack

      @Stability(Stable) @NotNull public Stack getStack()
      The stack in which this resource is defined.
      Specified by:
      getStack in interface IResource