
                            d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ dd	lmZ d
ddZ e	j                  e	j                   j"                        e	j$                   G d de	j&                                      Zy)z1VMware Engine VPC network peering create command.    )absolute_import)division)unicode_literals)networkpeering)arg_parsers)base)flags)logz
          Create a VMware Engine VPC network peering. VPC network peering creation is considered finished when the network peering is in ACTIVE state. Check the progress of a VPC network peering using `{parent_command} list`.
        a1  
          To create a VPC network peering called `new-peering` that connects the VMware Engine network `my-vmware-engine-network` with another VMware Engine network `another-vmware-engine-network` from project `another-project`, run:

          $ {command} new-peering --vmware-engine-network=my-vmware-engine-network --peer-network=another-vmware-engine-network --peer-network-type=VMWARE_ENGINE_NETWORK --peer-project=another-project

          In this example, the project is taken from gcloud properties core/project and location is taken as `global`.
    )DESCRIPTIONEXAMPLESc                   *    e Zd ZdZeZed        Zd Zy)Createz+Create a VMware Engine VPC network peering.c                    g d}t        j                  | d       t        j                  j	                  |        t        j                  j                  | d       | j                  j                  d       | j                  ddd       | j                  ddd	       | j                  d
d|d       | j                  dd       | j                  dd       | j                  dd       | j                  ddt        j                  d      d       | j                  ddddd       | j                  ddddd       | j                  d dddd!       | j                  d"dddd#       | j                  d$dddd%       y&)'z Register flags for this command.)PEER_NETWORK_TYPE_UNSPECIFIEDSTANDARDVMWARE_ENGINE_NETWORKPRIVATE_SERVICES_ACCESSNETAPP_CLOUD_VOLUMESTHIRD_PARTY_SERVICEDELL_POWERSCALEGOOGLE_CLOUD_NETAPP_VOLUMEST)
positionalyamlz--vmware-engine-networkzN        ID of the VMware Engine network to attach the new peering to.
        )requiredhelpz--peer-networkz        ID of the network to peer with the VMware Engine network. The peer network can be a consumer VPC network or another VMware Engine network.
        z--peer-network-typea<          Type of the VPC network to peer with the VMware Engine network. PEER_NETWORK_TYPE must be one of the following:
        * STANDARD: Peering connection used for connecting to another VPC network established by the same user.
          For example, a peering connection to another VPC network in the same project or to an on-premises network.
        * VMWARE_ENGINE_NETWORK: Peering connection used for connecting to another VMware Engine network.
        * PRIVATE_SERVICES_ACCESS: Peering connection used for establishing private services access.
        * NETAPP_CLOUD_VOLUMES: Peering connection used for connecting to NetApp Cloud Volumes.
        * THIRD_PARTY_SERVICE: Peering connection used for connecting to third-party services. Most third-party services require manual setup of reverse peering on the VPC network associated with the third-party service.
        * DELL_POWERSCALE: Peering connection used for connecting to Dell PowerScale Filers.
        * GOOGLE_CLOUD_NETAPP_VOLUMES: Peering connection used for connecting to Google Cloud NetApp Volumes.
        )r   choicesr   z--vmware-engine-network-projectz        Project of the VMware Engine network to attach the new peering to. Use this flag when the VMware Engine network is in another project.
        )r   z--peer-projectz}        Project ID or project number of the peer network. Use this flag when the peer network is in another project.
        z--descriptionzF        User-provided description of the VPC network peering.
        z
--peer-mtuF1GB)lower_boundz:        Maximum transmission unit (MTU) in bytes.
        )r   typer   z--export-custom-routes
store_truezz        True if custom routes are exported to the peered VPC network; false otherwise. The default value is true.
        )r   actiondefaultr   z--import-custom-routeszz        True if custom routes are imported to the peered VPC network; false otherwise. The default value is true.
        z%--import-custom-routes-with-public-ipz        True if all subnet routes with public IP address range are imported; false otherwise. The default value is true.
        z%--export-custom-routes-with-public-ipz        True if all subnet routes with public IP address range are exported; false otherwise. The default value is true.
        z--exchange-subnet-routesa)          True if full-mesh connectivity is created and managed automatically between peered VPC networks; false otherwise. This field is always true because Google Compute Engine automatically creates and manages subnetwork routes between two VPC networks when the peering state is ACTIVE.
        N)r	   AddNetworkPeeringToParserr   
ASYNC_FLAGAddToParser
SetDefaultdisplay_info	AddFormatadd_argumentr   
BinarySize)parserpeer_network_choicess     -lib/surface/vmware/network_peerings/create.pyArgszCreate.Args3   s   	 
##Ft<OO'OOvt,
!!&)
!      $
	    )  
   
   
 ##6	           /   /   "      c                    |j                   j                  j                         }t        j                         }|j
                  }|j                  ||j                  |j                  |j                  |j                  |j                  |j                  |j                  |j                  |j                  |j                   |j"                  |j$                        }|r#t'        j(                  |j*                  dd       y |j-                  |j/                  |      dj1                  |j3                                     }t'        j(                  |j3                         d       |S )N)vmware_engine_network_idpeer_network_idpeer_network_typedescriptionvmware_engine_network_projectpeer_projectpeer_mtuexport_custom_routesimport_custom_routes#export_custom_routes_with_public_ip#import_custom_routes_with_public_ipexchange_subnet_routeszVPC network peeringT)kindis_asyncz*waiting for vpc peering [{}] to be created)operation_refmessage)r=   )CONCEPTSnetwork_peeringParser   NetworkPeeringClientasync_r   vmware_engine_networkpeer_networkr3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r
   CreatedResourcenameWaitForOperationGetOperationRefformatRelativeName)selfargspeeringclientr>   	operationresources          r-   Runz
Create.Run   s2   mm++113G002F{{H!%!;!;))00$$&*&H&H&&!66!66,0,T,T,0,T,T#::  I 	
..4tE&&,,Y7<CC  "$ ' %H ,,.5JKOr/   N)	__name__
__module____qualname____doc__DETAILED_HELPdetailed_helpstaticmethodr.   rT    r/   r-   r   r   ,   s&     4-i iVr/   r   N)rX   
__future__r   r   r   googlecloudsdk.api_lib.vmwarer   googlecloudsdk.callioper   r   2googlecloudsdk.command_lib.vmware.network_peeringsr	   googlecloudsdk.corer
   rY   ReleaseTracksReleaseTrackGADefaultUniverseOnlyCreateCommandr   r\   r/   r-   <module>rg      s~    8 &  ' 8 / ( D #
		  D%%(()OT O  *Or/   