-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Add utilities for working with LocalStack & other tidying #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
dd478ae
add LOG_LEVEL env var
spompea-cfa c115758
change some logs into debug
spompea-cfa 249f2e6
enable consumer to work with localstack SQS
spompea-cfa 976f348
add some utils for common tasks
spompea-cfa b54e060
update trivyignore.yaml
spompea-cfa 251c48a
small readme fix
spompea-cfa a6273d0
remove unneded scaffolding-related items
spompea-cfa 0b15c23
consolidate into tools container, etc.
spompea-cfa 149cce8
update readme
spompea-cfa f23b245
update readme
spompea-cfa 2cdc208
update trivyignore
spompea-cfa f878a67
rerun checks
spompea-cfa 1781775
noop
spompea-cfa 09077cd
update readme etc
spompea-cfa 79b38c4
small tidy
spompea-cfa 9dc1d4f
tidy
spompea-cfa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
File renamed without changes.
This file contains hidden or 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 hidden or 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,24 @@ | ||
| import os | ||
| import sys | ||
| import boto3 | ||
|
|
||
| def make_s3_client(): | ||
| try: | ||
| sess = boto3.Session() | ||
| return sess.client('s3', endpoint_url=os.environ['AWS_ENDPOINT_URL']) | ||
| except Exception as e: | ||
| print(e) | ||
| sys.exit(1) | ||
|
|
||
| def get_file_from_s3(key): | ||
| '''Get file from S3 and write to /tmp (use docker-compose to map this | ||
| to desired directory on host machine).''' | ||
| s3 = make_s3_client() | ||
| print('Grabbing file...') | ||
| resp = s3.download_file(os.environ['S3_BUCKET_NAME'], key, '/tmp/'+key) | ||
| print ('Got file, put in tmp') | ||
|
|
||
| print("Starting util_s3_retrieve ...") | ||
| fname = sys.argv[1] | ||
| get_file_from_s3(fname) | ||
| print("Done") |
This file contains hidden or 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,16 @@ | ||
| import os | ||
| import boto3 | ||
|
|
||
| def purge_s3(): | ||
| s3 = boto3.resource('s3', endpoint_url=os.environ['AWS_ENDPOINT_URL']) | ||
| buck = s3.Bucket(os.environ['S3_BUCKET_NAME']) | ||
| print('Purging...') | ||
| buck.objects.all().delete() | ||
|
|
||
| print('Are you sure you want to purge the S3 bucket (' + os.environ['S3_BUCKET_NAME'] + ')? If so, type YES:') | ||
| ans = input('>') | ||
| if ans == 'YES': | ||
| purge_s3() | ||
| print('Done.') | ||
| else: | ||
| print('Nothing was done. Everything was left as-is.') |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.