
    J                         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
KJr  SSKJr   " S S\5      r " S S\5      r " S S\5      r " S S\5      rg)zOCommands for interacting with the Cloud NetApp Files Storage Pool API resource.    )absolute_import)division)unicode_literals)
list_pager)	constants)util)waiter)base)log)	resourcesc                       \ rS rSrSr\R                  R                  4S jr\	S 5       r
\	S 5       rS rS r                    SS	 jrSS
 jrS rS rS r            SS jrS rS rS rSrg)StoragePoolsClient   zNWrapper for working with Storage Pool in the Cloud NetApp Files API Client.
  c                    Xl         U R                   [        R                  R                  :X  a  [	        5       U l        g U R                   [        R                  R                  :X  a  [        5       U l        g U R                   [        R                  R                  :X  a  [        5       U l        g [        SR                  [        R                  U   5      5      e)Nz [{}] is not a valid API version.)release_trackr
   ReleaseTrackALPHAAlphaStoragePoolsAdapter_adapterBETABetaStoragePoolsAdapterGAStoragePoolsAdapter
ValueErrorformatnetapp_api_utilVERSION_MAP)selfr   s     9lib/googlecloudsdk/api_lib/netapp/storage_pools/client.py__init__StoragePoolsClient.__init__"   s    &T..444.0dm			t0055	5-/dm			t0033	3)+dm9@@

%
%m
46 7 7    c                 .    U R                   R                  $ N)r   clientr   s    r   r%   StoragePoolsClient.client.   s    ==r"   c                 .    U R                   R                  $ r$   )r   messagesr&   s    r   r)   StoragePoolsClient.messages2   s    ==!!!r"   c                     [         R                  " [         R                  " U R                  R                  5      USR                  UR                  5       5      5      $ )zWaits on the long-running operation until the done field is True.

Args:
  operation_ref: the operation reference.

Raises:
  waiter.OperationError: if the operation contains an error.

Returns:
  the 'response' field of the Operation.
zWaiting for [{0}] to finish)r	   WaitForCloudOperationPollerNoResourcesr%   projects_locations_operationsr   Name)r   operation_refs     r   WaitForOperation#StoragePoolsClient.WaitForOperation6   sL     >>..KK55	78E%,,]-?-?-ABD Dr"   c                 v   U R                   R                  UR                  5       R                  5       UR	                  5       US9nU R
                  R                  R                  U5      nU(       a  U$ [        R                  R                  UR                  [        R                  S9nU R                  U5      $ )z#Create a Cloud NetApp Storage Pool.)parentstoragePoolIdstoragePool
collection)r)   0NetappProjectsLocationsStoragePoolsCreateRequestParentRelativeNamer/   r%   projects_locations_storagePoolsCreater   REGISTRYParseRelativeNamenamer   OPERATIONS_COLLECTIONr1   )r   storagepool_refasync_configrequest	create_opr0   s          r   CreateStoragePool$StoragePoolsClient.CreateStoragePoolG   s    mmLL%%'446%**, M G ;;BB7KI&&889#B#B 9 DM  //r"   Nc                 Z    U R                   R                  UUUUUUUUU	U
UUUUUUUUUUS9$ )zHParses the command line arguments for Create Storage Pool into a config.)r@   service_levelnetwork
kms_configactive_directoryenable_ldapcapacitydescriptionallow_auto_tieringzonereplica_zonecustom_performance_enabledtotal_throughput
total_iopshot_tier_sizeenable_hot_tier_auto_resizelabelsunified_poolqos_typestorage_pool_type)r   ParseStoragePoolConfig)r   r@   rJ   rK   rM   rL   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   s                        r   r]   )StoragePoolsClient.ParseStoragePoolConfigT   s\    . ==//#)-!#=)#$?!+) 0  r"   c                 b   U R                   R                  US9nU R                  R                  R	                  U5      nUR
                   H(  n[        R                  " SR                  U5      5        M*     [        R                  " U R                  R                  U[        R                  USS9$ )aS  Make API calls to List active Cloud NetApp Storage Pools.

Args:
  location_ref: The parsed location of the listed NetApp Volumes.
  limit: The number of Cloud NetApp Storage Pools to limit the results to.
    This limit is passed to the server and the server does the limiting.

Returns:
  Generator that yields the Cloud NetApp Volumes.
)r4   zLocation {} may be unreachable.pageSize)fieldlimitbatch_size_attribute)r)   .NetappProjectsLocationsStoragePoolsListRequestr%   r<   Listunreachabler   warningr   r   YieldFromListr   STORAGE_POOL_RESOURCE)r   location_refrb   rE   responselocations         r   ListStoragePools#StoragePoolsClient.ListStoragePools   s     mmJJ K G {{::??HH((	kk3::8DE )##33--') )r"   c                     U R                   R                  UR                  5       S9nU R                  R                  R                  U5      $ )z*Get Cloud NetApp Storage Pool information.r@   )r)   -NetappProjectsLocationsStoragePoolsGetRequestr;   r%   r<   Get)r   rB   rE   s      r   GetStoragePool!StoragePoolsClient.GetStoragePool   sC    mmII))+ J -G;;66::7CCr"   c                 r    U R                   R                  UR                  5       S9nU R                  X#5      $ )z.Deletes an existing Cloud NetApp Storage Pool.rp   )r)   0NetappProjectsLocationsStoragePoolsDeleteRequestr;   _DeleteStoragePool)r   rB   rC   rE   s       r   DeleteStoragePool$StoragePoolsClient.DeleteStoragePool   s9    mmLL))+ M -G""633r"   c                     U R                   R                  R                  U5      nU(       a  U$ [        R                  R                  UR                  [        R                  S9nU R                  U5      $ )Nr7   )
r%   r<   Deleter   r>   r?   r@   r   rA   r1   )r   rC   rE   	delete_opr0   s        r   rw   %StoragePoolsClient._DeleteStoragePool   sa    ;;BB7KI&&889#B#B 9 DM  //r"   c                 P    U R                   R                  UUUUUUUUU	U
UUUS9nU$ )aP  Parses updates into a storage pool config.

Args:
  storagepool_config: The storage pool message to update.
  capacity: capacity of a storage pool
  active_directory: the Active Directory attached to a storage pool
  description: str, a new description, if any.
  allow_auto_tiering: bool indicate whether pool supports auto-tiering
  zone: str, zone for storage pool
  replica_zone: str, replica zone for storage pool
  total_throughput: int, total throughput of the storage pool
  total_iops: int, total IOPS of the storage pool
  hot_tier_size: int, hot tier size of the storage pool
  enable_hot_tier_auto_resize: bool, whether hot tier auto resize is enabled
  for the storage pool
  qos_type: qos (quality of service) type of the storage pool
  labels: LabelsValue message, the new labels value, if any.

Returns:
  The storage pool message.
)rO   rM   rP   rQ   rR   rS   rU   rV   rW   rX   r[   rY   )r   ParseUpdatedStoragePoolConfig)r   storagepool_configrO   rM   rP   rQ   rR   rS   rU   rV   rW   rX   r[   rY   storage_pools                  r   r   0StoragePoolsClient.ParseUpdatedStoragePoolConfig   sM    H ==>>)-!)#$? ? L r"   c                     U R                   R                  UX#5      nU(       a  U$ [        R                  R	                  UR
                  [        R                  S9nU R                  U5      $ )aI  Updates a Storage Pool.

Args:
  storagepool_ref: the reference to the storage pool.
  storagepool_config: Storage Pool message, the updated storage pool.
  update_mask: str, a comma-separated list of updated fields.
  async_: bool, if False, wait for the operation to complete.

Returns:
  an Operation or Storage Pool message.
r7   )	r   UpdateStoragePoolr   r>   r?   r@   r   rA   r1   )r   rB   r   update_maskrC   	update_opr0   s          r   r   $StoragePoolsClient.UpdateStoragePool   sc     //0BQI&&889#B#B 9 DM  //r"   c                     U R                   R                  U5      nU(       a  U$ [        R                  R	                  UR
                  [        R                  S9nU R                  U5      $ )a&  Switch the zone of a Regional Cloud NetApp Storage Pooln.

Args:
  storagepool_ref: the reference to the storage pool.
  async_: bool, if False, wait for the operation to complete.

Returns:
  an Operation if async_ is set to true, or a switch message if the
  SwtichStoragePool is successful.
r7   )	r   SwitchStoragePoolr   r>   r?   r@   r   rA   r1   )r   rB   rC   	switch_opr0   s        r   r   $StoragePoolsClient.SwitchStoragePool   s^     //@I&&889#B#B 9 M   //r"   c                     U R                   R                  X5      nU(       a  U$ [        R                  R	                  UR
                  [        R                  S9nU R                  U5      $ )aj  Validates the directory service attached to the storage pool.

Args:
  storagepool_ref: the reference to the storage pool.
  directory_service_type: the type of directory service to validate.
  async_: bool, if False, wait for the operation to complete.

Returns:
  an Operation if async_ is set to true, or a validate message if the
  validation is successful.
r7   )	r   ValidateDirectoryServicer   r>   r?   r@   r   rA   r1   )r   rB   directory_service_typerC   validate_opr0   s         r   r   +StoragePoolsClient.ValidateDirectoryService  se     --88K &&88Y%D%D 9 M   //r"   )r   r   )NNNNNNNNNNNNNNNNNNNNr$   NNNNNNNNNNNN)__name__
__module____qualname____firstlineno____doc__r
   r   r   r    propertyr%   r)   r1   rG   r]   rm   rs   rx   rw   r   r   r   r   __static_attributes__ r"   r   r   r      s     $(#4#4#:#: 
7     " "D"0 #'+/%).2(,)-&*)-04"&*.8<.2(,+/9=$(*.&*/3),\)0D40 .259047;)-1559/326@D-1+/3j0,0&0r"   r   c                   X    \ rS rSrSrS rS r            SS jrS rS r	S	 r
S
rg)r   i$  z9Adapter for the Cloud NetApp Files API for Storage Pools.c                     [         R                  R                  U l        [        R
                  " U R                  S9U l        [        R                  " U R                  S9U l        g N)r   )	r
   r   r   r   r   GetClientInstancer%   GetMessagesModuler)   r&   s    r   r    StoragePoolsAdapter.__init__'  sN    **--D!33((DK $55((DMr"   c                    U R                   R                  5       nUUl        UUl        UR	                  S5      Ul        SU;   a  UR	                  S5      Ul        UUl        UUl        UUl	        UUl
        UUl        U	b  U	Ul        U
b  U
Ul        Ub  UUl        Ub  UUl        Ub  UUl        Ub  UUl        Ub  UUl        Ub  UUl        Ub  UUl        UUl        Ub  UUl        Ub  UUl        U$ )a   Parses the command line arguments for Create Storage Pool into a config.

Args:
  name: the name of the Storage Pool
  service_level: the service level of the Storage Pool
  network: the network of the Storage Pool
  kms_config: the KMS Config of the Storage Pool
  active_directory: the Active Directory of the Storage Pool
  enable_ldap: Bool on whether to enable LDAP on Storage Pool
  capacity: the storage capacity of the Storage Pool
  description: the description of the Storage Pool
  allow_auto_tiering: Bool on whether Storage Pool supports auto tiering
  zone: zone of the Storage Pool
  replica_zone: Replica zone for the Storage Pool
  custom_performance_enabled: Bool on whether custom performance is enabled
  total_throughput: Total throughput of the Storage Pool
  total_iops: Total IOPS of the Storage Pool
  hot_tier_size: Hot tier size of the Storage Pool
  enable_hot_tier_auto_resize: Bool on whether hot tier auto resize is
    enabled
  qos_type: qos (quality of service) type of the storage pool
  labels: the parsed labels value
  unified_pool: Bool on whether the Storage Pool is a unified pool
  storage_pool_type: Type of the Storage Pool

Returns:
  The configuration that will be used as the request body for creating a
  Cloud NetApp Storage Pool.
r@   z	psa-range)r)   StoragePoolr@   serviceLevelgetrK   psaRange	kmsConfigactiveDirectoryldapEnabledcapacityGibrP   allowAutoTieringrR   replicaZonecustomPerformanceEnabledtotalThroughputMibps	totalIopshotTierSizeGibenableHotTierAutoResizeqosTyperY   unifiedPooltype)r   r@   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   r[   rY   rZ   r\   r   s                         r   r]   *StoragePoolsAdapter.ParseStoragePoolConfig0  s!   h ==,,.LL -L";;v.Lg%kk+6l'L#3L *L'L*L%&8l#l!-l!-.Hl+#*:l')l $1l!".-Hl*%l L!-l$+lr"   Nc                     Ub  XQl         Ub  X1l        Ub  X!l        Ub  Xal        Ub  Xql        Ub  Xl        U	b  Xl        U
b  Xl        Ub  Xl        Ub  Xl	        Ub  Xl
        Ub  XAl        U$ )z>Parse update information into an updated Storage Pool message.)r   r   rP   r   rR   r   r   r   r   r   r   rY   )r   r   rP   rM   rY   rO   rQ   rR   rS   rU   rV   rW   rX   r[   s                 r   r   1StoragePoolsAdapter.ParseUpdatedStoragePoolConfig  s    " '/$#+;('2$%,>) $'3$#0@-%/" *7'".3N0#+ "(r"   c                     U R                   R                  UUR                  5       US9nU R                  R                  R                  U5      nU$ )z7Send a Patch request for the Cloud NetApp Storage Pool.)r6   r@   
updateMask)r)   /NetappProjectsLocationsStoragePoolsPatchRequestr;   r%   r<   Patch)r   rB   r   r   update_requestr   s         r   r   %StoragePoolsAdapter.UpdateStoragePool  sZ     	EE* --/" 	F 	
  ;;AAI r"   c                     U R                   R                  UR                  5       S9nU R                  R                  R                  U5      $ )z=Send a switch zone request for the Cloud NetApp storage pool.rp   )r)   0NetappProjectsLocationsStoragePoolsSwitchRequestr;   r%   r<   Switch)r   rB   switch_requests      r   r   %StoragePoolsAdapter.SwitchStoragePool  sJ     	FF --/ 	G 	
 
 ;;66==nMMr"   c                     U R                   R                  US9nU R                   R                  UR                  5       US9nU R                  R
                  R                  U5      $ )zLSend a validate directory service request for the Cloud NetApp storage pool.)directoryServiceType)r@   validateDirectoryServiceRequest)r)   ValidateDirectoryServiceRequestBNetappProjectsLocationsStoragePoolsValidateDirectoryServiceRequestr;   r%   r<   r   )r   rB   r   rE   validate_requests        r   r   ,StoragePoolsAdapter.ValidateDirectoryService  sl    mm;;3 < G }}gg))+(/ h  ;;66OO r"   r%   r)   r   r   )r   r   r   r   r   r    r]   r   r   r   r   r   r   r"   r   r   r   $  sM    AVv "&)VNr"   r   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )r   i  z>Adapter for the Beta Cloud NetApp Files API for Storage Pools.c                    > [         [        U ]  5         [        R                  R
                  U l        [        R                  " U R                  S9U l	        [        R                  " U R                  S9U l        g r   )superr   r    r
   r   r   r   r   r   r%   r   r)   r   	__class__s    r   r     BetaStoragePoolsAdapter.__init__  s]    	
!413**//D!33((DK $55((DMr"   r   r   r   r   r   r   r    r   __classcell__r   s   @r   r   r     s    F r"   r   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )r   i  z?Adapter for the Alpha Cloud NetApp Files API for Storage Pools.c                    > [         [        U ]  5         [        R                  R
                  U l        [        R                  " U R                  S9U l	        [        R                  " U R                  S9U l        g r   )r   r   r    r
   r   r   r   r   r   r%   r   r)   r   s    r   r    !AlphaStoragePoolsAdapter.__init__  s]    	
"D24**00D!33((DK $55((DMr"   r   r   r   s   @r   r   r     s    G r"   r   N)r   
__future__r   r   r   apitools.base.pyr   googlecloudsdk.api_lib.netappr   r   r   googlecloudsdk.api_lib.utilr	   googlecloudsdk.callioper
   googlecloudsdk.corer   r   objectr   r   r   r   r   r"   r   <module>r      sa    V &  ' ' 3 A . ( # )C0 C0Lq& qh1 6 r"   