Best Python code snippet using tempest_python
nova_associate_security_group_request_body.py
Source:nova_associate_security_group_request_body.py
...28 self._add_security_group = None29 self.discriminator = None30 self.add_security_group = add_security_group31 @property32 def add_security_group(self):33 """Gets the add_security_group of this NovaAssociateSecurityGroupRequestBody.34 :return: The add_security_group of this NovaAssociateSecurityGroupRequestBody.35 :rtype: :class:`huaweicloudsdkecs.v2.NovaAddSecurityGroupOption`36 """37 return self._add_security_group38 @add_security_group.setter39 def add_security_group(self, add_security_group):40 """Sets the add_security_group of this NovaAssociateSecurityGroupRequestBody.41 :param add_security_group: The add_security_group of this NovaAssociateSecurityGroupRequestBody.42 :type add_security_group: :class:`huaweicloudsdkecs.v2.NovaAddSecurityGroupOption`43 """44 self._add_security_group = add_security_group45 def to_dict(self):46 """Returns the model properties as a dict"""47 result = {}48 for attr, _ in six.iteritems(self.openapi_types):49 value = getattr(self, attr)50 if isinstance(value, list):51 result[attr] = list(map(52 lambda x: x.to_dict() if hasattr(x, "to_dict") else x,53 value...
Temp_VPC.py
Source:Temp_VPC.py
1from osbot_aws.helpers.VPC import VPC2from osbot_utils.utils.Misc import random_string3from osbot_aws.apis.EC2 import EC24class Temp_VPC:5 def __init__(self, add_internet_gateway=False, add_route_table=False, add_security_group=False, add_subnet=False):6 self.add_internet_gateway = add_internet_gateway7 self.add_route_table = add_route_table8 self.add_security_group = add_security_group9 self.add_subnet = add_subnet10 self.vpc_name = random_string(prefix='osbot_aws-temp_vpc-')11 self.tags = {'Name': self.vpc_name}12 self.vpc = VPC(vpc_name=self.vpc_name, tags=self.tags)13 def __enter__(self):14 self.create_vpc()15 self.create_route_table()16 self.create_internet_gateway()17 self.create_security_group()18 self.create_subnet()19 return self20 def __exit__(self, exception_type, exception_value, traceback):21 self.delete_internet_gateway()22 self.delete_route_table()23 self.delete_security_group()24 self.delete_subnet()25 self.delete_vpc()26 def create_internet_gateway(self):27 if self.add_internet_gateway:28 self.vpc.create_internet_gateway()29 return self30 def create_route_table(self):31 if self.add_route_table:32 self.vpc.create_route_table()33 return self34 def create_security_group(self):35 if self.add_security_group:36 self.vpc.create_security_group()37 return self38 def create_subnet(self):39 if self.add_subnet:40 self.vpc.create_subnet()41 return self42 def create_vpc(self):43 self.vpc.create_vpc()44 return self45 def delete_internet_gateway(self):46 if self.add_internet_gateway:47 self.vpc.delete_internet_gateway()48 return self49 def delete_security_group(self):50 if self.add_security_group:51 self.vpc.delete_security_group()52 return self53 def delete_subnet(self):54 if self.add_subnet:55 self.vpc.delete_subnet()56 return self57 def delete_route_table(self):58 if self.add_route_table:59 self.vpc.delete_route_table()60 return self61 def delete_vpc(self):62 self.vpc.delete_vpc()...
compute_stack.py
Source:compute_stack.py
...27 instance_type=ec2.InstanceType(instance_type_identifier="t2.medium"))28 29 ec2_1 = Ec2Win(self, "myEc2-1", config=config, vpc=vpc, ec2_key_name=key_name)30 31 ec2_1.winmachine.add_security_group(ec2.SecurityGroup.from_security_group_id(32 self, "sg1", security_group_id=sg_id, allow_all_outbound=True33 ) )34 35 # ec2_2 = Ec2Win(self, "myEc2-2", config=config, vpc=vpc, ec2_key_name=key_name)36 # ec2_2.winmachine.add_security_group(ec2.SecurityGroup.from_security_group_id(37 # self, "sg2", security_group_id=sg_id, allow_all_outbound=True38 # ) )39 40 # ec2_3 = Ec2Win(self, "myEc2-3", config=config, vpc=vpc, ec2_key_name=key_name)41 # ec2_3.winmachine.add_security_group(ec2.SecurityGroup.from_security_group_id(42 # self, "sg3", security_group_id=sg_id, allow_all_outbound=True...
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!!