How to use get_conformance_pack_compliance_details method in localstack

Best Python code snippet using localstack_python

client.pyi

Source:client.pyi Github

copy

Full Screen

...766 noncompliant.767 [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/1.24.58/reference/services/config.html#ConfigService.Client.get_compliance_summary_by_resource_type)768 [Show boto3-stubs documentation](https://vemel.github.io/boto3_stubs_docs/mypy_boto3_config/client.html#get_compliance_summary_by_resource_type)769 """770 def get_conformance_pack_compliance_details(771 self,772 *,773 ConformancePackName: str,774 Filters: "ConformancePackEvaluationFiltersTypeDef" = None,775 Limit: int = None,776 NextToken: str = None777 ) -> GetConformancePackComplianceDetailsResponseTypeDef:778 """779 Returns compliance details of a conformance pack for all Amazon Web Services780 resources that are monitered by conformance pack.781 [Show boto3 documentation](https://boto3.amazonaws.com/v1/documentation/api/1.24.58/reference/services/config.html#ConfigService.Client.get_conformance_pack_compliance_details)782 [Show boto3-stubs documentation](https://vemel.github.io/boto3_stubs_docs/mypy_boto3_config/client.html#get_conformance_pack_compliance_details)783 """784 def get_conformance_pack_compliance_summary(...

Full Screen

Full Screen

config_service.py

Source:config_service.py Github

copy

Full Screen

...40 # HomeMade Paginator41 all_response = []42 next_token = ""43 while next_token is not None:44 response = self.client.get_conformance_pack_compliance_details(45 ConformancePackName=conformance_pack_name,46 Filters=filters,47 Limit=100,48 NextToken=next_token49 )50 if "NextToken" in response:51 next_token = response["NextToken"]52 else:53 next_token = None54 all_response.extend(response["ConformancePackRuleEvaluationResults"])55 except Exception as e:56 self.logger.exception("")57 raise e58 else:...

Full Screen

Full Screen

util_config.py

Source:util_config.py Github

copy

Full Screen

1import json2import botocore3import boto34def _fail(e, op, *args):5 print("Unexpected error calling config."+op)6 for a in args:7 print(a)8 print(e)9 return "Unexpected error calling {}".format(op)10def describe_conformance_packs(session):11 fn = "describe_conformance_packs"12 try:13 cfg_client = session.client('config')14 paginator = cfg_client.get_paginator(fn)15 page_iterator = paginator.paginate()16 for page in page_iterator:17 results = page["ConformancePackDetails"]18 for result in results:19 print(result)20 except botocore.exceptions.ClientError as e:21 erm = _fail(e, fn)22 raise Exception(erm)23def list_resource_noncompliance_by_rule(session, configRuleName):24 fn = "get_compliance_details_by_config_rule"25 complianceTypes = ['NON_COMPLIANT']26 map = {}27 try:28 cfg_client = session.client('config')29 paginator = cfg_client.get_paginator(fn)30 page_iterator = paginator.paginate(ConfigRuleName=configRuleName, ComplianceTypes=complianceTypes)31 for page in page_iterator:32 results = page["EvaluationResults"]33 for result in results:34 erq = result['EvaluationResultIdentifier']['EvaluationResultQualifier']35 resourceType = erq['ResourceType']36 resourceId = erq['ResourceId']37 if not (resourceType in map):38 map[resourceType] = []39 map[resourceType].append(resourceId)40 return map41 except botocore.exceptions.ClientError as e:42 erm = _fail(e, fn, '{}={}'.format("rule", configRuleName))43 raise Exception(erm)44def list_resource_noncompliance(session, cpackName):45 fn = "get_conformance_pack_compliance_details"46 filters = {47 'ComplianceType': 'NON_COMPLIANT' 48 }49 try:50 map = {}51 cfg_client = session.client('config')52 paginator = cfg_client.get_paginator(fn)53 page_iterator = paginator.paginate(ConformancePackName=cpackName, Filters=filters)54 for page in page_iterator:55 results = page["ConformancePackRuleEvaluationResults"]56 for result in results:57 erq = result['EvaluationResultIdentifier']['EvaluationResultQualifier']58 configRuleName = erq['ConfigRuleName']59 resourceType = erq['ResourceType']60 resourceId = erq['ResourceId']61 if not (configRuleName in map):62 map[configRuleName] = {}63 crmap = map[configRuleName]64 if not (resourceType in crmap):65 crmap[resourceType] = []66 crmap[resourceType].append(resourceId)67 return map68 except botocore.exceptions.ClientError as e:69 erm = _fail(e, fn, '{}={}'.format("cpackName", cpackName))70 raise Exception(erm)71def list_noncompliant_rules(session):72 fn = "describe_compliance_by_config_rule"73 complianceTypes = ['NON_COMPLIANT']74 try:75 map = {}76 cfg_client = session.client('config')77 paginator = cfg_client.get_paginator(fn)78 page_iterator = paginator.paginate(ComplianceTypes=complianceTypes)79 for page in page_iterator:80 results = page["ComplianceByConfigRules"]81 for result in results:82 print(result)83 return map84 except botocore.exceptions.ClientError as e:85 erm = _fail(e, fn)86 raise Exception(erm)87homeSession = boto3.session.Session()88# describe_conformance_packs(homeSession)89m = list_noncompliant_rules(homeSession)90print(m)91# m = list_resource_noncompliance_by_rule(homeSession, 'ebs-in-backup-plan-conformance-pack-msjja9vn7')...

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