o ckF[@s$dZddlmZGdddeZdS)z% Represents a Virtual Private Cloud. )TaggedEC2ObjectcseZdZdfdd ZddZddZdd Zd d Z dd dZdddZ dddZ dddZ dddZ dddZ dddZZS)VPCNcs>tt||d|_d|_d|_d|_d|_d|_d|_ dS)ah Represents a VPC. :ivar id: The unique ID of the VPC. :ivar dhcp_options_id: The ID of the set of DHCP options you've associated with the VPC (or default if the default options are associated with the VPC). :ivar state: The current state of the VPC. :ivar cidr_block: The CIDR block for the VPC. :ivar is_default: Indicates whether the VPC is the default VPC. :ivar instance_tenancy: The allowed tenancy of instances launched into the VPC. :ivar classic_link_enabled: Indicates whether ClassicLink is enabled. N) superr__init__iddhcp_options_idstate cidr_block is_defaultinstance_tenancyclassic_link_enabled)self connection __class__./usr/lib/python3/dist-packages/boto/vpc/vpc.pyrs  z VPC.__init__cCs d|jS)NzVPC:%s)rr rrr__repr__4s z VPC.__repr__cCs|dkr ||_dS|dkr||_dS|dkr||_dS|dkr$||_dS|dkr6|dkr1d|_dSd|_dS|d kr?||_dS|d krH||_dSt|||dS) NvpcId dhcpOptionsIdr cidrBlock isDefaulttrueTFinstanceTenancyclassicLinkEnabled)rrrr r r r setattr)r namevaluerrrr endElement7s      zVPC.endElementcCs|j|jSN)r delete_vpcrrrrrdeleteIsz VPC.deletecCs|j|jdSr )__dict__update)r updatedrrr_updateLsz VPC._updateFcCsF||jg|d}t|r|d}||dS|r!td|jfdS)Ndry_runrz%s is not a valid VPC ID)rlenr& ValueError)r get_status_methodvalidater(vpc_list updated_vpcrrr_get_status_then_update_vpcOszVPC._get_status_then_update_vpccC|j|jj||d|jS)Nr,r()r/r get_all_vpcsrr r,r(rrrr$[s z VPC.updatecCr0)z Updates instance's classic_link_enabled attribute :rtype: bool :return: self.classic_link_enabled after update has occurred. r1)r/rget_all_classic_link_vpcsr r3rrrupdate_classic_link_enabledcs zVPC.update_classic_link_enabledcC|jj|j|dS)a7 Disables ClassicLink for a VPC. You cannot disable ClassicLink for a VPC that has EC2-Classic instances linked to it. :type dry_run: bool :param dry_run: Set to True if the operation should not actually run. :rtype: bool :return: True if successful r')rdisable_vpc_classic_linkrr r(rrrdisable_classic_linkqs zVPC.disable_classic_linkcCr6)aj Enables a VPC for ClassicLink. You can then link EC2-Classic instances to your ClassicLink-enabled VPC to allow communication over private IP addresses. You cannot enable your VPC for ClassicLink if any of your VPC's route tables have existing routes for address ranges within the 10.0.0.0/8 IP address range, excluding local routes for VPCs in the 10.0.0.0/16 and 10.1.0.0/16 IP address ranges. :type dry_run: bool :param dry_run: Set to True if the operation should not actually run. :rtype: bool :return: True if successful r')renable_vpc_classic_linkrr8rrrenable_classic_links zVPC.enable_classic_linkcCs|jj|j|||dS)aC Links an EC2-Classic instance to a ClassicLink-enabled VPC through one or more of the VPC's security groups. You cannot link an EC2-Classic instance to more than one VPC at a time. You can only link an instance that's in the running state. An instance is automatically unlinked from a VPC when it's stopped. You can link it to the VPC again when you restart it. After you've linked an instance, you cannot change the VPC security groups that are associated with it. To change the security groups, you must first unlink the instance, and then link it again. Linking your instance to a VPC is sometimes referred to as attaching your instance. :type intance_id: str :param instance_is: The ID of a ClassicLink-enabled VPC. :tye groups: list :param groups: The ID of one or more of the VPC's security groups. You cannot specify security groups from a different VPC. The members of the list can be :class:`boto.ec2.securitygroup.SecurityGroup` objects or strings of the id's of the security groups. :type dry_run: bool :param dry_run: Set to True if the operation should not actually run. :rtype: bool :return: True if successful )vpc_id instance_idgroupsr()rattach_classic_link_vpcr)r r=r>r(rrrattach_classic_instances  zVPC.attach_classic_instancecCs|jj|j||dS)a Unlinks a linked EC2-Classic instance from a VPC. After the instance has been unlinked, the VPC security groups are no longer associated with it. An instance is automatically unlinked from a VPC when it's stopped. :type intance_id: str :param instance_is: The ID of the VPC to which the instance is linked. :type dry_run: bool :param dry_run: Set to True if the operation should not actually run. :rtype: bool :return: True if successful )r<r=r()rdetach_classic_link_vpcr)r r=r(rrrdetach_classic_instances zVPC.detach_classic_instancer )FF)F)__name__ __module__ __qualname__rrrr"r&r/r$r5r9r;r@rB __classcell__rrrrrs    'rN)__doc__boto.ec2.ec2objectrrrrrrs