Class CfnLifecyclePolicy

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.101.0 (build b95fe5d)", date="2024-07-12T19:34:03.066Z") @Stability(Stable) public class CfnLifecyclePolicy extends CfnResource implements IInspectable
Create a lifecycle policy resource.

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.imagebuilder.*;
 CfnLifecyclePolicy cfnLifecyclePolicy = CfnLifecyclePolicy.Builder.create(this, "MyCfnLifecyclePolicy")
         .executionRole("executionRole")
         .name("name")
         .policyDetails(List.of(PolicyDetailProperty.builder()
                 .action(ActionProperty.builder()
                         .type("type")
                         // the properties below are optional
                         .includeResources(IncludeResourcesProperty.builder()
                                 .amis(false)
                                 .containers(false)
                                 .snapshots(false)
                                 .build())
                         .build())
                 .filter(FilterProperty.builder()
                         .type("type")
                         .value(123)
                         // the properties below are optional
                         .retainAtLeast(123)
                         .unit("unit")
                         .build())
                 // the properties below are optional
                 .exclusionRules(ExclusionRulesProperty.builder()
                         .amis(AmiExclusionRulesProperty.builder()
                                 .isPublic(false)
                                 .lastLaunched(LastLaunchedProperty.builder()
                                         .unit("unit")
                                         .value(123)
                                         .build())
                                 .regions(List.of("regions"))
                                 .sharedAccounts(List.of("sharedAccounts"))
                                 .tagMap(Map.of(
                                         "tagMapKey", "tagMap"))
                                 .build())
                         .tagMap(Map.of(
                                 "tagMapKey", "tagMap"))
                         .build())
                 .build()))
         .resourceSelection(ResourceSelectionProperty.builder()
                 .recipes(List.of(RecipeSelectionProperty.builder()
                         .name("name")
                         .semanticVersion("semanticVersion")
                         .build()))
                 .tagMap(Map.of(
                         "tagMapKey", "tagMap"))
                 .build())
         .resourceType("resourceType")
         // the properties below are optional
         .description("description")
         .status("status")
         .tags(Map.of(
                 "tagsKey", "tags"))
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnLifecyclePolicy

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

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

      @Stability(Stable) public CfnLifecyclePolicy(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnLifecyclePolicyProps props)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
      props - Resource properties. This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector - tree inspector to collect and process attributes. This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrArn

      @Stability(Stable) @NotNull public String getAttrArn()
      The Amazon Resource Name (ARN) of the lifecycle policy resource.
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getExecutionRole

      @Stability(Stable) @NotNull public String getExecutionRole()
      The name or Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to run lifecycle actions.
    • setExecutionRole

      @Stability(Stable) public void setExecutionRole(@NotNull String value)
      The name or Amazon Resource Name (ARN) for the IAM role you create that grants Image Builder access to run lifecycle actions.
    • getName

      @Stability(Stable) @NotNull public String getName()
      The name of the lifecycle policy to create.
    • setName

      @Stability(Stable) public void setName(@NotNull String value)
      The name of the lifecycle policy to create.
    • getPolicyDetails

      @Stability(Stable) @NotNull public Object getPolicyDetails()
      Configuration details for the lifecycle policy rules.
    • setPolicyDetails

      @Stability(Stable) public void setPolicyDetails(@NotNull IResolvable value)
      Configuration details for the lifecycle policy rules.
    • setPolicyDetails

      @Stability(Stable) public void setPolicyDetails(@NotNull List<Object> value)
      Configuration details for the lifecycle policy rules.
    • getResourceSelection

      @Stability(Stable) @NotNull public Object getResourceSelection()
      Selection criteria for the resources that the lifecycle policy applies to.
    • setResourceSelection

      @Stability(Stable) public void setResourceSelection(@NotNull IResolvable value)
      Selection criteria for the resources that the lifecycle policy applies to.
    • setResourceSelection

      @Stability(Stable) public void setResourceSelection(@NotNull CfnLifecyclePolicy.ResourceSelectionProperty value)
      Selection criteria for the resources that the lifecycle policy applies to.
    • getResourceType

      @Stability(Stable) @NotNull public String getResourceType()
      The type of Image Builder resource that the lifecycle policy applies to.
    • setResourceType

      @Stability(Stable) public void setResourceType(@NotNull String value)
      The type of Image Builder resource that the lifecycle policy applies to.
    • getDescription

      @Stability(Stable) @Nullable public String getDescription()
      Optional description for the lifecycle policy.
    • setDescription

      @Stability(Stable) public void setDescription(@Nullable String value)
      Optional description for the lifecycle policy.
    • getStatus

      @Stability(Stable) @Nullable public String getStatus()
      Indicates whether the lifecycle policy resource is enabled.
    • setStatus

      @Stability(Stable) public void setStatus(@Nullable String value)
      Indicates whether the lifecycle policy resource is enabled.
    • getTags

      @Stability(Stable) @Nullable public Map<String,String> getTags()
      Tags to apply to the lifecycle policy resource.
    • setTags

      @Stability(Stable) public void setTags(@Nullable Map<String,String> value)
      Tags to apply to the lifecycle policy resource.