-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This enables pipelines to create their own, and gives more flexibility to the release cycle when using tooling that doesn't clear out s3 buckets for you. Also allows you to use a bucket from another account.
- Loading branch information
Brett Swift
authored and
Brett Swift
committed
Oct 23, 2018
1 parent
50dfa2e
commit b47384f
Showing
9 changed files
with
137 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
from troposphere.s3 import Bucket, VersioningConfiguration | ||
|
||
from cumulus.chain import step | ||
|
||
|
||
class S3Bucket(step.Step): | ||
def __init__(self, | ||
logical_name, | ||
bucket_name, | ||
# bucket_policy_statements=None, | ||
): | ||
""" | ||
:type bucket_name: the name of the bucket that will be created suffixed with the chaincontext instance name | ||
:type bucket_policy_statements: [awacs.aws.Statement] | ||
""" | ||
step.Step.__init__(self) | ||
self.logical_name = logical_name | ||
self.bucket_name = bucket_name | ||
# TODO: this property is a vistigial one from when this was ripped out of the pipeline, | ||
# however, leaving it here as it is surely useful if you want to just create a bucket | ||
# with some policies. | ||
# self.bucket_policy_statements = bucket_policy_statements | ||
|
||
def handle(self, chain_context): | ||
""" | ||
This step adds in the shell of a pipeline. | ||
* s3 bucket | ||
* policies for the bucket and pipeline | ||
* your next step in the chain MUST be a source stage | ||
:param chain_context: | ||
:return: | ||
""" | ||
|
||
bucket = Bucket( | ||
self.logical_name, | ||
BucketName=self.bucket_name, | ||
VersioningConfiguration=VersioningConfiguration( | ||
Status="Enabled" | ||
) | ||
) | ||
|
||
chain_context.template.add_resource(bucket) | ||
|
||
print("Added bucket: " + self.logical_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters