
                            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
 Ze	j$                   e	j&                  e	j(                  j*                         G d de	j,                                      Z e	j&                  e	j(                  j0                         G d de             Z e	j&                  e	j(                  j4                         G d de             Zy)z$Updates a Cloud NetApp Storage Pool.    )absolute_import)division)unicode_literals)client)base)flags)labels_util)logc                 0    t        j                  | |       y N)storagepools_flagsAddStoragePoolUpdateArgs)parserrelease_tracks     *lib/surface/netapp/storage_pools/update.py_CommonArgsr      s    --fmD    c                   \    e Zd ZdZej
                  j                  ZdddZe	d        Z
d Zy)Update#Update a Cloud NetApp Storage Pool.z@          Updates a Storage Pool with given arguments
          z          The following command updates a Storage Pool named NAME in the given location

              $ {command} NAME --location=us-central1 --capacity=4096 --active-directory=ad-2 --description="new description" --update-labels=key1=val1
          )DESCRIPTIONEXAMPLESc                 8    t        | t        j                         y r   )r   r   _RELEASE_TRACKr   s    r   ArgszUpdate.Args3   s    --.r   c                 	   |j                   j                  j                         }t        j                  | j
                        }t        j                  j                  |      }|j                  |      }|j                  r|j                  dz	  nd}|j                         rI|j                  |j                  j                  j                  |j                         j#                         }nd}|j$                  }|j&                  }	|j(                  |j(                  dz	  }
nd}
d}d}d}|j*                  8t-        j.                  |j                        j1                  |j*                        }| j
                  t2        j4                  j6                  k(  s'| j
                  t2        j4                  j8                  k(  r'|j:                  |j:                  dz	  }|j<                  }|j?                  |||j@                  |jB                  ||jD                  ||	|
|jF                  |||      }g }|jI                  d      r|jK                  d       |jI                  d      r|jK                  d       |jI                  d	      r|jK                  d	       |jI                  d
      s"|jI                  d      s|jI                  d      r|jK                  d       |jI                  d      r|jK                  d       |jI                  d      r|jK                  d       |jI                  d      r|jK                  d       |jI                  d      r|jK                  d       |jI                  d      r|jK                  d       |jI                  d      r|jK                  d       | j
                  t2        j4                  j6                  k(  s'| j
                  t2        j4                  j8                  k(  rD|jI                  d      r|jK                  d       |jI                  d      r|jK                  d       djM                  |      }|jO                  ||||jP                        }|jP                  rWdjS                  | j5                         jT                        }tV        jX                  j[                  djS                  |             |S ) z:Update a Cloud NetApp Storage Pool in the current project.   N   )capacityactive_directorydescriptionlabelsallow_auto_tieringzonereplica_zonetotal_throughput
total_iopshot_tier_sizeenable_hot_tier_auto_resizeqos_typer    capacityGibr!   activeDirectoryr"   update_labelsremove_labelsclear_labelsr#   r$   allowAutoTieringr%   r&   replicaZoner'   totalThroughputMibpsr(   	totalIopsr+   qosTyper)   hotTierSizeGibr*   enableHotTierAutoResize,z#gcloud {} netapp storage-pools listzRCheck the status of the updated storage pool by listing all storage pools:
  $ {} ).CONCEPTSstorage_poolParsestoragepools_clientStoragePoolsClientr   r	   DiffFromUpdateArgsGetStoragePoolr    MayHaveUpdatesApplymessagesStoragePoolLabelsValuer#   	GetOrNoner%   r&   r'   r+   r   GetStoragePoolQosTypeArgGetEnumForChoicer   ReleaseTrackALPHABETAr)   r*   ParseUpdatedStoragePoolConfigr!   r"   r$   r(   IsSpecifiedappendjoinUpdateStoragePoolasync_formatprefixr
   statusPrint)selfargsstoragepool_refr   labels_difforig_storagepoolcapacity_in_gibr#   r%   r&   total_throughput_mibpshot_tier_size_gibr*   r+   r:   updated_fieldsupdate_maskresultcommands                      r   Runz
Update.Run7   s   mm00668O 33D4G4GHF""11$7K,,_=-1]]dmmr)O!!#  
//
%
%
1
13C3J3J	  f99D$$L(#44:#"&H}} #<<
//'  	t00666t00555				' .."4$($D$D!77 ..$$22!/??'$? 8 L  N
#M**+-.&M*)O,N+H%,-./F#'M**+23%K(
#I&t00666t00555			/	*./			7	878((>*K%%{DKKF {{5<<




$
$g 
jj#VG_ Mr   N)__name__
__module____qualname____doc__r   rI   GAr   detailed_helpstaticmethodr   rb    r   r   r   r   !   sC     ,$$''.		- / /_r   r   c                   L    e Zd ZdZej
                  j                  Zed        Z	y)
UpdateBetar   c                 8    t        | t        j                         y r   )r   rl   r   r   s    r   r   zUpdateBeta.Args   s    
112r   N)
rc   rd   re   rf   r   rI   rK   r   ri   r   rj   r   r   rl   rl      s(    +$$)).3 3r   rl   c                   L    e Zd ZdZej
                  j                  Zed        Z	y)UpdateAlphar   c                 8    t        | t        j                         y r   )r   ro   r   r   s    r   r   zUpdateAlpha.Args   s    223r   N)
rc   rd   re   rf   r   rI   rJ   r   ri   r   rj   r   r   ro   ro      s(    +$$**.4 4r   ro   N)rf   
__future__r   r   r   +googlecloudsdk.api_lib.netapp.storage_poolsr   r<   googlecloudsdk.callioper   /googlecloudsdk.command_lib.netapp.storage_poolsr   r   $googlecloudsdk.command_lib.util.argsr	   googlecloudsdk.corer
   r   DefaultUniverseOnlyReleaseTracksrI   rg   UpdateCommandr   rK   rl   rJ   ro   rj   r   r   <module>rz      s    + &  ' U ( W < #E D%%(()sT s * sl D%%**+3 3 ,3 D%%++,4* 4 -4r   