ResourceCleaner
This class encapsulates and extends the ROS resource type ALIYUN::ROS::ResourceCleaner
, which is used to create a resource cleaner.
Initializers
import ros_cdk_ros
ros_cdk_ros.ResourceCleaner(
scope: Construct,
id: str,
action: typing.Union[str, IResolvable],
clean_up_algorithm: typing.Union[str, IResolvable] = None,
clean_up_retry_count: typing.Union[typing.Union[int, float], IResolvable] = None,
clean_up_timeout: typing.Union[typing.Union[int, float], IResolvable] = None,
disabled_side_effects: typing.Union[IResolvable, typing.List[typing.Union[str, IResolvable]]] = None,
excluded_resources: typing.Union[IResolvable, typing.List[typing.Union[IResolvable, ExcludedResourcesProperty]]] = None,
failure_option: typing.Union[str, IResolvable] = None,
mode: typing.Union[str, IResolvable] = None,
resource_filters: typing.Union[IResolvable, typing.List[typing.Union[IResolvable, ResourceFiltersProperty]]] = None,
resources: typing.Union[IResolvable, typing.List[typing.Union[IResolvable, ResourcesProperty]]] = None,
resource_type_order: typing.Union[IResolvable, typing.List[typing.Union[str, IResolvable]]] = None,
enable_resource_property_constraint: bool = None
)
Name | Type | Description |
---|---|---|
scope |
ros_cdk_core.Construct |
No description. |
id |
str |
No description. |
action |
typing.Union[str, ros_cdk_core.IResolvable] |
Property action: Resource cleaner actions: - Scan: Scanning phase. |
clean_up_algorithm |
typing.Union[str, ros_cdk_core.IResolvable] |
Property cleanUpAlgorithm: The cleanup algorithm of cleanup phase: - ResourceDependency: Clean up by resource dependency tree. |
clean_up_retry_count |
typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable] |
Property cleanUpRetryCount: The maximum number of executions of cleanup phase. |
clean_up_timeout |
typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable] |
Property cleanUpTimeout: The timeout seconds of executions of cleanup phase. |
disabled_side_effects |
typing.Union[ros_cdk_core.IResolvable, typing.List[typing.Union[str, ros_cdk_core.IResolvable]]] |
Property disabledSideEffects: Side effects to be disabled. |
excluded_resources |
typing.Union[ros_cdk_core.IResolvable, typing.List[typing.Union[ros_cdk_core.IResolvable, ExcludedResourcesProperty]]] |
Property excludedResources: Exclude parts from resources to be cleaned up. |
failure_option |
typing.Union[str, 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 |
typing.Union[str, 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. |
resource_filters |
typing.Union[ros_cdk_core.IResolvable, typing.List[typing.Union[ros_cdk_core.IResolvable, ResourceFiltersProperty]]] |
Property resourceFilters: Resource filters that ResourceCleaner uses to filter out the resources to be cleaned up during scanning. |
resources |
typing.Union[ros_cdk_core.IResolvable, typing.List[typing.Union[ros_cdk_core.IResolvable, ResourcesProperty]]] |
Property resources: Resources to be cleaned up. |
resource_type_order |
typing.Union[ros_cdk_core.IResolvable, typing.List[typing.Union[str, ros_cdk_core.IResolvable]]] |
Property resourceTypeOrder: This property takes effect only when property CleanUpAlgorithm is ResourceTypeOrder. |
enable_resource_property_constraint |
bool |
No description. |
scope
Required
- Type: ros_cdk_core.Construct
id
Required
- Type: str
action
Required
- Type: typing.Union[str, 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.
clean_up_algorithm
Optional
- Type: typing.Union[str, 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.
clean_up_retry_count
Optional
- Type: typing.Union[typing.Union[int, float], 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.
clean_up_timeout
Optional
- Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]
Property cleanUpTimeout: The timeout seconds of executions of cleanup phase.
Default to 1 hour.
disabled_side_effects
Optional
- Type: typing.Union[ros_cdk_core.IResolvable, typing.List[typing.Union[str, ros_cdk_core.IResolvable]]]
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.
excluded_resources
Optional
- Type: typing.Union[ros_cdk_core.IResolvable, typing.List[typing.Union[ros_cdk_core.IResolvable, ExcludedResourcesProperty]]]
Property excludedResources: Exclude parts from resources to be cleaned up.
failure_option
Optional
- Type: typing.Union[str, 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: typing.Union[str, 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.
resource_filters
Optional
- Type: typing.Union[ros_cdk_core.IResolvable, typing.List[typing.Union[ros_cdk_core.IResolvable, 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: typing.Union[ros_cdk_core.IResolvable, typing.List[typing.Union[ros_cdk_core.IResolvable, ResourcesProperty]]]
Property resources: Resources to be cleaned up.
Only one of Resources and ResourceFilters can be specified.
resource_type_order
Optional
- Type: typing.Union[ros_cdk_core.IResolvable, typing.List[typing.Union[str, ros_cdk_core.IResolvable]]]
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.
enable_resource_property_constraint
Optional
- Type: bool
Methods
Name | Description |
---|---|
to_string |
Returns a string representation of this construct. |
synthesize |
Allows this construct to emit artifacts into the cloud assembly during synthesis. |
add_condition |
No description. |
add_count |
No description. |
add_dependency |
No description. |
add_resource_desc |
No description. |
apply_removal_policy |
No description. |
get_att |
No description. |
set_metadata |
No description. |
to_string
def to_string() -> str
Returns a string representation of this construct.
synthesize
def synthesize(
session: ISynthesisSession
) -> None
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: ros_cdk_core.ISynthesisSession
The synthesis session.
add_condition
def add_condition(
condition: RosCondition
) -> None
- Type: ros_cdk_core.RosCondition
add_count
def add_count(
count: typing.Union[typing.Union[int, float], IResolvable]
) -> None
- Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]
add_dependency
def add_dependency(
resource: Resource
) -> None
- Type: ros_cdk_core.Resource
add_resource_desc
def add_resource_desc(
desc: str
) -> None
- Type: str
apply_removal_policy
def apply_removal_policy(
policy: RemovalPolicy
) -> None
- Type: ros_cdk_core.RemovalPolicy
get_att
def get_att(
name: str
) -> IResolvable
- Type: str
set_metadata
def set_metadata(
key: str,
value: typing.Any
) -> None
- Type: str
- Type: typing.Any
Static Functions
Name | Description |
---|---|
is_construct |
Return whether the given object is a Construct. |
is_construct
import ros_cdk_ros
ros_cdk_ros.ResourceCleaner.is_construct(
x: typing.Any
)
Return whether the given object is a Construct.
- Type: typing.Any
Properties
Name | Type | Description |
---|---|---|
node |
ros_cdk_core.ConstructNode |
The construct tree node associated with this construct. |
ref |
str |
No description. |
stack |
ros_cdk_core.Stack |
The stack in which this resource is defined. |
resource |
ros_cdk_core.RosResource |
No description. |
attr_clean_result |
ros_cdk_core.IResolvable |
Attribute CleanResult: The cleanup result. |
attr_no_cleanup_resource_details |
ros_cdk_core.IResolvable |
Attribute NoCleanupResourceDetails: The details of the resources that are scanned but filtered. |
attr_no_cleanup_resource_partial_details |
ros_cdk_core.IResolvable |
Attribute NoCleanupResourcePartialDetails: The partial details of the resources that are scanned but filtered. |
attr_resource_details |
ros_cdk_core.IResolvable |
Attribute ResourceDetails: The details of resources to be cleaned up. |
attr_resource_partial_details |
ros_cdk_core.IResolvable |
Attribute ResourcePartialDetails: The partial details of resources to be cleaned up. |
attr_resource_summary |
ros_cdk_core.IResolvable |
Attribute ResourceSummary: The details of resources to be cleaned up. |
attr_scan_errors |
ros_cdk_core.IResolvable |
Attribute ScanErrors: The scan errors. |
node
Required
node: ConstructNode
- Type: ros_cdk_core.ConstructNode
The construct tree node associated with this construct.
ref
Required
ref: str
- Type: str
stack
Required
stack: Stack
- Type: ros_cdk_core.Stack
The stack in which this resource is defined.
resource
Optional
resource: RosResource
- Type: ros_cdk_core.RosResource
attr_clean_result
Required
attr_clean_result: IResolvable
- Type: 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.
attr_no_cleanup_resource_details
Required
attr_no_cleanup_resource_details: IResolvable
- Type: 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.
attr_no_cleanup_resource_partial_details
Required
attr_no_cleanup_resource_partial_details: IResolvable
- Type: 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.
attr_resource_details
Required
attr_resource_details: IResolvable
- Type: 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.
attr_resource_partial_details
Required
attr_resource_partial_details: IResolvable
- Type: 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.
attr_resource_summary
Required
attr_resource_summary: IResolvable
- Type: 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.
attr_scan_errors
Required
attr_scan_errors: IResolvable
- Type: 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.