How to use describe_trusted_advisor_check_result method in localstack

Best Python code snippet using localstack_python

get-underutilized-resources.py

Source:get-underutilized-resources.py Github

copy

Full Screen

...32 print(e)33def get_ec2_check_results():34 check_id = "Qch7DwouX1"35 try:36 response = client.describe_trusted_advisor_check_result(checkId=check_id, language=language)37 flagged_resources = response['result']['flaggedResources']38 estimated_savings = response['result']['categorySpecificSummary']['costOptimizing']['estimatedMonthlySavings']39 instance = response['result']['flaggedResources'][0]['metadata']40 if response['ResponseMetadata']['HTTPStatusCode'] == 200:41 if not flagged_resources:42 print("====> No Low Utilization RDS Instances Found!")43 else: 44 for an_instance in flagged_resources:45 print("=== Low Utilization Amazon EC2 Instances ===")46 print("Account ID: " + account_id + "| Account Name: " + account_alias)47 print("Region: " + str(instance[0]) + " | " + "Instance ID: " + str(instance[1]) 48 + " | " + "Instance Type: " + str(instance[3] + " | " + "Estimated Savings: " + str(instance[4])))49 else:50 print("error")51 except Exception as e:52 print(e)53def get_rds_check_results():54 check_id = "Ti39halfu8"55 try:56 response = client.describe_trusted_advisor_check_result(checkId=check_id, language=language)57 flagged_resources = response['result']['flaggedResources']58 #instance = response['result']['flaggedResources'][0]['metadata']59 if response['ResponseMetadata']['HTTPStatusCode'] == 200:60 if not flagged_resources:61 print("====> No Low Utilization RDS Instances Found!")62 else:63 print(flagged_resources) 64 for an_instance in flagged_resources:65 print("=== Low Utilization Amazon RDS Instances ===")66 print("Account ID: " + account_id + "| Account Name: " + account_alias)67 print(an_instance)68 else:69 print("error")70 except Exception as e:71 print(e)72def get_ebs_check_results():73 check_id = "DAvU99Dc4C"74 try:75 response = client.describe_trusted_advisor_check_result(checkId=check_id, language=language)76 flagged_resources = response['result']['flaggedResources']77 volume = response['result']['flaggedResources'][0]['metadata']78 if response['ResponseMetadata']['HTTPStatusCode'] == 200:79 if not flagged_resources:80 print("====> No Low Utilization EBS Volumes Found!")81 else: 82 for a_volume in flagged_resources:83 print("=== Low Utilization EBS Volumes ===")84 print("Account ID: " + account_id + "| Account Name: " + account_alias)85 print("Region: " + str(volume[0]) + " | " + "Volume ID: " + str(volume[1]) 86 + " | " + "Volume Type: " + str(volume[3] + " | " + "Estimated Savings: " + str(volume[5])))87 else:88 print("error")89 except Exception as e:90 print(e)91def get_redshift_check_results():92 check_id = "G31sQ1E9U"93 try:94 response = client.describe_trusted_advisor_check_result(checkId=check_id, language=language)95 flagged_resources = response['result']['flaggedResources']96 #cluster = response['result']['flaggedResources'][0]['metadata']97 if response['ResponseMetadata']['HTTPStatusCode'] == 200:98 if not flagged_resources:99 print("====> No Low Utilization Clusters Found!")100 else: 101 for a_cluster in flagged_resources:102 print("=== Low Utilization Clusters ===")103 print("Account ID: " + account_id + "| Account Name: " + account_alias)104 print(a_cluster) 105 else:106 print("error")107 except Exception as e:108 print(e)109def get_elb_check_results():110 check_id = "hjLMh88uM8"111 try:112 response = client.describe_trusted_advisor_check_result(checkId=check_id, language=language)113 flagged_resources = response['result']['flaggedResources']114 #elb = response['result']['flaggedResources'][0]['metadata']115 if response['ResponseMetadata']['HTTPStatusCode'] == 200:116 if not flagged_resources:117 print("====> No Low Utilization ELB Found!")118 else: 119 for an_elb in flagged_resources:120 print("=== Low Utilization ELBs ===")121 print("Account ID: " + account_id + "| Account Name: " + account_alias)122 print(an_elb) 123 else:124 print("error")125 except Exception as e:126 print(e)127def get_eip_check_results():128 check_id = "Z4AUBRNSmz"129 try:130 response = client.describe_trusted_advisor_check_result(checkId=check_id, language=language)131 flagged_resources = response['result']['flaggedResources']132 eip = response['result']['flaggedResources'][0]['metadata']133 if response['ResponseMetadata']['HTTPStatusCode'] == 200:134 if not flagged_resources:135 print("====> No Unassociated Elastic IP Addresses Found!")136 else: 137 for an_elb in flagged_resources:138 print("=== Unassociated Elastic IP Addresses ===")139 print("Account ID: " + account_id + "| Account Name: " + account_alias)140 print("Region: " + str(eip[0]) + " | " + "EIP: " + str(eip[1]))141 else:142 print("error")143 except Exception as e:144 print(e)145def get_ri_expiration_check_results():146 check_id = "1e93e4c0b5"147 try:148 response = client.describe_trusted_advisor_check_result(checkId=check_id, language=language)149 flagged_resources = response['result']['flaggedResources']150 #riexp = response['result']['flaggedResources'][0]['metadata']151 if response['ResponseMetadata']['HTTPStatusCode'] == 200:152 if not flagged_resources:153 print("====> No RI Expiration Found!")154 else: 155 for an_expiration in flagged_resources:156 print("=== RI Expirations ===")157 print("Account ID: " + account_id + "| Account Name: " + account_alias)158 print(an_expiration) 159 else:160 print("error")161 except Exception as e:162 print(e)163def get_ri_optimization_results():164 check_id = "1MoPEMsKx6"165 try:166 response = client.describe_trusted_advisor_check_result(checkId=check_id, language=language)167 flagged_resources = response['result']['flaggedResources']168 #rires = response['result']['flaggedResources'][0]['metadata']169 if response['ResponseMetadata']['HTTPStatusCode'] == 200:170 if not flagged_resources:171 print("====> No RI Optimization Result Found!")172 else: 173 for optimization in flagged_resources:174 print("=== RI Optimization Result ===")175 print("Account ID: " + account_id + "| Account Name: " + account_alias)176 print(optimization) 177 else:178 print("error")179 except Exception as e:180 print(e)...

Full Screen

Full Screen

trusted_advisor.py

Source:trusted_advisor.py Github

copy

Full Screen

...10 def describe_trusted_advisor_checks(self, language, **query):11 query = self.generate_query(is_paginate=False, **query)12 response = self.client.describe_trusted_advisor_checks(language=language, **query)13 return response.get('checks', [])14 def describe_trusted_advisor_check_result(self, check_id, language, **query):15 query = self.generate_query(is_paginate=False, **query)16 response = self.client.describe_trusted_advisor_check_result(checkId=check_id, language=language, **query)17 return response.get('result', {})18 def refresh_trusted_advisor_check(self, check_id, **query):19 # Refresh check20 # Notice) We are not waiting for the result21 try:22 query = self.generate_query(is_paginate=False, **query)23 self.client.refresh_trusted_advisor_check(checkId=check_id, **query)24 except Exception as e:...

Full Screen

Full Screen

gds_support_client.py

Source:gds_support_client.py Github

copy

Full Screen

...8 support = self.get_boto3_session_client('support', session, 'us-east-1')9 response = support.describe_trusted_advisor_checks(language='en')10 checks = response['checks']11 return checks12 def describe_trusted_advisor_check_result(self, session, check_id):13 support = self.get_boto3_session_client('support', session, 'us-east-1')14 response = support.describe_trusted_advisor_check_result(15 checkId=check_id,16 language='en'17 )18 result = response['result']...

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