cloudsnorkel.cdk-rds-sanitized-snapshots 0.0.0__py3-none-any.whl → 0.1.6__py3-none-any.whl

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.
@@ -1,4 +1,4 @@
1
- '''
1
+ r'''
2
2
  # CDK Construct for RDS Sanitized Snapshots
3
3
 
4
4
  [![NPM](https://img.shields.io/npm/v/@cloudsnorkel/cdk-rds-sanitized-snapshots?label=npm&logo=npm)](https://www.npmjs.com/package/@cloudsnorkel/cdk-rds-sanitized-snapshots)
@@ -42,9 +42,44 @@ The step function does the following to create the snapshot:
42
42
  9. Optionally share the snapshot with other accounts (if you have separate accounts for developers/QA)
43
43
  10. Delete temporary database and snapshot
44
44
 
45
- ## Example
45
+ ## Usage
46
+
47
+ 1. Confirm you're using CDK v2
48
+ 2. Install the appropriate package
49
+
50
+ 1. [Python](https://pypi.org/project/cloudsnorkel.cdk-rds-sanitized-snapshots)
51
+
52
+ ```
53
+ pip install cloudsnorkel.cdk-rds-sanitized-snapshots
54
+ ```
55
+ 2. [TypeScript or JavaScript](https://www.npmjs.com/package/@cloudsnorkel/cdk-rds-sanitized-snapshots)
56
+
57
+ ```
58
+ npm i @cloudsnorkel/cdk-rds-sanitized-snapshots
59
+ ```
60
+ 3. [Java](https://search.maven.org/search?q=g:%22com.cloudsnorkel%22%20AND%20a:%22cdk.rds.sanitized-snapshots%22)
61
+
62
+ ```xml
63
+ <dependency>
64
+ <groupId>com.cloudsnorkel</groupId>
65
+ <artifactId>cdk.rds.sanitized-snapshots</artifactId>
66
+ </dependency>
67
+ ```
68
+ 4. [Go](https://pkg.go.dev/github.com/CloudSnorkel/cdk-rds-sanitized-snapshots-go/cloudsnorkelcdkrdssanitizedsnapshots)
69
+
70
+ ```
71
+ go get github.com/CloudSnorkel/cdk-rds-sanitized-snapshots-go/cloudsnorkelcdkrdssanitizedsnapshots
72
+ ```
73
+ 5. [.NET](https://www.nuget.org/packages/CloudSnorkel.Cdk.Rds.SanitizedSnapshots/)
74
+
75
+ ```
76
+ dotnet add package CloudSnorkel.Cdk.Rds.SanitizedSnapshots
77
+ ```
78
+ 3. Use `RdsSanitizedSnapshotter` construct in your code (starting with default arguments is fine)
46
79
 
47
- ```typescript
80
+ ### Code Sample
81
+
82
+ ```python
48
83
  let vpc: ec2.Vpc;
49
84
  let databaseInstance: rds.DatabaseInstance;
50
85
 
@@ -74,6 +109,9 @@ on giving other accounts access to the key.
74
109
  npm run bundle && npm run integ:default:deploy
75
110
  ```
76
111
  '''
112
+ from pkgutil import extend_path
113
+ __path__ = extend_path(__path__, __name__)
114
+
77
115
  import abc
78
116
  import builtins
79
117
  import datetime
@@ -84,15 +122,32 @@ import jsii
84
122
  import publication
85
123
  import typing_extensions
86
124
 
125
+ import typeguard
126
+ from importlib.metadata import version as _metadata_package_version
127
+ TYPEGUARD_MAJOR_VERSION = int(_metadata_package_version('typeguard').split('.')[0])
128
+
129
+ def check_type(argname: str, value: object, expected_type: typing.Any) -> typing.Any:
130
+ if TYPEGUARD_MAJOR_VERSION <= 2:
131
+ return typeguard.check_type(argname=argname, value=value, expected_type=expected_type) # type:ignore
132
+ else:
133
+ if isinstance(value, jsii._reference_map.InterfaceDynamicProxy): # pyright: ignore [reportAttributeAccessIssue]
134
+ pass
135
+ else:
136
+ if TYPEGUARD_MAJOR_VERSION == 3:
137
+ typeguard.config.collection_check_strategy = typeguard.CollectionCheckStrategy.ALL_ITEMS # type:ignore
138
+ typeguard.check_type(value=value, expected_type=expected_type) # type:ignore
139
+ else:
140
+ typeguard.check_type(value=value, expected_type=expected_type, collection_check_strategy=typeguard.CollectionCheckStrategy.ALL_ITEMS) # type:ignore
141
+
87
142
  from ._jsii import *
88
143
 
89
- import aws_cdk.aws_ec2
90
- import aws_cdk.aws_ecs
91
- import aws_cdk.aws_events
92
- import aws_cdk.aws_kms
93
- import aws_cdk.aws_rds
94
- import aws_cdk.aws_stepfunctions
95
- import constructs
144
+ import aws_cdk.aws_ec2 as _aws_cdk_aws_ec2_ceddda9d
145
+ import aws_cdk.aws_ecs as _aws_cdk_aws_ecs_ceddda9d
146
+ import aws_cdk.aws_events as _aws_cdk_aws_events_ceddda9d
147
+ import aws_cdk.aws_kms as _aws_cdk_aws_kms_ceddda9d
148
+ import aws_cdk.aws_rds as _aws_cdk_aws_rds_ceddda9d
149
+ import aws_cdk.aws_stepfunctions as _aws_cdk_aws_stepfunctions_ceddda9d
150
+ import constructs as _constructs_77d1e7e8
96
151
 
97
152
 
98
153
  @jsii.interface(
@@ -103,7 +158,7 @@ class IRdsSanitizedSnapshotter(typing_extensions.Protocol):
103
158
  :stability: experimental
104
159
  '''
105
160
 
106
- @builtins.property # type: ignore[misc]
161
+ @builtins.property
107
162
  @jsii.member(jsii_name="script")
108
163
  def script(self) -> builtins.str:
109
164
  '''(experimental) SQL script used to sanitize the database. It will be executed against the temporary database.
@@ -114,18 +169,20 @@ class IRdsSanitizedSnapshotter(typing_extensions.Protocol):
114
169
  '''
115
170
  ...
116
171
 
117
- @builtins.property # type: ignore[misc]
172
+ @builtins.property
118
173
  @jsii.member(jsii_name="vpc")
119
- def vpc(self) -> aws_cdk.aws_ec2.IVpc:
174
+ def vpc(self) -> "_aws_cdk_aws_ec2_ceddda9d.IVpc":
120
175
  '''(experimental) VPC where temporary database and sanitizing task will be created.
121
176
 
122
177
  :stability: experimental
123
178
  '''
124
179
  ...
125
180
 
126
- @builtins.property # type: ignore[misc]
181
+ @builtins.property
127
182
  @jsii.member(jsii_name="databaseCluster")
128
- def database_cluster(self) -> typing.Optional[aws_cdk.aws_rds.IDatabaseCluster]:
183
+ def database_cluster(
184
+ self,
185
+ ) -> typing.Optional["_aws_cdk_aws_rds_ceddda9d.IDatabaseCluster"]:
129
186
  '''(experimental) Database cluster to snapshot and sanitize.
130
187
 
131
188
  Only one of ``databaseCluster`` and ``databaseInstance`` can be specified.
@@ -134,9 +191,11 @@ class IRdsSanitizedSnapshotter(typing_extensions.Protocol):
134
191
  '''
135
192
  ...
136
193
 
137
- @builtins.property # type: ignore[misc]
194
+ @builtins.property
138
195
  @jsii.member(jsii_name="databaseInstance")
139
- def database_instance(self) -> typing.Optional[aws_cdk.aws_rds.IDatabaseInstance]:
196
+ def database_instance(
197
+ self,
198
+ ) -> typing.Optional["_aws_cdk_aws_rds_ceddda9d.IDatabaseInstance"]:
140
199
  '''(experimental) Database instance to snapshot and sanitize.
141
200
 
142
201
  Only one of ``databaseCluster`` and ``databaseInstance`` can be specified.
@@ -145,18 +204,33 @@ class IRdsSanitizedSnapshotter(typing_extensions.Protocol):
145
204
  '''
146
205
  ...
147
206
 
148
- @builtins.property # type: ignore[misc]
207
+ @builtins.property
149
208
  @jsii.member(jsii_name="databaseKey")
150
- def database_key(self) -> typing.Optional[aws_cdk.aws_kms.IKey]:
209
+ def database_key(self) -> typing.Optional["_aws_cdk_aws_kms_ceddda9d.IKey"]:
151
210
  '''(experimental) KMS key used to encrypt original database, if any.
152
211
 
153
212
  :stability: experimental
154
213
  '''
155
214
  ...
156
215
 
157
- @builtins.property # type: ignore[misc]
216
+ @builtins.property
217
+ @jsii.member(jsii_name="databaseName")
218
+ def database_name(self) -> typing.Optional[builtins.str]:
219
+ '''(experimental) Name of database to connect to inside the RDS cluster or instance.
220
+
221
+ This database will be used to execute the SQL script.
222
+
223
+ :default: 'postgres' for PostgreSQL and not set for MySQL
224
+
225
+ :stability: experimental
226
+ '''
227
+ ...
228
+
229
+ @builtins.property
158
230
  @jsii.member(jsii_name="dbSubnets")
159
- def db_subnets(self) -> typing.Optional[aws_cdk.aws_ec2.SubnetSelection]:
231
+ def db_subnets(
232
+ self,
233
+ ) -> typing.Optional["_aws_cdk_aws_ec2_ceddda9d.SubnetSelection"]:
160
234
  '''(experimental) VPC subnets to use for temporary databases.
161
235
 
162
236
  :default: ec2.SubnetType.PRIVATE_ISOLATED
@@ -165,9 +239,9 @@ class IRdsSanitizedSnapshotter(typing_extensions.Protocol):
165
239
  '''
166
240
  ...
167
241
 
168
- @builtins.property # type: ignore[misc]
242
+ @builtins.property
169
243
  @jsii.member(jsii_name="fargateCluster")
170
- def fargate_cluster(self) -> typing.Optional[aws_cdk.aws_ecs.ICluster]:
244
+ def fargate_cluster(self) -> typing.Optional["_aws_cdk_aws_ecs_ceddda9d.ICluster"]:
171
245
  '''(experimental) Cluster where sanitization task will be executed.
172
246
 
173
247
  :default: a new cluster running on given VPC
@@ -176,27 +250,38 @@ class IRdsSanitizedSnapshotter(typing_extensions.Protocol):
176
250
  '''
177
251
  ...
178
252
 
179
- @builtins.property # type: ignore[misc]
253
+ @builtins.property
180
254
  @jsii.member(jsii_name="sanitizeSubnets")
181
- def sanitize_subnets(self) -> typing.Optional[aws_cdk.aws_ec2.SubnetSelection]:
255
+ def sanitize_subnets(
256
+ self,
257
+ ) -> typing.Optional["_aws_cdk_aws_ec2_ceddda9d.SubnetSelection"]:
182
258
  '''(experimental) VPC subnets to use for sanitization task.
183
259
 
184
- :default: ec2.SubnetType.PRIVATE_WITH_NAT
260
+ :default: ec2.SubnetType.PRIVATE_WITH_EGRESS
185
261
 
186
262
  :stability: experimental
187
263
  '''
188
264
  ...
189
265
 
190
- @builtins.property # type: ignore[misc]
266
+ @builtins.property
191
267
  @jsii.member(jsii_name="schedule")
192
- def schedule(self) -> typing.Optional[aws_cdk.aws_events.Schedule]:
268
+ def schedule(self) -> typing.Optional["_aws_cdk_aws_events_ceddda9d.Schedule"]:
193
269
  '''(experimental) The schedule or rate (frequency) that determines when the sanitized snapshot runs automatically.
194
270
 
195
271
  :stability: experimental
196
272
  '''
197
273
  ...
198
274
 
199
- @builtins.property # type: ignore[misc]
275
+ @builtins.property
276
+ @jsii.member(jsii_name="shareAccounts")
277
+ def share_accounts(self) -> typing.Optional[typing.List[builtins.str]]:
278
+ '''(experimental) List of accounts the sanitized snapshot should be shared with.
279
+
280
+ :stability: experimental
281
+ '''
282
+ ...
283
+
284
+ @builtins.property
200
285
  @jsii.member(jsii_name="snapshotHistoryLimit")
201
286
  def snapshot_history_limit(self) -> typing.Optional[jsii.Number]:
202
287
  '''(experimental) Limit the number of snapshot history.
@@ -207,16 +292,16 @@ class IRdsSanitizedSnapshotter(typing_extensions.Protocol):
207
292
  '''
208
293
  ...
209
294
 
210
- @builtins.property # type: ignore[misc]
295
+ @builtins.property
211
296
  @jsii.member(jsii_name="snapshotKey")
212
- def snapshot_key(self) -> typing.Optional[aws_cdk.aws_kms.IKey]:
297
+ def snapshot_key(self) -> typing.Optional["_aws_cdk_aws_kms_ceddda9d.IKey"]:
213
298
  '''(experimental) Optional KMS key to encrypt target snapshot.
214
299
 
215
300
  :stability: experimental
216
301
  '''
217
302
  ...
218
303
 
219
- @builtins.property # type: ignore[misc]
304
+ @builtins.property
220
305
  @jsii.member(jsii_name="snapshotPrefix")
221
306
  def snapshot_prefix(self) -> typing.Optional[builtins.str]:
222
307
  '''(experimental) Prefix for sanitized snapshot name.
@@ -229,7 +314,7 @@ class IRdsSanitizedSnapshotter(typing_extensions.Protocol):
229
314
  '''
230
315
  ...
231
316
 
232
- @builtins.property # type: ignore[misc]
317
+ @builtins.property
233
318
  @jsii.member(jsii_name="tempPrefix")
234
319
  def temp_prefix(self) -> typing.Optional[builtins.str]:
235
320
  '''(experimental) Prefix for all temporary snapshots and databases.
@@ -242,6 +327,21 @@ class IRdsSanitizedSnapshotter(typing_extensions.Protocol):
242
327
  '''
243
328
  ...
244
329
 
330
+ @builtins.property
331
+ @jsii.member(jsii_name="useExistingSnapshot")
332
+ def use_existing_snapshot(self) -> typing.Optional[builtins.bool]:
333
+ '''(experimental) Use the latest available snapshot instead of taking a new one.
334
+
335
+ This can be used to shorten the process at the cost of using a possibly older snapshot.
336
+
337
+ This will use the latest snapshot whether it's an automatic system snapshot or a manual snapshot.
338
+
339
+ :default: false
340
+
341
+ :stability: experimental
342
+ '''
343
+ ...
344
+
245
345
 
246
346
  class _IRdsSanitizedSnapshotterProxy:
247
347
  '''
@@ -250,7 +350,7 @@ class _IRdsSanitizedSnapshotterProxy:
250
350
 
251
351
  __jsii_type__: typing.ClassVar[str] = "@cloudsnorkel/cdk-rds-sanitized-snapshots.IRdsSanitizedSnapshotter"
252
352
 
253
- @builtins.property # type: ignore[misc]
353
+ @builtins.property
254
354
  @jsii.member(jsii_name="script")
255
355
  def script(self) -> builtins.str:
256
356
  '''(experimental) SQL script used to sanitize the database. It will be executed against the temporary database.
@@ -261,89 +361,119 @@ class _IRdsSanitizedSnapshotterProxy:
261
361
  '''
262
362
  return typing.cast(builtins.str, jsii.get(self, "script"))
263
363
 
264
- @builtins.property # type: ignore[misc]
364
+ @builtins.property
265
365
  @jsii.member(jsii_name="vpc")
266
- def vpc(self) -> aws_cdk.aws_ec2.IVpc:
366
+ def vpc(self) -> "_aws_cdk_aws_ec2_ceddda9d.IVpc":
267
367
  '''(experimental) VPC where temporary database and sanitizing task will be created.
268
368
 
269
369
  :stability: experimental
270
370
  '''
271
- return typing.cast(aws_cdk.aws_ec2.IVpc, jsii.get(self, "vpc"))
371
+ return typing.cast("_aws_cdk_aws_ec2_ceddda9d.IVpc", jsii.get(self, "vpc"))
272
372
 
273
- @builtins.property # type: ignore[misc]
373
+ @builtins.property
274
374
  @jsii.member(jsii_name="databaseCluster")
275
- def database_cluster(self) -> typing.Optional[aws_cdk.aws_rds.IDatabaseCluster]:
375
+ def database_cluster(
376
+ self,
377
+ ) -> typing.Optional["_aws_cdk_aws_rds_ceddda9d.IDatabaseCluster"]:
276
378
  '''(experimental) Database cluster to snapshot and sanitize.
277
379
 
278
380
  Only one of ``databaseCluster`` and ``databaseInstance`` can be specified.
279
381
 
280
382
  :stability: experimental
281
383
  '''
282
- return typing.cast(typing.Optional[aws_cdk.aws_rds.IDatabaseCluster], jsii.get(self, "databaseCluster"))
384
+ return typing.cast(typing.Optional["_aws_cdk_aws_rds_ceddda9d.IDatabaseCluster"], jsii.get(self, "databaseCluster"))
283
385
 
284
- @builtins.property # type: ignore[misc]
386
+ @builtins.property
285
387
  @jsii.member(jsii_name="databaseInstance")
286
- def database_instance(self) -> typing.Optional[aws_cdk.aws_rds.IDatabaseInstance]:
388
+ def database_instance(
389
+ self,
390
+ ) -> typing.Optional["_aws_cdk_aws_rds_ceddda9d.IDatabaseInstance"]:
287
391
  '''(experimental) Database instance to snapshot and sanitize.
288
392
 
289
393
  Only one of ``databaseCluster`` and ``databaseInstance`` can be specified.
290
394
 
291
395
  :stability: experimental
292
396
  '''
293
- return typing.cast(typing.Optional[aws_cdk.aws_rds.IDatabaseInstance], jsii.get(self, "databaseInstance"))
397
+ return typing.cast(typing.Optional["_aws_cdk_aws_rds_ceddda9d.IDatabaseInstance"], jsii.get(self, "databaseInstance"))
294
398
 
295
- @builtins.property # type: ignore[misc]
399
+ @builtins.property
296
400
  @jsii.member(jsii_name="databaseKey")
297
- def database_key(self) -> typing.Optional[aws_cdk.aws_kms.IKey]:
401
+ def database_key(self) -> typing.Optional["_aws_cdk_aws_kms_ceddda9d.IKey"]:
298
402
  '''(experimental) KMS key used to encrypt original database, if any.
299
403
 
300
404
  :stability: experimental
301
405
  '''
302
- return typing.cast(typing.Optional[aws_cdk.aws_kms.IKey], jsii.get(self, "databaseKey"))
406
+ return typing.cast(typing.Optional["_aws_cdk_aws_kms_ceddda9d.IKey"], jsii.get(self, "databaseKey"))
407
+
408
+ @builtins.property
409
+ @jsii.member(jsii_name="databaseName")
410
+ def database_name(self) -> typing.Optional[builtins.str]:
411
+ '''(experimental) Name of database to connect to inside the RDS cluster or instance.
303
412
 
304
- @builtins.property # type: ignore[misc]
413
+ This database will be used to execute the SQL script.
414
+
415
+ :default: 'postgres' for PostgreSQL and not set for MySQL
416
+
417
+ :stability: experimental
418
+ '''
419
+ return typing.cast(typing.Optional[builtins.str], jsii.get(self, "databaseName"))
420
+
421
+ @builtins.property
305
422
  @jsii.member(jsii_name="dbSubnets")
306
- def db_subnets(self) -> typing.Optional[aws_cdk.aws_ec2.SubnetSelection]:
423
+ def db_subnets(
424
+ self,
425
+ ) -> typing.Optional["_aws_cdk_aws_ec2_ceddda9d.SubnetSelection"]:
307
426
  '''(experimental) VPC subnets to use for temporary databases.
308
427
 
309
428
  :default: ec2.SubnetType.PRIVATE_ISOLATED
310
429
 
311
430
  :stability: experimental
312
431
  '''
313
- return typing.cast(typing.Optional[aws_cdk.aws_ec2.SubnetSelection], jsii.get(self, "dbSubnets"))
432
+ return typing.cast(typing.Optional["_aws_cdk_aws_ec2_ceddda9d.SubnetSelection"], jsii.get(self, "dbSubnets"))
314
433
 
315
- @builtins.property # type: ignore[misc]
434
+ @builtins.property
316
435
  @jsii.member(jsii_name="fargateCluster")
317
- def fargate_cluster(self) -> typing.Optional[aws_cdk.aws_ecs.ICluster]:
436
+ def fargate_cluster(self) -> typing.Optional["_aws_cdk_aws_ecs_ceddda9d.ICluster"]:
318
437
  '''(experimental) Cluster where sanitization task will be executed.
319
438
 
320
439
  :default: a new cluster running on given VPC
321
440
 
322
441
  :stability: experimental
323
442
  '''
324
- return typing.cast(typing.Optional[aws_cdk.aws_ecs.ICluster], jsii.get(self, "fargateCluster"))
443
+ return typing.cast(typing.Optional["_aws_cdk_aws_ecs_ceddda9d.ICluster"], jsii.get(self, "fargateCluster"))
325
444
 
326
- @builtins.property # type: ignore[misc]
445
+ @builtins.property
327
446
  @jsii.member(jsii_name="sanitizeSubnets")
328
- def sanitize_subnets(self) -> typing.Optional[aws_cdk.aws_ec2.SubnetSelection]:
447
+ def sanitize_subnets(
448
+ self,
449
+ ) -> typing.Optional["_aws_cdk_aws_ec2_ceddda9d.SubnetSelection"]:
329
450
  '''(experimental) VPC subnets to use for sanitization task.
330
451
 
331
- :default: ec2.SubnetType.PRIVATE_WITH_NAT
452
+ :default: ec2.SubnetType.PRIVATE_WITH_EGRESS
332
453
 
333
454
  :stability: experimental
334
455
  '''
335
- return typing.cast(typing.Optional[aws_cdk.aws_ec2.SubnetSelection], jsii.get(self, "sanitizeSubnets"))
456
+ return typing.cast(typing.Optional["_aws_cdk_aws_ec2_ceddda9d.SubnetSelection"], jsii.get(self, "sanitizeSubnets"))
336
457
 
337
- @builtins.property # type: ignore[misc]
458
+ @builtins.property
338
459
  @jsii.member(jsii_name="schedule")
339
- def schedule(self) -> typing.Optional[aws_cdk.aws_events.Schedule]:
460
+ def schedule(self) -> typing.Optional["_aws_cdk_aws_events_ceddda9d.Schedule"]:
340
461
  '''(experimental) The schedule or rate (frequency) that determines when the sanitized snapshot runs automatically.
341
462
 
342
463
  :stability: experimental
343
464
  '''
344
- return typing.cast(typing.Optional[aws_cdk.aws_events.Schedule], jsii.get(self, "schedule"))
465
+ return typing.cast(typing.Optional["_aws_cdk_aws_events_ceddda9d.Schedule"], jsii.get(self, "schedule"))
345
466
 
346
- @builtins.property # type: ignore[misc]
467
+ @builtins.property
468
+ @jsii.member(jsii_name="shareAccounts")
469
+ def share_accounts(self) -> typing.Optional[typing.List[builtins.str]]:
470
+ '''(experimental) List of accounts the sanitized snapshot should be shared with.
471
+
472
+ :stability: experimental
473
+ '''
474
+ return typing.cast(typing.Optional[typing.List[builtins.str]], jsii.get(self, "shareAccounts"))
475
+
476
+ @builtins.property
347
477
  @jsii.member(jsii_name="snapshotHistoryLimit")
348
478
  def snapshot_history_limit(self) -> typing.Optional[jsii.Number]:
349
479
  '''(experimental) Limit the number of snapshot history.
@@ -354,16 +484,16 @@ class _IRdsSanitizedSnapshotterProxy:
354
484
  '''
355
485
  return typing.cast(typing.Optional[jsii.Number], jsii.get(self, "snapshotHistoryLimit"))
356
486
 
357
- @builtins.property # type: ignore[misc]
487
+ @builtins.property
358
488
  @jsii.member(jsii_name="snapshotKey")
359
- def snapshot_key(self) -> typing.Optional[aws_cdk.aws_kms.IKey]:
489
+ def snapshot_key(self) -> typing.Optional["_aws_cdk_aws_kms_ceddda9d.IKey"]:
360
490
  '''(experimental) Optional KMS key to encrypt target snapshot.
361
491
 
362
492
  :stability: experimental
363
493
  '''
364
- return typing.cast(typing.Optional[aws_cdk.aws_kms.IKey], jsii.get(self, "snapshotKey"))
494
+ return typing.cast(typing.Optional["_aws_cdk_aws_kms_ceddda9d.IKey"], jsii.get(self, "snapshotKey"))
365
495
 
366
- @builtins.property # type: ignore[misc]
496
+ @builtins.property
367
497
  @jsii.member(jsii_name="snapshotPrefix")
368
498
  def snapshot_prefix(self) -> typing.Optional[builtins.str]:
369
499
  '''(experimental) Prefix for sanitized snapshot name.
@@ -376,7 +506,7 @@ class _IRdsSanitizedSnapshotterProxy:
376
506
  '''
377
507
  return typing.cast(typing.Optional[builtins.str], jsii.get(self, "snapshotPrefix"))
378
508
 
379
- @builtins.property # type: ignore[misc]
509
+ @builtins.property
380
510
  @jsii.member(jsii_name="tempPrefix")
381
511
  def temp_prefix(self) -> typing.Optional[builtins.str]:
382
512
  '''(experimental) Prefix for all temporary snapshots and databases.
@@ -389,12 +519,27 @@ class _IRdsSanitizedSnapshotterProxy:
389
519
  '''
390
520
  return typing.cast(typing.Optional[builtins.str], jsii.get(self, "tempPrefix"))
391
521
 
522
+ @builtins.property
523
+ @jsii.member(jsii_name="useExistingSnapshot")
524
+ def use_existing_snapshot(self) -> typing.Optional[builtins.bool]:
525
+ '''(experimental) Use the latest available snapshot instead of taking a new one.
526
+
527
+ This can be used to shorten the process at the cost of using a possibly older snapshot.
528
+
529
+ This will use the latest snapshot whether it's an automatic system snapshot or a manual snapshot.
530
+
531
+ :default: false
532
+
533
+ :stability: experimental
534
+ '''
535
+ return typing.cast(typing.Optional[builtins.bool], jsii.get(self, "useExistingSnapshot"))
536
+
392
537
  # Adding a "__jsii_proxy_class__(): typing.Type" function to the interface
393
538
  typing.cast(typing.Any, IRdsSanitizedSnapshotter).__jsii_proxy_class__ = lambda : _IRdsSanitizedSnapshotterProxy
394
539
 
395
540
 
396
541
  class RdsSanitizedSnapshotter(
397
- constructs.Construct,
542
+ _constructs_77d1e7e8.Construct,
398
543
  metaclass=jsii.JSIIMeta,
399
544
  jsii_type="@cloudsnorkel/cdk-rds-sanitized-snapshots.RdsSanitizedSnapshotter",
400
545
  ):
@@ -403,7 +548,7 @@ class RdsSanitizedSnapshotter(
403
548
  The process is handled by a step function.
404
549
 
405
550
  1. Snapshot the source database
406
- 2. Optionally re-ncrypt the snapshot with a different key in case you want to share it with an account that doesn't have access to the original key
551
+ 2. Optionally re-encrypt the snapshot with a different key in case you want to share it with an account that doesn't have access to the original key
407
552
  3. Create a temporary database
408
553
  4. Run a Fargate task to connect to the temporary database and execute an arbitrary SQL script to sanitize it
409
554
  5. Snapshot the sanitized database
@@ -414,9 +559,9 @@ class RdsSanitizedSnapshotter(
414
559
 
415
560
  def __init__(
416
561
  self,
417
- scope: constructs.Construct,
562
+ scope: "_constructs_77d1e7e8.Construct",
418
563
  id: builtins.str,
419
- props: IRdsSanitizedSnapshotter,
564
+ props: "IRdsSanitizedSnapshotter",
420
565
  ) -> None:
421
566
  '''
422
567
  :param scope: -
@@ -425,30 +570,41 @@ class RdsSanitizedSnapshotter(
425
570
 
426
571
  :stability: experimental
427
572
  '''
573
+ if __debug__:
574
+ type_hints = typing.get_type_hints(_typecheckingstub__1e15c41233acb14f8259c09345be1563a5d61c80585cf7e3c29c90b00f3e5879)
575
+ check_type(argname="argument scope", value=scope, expected_type=type_hints["scope"])
576
+ check_type(argname="argument id", value=id, expected_type=type_hints["id"])
577
+ check_type(argname="argument props", value=props, expected_type=type_hints["props"])
428
578
  jsii.create(self.__class__, self, [scope, id, props])
429
579
 
430
- @builtins.property # type: ignore[misc]
580
+ @builtins.property
431
581
  @jsii.member(jsii_name="props")
432
- def props(self) -> IRdsSanitizedSnapshotter:
582
+ def props(self) -> "IRdsSanitizedSnapshotter":
433
583
  '''
434
584
  :stability: experimental
435
585
  '''
436
- return typing.cast(IRdsSanitizedSnapshotter, jsii.get(self, "props"))
586
+ return typing.cast("IRdsSanitizedSnapshotter", jsii.get(self, "props"))
437
587
 
438
- @builtins.property # type: ignore[misc]
588
+ @builtins.property
439
589
  @jsii.member(jsii_name="snapshotter")
440
- def snapshotter(self) -> aws_cdk.aws_stepfunctions.StateMachine:
590
+ def snapshotter(self) -> "_aws_cdk_aws_stepfunctions_ceddda9d.StateMachine":
441
591
  '''(experimental) Step function in charge of the entire process including snapshotting, sanitizing, and cleanup.
442
592
 
443
593
  Trigger this step function to get a new snapshot.
444
594
 
445
595
  :stability: experimental
446
596
  '''
447
- return typing.cast(aws_cdk.aws_stepfunctions.StateMachine, jsii.get(self, "snapshotter"))
597
+ return typing.cast("_aws_cdk_aws_stepfunctions_ceddda9d.StateMachine", jsii.get(self, "snapshotter"))
448
598
 
449
599
  @snapshotter.setter
450
- def snapshotter(self, value: aws_cdk.aws_stepfunctions.StateMachine) -> None:
451
- jsii.set(self, "snapshotter", value)
600
+ def snapshotter(
601
+ self,
602
+ value: "_aws_cdk_aws_stepfunctions_ceddda9d.StateMachine",
603
+ ) -> None:
604
+ if __debug__:
605
+ type_hints = typing.get_type_hints(_typecheckingstub__df51411713b297623720935bb6779afc65503804a74afed6b48f5754baba7f14)
606
+ check_type(argname="argument value", value=value, expected_type=type_hints["value"])
607
+ jsii.set(self, "snapshotter", value) # pyright: ignore[reportArgumentType]
452
608
 
453
609
 
454
610
  __all__ = [
@@ -457,3 +613,20 @@ __all__ = [
457
613
  ]
458
614
 
459
615
  publication.publish()
616
+
617
+ def _typecheckingstub__1e15c41233acb14f8259c09345be1563a5d61c80585cf7e3c29c90b00f3e5879(
618
+ scope: _constructs_77d1e7e8.Construct,
619
+ id: builtins.str,
620
+ props: IRdsSanitizedSnapshotter,
621
+ ) -> None:
622
+ """Type checking stubs"""
623
+ pass
624
+
625
+ def _typecheckingstub__df51411713b297623720935bb6779afc65503804a74afed6b48f5754baba7f14(
626
+ value: _aws_cdk_aws_stepfunctions_ceddda9d.StateMachine,
627
+ ) -> None:
628
+ """Type checking stubs"""
629
+ pass
630
+
631
+ for cls in [IRdsSanitizedSnapshotter]:
632
+ typing.cast(typing.Any, cls).__protocol_attrs__ = typing.cast(typing.Any, cls).__protocol_attrs__ - set(['__jsii_proxy_class__', '__jsii_type__'])
@@ -1,3 +1,6 @@
1
+ from pkgutil import extend_path
2
+ __path__ = extend_path(__path__, __name__)
3
+
1
4
  import abc
2
5
  import builtins
3
6
  import datetime
@@ -8,14 +11,31 @@ import jsii
8
11
  import publication
9
12
  import typing_extensions
10
13
 
14
+ import typeguard
15
+ from importlib.metadata import version as _metadata_package_version
16
+ TYPEGUARD_MAJOR_VERSION = int(_metadata_package_version('typeguard').split('.')[0])
17
+
18
+ def check_type(argname: str, value: object, expected_type: typing.Any) -> typing.Any:
19
+ if TYPEGUARD_MAJOR_VERSION <= 2:
20
+ return typeguard.check_type(argname=argname, value=value, expected_type=expected_type) # type:ignore
21
+ else:
22
+ if isinstance(value, jsii._reference_map.InterfaceDynamicProxy): # pyright: ignore [reportAttributeAccessIssue]
23
+ pass
24
+ else:
25
+ if TYPEGUARD_MAJOR_VERSION == 3:
26
+ typeguard.config.collection_check_strategy = typeguard.CollectionCheckStrategy.ALL_ITEMS # type:ignore
27
+ typeguard.check_type(value=value, expected_type=expected_type) # type:ignore
28
+ else:
29
+ typeguard.check_type(value=value, expected_type=expected_type, collection_check_strategy=typeguard.CollectionCheckStrategy.ALL_ITEMS) # type:ignore
30
+
11
31
  import aws_cdk._jsii
12
32
  import constructs._jsii
13
33
 
14
34
  __jsii_assembly__ = jsii.JSIIAssembly.load(
15
35
  "@cloudsnorkel/cdk-rds-sanitized-snapshots",
16
- "0.0.0",
36
+ "0.1.6",
17
37
  __name__[0:-6],
18
- "cdk-rds-sanitized-snapshots@0.0.0.jsii.tgz",
38
+ "cdk-rds-sanitized-snapshots@0.1.6.jsii.tgz",
19
39
  )
20
40
 
21
41
  __all__ = [
@@ -1,30 +1,29 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cloudsnorkel.cdk-rds-sanitized-snapshots
3
- Version: 0.0.0
3
+ Version: 0.1.6
4
4
  Summary: CDK construct to periodically take snapshots of RDS databases, sanitize them, and share with selected accounts.
5
5
  Home-page: https://github.com/CloudSnorkel/cdk-rds-sanitized-snapshots.git
6
6
  Author: Amir Szekely<amir@cloudsnorkel.com>
7
7
  License: Apache-2.0
8
8
  Project-URL: Source, https://github.com/CloudSnorkel/cdk-rds-sanitized-snapshots.git
9
- Platform: UNKNOWN
10
9
  Classifier: Intended Audience :: Developers
11
10
  Classifier: Operating System :: OS Independent
12
11
  Classifier: Programming Language :: JavaScript
13
12
  Classifier: Programming Language :: Python :: 3 :: Only
14
- Classifier: Programming Language :: Python :: 3.7
15
- Classifier: Programming Language :: Python :: 3.8
16
13
  Classifier: Programming Language :: Python :: 3.9
17
14
  Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
18
16
  Classifier: Typing :: Typed
19
17
  Classifier: Development Status :: 4 - Beta
20
18
  Classifier: License :: OSI Approved
21
- Requires-Python: ~=3.7
19
+ Requires-Python: ~=3.9
22
20
  Description-Content-Type: text/markdown
23
21
  License-File: LICENSE
24
- Requires-Dist: aws-cdk-lib (<3.0.0,>=2.0.0)
25
- Requires-Dist: constructs (<11.0.0,>=10.0.5)
26
- Requires-Dist: jsii (<2.0.0,>=1.61.0)
27
- Requires-Dist: publication (>=0.0.3)
22
+ Requires-Dist: aws-cdk-lib <3.0.0,>=2.146.0
23
+ Requires-Dist: constructs <11.0.0,>=10.0.5
24
+ Requires-Dist: jsii <2.0.0,>=1.126.0
25
+ Requires-Dist: publication >=0.0.3
26
+ Requires-Dist: typeguard ==2.13.3
28
27
 
29
28
  # CDK Construct for RDS Sanitized Snapshots
30
29
 
@@ -69,9 +68,44 @@ The step function does the following to create the snapshot:
69
68
  9. Optionally share the snapshot with other accounts (if you have separate accounts for developers/QA)
70
69
  10. Delete temporary database and snapshot
71
70
 
72
- ## Example
71
+ ## Usage
73
72
 
74
- ```typescript
73
+ 1. Confirm you're using CDK v2
74
+ 2. Install the appropriate package
75
+
76
+ 1. [Python](https://pypi.org/project/cloudsnorkel.cdk-rds-sanitized-snapshots)
77
+
78
+ ```
79
+ pip install cloudsnorkel.cdk-rds-sanitized-snapshots
80
+ ```
81
+ 2. [TypeScript or JavaScript](https://www.npmjs.com/package/@cloudsnorkel/cdk-rds-sanitized-snapshots)
82
+
83
+ ```
84
+ npm i @cloudsnorkel/cdk-rds-sanitized-snapshots
85
+ ```
86
+ 3. [Java](https://search.maven.org/search?q=g:%22com.cloudsnorkel%22%20AND%20a:%22cdk.rds.sanitized-snapshots%22)
87
+
88
+ ```xml
89
+ <dependency>
90
+ <groupId>com.cloudsnorkel</groupId>
91
+ <artifactId>cdk.rds.sanitized-snapshots</artifactId>
92
+ </dependency>
93
+ ```
94
+ 4. [Go](https://pkg.go.dev/github.com/CloudSnorkel/cdk-rds-sanitized-snapshots-go/cloudsnorkelcdkrdssanitizedsnapshots)
95
+
96
+ ```
97
+ go get github.com/CloudSnorkel/cdk-rds-sanitized-snapshots-go/cloudsnorkelcdkrdssanitizedsnapshots
98
+ ```
99
+ 5. [.NET](https://www.nuget.org/packages/CloudSnorkel.Cdk.Rds.SanitizedSnapshots/)
100
+
101
+ ```
102
+ dotnet add package CloudSnorkel.Cdk.Rds.SanitizedSnapshots
103
+ ```
104
+ 3. Use `RdsSanitizedSnapshotter` construct in your code (starting with default arguments is fine)
105
+
106
+ ### Code Sample
107
+
108
+ ```python
75
109
  let vpc: ec2.Vpc;
76
110
  let databaseInstance: rds.DatabaseInstance;
77
111
 
@@ -100,5 +134,3 @@ on giving other accounts access to the key.
100
134
  ```
101
135
  npm run bundle && npm run integ:default:deploy
102
136
  ```
103
-
104
-
@@ -0,0 +1,9 @@
1
+ cloudsnorkel/cdk_rds_sanitized_snapshots/__init__.py,sha256=tCWwZlMfeCwsruMGSTnWjr4bUXTzq4ay-mxilSU3mxs,23793
2
+ cloudsnorkel/cdk_rds_sanitized_snapshots/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
3
+ cloudsnorkel/cdk_rds_sanitized_snapshots/_jsii/__init__.py,sha256=zXWY1ALvWAeJRTF66SX9CubTFVZToWyrUL71jSmVeFc,1492
4
+ cloudsnorkel/cdk_rds_sanitized_snapshots/_jsii/cdk-rds-sanitized-snapshots@0.1.6.jsii.tgz,sha256=2prnZyB6wxSmIe-WnwAHTAUN5ny7hSwfc2sPx1Kd_jM,81023
5
+ cloudsnorkel_cdk_rds_sanitized_snapshots-0.1.6.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
6
+ cloudsnorkel_cdk_rds_sanitized_snapshots-0.1.6.dist-info/METADATA,sha256=PtzOv2BTAdt6gkN-4bx1ZfT7lQn-xfVS2iAOx1SVq-Y,6442
7
+ cloudsnorkel_cdk_rds_sanitized_snapshots-0.1.6.dist-info/WHEEL,sha256=WnJ8fYhv8N4SYVK2lLYNI6N0kVATA7b0piVUNvqIIJE,91
8
+ cloudsnorkel_cdk_rds_sanitized_snapshots-0.1.6.dist-info/top_level.txt,sha256=6vUrT-dcGOiRMT4Q6gEQPznoyS7nHOJ269MHpo4DEd8,13
9
+ cloudsnorkel_cdk_rds_sanitized_snapshots-0.1.6.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.37.1)
2
+ Generator: setuptools (75.3.3)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,9 +0,0 @@
1
- cloudsnorkel/cdk_rds_sanitized_snapshots/__init__.py,sha256=Y_y2uTlpcLIgwFL7CFOlz3Uvf-LD_GyF31A2_woBu8U,17272
2
- cloudsnorkel/cdk_rds_sanitized_snapshots/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
3
- cloudsnorkel/cdk_rds_sanitized_snapshots/_jsii/__init__.py,sha256=uGbhnW8m9cvrYhjjhoB4a7WeOtMWpywXz5Ch6Pd9wGA,414
4
- cloudsnorkel/cdk_rds_sanitized_snapshots/_jsii/cdk-rds-sanitized-snapshots@0.0.0.jsii.tgz,sha256=MNLaRmvO5BdcUUT9PapFyxFbWfNJhoJ8z5ZyuxiZQSo,70445
5
- cloudsnorkel.cdk_rds_sanitized_snapshots-0.0.0.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
6
- cloudsnorkel.cdk_rds_sanitized_snapshots-0.0.0.dist-info/METADATA,sha256=cWO9-t924T6xaNdOKT7iua-I7sPgisOsDj_h9jFYgr0,5260
7
- cloudsnorkel.cdk_rds_sanitized_snapshots-0.0.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
8
- cloudsnorkel.cdk_rds_sanitized_snapshots-0.0.0.dist-info/top_level.txt,sha256=6vUrT-dcGOiRMT4Q6gEQPznoyS7nHOJ269MHpo4DEd8,13
9
- cloudsnorkel.cdk_rds_sanitized_snapshots-0.0.0.dist-info/RECORD,,