Experimental
@aws-cdk/aws-imagebuilder-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
LifecyclePolicyDetail Struct
Configuration details for the lifecycle policy rules.
Example
ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as imagebuilder_alpha from '@aws-cdk/aws-imagebuilder-alpha';
import * as cdk from 'aws-cdk-lib';
const lifecyclePolicyDetail: imagebuilder_alpha.LifecyclePolicyDetail = {
action: {
type: imagebuilder_alpha.LifecyclePolicyActionType.DELETE,
// the properties below are optional
includeAmis: false,
includeContainers: false,
includeSnapshots: false,
},
filter: {
ageFilter: {
age: cdk.Duration.minutes(30),
// the properties below are optional
retainAtLeast: 123,
},
countFilter: {
count: 123,
},
},
// the properties below are optional
exclusionRules: {
amiExclusionRules: {
isPublic: false,
lastLaunched: cdk.Duration.minutes(30),
regions: ['regions'],
sharedAccounts: ['sharedAccounts'],
tags: {
tagsKey: 'tags',
},
},
imageExclusionRules: {
tags: {
tagsKey: 'tags',
},
},
},
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_imagebuilder_alpha as imagebuilder_alpha
import aws_cdk as cdk
lifecycle_policy_detail = imagebuilder_alpha.LifecyclePolicyDetail(
action=imagebuilder_alpha.LifecyclePolicyAction(
type=imagebuilder_alpha.LifecyclePolicyActionType.DELETE,
# the properties below are optional
include_amis=False,
include_containers=False,
include_snapshots=False
),
filter=imagebuilder_alpha.LifecyclePolicyFilter(
age_filter=imagebuilder_alpha.LifecyclePolicyAgeFilter(
age=cdk.Duration.minutes(30),
# the properties below are optional
retain_at_least=123
),
count_filter=imagebuilder_alpha.LifecyclePolicyCountFilter(
count=123
)
),
# the properties below are optional
exclusion_rules=imagebuilder_alpha.LifecyclePolicyExclusionRules(
ami_exclusion_rules=imagebuilder_alpha.LifecyclePolicyAmiExclusionRules(
is_public=False,
last_launched=cdk.Duration.minutes(30),
regions=["regions"],
shared_accounts=["sharedAccounts"],
tags={
"tags_key": "tags"
}
),
image_exclusion_rules=imagebuilder_alpha.LifecyclePolicyImageExclusionRules(
tags={
"tags_key": "tags"
}
)
)
)
java
// 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.alpha.*;
import software.amazon.awscdk.*;
LifecyclePolicyDetail lifecyclePolicyDetail = LifecyclePolicyDetail.builder()
.action(LifecyclePolicyAction.builder()
.type(LifecyclePolicyActionType.DELETE)
// the properties below are optional
.includeAmis(false)
.includeContainers(false)
.includeSnapshots(false)
.build())
.filter(LifecyclePolicyFilter.builder()
.ageFilter(LifecyclePolicyAgeFilter.builder()
.age(Duration.minutes(30))
// the properties below are optional
.retainAtLeast(123)
.build())
.countFilter(LifecyclePolicyCountFilter.builder()
.count(123)
.build())
.build())
// the properties below are optional
.exclusionRules(LifecyclePolicyExclusionRules.builder()
.amiExclusionRules(LifecyclePolicyAmiExclusionRules.builder()
.isPublic(false)
.lastLaunched(Duration.minutes(30))
.regions(List.of("regions"))
.sharedAccounts(List.of("sharedAccounts"))
.tags(Map.of(
"tagsKey", "tags"))
.build())
.imageExclusionRules(LifecyclePolicyImageExclusionRules.builder()
.tags(Map.of(
"tagsKey", "tags"))
.build())
.build())
.build();
csharp
// Install: dotnet add package Amazon.CDK.AWS.ImageBuilder.Alpha
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.ImageBuilder.Alpha;
using Amazon.CDK;
var lifecyclePolicyDetail = new LifecyclePolicyDetail {
Action = new LifecyclePolicyAction {
Type = LifecyclePolicyActionType.DELETE,
// the properties below are optional
IncludeAmis = false,
IncludeContainers = false,
IncludeSnapshots = false
},
Filter = new LifecyclePolicyFilter {
AgeFilter = new LifecyclePolicyAgeFilter {
Age = Duration.Minutes(30),
// the properties below are optional
RetainAtLeast = 123
},
CountFilter = new LifecyclePolicyCountFilter {
Count = 123
}
},
// the properties below are optional
ExclusionRules = new LifecyclePolicyExclusionRules {
AmiExclusionRules = new LifecyclePolicyAmiExclusionRules {
IsPublic = false,
LastLaunched = Duration.Minutes(30),
Regions = new [] { "regions" },
SharedAccounts = new [] { "sharedAccounts" },
Tags = new Dictionary<string, string> {
{ "tagsKey", "tags" }
}
},
ImageExclusionRules = new LifecyclePolicyImageExclusionRules {
Tags = new Dictionary<string, string> {
{ "tagsKey", "tags" }
}
}
}
};
go
// Install: go get github.com/aws/aws-cdk-go/awsimagebuilderalpha/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import imagebuilder_alpha "github.com/aws/aws-cdk-go/awsimagebuilderalpha"
import "github.com/aws/aws-cdk-go/awscdk"
lifecyclePolicyDetail := &LifecyclePolicyDetail{
Action: &LifecyclePolicyAction{
Type: imagebuilder_alpha.LifecyclePolicyActionType_DELETE,
// the properties below are optional
IncludeAmis: jsii.Boolean(false),
IncludeContainers: jsii.Boolean(false),
IncludeSnapshots: jsii.Boolean(false),
},
Filter: &LifecyclePolicyFilter{
AgeFilter: &LifecyclePolicyAgeFilter{
Age: cdk.Duration_Minutes(jsii.Number(30)),
// the properties below are optional
RetainAtLeast: jsii.Number(123),
},
CountFilter: &LifecyclePolicyCountFilter{
Count: jsii.Number(123),
},
},
// the properties below are optional
ExclusionRules: &LifecyclePolicyExclusionRules{
AmiExclusionRules: &LifecyclePolicyAmiExclusionRules{
IsPublic: jsii.Boolean(false),
LastLaunched: cdk.Duration_*Minutes(jsii.Number(30)),
Regions: []*string{
jsii.String("regions"),
},
SharedAccounts: []*string{
jsii.String("sharedAccounts"),
},
Tags: map[string]*string{
"tagsKey": jsii.String("tags"),
},
},
ImageExclusionRules: &LifecyclePolicyImageExclusionRules{
Tags: map[string]*string{
"tagsKey": jsii.String("tags"),
},
},
},
}
Properties
actionLifecyclePolicyActionactionLifecyclePolicyActionactionLifecyclePolicyActionActionLifecyclePolicyActionActionLifecyclePolicyActionrequired#The action to perform in the lifecycle policy rule.
exclusionRulesoptionalLifecyclePolicyExclusionRulesexclusion_rulesoptionalLifecyclePolicyExclusionRulesexclusionRulesoptionalLifecyclePolicyExclusionRulesExclusionRulesoptionalLifecyclePolicyExclusionRulesExclusionRulesoptionalLifecyclePolicyExclusionRules#The rules to apply for excluding resources from the lifecycle policy rule.
Default: no exclusion rules are applied on any resource
filterLifecyclePolicyFilterfilterLifecyclePolicyFilterfilterLifecyclePolicyFilterFilterLifecyclePolicyFilterFilterLifecyclePolicyFilterrequired#The resource filtering to apply in the lifecycle policy rule.