How to use get_resource_config_history method in localstack

Best Python code snippet using localstack_python

service.py

Source:service.py Github

copy

Full Screen

...62def is_scheduled_notification(message_type):63 check_defined(message_type, 'messageType')64 return message_type == 'ScheduledNotification'65def inflate_oversized_notification(config_client, invoking_event):66 grh_response = get_resource_config_history(config_client, invoking_event)67 config_item = convert_into_notification_config_item(grh_response['configurationItems'][0])68 return {69 'configurationItem': config_item,70 'notificationCreationTime': invoking_event['notificationCreationTime'],71 'messageType': invoking_event['messageType'],72 'recordVersion': invoking_event['recordVersion']73 }74def get_resource_config_history(config_client, invoking_event):75 resource_id = invoking_event['configurationItemSummary']['resourceId']76 resource_type = invoking_event['configurationItemSummary']['resourceType']77 return config_client.get_resource_config_history(78 resourceType=resource_type,79 resourceId=resource_id,80 limit=181 )82def convert_into_notification_config_item(grh_config_item):83 return {84 'configurationItemCaptureTime': grh_config_item['configurationItemCaptureTime'],85 'configurationStateId': grh_config_item['configurationStateId'],86 'awsAccountId': grh_config_item['accountId'],87 'configurationItemStatus': grh_config_item['configurationItemStatus'],88 'resourceType': grh_config_item['resourceType'],89 'resourceId': grh_config_item['resourceId'],90 'resourceName': grh_config_item['resourceName'],91 'ARN': grh_config_item['arn'],...

Full Screen

Full Screen

send_non_compliant.py

Source:send_non_compliant.py Github

copy

Full Screen

...11 d[rulename['ConfigRuleName']] = []12 evaluation_results = CONFIG_CLIENT.get_compliance_details_by_config_rule(ComplianceTypes=['NON_COMPLIANT'], ConfigRuleName=rulename['ConfigRuleName'])13 for resources in evaluation_results['EvaluationResults']:14 # config resource Id will not give complete ARN. So make another call for et_resource_config_history and get the resource ARN15 resource_arn = CONFIG_CLIENT.get_resource_config_history(resourceType=resources['EvaluationResultIdentifier']['EvaluationResultQualifier']['ResourceType']16 ,resourceId=resources['EvaluationResultIdentifier']['EvaluationResultQualifier']['ResourceId'],limit=1)17 18 d[rulename['ConfigRuleName']].append(resource_arn['configurationItems'][0]['arn'])19 #print(d)20 21 for key,values in d.items():22 if d[key]:23 message = "total " + str(len(values)) + " NON_COMPLIANT resources for ConfigRule - " + key + "\n"24 for pos,value in enumerate(values):25 message += "\n" + " " + str(pos) + " - " + value26 response = SNS_CLIENT.publish(TopicArn=topic_arn,Message=message)...

Full Screen

Full Screen

get_resource_config_history.py

Source:get_resource_config_history.py Github

copy

Full Screen

...7 os.environ['AWS_SHARED_CREDENTIALS_FILE'] = credentials_file8if os.path.isfile(config_file):9 os.environ['AWS_CONFIG_FILE'] = config_file10client = boto3.client('config')11response = client.get_resource_config_history(12 resourceType='AWS::EC2::Instance',13 resourceId='i-xxxxxxxxxxxxxxxxx')14conf_items = response['configurationItems']...

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