
    :                     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
lmZ ddlmZ ddlmZ dZdZd+dZd Zd Zd Zd Z	 d,dZd Zd+dZd Z d Z!d Z"d Z#d Z$d Z%d Z&d Z'd Z(d  Z)d! Z*d" Z+d# Z,d$ Z-d% Z.d& Z/d' Z0d( Z1d) Z2y*)-zDFlags and helpers for the Cloud NetApp Files Storage Pools commands.    )absolute_import)division)unicode_literals)util)arg_parsers)base)concepts)flags)	arg_utils)labels_util)concept_parsersz    table(
        name.basename():label=STORAGE_POOL_NAME:sort=1,
        name.segment(3):label=LOCATION,
        serviceLevel,
        capacityGib,
        network,
        state,
        volumeCapacityGib,
        type
    )z    table(
        name.basename():label=STORAGE_POOL_NAME:sort=1,
        name.segment(3):label=LOCATION,
        serviceLevel,
        capacityGib,
        network,
        state,
        volumeCapacityGib
    )c                 p    ddddd}t        j                  d| j                  j                  d||      }|S )	zAdds a --service-level arg to the given parser.

  Args:
    messages: The messages module.
    required: bool, whether choice arg is required or not

  Returns:
    the choice arg.
  )premiumz
                          Premium Service Level for Cloud NetApp Storage Pool.
                          The Premium Service Level has a throughput per GiB of
                          allocated volume size of 64 KiB/s.)extremez
                          Extreme Service Level for Cloud NetApp Storage Pool.
                          The Extreme Service Level has a throughput per GiB of
                          allocated volume size of 128 KiB/s.)standardz
                          Standard Service Level for Cloud NetApp Storage Pool.
                          The Standard Service Level has a throughput per GiB of
                          allocated volume size of 16 KiB/s.)flexz
                          Flex Service Level for Cloud NetApp Storage Pool.
                          The Flex Service Level has a throughput per GiB of
                          allocated volume size of 16 KiB/s.)PREMIUMEXTREMESTANDARDFLEXz--service-levelzThe service level for the Cloud NetApp Storage Pool.
       For more details, see:
       https://cloud.google.com/netapp/volumes/docs/configure-and-use/storage-pools/overview#service_levels
        )help_strcustom_mappingsrequired)r   ChoiceEnumMapperStoragePoolServiceLevelValueValuesEnum)messagesr   r   service_level_args       <lib/googlecloudsdk/command_lib/netapp/storage_pools/flags.pyGetStoragePoolServiceLevelArgr    :   sW    -/<  0066 &	 
    c                 X    t        j                  | |j                  j                        S )zReturns the Choice Enum for Directory Service Type.

  Args:
    choice: The choice for directory service type as string
    messages: The messages module.

  Returns:
    the directory service type enum.
  choice	enum_type)r   ChoiceToEnumValidateDirectoryServiceRequest#DirectoryServiceTypeValueValuesEnumr$   r   s     r   "GetDirectoryServiceTypeEnumFromArgr*   o   s)     
		88\\
 r!   c                 ^    t        j                  d| j                  j                  d      }|S )z(Adds the Qos Type arg to the arg parser.z
--qos-typez3Quality of service (QoS) type for the Storage Pool.)r   )r   r   r   QosTypeValueValuesEnum)r   qos_type_args     r   GetStoragePoolQosTypeArgr.      s/    ++11H,
 
r!   c                 X    t        j                  | |j                  j                        S )z,Returns the Choice Enum for StoragePoolType.r#   )r   r&   r   TypeValueValuesEnumr)   s     r   GetStoragePoolTypeEnumFromArgr1      s'    			$$88
 r!   c           	          t        j                  d|j                  j                  ddddd      }|j                  j                  |        y)	z8Adds the --type arg to the arg parser for Storage Pools.z--typezThe type of the Storage Pool. `FILE` pools support file-based volumes only. `UNIFIED` pools support both file and block volumes.T)filez"File-based volumes only (default).)unifiedzBoth file and block volumes.)FILEUNIFIED)r   hiddenr   N)r   r   r   r0   
choice_argAddToParser)parserr   type_args      r   AddStoragePoolTypeArgr<      sO    ''.. @@
	( !!&)r!   c                 P    t        ||      j                  j                  |        y )Nr   )r    r8   r9   )r:   r   r   s      r   AddStoragePoolServiceLevelArgr?      s      J{{6"r!   c                 t    d}t        j                  d|       t        j                  j	                  |        y )NzPReturn immediately, without waiting for the operation
  in progress to complete.async)name	help_text)r	    ResourceParameterAttributeConfigr   
ASYNC_FLAGr9   )r:   rC   s     r   AddStoragePoolAsyncFlagrF      s+    )
++IN//f%r!   c                 x    t         t         d}d}| j                  dt        j                  |dg      ||       y)zAdds a --network arg to the given parser.

  Args:
    parser: argparse parser.
    required: bool whether arg is required or not
  )rB   z	psa-rangea{          Network configuration for a Cloud NetApp Files Storage Pool. Specifying
        `psa-range` is optional.
        *name*::: The name of the Google Compute Engine
        [VPC network](/compute/docs/networks-and-firewalls#networks) to which
        the volume is connected. Short-form (VPC network ID) or long-form
        (full VPC network name: projects/PROJECT/locations/LOCATION/networks/NETWORK) are both
        accepted, but please use the long-form when attempting to create a Storage Pool using a shared VPC.
        *psa-range*::: This field is not implemented. The values provided in
        this field are ignored.
  z	--networkrB   )specrequired_keys)typer   helpN)stradd_argumentr   ArgDict)r:   r   network_arg_specnetwork_helps       r   AddStoragePoolNetworkArgrQ      sJ     

, 	$4VHM	  r!   c                     t         j                  j                  dt        j                         dddi      j                  |        y)z2Adds a --active-directory arg to the given parser.z--active-directoryz3The Active Directory to attach to the Storage Pool.location flag_name_overridesN)r   ConceptParserForResourcer
   GetActiveDirectoryResourceSpecr9   r:   s    r    AddStoragePoolActiveDirectoryArgr[      sA    ++**,;%r*	 , , -8K,?r!   c                     t         j                  j                  dt        j                         dddi      j                  |        y)z,Adds a --kms-config arg to the given parser.z--kms-configz-The KMS config to attach to the Storage Pool.rS   rT   rU   N)r   rW   rX   r
   GetKmsConfigResourceSpecr9   rZ   s    r   AddStoragePoolKmsConfigArgr^      sA    ++$$&5%r*	 , , -8K,?r!   c                     | j                  dt        j                  t        j                  t        j
                        d       y)z/Adds the --enable-ladp arg to the given parser.z--enable-ldaptruthy_stringsfalsey_stringszNBoolean flag indicating whether Storage Pool is a NFS LDAP Storage Pool or notrJ   rK   NrM   r   
ArgBooleannetapp_utiltruthyfalseyrZ   s    r   AddStoragePoolEnableLdapArgri      s;    !!$++K<N<NP_	  r!   c                     | j                  dt        j                  t        j                  t        j
                        d       y)z6Adds the --allow-auto-tiering arg to the given parser.z--allow-auto-tieringr`   zKBoolean flag indicating whether Storage Pool is allowed to use auto-tieringrc   Nrd   rZ   s    r   !AddStoragePoolAllowAutoTieringArgrk      s;    !!$++K<N<NP\	  r!   c                 4    | j                  dt        d       y)z$Adds the Zone arg to the arg parser.z--zonez1String indicating active zone of the Storage Poolrc   NrM   rL   rZ   s    r   AddStoragePoolZoneArgrn      s    B  r!   c                 4    | j                  dt        d       y)z,Adds the Replica Zone arg to the arg parser.z--replica-zonez3String indicating replica zone for the Storage Poolrc   Nrm   rZ   s    r   AddStoragePoolReplicaZoneArgrp      s    D  r!   c                 4    | j                  dt        d       y)z6Adds the Directory Service Type arg to the arg parser.z--directory-service-typez=String indicating directory service type for the Storage Poolrc   Nrm   rZ   s    r   %AddStoragePoolDirectoryServiceTypeArgrr     s     N  r!   c                     | j                  dt        j                  t        j                  t        j
                        d       y)z:Adds the Custom Performance Enabled arg to the arg parser.z--custom-performance-enabledr`   zXBoolean flag indicating whether Storage Pool is a custom performance Storage Pool or notrc   Nrd   rZ   s    r   )AddStoragePoolCustomPerformanceEnabledArgrt     s=    $!!$++K<N<N j  r!   c                 \    | j                  dt        j                  dddgd      d       y)	z0Adds the Total Throughput arg to the arg parser.z--total-throughputzMiB/szGiB/szB/sdefault_unitsuggested_binary_size_scales	type_abbrzThe total throughput of the Storage Pool in MiB/s or GiB/s units.
              If no throughput unit is specified, MiB/s is assumed.rc   NrM   r   
BinarySizerZ   s    r    AddStoragePoolTotalThroughputArgr|     s:    !!(/'9
G  	r!   c                 4    | j                  dt        d       y)z*Adds the Total IOPS arg to the arg parser.z--total-iopsz1Integer indicating total IOPS of the Storage Poolrc   N)rM   intrZ   s    r   AddStoragePoolTotalIopsArgr   *  s    B  r!   c                 Z    | j                  dt        j                  ddgd      d       y)z-Adds the Hot Tier Size arg to the arg parser.z--hot-tier-sizeGiBBrv   zThe hot tier size of the Storage Pool in GiB units.
              This is a required field when --allow-auto-tiering is set for flex service level.rc   Nrz   rZ   s    r   AddStoragePoolHotTierSizeArgr   3  s7    !!(-w
c  	r!   c                     | j                  dt        j                  t        j                  t        j
                        d       y)z;Adds the Enable Hot Tier Auto Resize arg to the arg parser.z--enable-hot-tier-auto-resizer`   zSBoolean flag indicating whether Storage Pool is allowed to use hot tier auto resizerc   Nrd   rZ   s    r   (AddStoragePoolEnableHotTierAutoResizeArgr   A  s=    %!!$++K<N<N e  r!   c                     | j                  dt        j                  t        j                  t        j
                        dd       y)z)Adds the Unified Pool arg to the  parser.z--unified-poolr`   zBoolean flag indicating whether Storage Pool is a unified pool that supports BLOCK storage. Defaults to False if not specified.T)rJ   rK   r7   Nrd   rZ   s    r   AddStoragePoolUnifiedPoolArgr   L  s@    !!$++K<N<N Q  r!   c                 L    t        |      j                  j                  |        y )N)r.   r8   r9   )r:   r   s     r   AddStoragePoolQosTypeArgr   X  s    J{{6"r!   c                 ,   t        j                  t        j                  d      g      j	                  |        t        j
                  | d       t        j                  | d       t        j                  |        t        j                  |        t        j                  |      }t        | |d       t        |        t        |        t        |        t!        |        t#        |        t%        |        t'        |        t)        |        t+        |        t-        |        t/        | |       |t0        j2                  j4                  k(  s|t0        j2                  j6                  k(  r.t9        |        t;        |        t=        |        t?        | |       yy)z%Add args for creating a Storage Pool.zThe Storage Pool to create.Storage Poolrelease_trackT)r   r   N) r   rW   r
   GetStoragePoolPresentationSpecr9   AddResourceDescriptionArgAddResourceCapacityArgAddResourceAsyncFlagr   AddCreateLabelsFlagsnetapp_api_utilGetMessagesModuler?   rQ   r[   r^   ri   rn   rp   rk   rt   r|   r   r   r   ReleaseTrackALPHABETAr   r   r   r<   r:   r   r   s      r   AddStoragePoolCreateArgsr   `  s4   **+HI! [!!&.9v~6V$""6*..]K(x$ 6""6*V$f%v&#F++F3"6*V$68,t((...t((--- (,V4 (&(+	 .r!   c                     t        j                  t        j                  d      g      j	                  |        t        j
                  |        y)z%Add args for deleting a Storage Pool.zThe Storage Pool to delete.Nr   rW   r
   r   r9   r   rZ   s    r   AddStoragePoolDeleteArgsr     <    **+HI! [V$r!   c                    t        j                  |      }t        j                  t	        j
                  d      g      j                  |        t	        j                  | d       t	        j                  |        t	        j                  | dd       t        j                  |        t        |        t        |        t        |        t        |        t!        |        t#        | |       t%        |        |t&        j(                  j*                  k(  s|t&        j(                  j,                  k(  rt/        |        t1        |        yy)z%Add args for updating a Storage Pool.r   zThe Storage Pool to update.r   Fr>   N)r   r   r   rW   r
   r   r9   r   r   r   r   AddUpdateLabelsFlagsr[   rn   rp   rk   r|   r   r   r   r   r   r   r   r   r   s      r   AddStoragePoolUpdateArgsr     s    ..]K(**+HI! [!!&.9V$v~F""6*"6*v&#F+"6*68,V$t((...t((--- (,V4 .r!   c                     t        j                  t        j                  d      g      j	                  |        t        j
                  |        y)z/Add args for switching zones of a Storage Pool.zThe Storage Pool to switch.Nr   rZ   s    r   AddStoragePoolSwitchArgr     r   r!   c                     t        j                  t        j                  d      g      j	                  |        t        j
                  |        t        |        y)z<Add args for validating directory service of a Storage Pool.zThe Storage Pool to validate.N)r   rW   r
   r   r9   r   rr   rZ   s    r   )AddStoragePoolValidateDirectoryServiceArgr     sD    **+JK! [V$'/r!   N)T)F)3__doc__
__future__r   r   r   googlecloudsdk.api_lib.netappr   r   googlecloudsdk.callioper   r    googlecloudsdk.calliope.conceptsr	   !googlecloudsdk.command_lib.netappr
   rf   $googlecloudsdk.command_lib.util.apisr   $googlecloudsdk.command_lib.util.argsr   (googlecloudsdk.command_lib.util.conceptsr   STORAGE_POOLS_LIST_FORMATSTORAGE_POOLS_LIST_FORMAT_GAr    r*   r.   r1   r<   r?   rF   rQ   r[   r^   ri   rk   rn   rp   rr   rt   r|   r   r   r   r   r   r   r   r   r   r    r!   r   <module>r      s    K &  ' A / ( 5 3 A : < D
	 	 	 2j *"  %#&@@@	#,@%5.%0r!   