/
awscdk_RemovalPolicy.go
91 lines (87 loc) · 3.5 KB
/
awscdk_RemovalPolicy.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// Version 2 of the AWS Cloud Development Kit library
package awscdk
// Possible values for a resource's Removal Policy.
//
// The removal policy controls what happens to the resource if it stops being
// managed by CloudFormation. This can happen in one of three situations:
//
// - The resource is removed from the template, so CloudFormation stops managing it;
// - A change to the resource is made that requires it to be replaced, so CloudFormation stops
// managing it;
// - The stack is deleted, so CloudFormation stops managing all resources in it.
//
// The Removal Policy applies to all above cases.
//
// Many stateful resources in the AWS Construct Library will accept a
// `removalPolicy` as a property, typically defaulting it to `RETAIN`.
//
// If the AWS Construct Library resource does not accept a `removalPolicy`
// argument, you can always configure it by using the escape hatch mechanism,
// as shown in the following example:
//
// ```ts
// declare const bucket: s3.Bucket;
//
// const cfnBucket = bucket.node.findChild('Resource') as CfnResource;
// cfnBucket.applyRemovalPolicy(RemovalPolicy.DESTROY);
// ```.
//
// Example:
// import opensearch "github.com/aws/aws-cdk-go/awscdk"
//
// var api graphqlApi
//
//
// user := iam.NewUser(this, jsii.String("User"))
// domain := opensearch.NewDomain(this, jsii.String("Domain"), &domainProps{
// version: opensearch.engineVersion_OPENSEARCH_1_3(),
// removalPolicy: awscdk.RemovalPolicy_DESTROY,
// fineGrainedAccessControl: &advancedSecurityOptions{
// masterUserArn: user.userArn,
// },
// encryptionAtRest: &encryptionAtRestOptions{
// enabled: jsii.Boolean(true),
// },
// nodeToNodeEncryption: jsii.Boolean(true),
// enforceHttps: jsii.Boolean(true),
// })
// ds := api.addOpenSearchDataSource(jsii.String("ds"), domain)
//
// ds.createResolver(&baseResolverProps{
// typeName: jsii.String("Query"),
// fieldName: jsii.String("getTests"),
// requestMappingTemplate: appsync.mappingTemplate.fromString(jSON.stringify(map[string]interface{}{
// "version": jsii.String("2017-02-28"),
// "operation": jsii.String("GET"),
// "path": jsii.String("/id/post/_search"),
// "params": map[string]map[string]interface{}{
// "headers": map[string]interface{}{
// },
// "queryString": map[string]interface{}{
// },
// "body": map[string]*f64{
// "from": jsii.Number(0),
// "size": jsii.Number(50),
// },
// },
// })),
// responseMappingTemplate: appsync.*mappingTemplate.fromString(jsii.String("[\n #foreach($entry in $context.result.hits.hits)\n #if( $velocityCount > 1 ) , #end\n $utils.toJson($entry.get(\"_source\"))\n #end\n ]")),
// })
//
type RemovalPolicy string
const (
// This is the default removal policy.
//
// It means that when the resource is
// removed from the app, it will be physically destroyed.
RemovalPolicy_DESTROY RemovalPolicy = "DESTROY"
// This uses the 'Retain' DeletionPolicy, which will cause the resource to be retained in the account, but orphaned from the stack.
RemovalPolicy_RETAIN RemovalPolicy = "RETAIN"
// This retention policy deletes the resource, but saves a snapshot of its data before deleting, so that it can be re-created later.
//
// Only available for some stateful resources,
// like databases, EC2 volumes, etc.
// See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html#aws-attribute-deletionpolicy-options
//
RemovalPolicy_SNAPSHOT RemovalPolicy = "SNAPSHOT"
)