Class CfnAutomationRule

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.CfnElement
software.amazon.awscdk.CfnRefElement
software.amazon.awscdk.CfnResource
software.amazon.awscdk.services.computeoptimizer.CfnAutomationRule
All Implemented Interfaces:
IInspectable, IAutomationRuleRef, IEnvironmentAware, ITaggableV2, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.127.0 (build 2117ad5)", date="2026-03-19T12:55:01.612Z") @Stability(Stable) public class CfnAutomationRule extends CfnResource implements IInspectable, IAutomationRuleRef, ITaggableV2
Creates an AWS Compute Optimizer automation rule that automatically implements recommended actions based on your defined criteria and schedule.

Automation rules are global resources that manage automated actions across all AWS Regions where Compute Optimizer Automation is available. Organization-level rules can only be created by the management account or delegated administrator.

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.computeoptimizer.*;
 CfnAutomationRule cfnAutomationRule = CfnAutomationRule.Builder.create(this, "MyCfnAutomationRule")
         .name("name")
         .recommendedActionTypes(List.of("recommendedActionTypes"))
         .ruleType("ruleType")
         .schedule(ScheduleProperty.builder()
                 .executionWindowInMinutes(123)
                 .scheduleExpression("scheduleExpression")
                 .scheduleExpressionTimezone("scheduleExpressionTimezone")
                 .build())
         .status("status")
         // the properties below are optional
         .criteria(CriteriaProperty.builder()
                 .ebsVolumeSizeInGib(List.of(IntegerCriteriaConditionProperty.builder()
                         .comparison("comparison")
                         .values(List.of(123))
                         .build()))
                 .ebsVolumeType(List.of(StringCriteriaConditionProperty.builder()
                         .comparison("comparison")
                         .values(List.of("values"))
                         .build()))
                 .estimatedMonthlySavings(List.of(DoubleCriteriaConditionProperty.builder()
                         .comparison("comparison")
                         .values(List.of(123))
                         .build()))
                 .lookBackPeriodInDays(List.of(IntegerCriteriaConditionProperty.builder()
                         .comparison("comparison")
                         .values(List.of(123))
                         .build()))
                 .region(List.of(StringCriteriaConditionProperty.builder()
                         .comparison("comparison")
                         .values(List.of("values"))
                         .build()))
                 .resourceArn(List.of(StringCriteriaConditionProperty.builder()
                         .comparison("comparison")
                         .values(List.of("values"))
                         .build()))
                 .resourceTag(List.of(ResourceTagsCriteriaConditionProperty.builder()
                         .comparison("comparison")
                         .key("key")
                         .values(List.of("values"))
                         .build()))
                 .restartNeeded(List.of(StringCriteriaConditionProperty.builder()
                         .comparison("comparison")
                         .values(List.of("values"))
                         .build()))
                 .build())
         .description("description")
         .organizationConfiguration(OrganizationConfigurationProperty.builder()
                 .accountIds(List.of("accountIds"))
                 .ruleApplyOrder("ruleApplyOrder")
                 .build())
         .priority("priority")
         .tags(List.of(CfnTag.builder()
                 .key("key")
                 .value("value")
                 .build()))
         .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

    • CfnAutomationRule

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

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

      @Stability(Stable) public CfnAutomationRule(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnAutomationRuleProps props)
      Create a new AWS::ComputeOptimizer::AutomationRule.

      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

    • isCfnAutomationRule

      @Stability(Stable) @NotNull public static Boolean isCfnAutomationRule(@NotNull Object x)
      Checks whether the given object is a CfnAutomationRule.

      Parameters:
      x - This parameter is required.
    • 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.
    • getAttrAccountId

      @Stability(Stable) @NotNull public String getAttrAccountId()
      The AWS account ID that owns the automation rule.
    • getAttrCreatedTimestamp

      @Stability(Stable) @NotNull public String getAttrCreatedTimestamp()
      The timestamp when the automation rule was created.
    • getAttrLastUpdatedTimestamp

      @Stability(Stable) @NotNull public String getAttrLastUpdatedTimestamp()
      The timestamp when the automation rule was last updated.
    • getAttrRuleArn

      @Stability(Stable) @NotNull public String getAttrRuleArn()
      The Amazon Resource Name (ARN) of the automation rule.
    • getAttrRuleId

      @Stability(Stable) @NotNull public String getAttrRuleId()
      The unique identifier of the automation rule.
    • getAttrRuleRevision

      @Stability(Stable) @NotNull public String getAttrRuleRevision()
      The revision number of the automation rule.
    • getAutomationRuleRef

      @Stability(Stable) @NotNull public AutomationRuleReference getAutomationRuleRef()
      A reference to a AutomationRule resource.
      Specified by:
      getAutomationRuleRef in interface IAutomationRuleRef
    • getCdkTagManager

      @Stability(Stable) @NotNull public TagManager getCdkTagManager()
      Tag Manager which manages the tags for this resource.
      Specified by:
      getCdkTagManager in interface ITaggableV2
    • getCfnProperties

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

      @Stability(Stable) @NotNull public String getName()
      The name of the automation rule.
    • setName

      @Stability(Stable) public void setName(@NotNull String value)
      The name of the automation rule.
    • getRecommendedActionTypes

      @Stability(Stable) @NotNull public List<String> getRecommendedActionTypes()
      The types of recommended actions this rule will implement.
    • setRecommendedActionTypes

      @Stability(Stable) public void setRecommendedActionTypes(@NotNull List<String> value)
      The types of recommended actions this rule will implement.
    • getRuleType

      @Stability(Stable) @NotNull public String getRuleType()
      The type of automation rule.
    • setRuleType

      @Stability(Stable) public void setRuleType(@NotNull String value)
      The type of automation rule.
    • getSchedule

      @Stability(Stable) @NotNull public Object getSchedule()
    • setSchedule

      @Stability(Stable) public void setSchedule(@NotNull IResolvable value)
    • setSchedule

      @Stability(Stable) public void setSchedule(@NotNull CfnAutomationRule.ScheduleProperty value)
    • getStatus

      @Stability(Stable) @NotNull public String getStatus()
      The status of the automation rule.
    • setStatus

      @Stability(Stable) public void setStatus(@NotNull String value)
      The status of the automation rule.
    • getCriteria

      @Stability(Stable) @Nullable public Object getCriteria()
    • setCriteria

      @Stability(Stable) public void setCriteria(@Nullable IResolvable value)
    • setCriteria

      @Stability(Stable) public void setCriteria(@Nullable CfnAutomationRule.CriteriaProperty value)
    • getDescription

      @Stability(Stable) @Nullable public String getDescription()
      The description of the automation rule.
    • setDescription

      @Stability(Stable) public void setDescription(@Nullable String value)
      The description of the automation rule.
    • getOrganizationConfiguration

      @Stability(Stable) @Nullable public Object getOrganizationConfiguration()
    • setOrganizationConfiguration

      @Stability(Stable) public void setOrganizationConfiguration(@Nullable IResolvable value)
    • setOrganizationConfiguration

      @Stability(Stable) public void setOrganizationConfiguration(@Nullable CfnAutomationRule.OrganizationConfigurationProperty value)
    • getPriority

      @Stability(Stable) @Nullable public String getPriority()
      Rule priority within its group.
    • setPriority

      @Stability(Stable) public void setPriority(@Nullable String value)
      Rule priority within its group.
    • getTags

      @Stability(Stable) @Nullable public List<CfnTag> getTags()
      Tags associated with the automation rule.
    • setTags

      @Stability(Stable) public void setTags(@Nullable List<CfnTag> value)
      Tags associated with the automation rule.