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.List |
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.List |
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.List |
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. |
scope
Required
- Type: com.aliyun.ros.cdk.core.Construct
id
Required
- Type: java.lang.String
enableResourcePropertyConstraint
Optional
- Type: java.lang.Boolean
action
Required
- 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.
cleanUpAlgorithm
Optional
- 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.
cleanUpRetryCount
Optional
- 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.
cleanUpTimeout
Optional
- 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.
disabledSideEffects
Optional
- 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.
excludedResources
Optional
- Type: com.aliyun.ros.cdk.core.IResolvable OR java.util.List
ExcludedResourcesProperty>
Property excludedResources: Exclude parts from resources to be cleaned up.
failureOption
Optional
- 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.
mode
Optional
- 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.
resourceFilters
Optional
- Type: com.aliyun.ros.cdk.core.IResolvable OR java.util.List
ResourceFiltersProperty>
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.
resources
Optional
- Type: com.aliyun.ros.cdk.core.IResolvable OR java.util.List
ResourcesProperty>
Property resources: Resources to be cleaned up.
Only one of Resources and ResourceFilters can be specified.
resourceTypeOrder
Optional
- 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.
- Type: com.aliyun.ros.cdk.core.ISynthesisSession
The synthesis session.
addCondition
public void addCondition(RosCondition condition)
- Type: com.aliyun.ros.cdk.core.RosCondition
addCount
public void addCount(java.lang.Number OR IResolvable count)
- Type: java.lang.Number OR com.aliyun.ros.cdk.core.IResolvable
addDependency
public void addDependency(Resource resource)
- Type: com.aliyun.ros.cdk.core.Resource
addResourceDesc
public void addResourceDesc(java.lang.String desc)
- Type: java.lang.String
applyRemovalPolicy
public void applyRemovalPolicy(RemovalPolicy policy)
- Type: com.aliyun.ros.cdk.core.RemovalPolicy
getAtt
public IResolvable getAtt(java.lang.String name)
- Type: java.lang.String
setMetadata
public void setMetadata(java.lang.String key, java.lang.Object value)
- Type: java.lang.String
- 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.
- 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. |
node
Required
public ConstructNode getNode();
- Type: com.aliyun.ros.cdk.core.ConstructNode
The construct tree node associated with this construct.
ref
Required
public java.lang.String getRef();
- Type: java.lang.String
stack
Required
public Stack getStack();
- Type: com.aliyun.ros.cdk.core.Stack
The stack in which this resource is defined.
resource
Optional
public RosResource getResource();
- Type: com.aliyun.ros.cdk.core.RosResource
attrCleanResult
Required
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.
attrNoCleanupResourceDetails
Required
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.
attrNoCleanupResourcePartialDetails
Required
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.
attrResourceDetails
Required
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.
attrResourcePartialDetails
Required
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.
attrResourceSummary
Required
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.
attrScanErrors
Required
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.