
    #                         S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJ	r	  SSK
Jr  SS	KJr  S
SS.r\R                  " \R                   R"                  5       " S S\R$                  5      5       rg)z,'vmware private-connections create' command.    )absolute_import)division)unicode_literals)PrivateConnectionsClient)base)
exceptions)flags)loga  
          Creates a new private connection to connect VMware Engine Network to the specified VPC network. This establishes private IP connectivity between the VPC network and all the VMware Private Clouds attached to the VMware Engine Network. Private connection creation is considered finished when the connection is in ACTIVE state. Check the progress of the private connection using `{parent_command} list`.
        a  
        To create a Private Connection of type PRIVATE_SERVICE_ACCESS, first obtain the service-project by listing vpc-peerings, run:

          $ gcloud compute networks peerings list --network=my-vpc --project=my-project

        where my-vpc is the VPC on which a private service access connection is created and project is the one in which the private connection will be created.

        The response will be of this format:

        NAME                              NETWORK  PEER_PROJECT           

        servicenetworking-googleapis-com  my-vpc   td096d594ece09650-tp

        The PEER_PROJECT field in the output of the command will provide the value for the service-project required for creating the private connection.

        To create a Private Connection called `my-private-connection` of type `PRIVATE_SERVICE_ACCESS` in project `my-project` and region `us-west1` with routing_mode `REGIONAL` to connect service networking VPC from project `td096d594ece09650-tp` to legacy VMware Engine Network `us-west1-default`, run:

          $ {command} my-private-connection --location=us-west1 --project=my-project --vmware-engine-network=us-west1-default --description="A short description for the new private connection" --routing-mode=REGIONAL --service-project=td096d594ece09650-tp --type=PRIVATE_SERVICE_ACCESS

        Or:

          $ {command} my-private-connection --vmware-engine-network=us-west1-default --description="A short description for the new private connection" --routing-mode=REGIONAL --service-project=td096d594ece09650-tp --type=PRIVATE_SERVICE_ACCESS

          In the second example, the project and location are taken from gcloud properties core/project and compute/region, respectively.

        To create a Private Connection called `my-private-connection` of type `THIRD_PARTY_SERVICE` in project `my-project` and region `us-west1` to connect VPC `my-service-network` from project `td096d594ece09650-tp` to legacy VMware Engine Network `us-west1-default`, run:

          $ {command} my-private-connection --location=us-west1 --project=my-project --vmware-engine-network=us-west1-default --description="A short description for the new private connection" --service-network=my-service-network --service-project=td096d594ece09650-tp --type=THIRD_PARTY_SERVICE

        Or:

          $ {command} my-private-connection --vmware-engine-network=us-west1-default --description="A short description for the new private connection" --service-network=my-service-network --service-project=td096d594ece09650-tp --type=THIRD_PARTY_SERVICE

          In the above example, the project and location are taken from gcloud properties core/project and compute/region, respectively.

        If you try to create a private connection of type=THIRD_PARTY_SERVICE, and do not provide the service-network field, an error will be thrown with the message:

        Missing required argument [--service-network]: For private connection of type THIRD_PARTY_SERVICE, service-network field is required
        )DESCRIPTIONEXAMPLESc                   2    \ rS rSrSr\r\S 5       rS r	Sr
g)CreateI   z)Create a Google Cloud Private Connection.c           	         [         R                  " U SS9  [        R                  R	                  U 5        [        R                  R                  U S5        U R                  R                  S5        U R                  SSS9  U R                  SSS	/S
S9  U R                  SSSSSSS.SS9  U R                  SSS9  U R                  SSSS9  U R                  SSSS9  g)z Register flags for this command.T)
positionalyamlz--descriptionz8        Text describing the private connection.
        )helpz--routing-modeGLOBALREGIONALz        Type of the routing mode. Default value is set to GLOBAL. For type=PRIVATE_SERVICE_ACCESS, this field can be set to GLOBAL or REGIONAL, for other types only GLOBAL is supported.
        )choicesr   z--typez~Peering connection used for establishing [private services access](https://cloud.google.com/vpc/docs/private-services-access).z?Peering connection used for connecting to NetApp Cloud Volumes.z:Peering connection used for connecting to Dell PowerScale.zPeering 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.)PRIVATE_SERVICE_ACCESSNETAPP_CLOUD_VOLUMESDELL_POWERSCALETHIRD_PARTY_SERVICEz,        Type of private connection.
        )requiredr   r   --service-networkax          Resource ID of the service network to connect with the VMware Engine network to create a private connection.
        * For type=PRIVATE_SERVICE_ACCESS, this field represents service networking VPC. In this case the field value will be automatically set to `servicenetworking` and cannot be changed.
        * For type=NETAPP_CLOUD_VOLUME, this field represents NetApp service VPC. In this case the field value will be automatically set to `netapp-tenant-vpc` and cannot be changed.
        * For type=DELL_POWERSCALE, this field represents Dell service VPC. In this case the field value will be automatically set to `dell-tenant-vpc` and cannot be changed.
        * For type=THIRD_PARTY_SERVICE, this field could represent a consumer VPC or any other producer VPC to which the VMware Engine Network needs to be connected. service-network field is required for this type.
        z--service-projectzE        Project ID or project number of the service network.
        )r   r   z--vmware-engine-networkz        Resource ID of the legacy VMware Engine network. Provide the {vmware_engine_network_id}, which will be in the form of {location}-default. The {location} is the same as the location specified in the private connection resource.
        N)	r	   AddPrivateConnectionToParserr   
ASYNC_FLAGAddToParser
SetDefaultdisplay_info	AddFormatadd_argument)parsers    0lib/surface/vmware/private_connections/create.pyArgsCreate.ArgsN   s"    
&&v$?OO'OOvt,
!!&)
  
 :&    QQL P	
          !      c           
         UR                   S:X  a(  UR                  (       d  [        R                  " SS5      eUR                  R
                  R                  5       n[        5       nUR                  nUR                  UUR                  UR                  UR                   UR                  UR                  UR                  S9nU(       a!  [        R                  " UR                   SSS9  g UR#                  UR%                  U5      SR'                  UR)                  5       5      S	9n[        R                  " UR)                  5       SS
9  U$ )Nr   r   zVFor private connection of type THIRD_PARTY_SERVICE, service-network field is required.)vmware_engine_networkservice_projectprivate_connection_typerouting_modedescriptionservice_networkzPrivate ConnectionT)kindis_asyncz1waiting for private connection [{}] to be created)operation_refmessage)r0   )typer/   r   RequiredArgumentExceptionCONCEPTSprivate_connectionParser   async_r   r*   r+   r-   r.   r
   CreatedResourcenameWaitForOperationGetOperationRefformatRelativeName)selfargsr7   clientr1   	operationresources          r%   Run
Create.Run   s,   yy))$2F2F00

b  99??A%'F{{H"88,, $		&&$$,,  I 	
..3dD&&,,Y7CJJ++-
 ' H '')0D Or(    N)__name__
__module____qualname____firstlineno____doc__DETAILED_HELPdetailed_helpstaticmethodr&   rE   __static_attributes__rG   r(   r%   r   r   I   s"    1-5 5n r(   r   N)rL   
__future__r   r   r   0googlecloudsdk.api_lib.vmware.privateconnectionsr   googlecloudsdk.callioper   r   !googlecloudsdk.command_lib.vmwarer	   googlecloudsdk.corer
   rM   ReleaseTracksReleaseTrackGACreateCommandr   rG   r(   r%   <module>rZ      so    3 &  ' U ( . 3 #	%	,^ D%%(()\T \ *\r(   