Skip to content

ResourceCleaner

This class encapsulates and extends the ROS resource type ALIYUN::ROS::ResourceCleaner, which is used to create a resource cleaner.

Initializers

import com.aliyun.ros.cdk.ros.ResourceCleaner;
ResourceCleaner.Builder.create(Construct scope, java.lang.String id, java.lang.Boolean enableResourcePropertyConstraint)
    .action(java.lang.String)
    .action(IResolvable)
//  .cleanUpAlgorithm(java.lang.String)
//  .cleanUpAlgorithm(IResolvable)
//  .cleanUpRetryCount(java.lang.Number)
//  .cleanUpRetryCount(IResolvable)
//  .cleanUpTimeout(java.lang.Number)
//  .cleanUpTimeout(IResolvable)
//  .disabledSideEffects(IResolvable)
//  .disabledSideEffects(java.util.List<java.lang.String)
//  .disabledSideEffects(IResolvable>)
//  .excludedResources(IResolvable)
//  .excludedResources(java.util.List<IResolvable)
//  .excludedResources(ExcludedResourcesProperty>)
//  .failureOption(java.lang.String)
//  .failureOption(IResolvable)
//  .mode(java.lang.String)
//  .mode(IResolvable)
//  .resourceFilters(IResolvable)
//  .resourceFilters(java.util.List<IResolvable)
//  .resourceFilters(ResourceFiltersProperty>)
//  .resources(IResolvable)
//  .resources(java.util.List<IResolvable)
//  .resources(ResourcesProperty>)
//  .resourceTypeOrder(IResolvable)
//  .resourceTypeOrder(java.util.List<java.lang.String)
//  .resourceTypeOrder(IResolvable>)
    .build();
Name Type Description
scope com.aliyun.ros.cdk.core.Construct No description.
id java.lang.String No description.
enableResourcePropertyConstraint java.lang.Boolean No description.
action java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property action: Resource cleaner actions: - Scan: Scanning phase.
cleanUpAlgorithm java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property cleanUpAlgorithm: The cleanup algorithm of cleanup phase: - ResourceDependency: Clean up by resource dependency tree.
cleanUpRetryCount java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable Property cleanUpRetryCount: The maximum number of executions of cleanup phase.
cleanUpTimeout java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable Property cleanUpTimeout: The timeout seconds of executions of cleanup phase.
disabledSideEffects com.aliyun.ros.cdk.core.IResolvable OR java.util.List Property disabledSideEffects: Side effects to be disabled.
excludedResources com.aliyun.ros.cdk.core.IResolvable OR java.util.ListExcludedResourcesProperty> Property excludedResources: Exclude parts from resources to be cleaned up.
failureOption java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property failureOption: The failure option of cleanup phase: - Normal: Resource failure does not affect the resources that depend on it.
mode java.lang.String OR com.aliyun.ros.cdk.core.IResolvable Property mode: The result mode of resource cleaner: - Strict: Any scanning or cleanup failure leads to the failure of the cleaner.
resourceFilters com.aliyun.ros.cdk.core.IResolvable OR java.util.ListResourceFiltersProperty> Property resourceFilters: Resource filters that ResourceCleaner uses to filter out the resources to be cleaned up during scanning.
resources com.aliyun.ros.cdk.core.IResolvable OR java.util.ListResourcesProperty> Property resources: Resources to be cleaned up.
resourceTypeOrder com.aliyun.ros.cdk.core.IResolvable OR java.util.List Property resourceTypeOrder: This property takes effect only when property CleanUpAlgorithm is ResourceTypeOrder.

scopeRequired

  • Type: com.aliyun.ros.cdk.core.Construct

idRequired

  • Type: java.lang.String

enableResourcePropertyConstraintOptional

  • Type: java.lang.Boolean

actionRequired

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property action: Resource cleaner actions: - Scan: Scanning phase.

Scan out the resources to be cleaned up.

  • CleanUp: Cleanup phase. Clean up the scanned resources. It it not allowed for resource creation.
  • Scan+CleanUp: Scan first, then CleanUp.
  • ScanWhenCreatingAndUpdating+CleanUpWhenDeleting: Scan when creating or updating resource, and CleanUp when deleting stack.

cleanUpAlgorithmOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property cleanUpAlgorithm: The cleanup algorithm of cleanup phase: - ResourceDependency: Clean up by resource dependency tree.

  • ResourceTypeOrder: Clean up by resource type order. Property ResourceTypeOrder can be used to specify resource type order. If it is not specified, a default order will be used. Default to ResourceDependency.

cleanUpRetryCountOptional

  • Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable

Property cleanUpRetryCount: The maximum number of executions of cleanup phase.

Default to 1, which means no retry. Conditions that trigger a retry: (the relationship is or) 1.There are resources which fail to be cleaned up. 2.The cleanup is timeout.


cleanUpTimeoutOptional

  • Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable

Property cleanUpTimeout: The timeout seconds of executions of cleanup phase.

Default to 1 hour.


disabledSideEffectsOptional

  • Type: com.aliyun.ros.cdk.core.IResolvable OR java.util.List

Property disabledSideEffects: Side effects to be disabled.

Cleaning up some resources will cause some side effects. If is not expected, use the property to disable them. The side effects can be found in response(ResourceCleaner) of API GetFeatureDetails.


excludedResourcesOptional

  • Type: com.aliyun.ros.cdk.core.IResolvable OR java.util.ListExcludedResourcesProperty>

Property excludedResources: Exclude parts from resources to be cleaned up.


failureOptionOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property failureOption: The failure option of cleanup phase: - Normal: Resource failure does not affect the resources that depend on it.

  • Fast: Resource failure causes all resources that depend on it to fail. Default to Normal.

modeOptional

  • Type: java.lang.String OR com.aliyun.ros.cdk.core.IResolvable

Property mode: The result mode of resource cleaner: - Strict: Any scanning or cleanup failure leads to the failure of the cleaner.

  • Loose: Only a little scanning and cleanup failures lead to the failure of the cleaner. Most scanning failures will be ignored, failure messages can be found in ScanErrors or ResourceDetails. Most cleanup failures will be ignored, failure messages can be found in ResourceDetails. Default to Loose.

resourceFiltersOptional

  • Type: com.aliyun.ros.cdk.core.IResolvable OR java.util.ListResourceFiltersProperty>

Property resourceFilters: Resource filters that ResourceCleaner uses to filter out the resources to be cleaned up during scanning.

Only one of ResourceFilters and Resources can be specified. There are two filtering behaviors(Effect): Allow and Deny. The filters work as below: 1.Any resource denied by any Deny filter will not be cleaned up. 2.Only resources allowed by some Allow filter and not denied by any Deny filter will be cleaned up. If filters are changed during resource update, ResourceCleaner requires to rescan. And if Action equals CleanUp, an error occurs.


resourcesOptional

  • Type: com.aliyun.ros.cdk.core.IResolvable OR java.util.ListResourcesProperty>

Property resources: Resources to be cleaned up.

Only one of Resources and ResourceFilters can be specified.


resourceTypeOrderOptional

  • Type: com.aliyun.ros.cdk.core.IResolvable OR java.util.List

Property resourceTypeOrder: This property takes effect only when property CleanUpAlgorithm is ResourceTypeOrder.

If it takes effect:

  • Resources will be cleaned up in order from front to back.
  • Resource with resource type not specified in this property will not be cleaned up.

Methods

Name Description
toString Returns a string representation of this construct.
synthesize Allows this construct to emit artifacts into the cloud assembly during synthesis.
addCondition No description.
addCount No description.
addDependency No description.
addResourceDesc No description.
applyRemovalPolicy No description.
getAtt No description.
setMetadata No description.

toString

public java.lang.String toString()

Returns a string representation of this construct.

synthesize

public void synthesize(ISynthesisSession session)

Allows this construct to emit artifacts into the cloud assembly during synthesis.

This method is usually implemented by framework-level constructs such as Stack and Asset as they participate in synthesizing the cloud assembly.

sessionRequired

  • Type: com.aliyun.ros.cdk.core.ISynthesisSession

The synthesis session.


addCondition

public void addCondition(RosCondition condition)

conditionRequired

  • Type: com.aliyun.ros.cdk.core.RosCondition

addCount

public void addCount(java.lang.Number OR IResolvable count)

countRequired

  • Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable

addDependency

public void addDependency(Resource resource)

resourceRequired

  • Type: com.aliyun.ros.cdk.core.Resource

addResourceDesc

public void addResourceDesc(java.lang.String desc)

descRequired

  • Type: java.lang.String

applyRemovalPolicy

public void applyRemovalPolicy(RemovalPolicy policy)

policyRequired

  • Type: com.aliyun.ros.cdk.core.RemovalPolicy

getAtt

public IResolvable getAtt(java.lang.String name)

nameRequired

  • Type: java.lang.String

setMetadata

public void setMetadata(java.lang.String key, java.lang.Object value)

keyRequired

  • Type: java.lang.String

valueRequired

  • Type: java.lang.Object

Static Functions

Name Description
isConstruct Return whether the given object is a Construct.

isConstruct

import com.aliyun.ros.cdk.ros.ResourceCleaner;
ResourceCleaner.isConstruct(java.lang.Object x)

Return whether the given object is a Construct.

xRequired

  • Type: java.lang.Object

Properties

Name Type Description
node com.aliyun.ros.cdk.core.ConstructNode The construct tree node associated with this construct.
ref java.lang.String No description.
stack com.aliyun.ros.cdk.core.Stack The stack in which this resource is defined.
resource com.aliyun.ros.cdk.core.RosResource No description.
attrCleanResult com.aliyun.ros.cdk.core.IResolvable Attribute CleanResult: The cleanup result.
attrNoCleanupResourceDetails com.aliyun.ros.cdk.core.IResolvable Attribute NoCleanupResourceDetails: The details of the resources that are scanned but filtered.
attrNoCleanupResourcePartialDetails com.aliyun.ros.cdk.core.IResolvable Attribute NoCleanupResourcePartialDetails: The partial details of the resources that are scanned but filtered.
attrResourceDetails com.aliyun.ros.cdk.core.IResolvable Attribute ResourceDetails: The details of resources to be cleaned up.
attrResourcePartialDetails com.aliyun.ros.cdk.core.IResolvable Attribute ResourcePartialDetails: The partial details of resources to be cleaned up.
attrResourceSummary com.aliyun.ros.cdk.core.IResolvable Attribute ResourceSummary: The details of resources to be cleaned up.
attrScanErrors com.aliyun.ros.cdk.core.IResolvable Attribute ScanErrors: The scan errors.

nodeRequired

public ConstructNode getNode();
  • Type: com.aliyun.ros.cdk.core.ConstructNode

The construct tree node associated with this construct.


refRequired

public java.lang.String getRef();
  • Type: java.lang.String

stackRequired

public Stack getStack();
  • Type: com.aliyun.ros.cdk.core.Stack

The stack in which this resource is defined.


resourceOptional

public RosResource getResource();
  • Type: com.aliyun.ros.cdk.core.RosResource

attrCleanResultRequired

public IResolvable getAttrCleanResult();
  • Type: com.aliyun.ros.cdk.core.IResolvable

Attribute CleanResult: The cleanup result.

Valid values:

  • Success: All resources are cleaned up successfully.
  • ResourceFailure: Partial resources fail to clean up.
  • Timeout: Timeout to clean up.
  • CheckFailure: Pre check of cleanup fails.
  • UnknownFailure: Unexpected failure.
  • UserCancelled: Cleanup is cancelled by user.
  • None: Cleanup is not triggered.

attrNoCleanupResourceDetailsRequired

public IResolvable getAttrNoCleanupResourceDetails();
  • Type: com.aliyun.ros.cdk.core.IResolvable

Attribute NoCleanupResourceDetails: The details of the resources that are scanned but filtered.

Only resources with the resource types ResourceCleaner supports and the regions not filtered are scanned. The format is the same as ResourceDetails.


attrNoCleanupResourcePartialDetailsRequired

public IResolvable getAttrNoCleanupResourcePartialDetails();
  • Type: com.aliyun.ros.cdk.core.IResolvable

Attribute NoCleanupResourcePartialDetails: The partial details of the resources that are scanned but filtered.

Only resources with the resource types ResourceCleaner supports and the regions not filtered are scanned. The format is the same as ResourcePartialDetails.


attrResourceDetailsRequired

public IResolvable getAttrResourceDetails();
  • Type: com.aliyun.ros.cdk.core.IResolvable

Attribute ResourceDetails: The details of resources to be cleaned up.

The value is a list of dict. The dict contains the fields below:

  • ResourceType: Resource type of the resource.
  • RegionId: Region ID of the resource.
  • ResourceId: ID of the resource.
  • ResourceName: Name of the resource.
  • CleanupType: Cleanup type of the resource. Valid values:
  • Normal: The resource can be deleted normally.
  • DeleteWithInstance: The resource will be deleted with the resource it belongs to. If the resource it belongs to is filtered or excluded, the deletion probably fails. CleanupTypeReasons give more information.
  • UnableToDelete: Unable to delete the resource. CleanupTypeReasons give more information.
  • CleanupTypeReasons: The information of the related CleanupType.
  • ResourceStatus: Status of the resource. Valid values:
  • Deleting: The resource is deleting.
  • Failure: The deletion of the resource failed.
  • Success: The resource is deleted.
  • Skipped: The deletion of the resource is skipped.
  • Pending: The deletion of the resource is not started.
  • ResourceStatusReason: The information of the related ResourceStatus.
  • Dependencies: The resources that need to be deleted before the deletion of the resource. The value is a list of dict. The dict contains the fields below:
  • ResourceType: Resource type of the dependency resource.
  • RegionId: Region ID of the dependency resource.
  • ResourceId: ID of the dependency resource.

attrResourcePartialDetailsRequired

public IResolvable getAttrResourcePartialDetails();
  • Type: com.aliyun.ros.cdk.core.IResolvable

Attribute ResourcePartialDetails: The partial details of resources to be cleaned up.

The value is a list of dict. The dict contains the fields below:

  • ResourceType: Resource type of the resource.
  • RegionId: Region ID of the resource.
  • ResourceId: ID of the resource.
  • ResourceName: Name of the resource.
  • ResourceStatus: Status of the resource. Valid values:
  • Deleting: The resource is deleting.
  • Failure: The deletion of the resource failed.
  • Success: The resource is deleted.
  • Skipped: The deletion of the resource is skipped.
  • Pending: The deletion of the resource is not started.
  • ResourceStatusReason: The information of the related ResourceStatus.

attrResourceSummaryRequired

public IResolvable getAttrResourceSummary();
  • Type: com.aliyun.ros.cdk.core.IResolvable

Attribute ResourceSummary: The details of resources to be cleaned up.

The value is a list of dict. The dict contains the fields below:

  • ResourceType: Resource type of the resources.
  • DeletingCount: Number of deleting resources of the resource type.
  • SuccessCount: Number of deleted resources of the resource type.
  • FailureCount: Number of resources that failed to delete of the resource type.
  • SkippedCount: Number of skipped resources of the resource type.
  • PendingCount: Number of resources that have not been deleted of the resource type.
  • OtherCount: Number of other resources of the resource type.
  • TotalCount: Number of total resources of the resource type.

attrScanErrorsRequired

public IResolvable getAttrScanErrors();
  • Type: com.aliyun.ros.cdk.core.IResolvable

Attribute ScanErrors: The scan errors.

It takes effect only when property Mode is Loose. The value is a list of dict. The dict contains the fields below:

  • ResourceType: Resource type for scanning.
  • RegionId: Region ID for scanning.
  • ErrorMessage: Error message of scanning with specified resource type and region ID.