How to use list_role_tags method in localstack

Best Python code snippet using localstack_python

role.py

Source:role.py Github

copy

Full Screen

...16registry = FlagRegistry()17FLAGS = Flags('BASE', 'MANAGED_POLICIES', 'INLINE_POLICIES', 'INSTANCE_PROFILES', 'TAGS')18@registry.register(flag=FLAGS.TAGS, depends_on=FLAGS.BASE, key='tags')19def get_tags(role, **conn):20 tags = list_role_tags(role, **conn)21 # AWS Returns a funky format for tags:22 # [{23 # "Key": "owner",24 # "Value": "bandersnatch"25 # }]26 # reformat into a single dict.27 # { "owner": "bandersnatch" }28 return {t.get('Key'): t.get('Value') for t in tags}29@registry.register(flag=FLAGS.MANAGED_POLICIES, depends_on=FLAGS.BASE, key='managed_policies')30def get_managed_policies(role, **conn):31 return get_role_managed_policies(role, **conn)32@registry.register(flag=FLAGS.INLINE_POLICIES, depends_on=FLAGS.BASE, key='inline_policies')33def get_inline_policies(role, **conn):34 return get_role_inline_policies(role, **conn)...

Full Screen

Full Screen

sari_config.py

Source:sari_config.py Github

copy

Full Screen

...18 """19 Retrieve the SARI configuration stored as tags of to the IAM Role.20 """21 iam = boto3_session.client("iam")22 # list_role_tags() reference:23 # https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/iam.html#IAM.Client.list_role_tags24 response = iam.list_role_tags(RoleName=SARI_ROLE_NAME)25 prefix = "sari:"26 settings = dict(27 [(tag["Key"][len(prefix):], tag["Value"]) for tag in response["Tags"]28 if tag["Key"].startswith(prefix)]29 )...

Full Screen

Full Screen

app.py

Source:app.py Github

copy

Full Screen

...3import boto34def lambda_handler(event, context):5 print(f'Input: {event}')6 client = boto3.client('iam')7 response = client.list_role_tags(8 RoleName=event.get('IdentityName')9 )10 print(f'Response: {response}')11 role_project_tag = list(filter(lambda x:x.get('Key')=='Project', response.get('Tags', []))) 12 event['IdentityProject'] = role_project_tag[0]['Value'] if role_project_tag else ''...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful