FRTc@sdZddlmZddlmZddlmZddlmZddl m Z ddl m Z ddl mZdd lmZmZdd lmZdd lmZdd lmZdd lmZddlmZddlmZmZdZdZ defdYZ!dS(s- Represents a connection to the EC2 service. i(t EC2Connection(t ResultSet(tVPC(tCustomerGateway(t NetworkAcl(t RouteTable(tInternetGateway(t VpnGatewayt Attachment(t DhcpOptions(tSubnet(t VpnConnection(tVpcPeeringConnection(t RegionData(t RegionInfot get_regionscKstddtS(s: Get all available regions for the EC2 service. You may pass any of the arguments accepted by the VPCConnection object's constructor as keyword arguments and they will be passed along to the VPCConnection object. :rtype: list :return: A list of :class:`boto.ec2.regioninfo.RegionInfo` tec2tconnection_cls(Rt VPCConnection(t kw_params((s>/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytregions*s cKs7x0t|D]"}|j|kr |j|Sq WdS(s Given a valid region name, return a :class:`boto.vpc.VPCConnection`. Any additional parameters after the region_name are passed on to the connect method of the region object. :type: str :param region_name: The name of the region to connect to. :rtype: :class:`boto.vpc.VPCConnection` or ``None`` :return: A connection to the given region, or None if an invalid region name is given N(RtnametconnecttNone(t region_nameRtregion((s>/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytconnect_to_region7sRcBs eZd7d7edZd7edZedZd7d7edZd7d7edZedZ edZ edZ edZ ed Z ed Zed Zd7d7d7d7ed Zd7d7d7d7ed ZedZd7d7dZdZd7dZdZdZd7d7d7d7d7dZd7d7d7d7d7dZd7dZd7d7edZedZedZedZedZd7d7edZ edZ!edZ"d7d7edZ#d7ed Z$ed!Z%ed"Z&ed#Z'd7d7ed$Z(d7ed%Z)ed&Z*d7d7ed'Z+d7d7d7d7d7ed(Z,ed)Z-ed*Z.d7d7ed+Z/d7ed,Z0ed-Z1ed.Z2ed/Z3ed0Z4ed1Z5d7d7ed2Z6d7ed3Z7ed4Z8ed5Z9ed6Z:RS(8cCsji}|r"|j||dn|r;|j||n|rNd|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pyt get_all_vpcsOs cCsFi|d6}|r ||d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pyt create_vpcqs    cCs0i|d6}|r d|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pyt delete_vpcs  cCsi|d6}|dk r9|r,d|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytmodify_vpc_attributes        cCsji}|r"|j||dn|r;|j||n|rNd|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytget_all_route_tabless  cCsCi|d6|d6}|r'd|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytassociate_route_tables  cCs0i|d6}|r d|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytdisassociate_route_tables  cCs3i|d6}|r d|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytcreate_route_tables  cCs0i|d6}|r d|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytdelete_route_table#s  cCs:i|d6|d6}|r'd|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pyt _replace_route_table_association5s   cCs|j||d|jS(ss Replaces a route association with a new route table. This can be used to replace the 'main' route table by using the main route table association instead of the more common subnet type association. NOTE: It may be better to use replace_route_table_association_with_assoc instead of this function; this function does not return the new association ID. This function is retained for backwards compatibility. :type association_id: str :param association_id: The ID of the existing association to replace. :type route_table_id: str :param route_table_id: The route table to ID to be used in the association. :type dry_run: bool :param dry_run: Set to True if the operation should not actually run. :rtype: bool :return: True if successful R&(RMtstatus(R#RFR@R&((s>/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytreplace_route_table_assocationQscCs|j||d|jS(s Replaces a route association with a new route table. This can be used to replace the 'main' route table by using the main route table association instead of the more common subnet type association. Returns the new association ID. :type association_id: str :param association_id: The ID of the existing association to replace. :type route_table_id: str :param route_table_id: The route table to ID to be used in the association. :type dry_run: bool :param dry_run: Set to True if the operation should not actually run. :rtype: str :return: New association ID R&(RMtnewAssociationId(R#RFR@R&((s>/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pyt*replace_route_table_association_with_assocnsc Csi|d6|d6}|d k r-||d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pyt create_routes#          c Csi|d6|d6}|d k r-||d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pyt replace_routes!          cCs7i|d6|d6}|r'd|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pyt delete_routes   cCsWi}|r"|j||dn|r;|j||n|jd|dtfgS(s Retrieve information about your network acls. You can filter results to return information only about those network acls that match your search parameters. Otherwise, all network acls associated with your account are returned. :type network_acl_ids: list :param network_acl_ids: A list of strings with the desired network ACL IDs. :type filters: list of tuples or dict :param filters: A list of tuples or dict containing filters. Each tuple or dict item consists of a filter key and a filter value. :rtype: list :return: A list of :class:`boto.vpc.networkacl.NetworkAcl` t NetworkAclIdtDescribeNetworkAclsR(R R!R"R(R#tnetwork_acl_idsR%R'((s>/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytget_all_network_acls s cCs|jdd|fgd}g|jD]}|j|kr)|^q)d}i|jd6|d6}|jd|t}|jS(sT Associates a network acl with a specific subnet. :type network_acl_id: str :param network_acl_id: The ID of the network ACL to associate. :type subnet_id: str :param subnet_id: The ID of the subnet to associate with. :rtype: str :return: The ID of the association created R%sassociation.subnet-idiRDRbtReplaceNetworkAclAssociation(Ret associationsRAtidR,RRP(R#tnetwork_acl_idRAtaclt associationR'RB((s>/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytassociate_network_acl%s/  cCs]|s"|j|gdj}n|jdd|fdg}|dj}|j||S(s Figures out what the default ACL is for the VPC, and associates current network ACL with the default. :type subnet_id: str :param subnet_id: The ID of the subnet to which the ACL belongs. :type vpc_id: str :param vpc_id: The ID of the VPC to which the ACL/subnet belongs. Queries EC2 if omitted. :rtype: str :return: The ID of the association created iR%svpc-idtdefaultR(sdefaultstrue(tget_all_subnetsR2ReRhRl(R#RAR2taclstdefault_acl_id((s>/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytdisassociate_network_acl>s  cCs i|d6}|jd|tS(s Creates a new network ACL. :type vpc_id: str :param vpc_id: The VPC ID to associate this network ACL with. :rtype: The newly created network ACL :return: A :class:`boto.vpc.networkacl.NetworkAcl` object RtCreateNetworkAcl(R,R(R#R2R'((s>/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytcreate_network_aclSs cCsi|d6}|jd|S(s Delete a network ACL :type network_acl_id: str :param network_acl_id: The ID of the network_acl to delete. :rtype: bool :return: True if successful RbtDeleteNetworkAcl(R1(R#RiR'((s>/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytdelete_network_acl`s c Csi|d6|d6|d6|d6|d6} |d k rft|trYt|j}n|| d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytcreate_network_acl_entryms&-           c Csi|d6|d6|d6|d6|d6} |d k rft|trYt|j}n|| d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytreplace_network_acl_entrys&-           cCsai|d6|d6}|dk rQt|trDt|j}n||d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytdelete_network_acl_entrys   cCsji}|r"|j||dn|r;|j||n|rNd|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytget_all_internet_gatewayss    cCs,i}|rd|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytcreate_internet_gateway1s  cCs0i|d6}|r d|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytdelete_internet_gateway@s  cCs7i|d6|d6}|r'd|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytattach_internet_gatewayRs   cCs7i|d6|d6}|r'd|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytdetach_internet_gatewayks   cCsji}|r"|j||dn|r;|j||n|rNd|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytget_all_customer_gatewayss    cCsAi|d6|d6|d6}|r.d|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytcreate_customer_gateways    cCs0i|d6}|r d|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytdelete_customer_gateways  cCsji}|r"|j||dn|r;|j||n|rNd|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytget_all_vpn_gatewayss  cCsFi|d6}|r ||d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytcreate_vpn_gateways    cCs0i|d6}|r d|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytdelete_vpn_gateways  cCs:i|d6|d6}|r'd|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytattach_vpn_gateway/s    cCs7i|d6|d6}|r'd|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytdetach_vpn_gatewayEs    cCsji}|r"|j||dn|r;|j||n|rNd|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pyRn]s cCsMi|d6|d6}|r'||d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pyt create_subnets    cCs0i|d6}|r d|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pyt delete_subnets  cCsji}|r"|j||dn|r;|j||n|rNd|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytget_all_dhcp_optionss  c sdi}fd}|r6||d|n|rQ||d|n|rl||d|n|r||d|n|r||d|n|rd|d /opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pyt insert_options   s domain-namesdomain-name-serverss ntp-serverssnetbios-name-serverssnetbios-node-typeRRtCreateDhcpOptions(R,R ( R#t domain_nametdomain_name_serverst ntp_serverstnetbios_name_serverstnetbios_node_typeR&R'R((Rs>/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytcreate_dhcp_optionss*&  cCs0i|d6}|r d|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytdelete_dhcp_optionss  cCs7i|d6|d6}|r'd|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytassociate_dhcp_options*s    cCsji}|r"|j||dn|r;|j||n|rNd|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytget_all_vpn_connectionsBs    cCs~i|d6|d6|d6}|dk rXt|trKt|j}n||d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytcreate_vpn_connectionks     cCs0i|d6}|r d|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytdelete_vpn_connections  cCs7i|d6|d6}|r'd|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytdisable_vgw_route_propagations   cCs7i|d6|d6}|r'd|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytenable_vgw_route_propagations   cCs7i|d6|d6}|r'd|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytcreate_vpn_connection_routes   cCs7i|d6|d6}|r'd|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytdelete_vpn_connection_routes   cCspi}|r"|j||dn|rA|j|t|n|rTd|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytget_all_vpc_peering_connectionss' cCsSi|d6|d6}|dk r-||d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytcreate_vpc_peering_connection@s      cCs0i|d6}|r d|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytdelete_vpc_peering_connection[s   cCs0i|d6}|r d|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytreject_vpc_peering_connectionps   cCs3i|d6}|r d|d/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pytaccept_vpc_peering_connections    N(;t__name__t __module__RtFalseR(R/R3R8R<RCRGRIRKRMRORQR]R_RaReRlRqRsRuRRRRRRRRRRRRRRRRRnRRRRRRRRRRRRRRRRRR(((s>/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pyRKs" '          3  1     C B     )   %   &  H   )$     0  N("t__doc__tboto.ec2.connectionRtboto.resultsetRt boto.vpc.vpcRtboto.vpc.customergatewayRtboto.vpc.networkaclRtboto.vpc.routetableRtboto.vpc.internetgatewayRtboto.vpc.vpngatewayRRtboto.vpc.dhcpoptionsR tboto.vpc.subnetR tboto.vpc.vpnconnectionR tboto.vpc.vpc_peering_connectionR tboto.ec2R tboto.regioninfoRRRRR(((s>/opt/freeware/lib/python2.7/site-packages/boto/vpc/__init__.pyts"