-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a new feature to retrieve secrets without downloading them (#43)
* 🔧 Specified version of the auth0-saml file * 🎉 Added reading secrets * 🔧 Updated README file --------- Co-authored-by: Alex Lubneuski <[email protected]>
- Loading branch information
1 parent
7cf61e8
commit 2c69a75
Showing
4 changed files
with
59 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import d3b_cli_igor.common | ||
import boto3 | ||
import boto3, yaml, numpy, sys, time | ||
from termcolor import colored | ||
|
||
logger = d3b_cli_igor.common.get_logger( | ||
__name__, testing_mode=False, log_format="detailed" | ||
) | ||
|
||
def pretty_print(output): | ||
for item in output: | ||
print(colored('Application Name: ','red'),colored(item['app'],'green')) | ||
for k in item: | ||
print(colored(k,'red'),":",colored(str(item[k]),'green')) | ||
|
||
|
||
def get_secrets(app, environment, account, region): | ||
client = boto3.client('s3') | ||
account_id = boto3.client('sts').get_caller_identity().get('Account') | ||
bucket = account+"-"+account_id+"-"+region+"-"+environment+"-secrets" | ||
prefix = app + "/" | ||
|
||
result = client.list_objects_v2(Bucket=bucket, Prefix=prefix, Delimiter="/") | ||
for obj in result["Contents"]: | ||
print(obj["Key"]) | ||
print("=============================") | ||
s3 = boto3.resource('s3') | ||
object_body = s3.Object(bucket,obj["Key"]) | ||
print(object_body.get()['Body'].read().decode('utf-8')) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ click | |
pyyaml>=5.4 | ||
datetime | ||
aws-ssm-tools | ||
auth0-login | ||
auth0-login<=0.5.2 |