Best Python code snippet using localstack_python
kms.py
Source:kms.py
...86 self.logger.log_unhandled_exception(e)87 raise88 def enable_key_rotation(self, key_id):89 try:90 response = self.get_key_rotation_status(key_id)91 # Enable auto key rotation only if it hasn't been enabled92 if not response.get('KeyRotationEnabled'):93 self.kms_client.enable_key_rotation(KeyId=key_id)94 return response95 except ClientError as e:96 self.logger.log_unhandled_exception(e)97 raise98 def get_key_rotation_status(self, key_id):99 try:100 response = self.kms_client.get_key_rotation_status(101 KeyId=key_id102 )103 return response104 except ClientError as e:105 self.logger.log_unhandled_exception(e)...
gds_kms_client.py
Source:gds_kms_client.py
...9 """10 def get_key_list_with_details(self, session):11 keys_list = self.get_key_list(session)12 for key in keys_list:13 key.update(self.get_key_rotation_status(session, key["KeyArn"]))14 key.update(self.get_key_details(session, key["KeyArn"]))15 self.app.log.debug("KMS::get_key_list_with_details")16 self.app.log.debug(type(keys_list))17 self.app.log.debug(keys_list)18 return keys_list19 def get_key_list(self, session):20 """21 """22 kms_client = self.get_boto3_session_client("kms", session)23 data = kms_client.list_keys().get("Keys", [])24 self.app.log.debug("KMS::get_key_list")25 self.app.log.debug(type(data))26 self.app.log.debug(data)27 return data28 def get_key_rotation_status(self, session, key_id_or_arn):29 """30 """31 kms_client = self.get_boto3_session_client("kms", session)32 data = kms_client.get_key_rotation_status(KeyId=key_id_or_arn)33 self.app.log.debug("KMS::get_key_rotation_status")34 self.app.log.debug(type(data))35 self.app.log.debug(data)36 return data37 def get_key_details(self, session, key_id_or_arn):38 """39 """40 kms_client = self.get_boto3_session_client("kms", session)41 data = kms_client.describe_key(KeyId=key_id_or_arn)42 self.app.log.debug("KMS::get_key_details")43 self.app.log.debug(type(data))44 self.app.log.debug(data)45 return data["KeyMetadata"]46 ###...
kms_barrel.py
Source:kms_barrel.py
...40 )41 items_by_region[region][key_id] = response['KeyMetadata']42 self.cache['describe_key'] = items_by_region43 return items_by_region44 def get_key_rotation_status(self):45 items_by_region = {}46 for region, client in self.clients.items():47 items_by_region[region] = {}48 for key in self.tap('list_keys')[region]:49 key_id = key['KeyId']50 response = client.get_key_rotation_status(51 KeyId=key_id52 )53 items_by_region[region][key_id] = response54 self.cache['get_key_rotation_status'] = items_by_region...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!