How to use list_compliance_summaries method in localstack

Best Python code snippet using localstack_python

constants.py

Source: constants.py Github

copy

Full Screen

1from collections import OrderedDict2from pyrsistent import freeze3SINLE_REGION_SERVICES = freeze(["iam", "s3", "cloudfront"])4# fmt: off5METAMAP = freeze(6 OrderedDict({7 "autoscaling_auto_scaling_groups": {"fetch_method": "describe_auto_scaling_groups", "response_key": "AutoScalingGroups"},8 "cloudformation_stacks": {"fetch_method": "describe_stacks", "response_key": "Stacks"},9 "cloudfront_distributions": {"fetch_method": "list_distributions", "response_key": "Items", "page_key": "DistributionList"},10 "cloudtrail_trails": {"fetch_method": "describe_trails", "response_key": "trailList"},11 "config_configuration_recorder_status": {"fetch_method": "describe_configuration_recorder_status", "response_key": "ConfigurationRecordersStatus"},12 "config_configuration_recorders": {"fetch_method": "describe_configuration_recorders", "response_key": "ConfigurationRecorders"},13 "config_delivery_channel_status": {"fetch_method": "describe_delivery_channel_status", "response_key": "DeliveryChannelsStatus"},14 "config_delivery_channels": {"fetch_method": "describe_delivery_channels", "response_key": "DeliveryChannels"},15 "dynamodb_tables": {"fetch_method": "list_tables", "response_key": "TableNames"},16 "ec2_addresses": {"fetch_method": "describe_addresses", "response_key": "Addresses"},17 "ec2_flow_logs": {"fetch_method": "describe_flow_logs", "response_key": "FlowLogs"},18 "ec2_images": {"fetch_method": "describe_images", "response_key": "Images", "kwargs": {"Owners": ["self"]}},19 "ec2_instances": {"fetch_method": "describe_instances", "page_key": "Reservations", "response_key": "Instances"},20 "ec2_nat_gateways": {"fetch_method": "describe_nat_gateways", "response_key": "NatGateways"},21 "ec2_network_interfaces": {"fetch_method": "describe_network_interfaces", "response_key": "NetworkInterfaces"},22 "ec2_reserved_instances": {"fetch_method": "describe_reserved_instances", "response_key": "ReservedInstances"},23 "ec2_reserved_instances_modifications": {"fetch_method": "describe_reserved_instances_modifications", "response_key": "ReservedInstancesModifications"},24 "ec2_route_tables": {"fetch_method": "describe_route_tables", "response_key": "RouteTables"},25 "ec2_security_groups": {"fetch_method": "describe_security_groups", "response_key": "SecurityGroups"},26 "ec2_snapshots": {"fetch_method": "describe_snapshots", "response_key": "Snapshots", "kwargs": {"OwnerIds": ["self"]}},27 "ec2_subnets": {"fetch_method": "describe_subnets", "response_key": "Subnets"},28 "ec2_volumes": {"fetch_method": "describe_volumes", "response_key": "Volumes"},29 "ec2_vpcs": {"fetch_method": "describe_vpcs", "response_key": "Vpcs"},30 "ecs_clusters": {"fetch_method": "list_clusters", "response_key": "clusterArns"},31 "efs_file_systems": {"fetch_method": "describe_file_systems", "response_key": "FileSystems"},32 "eks_clusters": {"fetch_method": "list_clusters", "response_key": "clusters"},33 "elasticache_cache_clusters": {"fetch_method": "describe_cache_clusters", "response_key": "CacheClusters"},34 "elasticache_replication_groups": {"fetch_method": "describe_replication_groups", "response_key": "ReplicationGroups"},35 "elasticache_cache_subnet_groups": {"fetch_method": "describe_cache_subnet_groups", "response_key": "CacheSubnetGroups"},36 "elbv2_load_balancers": {"fetch_method": "describe_load_balancers", "response_key": "LoadBalancers"},37 "elbv2_target_groups": {"fetch_method": "describe_target_groups", "response_key": "TargetGroups"},38 "iam_account_aliases": {"fetch_method": "list_account_aliases", "response_key": "AccountAliases"},39 "iam_account_summary": {"fetch_method": "get_account_summary", "response_key": "SummaryMap"},40 "iam_account_password_policy": {"fetch_method": "get_account_password_policy", "response_key": "PasswordPolicy"},41 "iam_instance_profiles": {"fetch_method": "list_instance_profiles", "response_key": "InstanceProfiles"},42 "iam_roles": {"fetch_method": "list_roles", "response_key": "Roles"},43 "iam_users": {"fetch_method": "list_users", "response_key": "Users"},44 "inspector_assessment_runs": {"fetch_method": "list_assessment_runs", "response_key": "assessmentRunArns"},45 "kms_keys": {"fetch_method": "list_keys", "response_key": "Keys"},46 "lambda_functions": {"fetch_method": "list_functions", "response_key": "Functions"},47 "neptune_db_instances": {"fetch_method": "describe_db_instances", "response_key": "DBInstances"},48 "rds_db_instances": {"fetch_method": "describe_db_instances", "response_key": "DBInstances"},49 "rds_db_snapshots": {"fetch_method": "describe_db_snapshots", "response_key": "DBSnapshots"},50 "rds_pending_maintenance_actions": {"fetch_method": "describe_pending_maintenance_actions", "response_key": "PendingMaintenanceActions"},51 "redshift_clusters": {"fetch_method": "describe_clusters", "response_key": "Clusters"},52 "resourcegroupstaggingapi_tag_keys": {"fetch_method": "get_tag_keys", "response_key": "TagKeys"},53 "resourcegroupstaggingapi_resources": {"fetch_method": "get_resources", "response_key": "ResourceTagMappingList"},54 "s3_buckets": {"fetch_method": "list_buckets", "response_key": "Buckets"},55 "ssm_compliance_summaries": {"fetch_method": "list_compliance_summaries", "response_key": "ComplianceSummaryItems"},56 "workspaces_workspace_directories": {"fetch_method": "describe_workspace_directories", "response_key": "Directories"},57 "workspaces_workspaces": {"fetch_method": "describe_workspaces", "response_key": "Workspaces"},58 })59)60SUBRESOURCES_METAMAP = freeze(61 OrderedDict({62 "elbv2_target_health": {63 "fetch_method": "describe_target_health",64 "response_key": "TargetHealthDescriptions",65 "parent_required_filters": {66 "filter_key": "TargetGroupArn",67 "parent_filter_field": "TargetGroupArn",68 "parent_metadata_type": "elbv2_target_groups",69 }70 },71 "s3_bucket_versioning": {72 "fetch_method": "get_bucket_versioning",73 "parent_required_filters": {74 "filter_key": "Bucket",75 "parent_filter_field": "Name",76 "parent_metadata_type": "s3_buckets",77 }78 },79 "s3_bucket_encryption": {80 "fetch_method": "get_bucket_encryption",81 "response_key": "ServerSideEncryptionConfiguration",82 "parent_required_filters": {83 "filter_key": "Bucket",84 "parent_filter_field": "Name",85 "parent_metadata_type": "s3_buckets",86 }87 }88 })89)90# This dict stores the "metadata_type -> fields to process" mapping91# We need it because sweet boto3 lib marks AssumeRolePolicyDocument as str in schemas, but in fact it returns dict obj.92# SEE: nops_metadata.utils.process_element93APPLY_NESTED_ELEMENT_PROCESSING = {94 "iam_instance_profiles": ["Roles"]95}96RELATIONSHIPS_MAPPING = freeze(97 {98 "ec2_instances": {99 "volume": {100 "many_to_many": True,101 "m2m_table_name": "ec2_instance_volume",102 "related_table": "ec2_volumes",103 "related_column": "volume_id",104 "custom_join_query": """, json_array_elements(block_device_mappings::json) AS e JOIN ec2_volumes ec2_volumes_tmp ON (e -> 'Ebs' ->> 'VolumeId') = ec2_volumes_tmp.volume_id """,105 },106 "image_fk": {107 "related_table": "ec2_images",108 "related_column": "image_id",109 },110 "vpc_fk": {111 "related_table": "ec2_vpcs",112 "related_column": "vpc_id",113 },114 "subnet_fk": {115 "related_table": "ec2_subnets",116 "related_column": "subnet_id",117 },118 "ec2_security_groups": {119 "many_to_many": True,120 "m2m_table_name": "ec2_instance_security_group",121 "related_table": "ec2_security_groups",122 "related_column": "group_id",123 "custom_join_query": """, json_array_elements(security_groups::json) AS e JOIN ec2_security_groups ec2_security_groups_tmp ON (e ->> 'GroupId') = ec2_security_groups_tmp.group_id """,124 },125 "iam_instance_profile_fk": {126 "related_table": "iam_instance_profiles",127 "related_column": "instance_profile_id",128 "custom_join_query": """LEFT OUTER JOIN iam_instance_profiles iam_instance_profiles_tmp ON iam_instance_profiles_tmp.arn = vals.iam_instance_profile->>'Arn'""",129 },130 },131 "iam_instance_profiles": {132 "roles": {133 "many_to_many": True,134 "m2m_table_name": "iam_instance_profile_role",135 "related_table": "iam_roles",136 "related_column": "arn",137 "custom_join_query": """, json_array_elements(roles::json) AS e JOIN iam_roles iam_roles_tmp ON (e ->> 'Arn') = iam_roles_tmp.arn """,138 }139 },140 "ec2_security_groups": {141 "vpc_fk": {142 "related_table": "ec2_vpcs",143 "related_column": "vpc_id",144 },145 },146 "elbv2_target_groups": {147 "load_balancer_arns": {148 "many_to_many": True,149 "m2m_table_name": "target_group_load_balancer",150 "related_table": "elbv2_load_balancers",151 "related_column": "load_balancer_arn",152 },153 "vpc_fk": {154 "related_table": "ec2_vpcs",155 "related_column": "vpc_id",156 },157 },158 "elbv2_load_balancers": {159 "vpc_fk": {160 "related_table": "ec2_vpcs",161 "related_column": "vpc_id",162 },163 "security_groups": {164 "many_to_many": True,165 "m2m_table_name": "load_balancer_security_group",166 "related_table": "ec2_security_groups",167 "related_column": "group_id",168 }169 },170 "elbv2_target_health": {171 "instance_fk": {172 "related_table": "ec2_instances",173 "custom_join_query": """LEFT OUTER JOIN ec2_instances ec2_instances_tmp ON ec2_instances_tmp.instance_id = vals.target->>'Id'""",174 "related_column": "instance_id",175 }176 },177 "ec2_snapshots": {178 "volume_fk": {179 "related_table": "ec2_volumes",180 "related_column": "volume_id",181 }182 },183 "ec2_addresses": {184 "instance_fk": {185 "related_table": "ec2_instances",186 "related_column": "instance_id",187 },188 "network_interface_fk": {189 "related_table": "ec2_network_interfaces",190 "related_column": "network_interface_id",191 }192 },193 "ec2_route_tables": {194 "vpc_fk": {195 "related_table": "ec2_vpcs",196 "related_column": "vpc_id",197 }198 },199 "ec2_subnets": {200 "vpc_fk": {201 "related_table": "ec2_vpcs",202 "related_column": "vpc_id",203 }204 },205 "rds_db_snapshots": {206 "vpc_fk": {207 "related_table": "ec2_vpcs",208 "related_column": "vpc_id",209 }210 },211 "ec2_flow_logs": {212 "resource_fk": {213 "related_table": "ec2_vpcs",214 "related_column": "vpc_id",215 "this_table_column": "resource_id"216 }217 },218 "ec2_nat_gateways": {219 "subnet_fk": {220 "related_table": "ec2_subnets",221 "related_column": "subnet_id",222 },223 "vpc_fk": {224 "related_table": "ec2_vpcs",225 "related_column": "vpc_id",226 }227 },228 "autoscaling_auto_scaling_groups": {229 "instances": {230 "many_to_many": True,231 "m2m_table_name": "autoscaling_enabled_ec2_instance",232 "related_table": "ec2_instances",233 "related_column": "instance_id",234 "custom_join_query": """, json_array_elements(instances::json) AS e JOIN ec2_instances ec2_instances_tmp ON (e ->> 'InstanceId') = ec2_instances_tmp.instance_id """,235 }236 },237 "rds_db_instances": {238 "kms_key_pk": {239 "related_table": "kms_keys",240 "related_column": "key_arn",241 "this_table_column": "kms_key_id",242 },243 "vpc_security_groups": {244 "many_to_many": True,245 "m2m_table_name": "rds_instance_security_group",246 "related_table": "ec2_security_groups",247 "related_column": "group_id",248 "custom_join_query": """, json_array_elements(vpc_security_groups::json) AS e JOIN ec2_security_groups ec2_security_groups_tmp ON (e ->> 'VpcSecurityGroupId') = ec2_security_groups_tmp.group_id """,249 }250 },251 "efs_file_systems": {252 "kms_key_pk": {253 "related_table": "kms_keys",254 "related_column": "key_arn",255 "this_table_column": "kms_key_id",256 },257 },258 "elasticache_cache_clusters": {259 "security_groups": {260 "many_to_many": True,261 "m2m_table_name": "elasticache_security_group",262 "related_table": "ec2_security_groups",263 "related_column": "group_id",264 "custom_join_query": """, json_array_elements(security_groups::json) AS e JOIN ec2_security_groups ec2_security_groups_tmp ON (e ->> 'SecurityGroupId') = ec2_security_groups_tmp.group_id """,265 },266 "replication_group_pk": {267 "related_table": "elasticache_replication_groups",268 "related_column": "replication_group_id",269 },270 "cache_subnet_group_name_fk": {271 "related_table": "elasticache_cache_subnet_groups",272 "related_column": "cache_subnet_group_name",273 }274 },275 "elasticache_replication_groups": {276 "kms_key_pk": {277 "related_table": "kms_keys",278 "related_column": "key_arn",279 "this_table_column": "kms_key_id",280 },281 },282 "elasticache_cache_subnet_groups": {283 "vpc_fk": {284 "related_table": "ec2_vpcs",285 "related_column": "vpc_id",286 },287 "subnets": {288 "many_to_many": True,289 "m2m_table_name": "elasticache_cache_subnet_group",290 "related_table": "ec2_subnets",291 "related_column": "subnet_id",292 "custom_join_query": """, json_array_elements(subnets::json) AS e LEFT OUTER JOIN ec2_subnets ec2_subnets_tmp ON (e ->> 'SubnetIdentifier') = ec2_subnets_tmp.subnet_id """,293 },294 },295 "redshift_clusters": {296 "vpc_fk": {297 "related_table": "ec2_vpcs",298 "related_column": "vpc_id",299 },300 "kms_key_pk": {301 "related_table": "kms_keys",302 "related_column": "key_arn",303 "this_table_column": "kms_key_id",304 },305 },306 "cloudtrail_trails": {307 "s3_bucket_fk": {308 "related_table": "s3_buckets",309 "related_column": "name",310 "this_table_column": "s3_bucket_name",311 },312 "kms_key_pk": {313 "related_table": "kms_keys",314 "related_column": "key_arn",315 "this_table_column": "kms_key_id",316 },317 },318 "config_delivery_channels": {319 "s3_bucket_fk": {320 "related_table": "s3_buckets",321 "related_column": "name",322 "this_table_column": "s3_bucket_name",323 },324 },325 "cloudformation_stacks": {326 "parent_stack_fk": {327 "related_table": "cloudformation_stacks",328 "related_column": "stack_id",329 "this_table_column": "parent_id",330 },331 "iam_role_fk": {332 "related_table": "iam_roles",333 "related_column": "arn",334 "this_table_column": "role_arn",335 },336 },337 "neptune_db_instances": {338 "vpc_security_groups": {339 "many_to_many": True,340 "m2m_table_name": "neptune_instance_security_group",341 "related_table": "ec2_security_groups",342 "related_column": "group_id",343 "custom_join_query": """, json_array_elements(vpc_security_groups::json) AS e JOIN ec2_security_groups ec2_security_groups_tmp ON (e ->> 'VpcSecurityGroupId') = ec2_security_groups_tmp.group_id """,344 },345 "kms_key_pk": {346 "related_table": "kms_keys",347 "related_column": "key_arn",348 "this_table_column": "kms_key_id",349 },350 }351 },352)...

Full Screen

Full Screen

list_ssm_compliance_summaries.py

Source: list_ssm_compliance_summaries.py Github

copy

Full Screen

...13 managedinstanceinventory_client = boto3.client('ssm', region_name = j )14 managedinstanceinventory = []15 next_token = None16 while True:17 response = managedinstanceinventory_client.list_compliance_summaries(18 NextToken= next_token19 ) if next_token else managedinstanceinventory_client.list_compliance_summaries()20 print(response['ComplianceSummaryItems']) 21 for i in response['ComplianceSummaryItems']:22 23 managedinstanceinventory.append(i['ComplianceType'])24 print(i['ComplianceType']) 25 # print(i['CompliantSummary'])26 # print(i['NonCompliantSummary'])27 # for compliance in i['CompliantSummary']:28 # print("Count of compliants: ") 29 # print(str(compliance['CompliantCount']))30 # for non_compliance in i['NonCompliantSummary']:31 # print("Count of non-compliants: ") 32 # print(non_compliance['NonCompliantCount']) 33 ...

Full Screen

Full Screen

ssm.py

Source: ssm.py Github

copy

Full Screen

...8 session = boto39 if region is not None:10 session = boto3.session.Session(region_name=region) 11 client = session.client('ssm')12 response = client.list_compliance_summaries()13 return_dicts = []14 for i in response['ComplianceSummaryItems']:15 return_dicts.append({16 "ComplianceType": i['ComplianceType'],17 "CompliantCount": str(i['CompliantSummary']['CompliantCount']),18 "NonCompliantCount": str(i['NonCompliantSummary']['NonCompliantCount'])19 })...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

13 Best Java Testing Frameworks For 2023

The fact is not alien to us anymore that cross browser testing is imperative to enhance your application’s user experience. Enhanced knowledge of popular and highly acclaimed testing frameworks goes a long way in developing a new app. It holds more significance if you are a full-stack developer or expert programmer.

QA Innovation – Using the senseshaping concept to discover customer needs

QA Innovation - Using the senseshaping concept to discover customer needsQA testers have a unique role and responsibility to serve the customer. Serving the customer in software testing means protecting customers from application defects, failures, and perceived failures from missing or misunderstood requirements. Testing for known requirements based on documentation or discussion is the core of the testing profession. One unique way QA testers can both differentiate themselves and be innovative occurs when senseshaping is used to improve the application user experience.

Best 23 Web Design Trends To Follow In 2023

Having a good web design can empower business and make your brand stand out. According to a survey by Top Design Firms, 50% of users believe that website design is crucial to an organization’s overall brand. Therefore, businesses should prioritize website design to meet customer expectations and build their brand identity. Your website is the face of your business, so it’s important that it’s updated regularly as per the current web design trends.

Acquiring Employee Support for Change Management Implementation

Enterprise resource planning (ERP) is a form of business process management software—typically a suite of integrated applications—that assists a company in managing its operations, interpreting data, and automating various back-office processes. The introduction of a new ERP system is analogous to the introduction of a new product into the market. If the product is not handled appropriately, it will fail, resulting in significant losses for the business. Most significantly, the employees’ time, effort, and morale would suffer as a result of the procedure.

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