
    J                         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
lmZ dddZ e	j"                  e	j$                  j&                        e	j(                   G d de	j*                                      Zy)z''vmware private-clouds create' command.    )absolute_import)division)unicode_literals)PrivateCloudsClient)arg_parsers)base)flags)util)logz
          Create a VMware Engine private cloud. Private cloud creation is considered finished when the private cloud is in READY state. Check the progress of a private cloud using `{parent_command} list`.
        a  
          To create a private cloud in the `us-west2-a` zone using `standard-72` nodes that connects to the `my-network` VMware Engine network, run:


          $ {command} my-private-cloud --location=us-west2-a --project=my-project --cluster=my-management-cluster --node-type-config=type=standard-72,count=3 --management-range=192.168.0.0/24 --vmware-engine-network=my-network

          Or:

          $ {command} my-private-cloud --cluster=my-management-cluster --node-type-config=type=standard-72,count=3 --management-range=192.168.0.0/24 --vmware-engine-network=my-network

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


          To create a stretched private cloud in the `us-west2` region using `us-west2-a` zone as preferred and `us-west2-b` zone as secondary

          $ {command} my-private-cloud --project=sample-project --location=us-west2 --cluster=my-management-cluster --node-type-config=type=standard-72,count=6 --management-range=192.168.0.0/24 --vmware-engine-network=my-network --type=STRETCHED --preferred-zone=us-west2-a --secondary-zone=us-west2-b

          The project is taken from gcloud properties core/project.
    )DESCRIPTIONEXAMPLESc                   *    e Zd ZdZeZed        Zd Zy)Createz%Create a VMware Engine private cloud.c           
         t        j                  | d       t        j                  | dd       t        j                  j                  |        t        j                  j                  | d       | j                  j                  d       | j                  dd       | j                  d	dd
       | j                  ddd       | j                  ddt        j                  t        t        t        dd      dd       | j                  dddddddd       | j                  ddd       | j                  ddd        | j                  d!dddd"#       t        j                  |        y$)%z Register flags for this command.T)
positionalF)r   hide_resource_argument_flagsyamlz--descriptionz3        Text describing the private cloud.
        )helpz--management-rangea	           IP address range in the private cloud to use for management appliances, in CIDR format. Use an IP address range that meets the [VMware Engine networking requirements](https://cloud.google.com/vmware-engine/docs/quickstart-networking-requirements).
        )requiredr   z--vmware-engine-networkzX        Resource ID of the VMware Engine network attached to the private cloud.
        z--node-type-config)typecountzcustom-core-count)r   r   )specrequired_keysappenda          Information about the type and number of nodes associated with the cluster.

        type (required): canonical identifier of the node type.

        count (required): number of nodes of this type in the cluster.

        custom-core-count (optional): customized number of cores available to each node of the type.
        To get a list of valid values for your node type,
        run the gcloud vmware node-types describe command and reference the
        availableCustomCoreCounts field in the output.
        )r   r   actionr   z--typeSTANDARDzOStandard private is a zonal resource, with 3 or more nodes nodes. Default type.a  Time limited private cloud is a zonal resource, can have only 1 node and
            has limited life span. Will be deleted after defined period of time,
            can be converted into standard private cloud by expanding it up to 3
            or more nodes.zStretched private cloud is a regional resource with redundancy,
            with a minimum of 6 nodes, nodes count has to be even.)r   TIME_LIMITED	STRETCHEDzType of the private cloud)r   defaultchoicesr   z--preferred-zonez        Zone that will remain operational when connection between the two zones is
        lost. Specify the resource name of a zone that belongs to the region of the
        private cloud.
        z--secondary-zonez        Additional zone for a higher level of availability and load balancing.
        Specify the resource name of a zone that belongs to the region of the
        private cloud.
        z--service-subnetz        A non-overlapping CIDR range and prefix length for the service subnets.
        The service subnets are used for appliance or service deployment, such as storage,
        backup, disaster recovery, and media streaming.
        )r   hiddenr   r   N)r	   AddPrivatecloudArgToParserAddClusterArgToParserr   
ASYNC_FLAGAddToParser
SetDefaultdisplay_info	AddFormatadd_argumentr   ArgDictstrint#AddAutoscalingSettingsFlagsToParser)parsers    +lib/surface/vmware/private_clouds/create.pyArgszCreate.Args=   s    
$$V=	5t 	OO'OOvt,
!!&)
      !     #F+
   * mF
 )           
 
--f5    c                    |j                   j                  j                         }t               }|j                  }t        j                  |j                        }d }|j                  rt        j                  |j                        }|j                  s$|j                  s|j                  s|j                  r@t        j                  |j                  |j                  |j                  |j                        }|j                  ||j                   ||j"                  |j$                  |j&                  |j(                  |j*                  |j,                  ||j.                        }|r#t1        j2                  |j4                  dd       y |j7                  |j9                  |      dj;                  |j=                                     }t1        j2                  |j=                         d       |S )N)

cluster_idnodes_configsnetwork_cidrvmware_engine_network_iddescriptionprivate_cloud_typepreferred_zonesecondary_zoneautoscaling_settingsservice_subnetzprivate cloudT)kindis_asyncz,waiting for private cloud [{}] to be created)operation_refmessage)r=   )CONCEPTSprivate_cloudParser   async_r
   ParseNodesConfigsParametersnode_type_configautoscaling_settings_from_file&ParseAutoscalingSettingsFromFileFormat"autoscaling_min_cluster_node_count"autoscaling_max_cluster_node_countautoscaling_cool_down_periodautoscaling_policy)ParseAutoscalingSettingsFromInlinedFormatr   clustermanagement_rangevmware_engine_networkr7   r   r9   r:   r<   r   CreatedResourcenameWaitForOperationGetOperationRefformatRelativeName)	selfargsprivatecloudclientr>   r4   r;   	operationresources	            r/   Runz
Create.Run   s   ==..446L "F{{H44T5J5JKM**!HH

-
- 	//22,,""!KK

1
1

1
1

+
+

!
!	 <<#**!%!;!;$$99****1**  I 	)..N&&,,Y7>EE%%'
 ' H 113/JOr1   N)	__name__
__module____qualname____doc__DETAILED_HELPdetailed_helpstaticmethodr0   r]    r1   r/   r   r   6   s&     .-^6 ^6@0r1   r   N)ra   
__future__r   r   r   +googlecloudsdk.api_lib.vmware.privatecloudsr   googlecloudsdk.callioper   r   !googlecloudsdk.command_lib.vmwarer	   *googlecloudsdk.command_lib.vmware.clustersr
   googlecloudsdk.corer   rb   ReleaseTracksReleaseTrackGAUniverseCompatibleCreateCommandr   re   r1   r/   <module>rq      s    . &  ' K / ( 3 ; #	4 D%%(()VT V  *Vr1   