
    H                         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
dZ ej                  ej                  j                          G d dej"                               Zy)z)'vmware network-policies create' command.    )absolute_import)division)unicode_literals)NetworkPoliciesClient)base)flags)logz
          Create a VMware Engine network policy. Only one network policy applies to a VMware Engine network per region. Check the progress of a network policy creation using `{parent_command} list`.
        am  
          To create a network policy called `my-network-policy` which connects to the VMware Engine network `my-vmware-engine-network` using the edge services address range `192.168.0.0/26` with the internet access service enabled and the external IP access service disabled, run:

            $ {command} my-network-policy --location=us-west2 --project=my-project --vmware-engine-network=my-vmware-engine-network --edge-services-cidr=192.168.0.0/26 --internet-access --no-external-ip-access

          Or:

            $ {command} my-network-policy --vmware-engine-network=my-vmware-engine-network --edge-services-cidr=192.168.0.0/26 --internet-access

          In the second example, the project and the location are taken from gcloud properties core/project and compute/region respectively. If the `--external-ip-access` flag is not specified, it is taken as `False`.
    )DESCRIPTIONEXAMPLESc                   *    e Zd ZdZeZed        Zd Zy)Createz&Create a VMware Engine network policy.c                    t        j                  | d       t        j                  j	                  |        t        j                  j                  | d       | j                  j                  d       | j                  ddd       | j                  dd	       | j                  d
dd       | j                  dddd       | j                  dddd       y)z Register flags for this command.T)
positionalyamlz--vmware-engine-networkzV        Resource ID of the VMware Engine network to attach the new policy to.
        )requiredhelpz--descriptionzA        User-provided description of the network policy.
        )r   z--edge-services-cidrz        IP address range to use for internet access and external IP access gateways, in CIDR notation. An RFC 1918 CIDR block with a "/26" prefix is required.
        z--internet-access
store_trueFz        Enable or disable network service that allows VMware workloads to access the internet. Use `--no-internet-access` to disable. If the flag is not provided, internet access is disabled.
        )actiondefaultr   z--external-ip-accessaE          Enable or disable network service that allows external IP addresses to be assigned to VMware workloads. To enable this service, `internet-access` must also be enabled. Use `--no-external-ip-access` to disable. If the flag is not provided, access to VMware workloads through external IP addresses is disabled.
        N)	r   AddNetworkPolicyToParserr   
ASYNC_FLAGAddToParser
SetDefaultdisplay_info	AddFormatadd_argument)parsers    -lib/surface/vmware/network_policies/create.pyArgszCreate.Args2   s     
""6d;OO'OOvt,
!!&)
!     
    	   	      c                    |j                   j                  j                         }t               }|j                  }|j                  ||j                  |j                  |j                  |j                  |j                        }|r#t        j                  |j                  dd       y |j                  |j                  |      dj!                  |j#                                     }t        j                  |j#                         d       |S )N)vmware_engine_network_idedge_services_cidrdescriptioninternet_accessexternal_ip_accesszVMware Engine network policyT)kindis_asyncz-waiting for network policy [{}] to be created)operation_refmessage)r'   )CONCEPTSnetwork_policyParser   async_r   vmware_engine_networkr#   r$   r%   r&   r	   CreatedResourcenameWaitForOperationGetOperationRefformatRelativeName)selfargsr,   clientr(   	operationresources          r   Runz
Create.RunY   s    ]]11779N"$F{{H!%!;!;22$$,,22  I 	
..=N&&,,Y7?FF'')
 ' H ##%,J Or    N)	__name__
__module____qualname____doc__DETAILED_HELPdetailed_helpstaticmethodr   r;    r    r   r   r   -   s"    .-$ $Lr    r   N)r?   
__future__r   r   r   -googlecloudsdk.api_lib.vmware.networkpoliciesr   googlecloudsdk.callioper   2googlecloudsdk.command_lib.vmware.network_policiesr   googlecloudsdk.corer	   r@   ReleaseTracksReleaseTrackGACreateCommandr   rC   r    r   <module>rM      sm    0 &  ' O ( D #	
	( D%%(()ET E *Er    