How to use get_resource_policy method in localstack

Best Python code snippet using localstack_python

glue.py

Source:glue.py Github

copy

Full Screen

...55 "SecurityConfigurationDetails"56 ] = self.get_security_configuration(57 crawler["CrawlerSecurityConfiguration"]58 )59 resource["DataCatalogueResourcePolicy"] = self.get_resource_policy()60 resource["Connections"] = self.get_connections()61 return resource62 def list_jobs(self):63 """List jobs"""64 jobs = []65 def get_jobs(next_token, jobs):66 resp = self.glue.get_jobs(NextToken=next_token)67 jobs += resp.get("Jobs", [])68 if resp.get("NextToken"):69 get_jobs(resp.get("NextToken"), jobs)70 resp = self.glue.get_jobs()71 jobs += resp.get("Jobs", [])72 if resp.get("NextToken"):73 get_jobs(resp.get("NextToken"), jobs)74 return jobs75 def list_dev_endpoints(self):76 """List dev endpoints"""77 endpoints = []78 def get_dev_endpoints(next_token, endpoints):79 resp = self.glue.get_dev_endpoints(NextToken=next_token)80 endpoints += resp.get("DevEndpoints", [])81 if resp.get("NextToken"):82 get_dev_endpoints(resp.get("NextToken"), endpoints)83 resp = self.glue.get_dev_endpoints()84 endpoints += resp.get("DevEndpoints", [])85 if resp.get("NextToken"):86 get_dev_endpoints(resp.get("NextToken"), endpoints)87 return endpoints88 def get_security_configuration(self, configuration_name):89 """Get sercurity configuration"""90 resp = self.glue.get_security_configuration(Name=configuration_name)91 return resp.get("SecurityConfiguration", {})92 def get_data_catalog_encryption_settings(self):93 """Get data catalog encryption setttings"""94 resp = self.glue.get_data_catalog_encryption_settings()95 return resp.get("DataCatalogEncryptionSettings", {})96 def get_key_details(self, key_id):97 """Get key details"""98 resp = self.kms.describe_key(KeyId=key_id)99 return resp.get("KeyMetadata", {})100 def list_crawlers(self):101 """List crawlers"""102 endpoints = []103 def get_crawlers(next_token, endpoints):104 resp = self.glue.get_crawlers(NextToken=next_token)105 endpoints += resp.get("Crawlers", [])106 if resp.get("NextToken"):107 get_crawlers(resp.get("NextToken"), endpoints)108 resp = self.glue.get_crawlers()109 endpoints += resp.get("Crawlers", [])110 if resp.get("NextToken"):111 get_crawlers(resp.get("NextToken"), endpoints)112 return endpoints113 def get_resource_policy(self, arn=None):114 """Get resource policy"""115 # No ARN need to pass to get resource policy of data catalogue116 if arn:117 resp = self.glue.get_resource_policy(ResourceArn=arn)118 else:119 resp = self.glue.get_resource_policy()120 return resp121 def get_connections(self, catalog_id=None):122 """Get connections"""123 # No ARN need to pass to get resource policy of data catalogue124 if catalog_id:125 resp = self.glue.get_connections(CatalogId=catalog_id)126 else:127 resp = self.glue.get_connections()128 return resp.get("ConnectionList")129def register() -> Any:130 """Register plugin"""...

Full Screen

Full Screen

secretsmanager_starter.py

Source:secretsmanager_starter.py Github

copy

Full Screen

...33 raise SecretNotFoundException()34 setattr(SecretsManagerBackend, 'get_resource_policy', get_resource_policy_model)35 def get_resource_policy_response(self):36 secret_id = self._get_param('SecretId')37 return secretsmanager_backends[self.region].get_resource_policy(38 secret_id=secret_id39 )40 setattr(SecretsManagerResponse, 'get_resource_policy', get_resource_policy_response)41 def delete_resource_policy_model(self, secret_id):42 if self._is_valid_identifier(secret_id):43 self.secrets[secret_id].policy = None44 return json.dumps(45 {46 'ARN': self.secrets[secret_id].arn,47 'Name': self.secrets[secret_id].secret_id48 }49 )50 else:51 raise SecretNotFoundException()...

Full Screen

Full Screen

actions.py

Source:actions.py Github

copy

Full Screen

1class IAMActions:2 name: str3 action_names: list4 @staticmethod5 def generate_action_name(name, action_name: str):6 return '{}:{}'.format(name, action_name)7class Route53Actions(IAMActions):8 name = 'route53'9 FULL_ACCESS = IAMActions.generate_action_name(name, '*')10 CREATE_HOSTED_ZONE = IAMActions.generate_action_name(name, 'CreateHostedZone')11class CWLogsActions(IAMActions):12 name = 'logs'13 FULL_ACCESS = IAMActions.generate_action_name(name, '*')14class CWActions(IAMActions):15 name = 'cloudwatch'16 FULL_ACCESS = IAMActions.generate_action_name(name, '*')17class S3Actions(IAMActions):18 name = 's3'19 FULL_ACCESS = IAMActions.generate_action_name(name, '*')20class IAMIAMActions(IAMActions):21 name = 'iam'22 FULL_ACCESS = IAMActions.generate_action_name(name, '*')23class STSActions(IAMActions):24 name = 'sts'25 ASSUME_ROLE = IAMActions.generate_action_name(name, 'AssumeRole')26class CFNActions(IAMActions):27 name = 'cloudformation'28 FULL_ACCESS = IAMActions.generate_action_name(name, '*')29class EventsActions(IAMActions):30 name = 'events'31 FULL_ACCESS = IAMActions.generate_action_name(name, '*')32class LambdaActions(IAMActions):33 name = 'lambda'34 FULL_ACCESS = IAMActions.generate_action_name(name, '*')35 CREATE_FUNCTION = IAMActions.generate_action_name(name, 'CreateFunction')36 DELETE_FUNCTION = IAMActions.generate_action_name(name, 'DeleteFunction')37 INVOKE_FUNCTION = IAMActions.generate_action_name(name, 'InvokeFunction')38class KMSActions(IAMActions):39 name = 'kms'40 FULL_ACCESS = IAMActions.generate_action_name(name, '*')41 CREATE_KEY = IAMActions.generate_action_name(name, 'CreateKey')42class SecretsManagerActions(IAMActions):43 name = 'secretsmanager'44 FULL_ACCESS = IAMActions.generate_action_name(name, '*')45 CREATE_SECRET = IAMActions.generate_action_name(name, 'CreateSecret')46 LIST_SECRETS = IAMActions.generate_action_name(name, 'ListSecrets')47 GET_RESOURCE_POLICY = IAMActions.generate_action_name(name, 'GetResourcePolicy')48 DESCRIBE_SECRET = IAMActions.generate_action_name(name, 'DescribeSecret')49 PUT_RESOURCE_POLICY = IAMActions.generate_action_name(name, 'PutResourcePolicy')50 PUT_SECRET_VALUE = IAMActions.generate_action_name(name, 'PutSecretValue')51 RESTORE_SECRET = IAMActions.generate_action_name(name, 'RestoreSecret')52 UPDATE_SECRET = IAMActions.generate_action_name(name, 'UpdateSecret')53 DELETE_RESOURCE_POLICY = IAMActions.generate_action_name(name, 'DeleteResourcePolicy')54 DELETE_SECRET = IAMActions.generate_action_name(name, 'DeleteSecret')55 MAIN_ACTIONS = [56 CREATE_SECRET,57 LIST_SECRETS,58 GET_RESOURCE_POLICY,59 DESCRIBE_SECRET,60 PUT_RESOURCE_POLICY,61 PUT_SECRET_VALUE,62 RESTORE_SECRET,63 UPDATE_SECRET,64 DELETE_RESOURCE_POLICY,65 DELETE_SECRET...

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