Best Python code snippet using localstack_python
load_balancer.py
Source:load_balancer.py
...127 self.client.modify_load_balancer_attributes,128 LoadBalancerName=serializers.Identifier(),129 LoadBalancerAttributes=serializers.Resource(group="attributes"),130 )131 def update_health_check(self):132 if not self.object and self.resource.health_check:133 yield self.generic_action(134 "Configure health check",135 self.client.configure_health_check,136 LoadBalancerName=self.resource.name,137 HealthCheck=serializers.Argument("health_check"),138 )139 def update_object(self):140 for action in super(Apply, self).update_object():141 yield action142 for action in self.update_attributes():143 yield action144 for action in self.update_health_check():145 yield action146class WaitForNetworkInterfaces(Action):147 description = ["Wait for network interfaces to be released"]148 def run(self):149 description = "ELB {}".format(self.plan.resource.name)150 for i in range(120):151 interfaces = self.plan.ec2_client.describe_network_interfaces(152 Filters=[{"Name": "description", "Values": [description]}]153 ).get("NetworkInterfaces", [])154 if len(interfaces) == 0:155 return156 time.sleep(1)157 raise errors.Error(158 "Load balancer {} still hanging around in Elastic Network Interfaces after deletion for over 2 minutes.".format(...
heathcheck-editor.py
Source:heathcheck-editor.py
...31 # set aws client session and32 SESSION = boto3.session.Session(region_name=region)33 cf = SESSION.client('route53')34 # disabled: set healthcheck to always healthy. inverted: invert always healthy to always unhealthy35 cf.update_health_check(HealthCheckId=healthcheck_id, Disabled=True, Inverted=True)36if __name__ == "__main__":37 parser = argparse.ArgumentParser(description='Perform deletion on AWS cloudformation stacks based on criterias '38 'listed ')39 parser.add_argument("--region", help="The AWS region the stack is in", dest='region', required=True)40 parser.add_argument("--profile", help="The name of an aws cli profile to use.", dest='profile', default=None,41 required=False)42 args = parser.parse_args()43 # create the session for the boto3 with profile and region from user parameters44 SESSION = boto3.session.Session(profile_name=args.profile, region_name=args.region)45 cf = SESSION.client('route53')46 healthcheck_id="12345"...
route53-update-health-check.py
Source:route53-update-health-check.py
1import boto32client = boto3.client('route53')3response = client.update_health_check(4 HealthCheckId='a389b0b5-5322-49ef-b1c3-3edb9e5f617b',5 Port=806)...
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!!