@hiiretail/gcp-infra-cli 0.99.10 → 0.99.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -84,6 +84,20 @@ module.exports = class extends BaseGenerator {
84
84
  message: 'Relevant only for versioned objects. The number of newer versions of an object to satisfy the condition. Use null to not set the value',
85
85
  validate: required,
86
86
  },
87
+ {
88
+ type: 'list',
89
+ name: 'retentionPolicy',
90
+ message: 'Do you want to set up a retention period for the bucket?',
91
+ default: 'false',
92
+ choices: ['true', 'false'],
93
+ },
94
+ {
95
+ when: (response) => response.retentionPolicy === 'true',
96
+ type: 'input',
97
+ name: 'retentionPeriod',
98
+ message: 'The period of time, in seconds, that objects in the bucket must be retained and cannot be deleted, overwritten, or archived. The value must be less than 2147483647 seconds',
99
+ validate: required,
100
+ },
87
101
  ];
88
102
 
89
103
  return this.prompt(prompts).then((props) => {
@@ -96,6 +110,7 @@ module.exports = class extends BaseGenerator {
96
110
  bucketName,
97
111
  prefix,
98
112
  lifecycleRules,
113
+ retentionPolicy,
99
114
  versioning,
100
115
  action,
101
116
  storageClass,
@@ -104,6 +119,7 @@ module.exports = class extends BaseGenerator {
104
119
  withState,
105
120
  matchesStorageClass,
106
121
  numNewerVersions,
122
+ retentionPeriod,
107
123
  } = this.answers;
108
124
 
109
125
  ['prod', 'staging'].forEach((env) => {
@@ -116,6 +132,7 @@ module.exports = class extends BaseGenerator {
116
132
  bucketName,
117
133
  prefix,
118
134
  lifecycleRules,
135
+ retentionPolicy,
119
136
  versioning,
120
137
  action,
121
138
  storageClass,
@@ -124,6 +141,7 @@ module.exports = class extends BaseGenerator {
124
141
  withState,
125
142
  matchesStorageClass,
126
143
  numNewerVersions,
144
+ retentionPeriod,
127
145
  },
128
146
  );
129
147
  });
@@ -20,4 +20,7 @@ lifecycle_rules:
20
20
  with_state: null <% } %> <% if (matchesStorageClass != 'null') { %>
21
21
  matches_storage_class: "<%-matchesStorageClass%>" <% } else { %>
22
22
  matches_storage_class: null <% } %>
23
- num_newer_versions: <%-numNewerVersions%> <% } %>
23
+ num_newer_versions: <%-numNewerVersions%> <% } %> <% if (retentionPolicy == 'true') { %>
24
+ retention_policy:
25
+ "<%-bucketName%><% if (env == 'staging') { %>-staging<% } %>":
26
+ retention_period: <%-retentionPeriod%> <% } %>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hiiretail/gcp-infra-cli",
3
- "version": "0.99.10",
3
+ "version": "0.99.12",
4
4
  "description": "Infrastructure as code generator for GCP.",
5
5
  "main": "src/cli.js",
6
6
  "bin": {