
    n$                         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g)zMCommands for interacting with the Cloud NetApp Files KMS Config 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 r  SS jrS rS rSrg)KmsConfigsClient   zJWrapper for working with KMS Configs in the Cloud NetApp Files API Client.c                    U[         R                  R                  :X  a  [        5       U l        g U[         R                  R
                  :X  a  [        5       U l        g [        SR                  [        R                  U   5      5      e)Nz [{}] is not a valid API version.)r
   ReleaseTrackBETABetaKmsConfigsAdapter_adapterGAKmsConfigsAdapter
ValueErrorformatnetapp_api_utilVERSION_MAP)selfrelease_tracks     7lib/googlecloudsdk/api_lib/netapp/kms_configs/client.py__init__KmsConfigsClient.__init__!   sg    ))...+-dm	$++..	.')dm9@@

%
%m
46 7 7    c                 .    U R                   R                  $ N)r   clientr   s    r   r#   KmsConfigsClient.client*   s    ==r    c                 .    U R                   R                  $ r"   )r   messagesr$   s    r   r'   KmsConfigsClient.messages.   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!KmsConfigsClient.WaitForOperation2   sL     >>..KK55	
 	%,,]-?-?-AB 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 KMS Config.)parentkmsConfigId	kmsConfig
collection)r'   .NetappProjectsLocationsKmsConfigsCreateRequestParentRelativeNamer-   r#   projects_locations_kmsConfigsCreater   REGISTRYParseRelativeNamenamer   OPERATIONS_COLLECTIONr/   )r   kmsconfig_refasync_
kms_configrequest	create_opr.   s          r   CreateKmsConfig KmsConfigsClient.CreateKmsConfigF   s    mmJJ##%224!&&( K G
 99@@II&&889#B#B 9 M   //r    Nc                 j    U R                   R                  5       nXl        X%l        X5l        XEl        U$ )al  Parses the command line arguments for Create KMS Config into a message.

Args:
  name: the name of the KMS Config
  crypto_key_name: the crypto key name of the KMS Config
  description: the description of the KMS COnfig
  labels: the parsed labels value

Returns:
  The configuration that will be used as the request body for creating a
  Cloud NetApp KMS Config.
)r'   	KmsConfigr>   cryptoKeyNamedescriptionlabels)r   r>   crypto_key_namerJ   rK   rB   s         r   ParseKmsConfigKmsConfigsClient.ParseKmsConfigU   s3     ((*JO.(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$ )aO  Make API calls to List Cloud NetApp KMS Configs.

Args:
  location_ref: The parsed location of the listed NetApp KMS Configs.
  limit: The number of Cloud NetApp KMS Configs 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 KMS Config.
)r2   zLocation {} may be unreachable.pageSize)fieldlimitbatch_size_attribute)r'   ,NetappProjectsLocationsKmsConfigsListRequestr#   r:   Listunreachabler   warningr   r   YieldFromListr   KMS_CONFIG_RESOURCE)r   location_refrR   rC   responselocations         r   ListKmsConfigsKmsConfigsClient.ListKmsConfigsk   s     mmHH I G {{88==gFH((	kk3::8DE )##11++') )r    c                     U R                   R                  UR                  5       S9nU R                  R                  R                  U5      $ )z(Get Cloud NetApp KMS Config information.r>   )r'   +NetappProjectsLocationsKmsConfigsGetRequestr9   r#   r:   Getr   r@   rC   s      r   GetKmsConfigKmsConfigsClient.GetKmsConfig   sC    mmGG'') H +G;;4488AAr    c                 r    U R                   R                  UR                  5       S9nU R                  X#5      $ )z,Deletes an existing Cloud NetApp KMS Config.r`   )r'   .NetappProjectsLocationsKmsConfigsDeleteRequestr9   _DeleteKmsConfig)r   r@   rA   rC   s       r   DeleteKmsConfig KmsConfigsClient.DeleteKmsConfig   s@     	DD++- 	E 	
 
   11r    c                     U R                   R                  R                  U5      nU(       a  U$ [        R                  R                  UR                  [        R                  S9nU R                  U5      $ )Nr5   )
r#   r:   Deleter   r<   r=   r>   r   r?   r/   )r   rA   rC   	delete_opr.   s        r   rh   !KmsConfigsClient._DeleteKmsConfig   sb    99@@II&&889#B#B 9 M   //r    c                     U R                   R                  UX#5      nU(       a  U$ [        R                  R	                  UR
                  [        R                  S9nU R                  U5      $ )a5  Updates a KMS Config.

Args:
  kmsconfig_ref: the reference to the kms config.
  kms_config: KMS Config message, the updated kms config.
  update_mask: str, a comma-separated list of updated fields.
  async_: bool, if False, wait for the operation to complete.

Returns:
  an Operation or KMS Config message.
r5   )	r   UpdateKmsConfigr   r<   r=   r>   r   r?   r/   )r   r@   rB   update_maskrA   	update_opr.   s          r   rp    KmsConfigsClient.UpdateKmsConfig   sc     --m.8GI&&889#B#B 9 DM  //r    c                 :    U R                   R                  UUUUS9$ )z"Parses updates into an kms config.)rB   rL   rJ   rK   )r   ParseUpdatedKmsConfigr   rB   rL   rJ   rK   s        r   ru   &KmsConfigsClient.ParseUpdatedKmsConfig   s,     ==..'	 /  r    c                 :   U R                   R                  UR                  5       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=Encrypts the volumes attached to the Cloud NetApp KMS Config.r`   r5   )r'   /NetappProjectsLocationsKmsConfigsEncryptRequestr9   r#   r:   Encryptr   r<   r=   r>   r   r?   r/   )r   r@   rA   rC   
encrypt_opr.   s         r   EncryptKmsConfig!KmsConfigsClient.EncryptKmsConfig   s     	EE++- 	F 	
 
 ::BB7KJ&&88I$C$C 9 EM  //r    c                     U R                   R                  UR                  5       S9nU R                  R                  R                  U5      $ )z:Verifies the Cloud NetApp Volumes KMS Config is reachable.r`   )r'   .NetappProjectsLocationsKmsConfigsVerifyRequestr9   r#   r:   Verifyrc   s      r   VerifyKmsConfig KmsConfigsClient.VerifyKmsConfig   sO     	DD++- 	E 	
 
 ;;44;; r    )r   )NNNNr"   )NN)__name__
__module____qualname____firstlineno____doc__r
   r   r   r   propertyr#   r'   r/   rE   rM   r]   rd   ri   rh   rp   ru   r|   r   __static_attributes__ r    r   r   r      s    R#'#4#4#9#9 7     " "(0  GK,)0B200. )-#'	
0	r    r   c                   0    \ rS rSrSrS r SS jrS rSrg)	r      z7Adapter for the Cloud NetApp Files API for KMS Configs.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   KmsConfigsAdapter.__init__   sN    **--D!33((DK $55((DMr    Nc                 <    Ub  X!l         Ub  X1l        Ub  XAl        U$ )z%Parses updates into a new kms config.)rI   rJ   rK   rv   s        r   ru   'KmsConfigsAdapter.ParseUpdatedKmsConfig   s.     "!0* r    c                     U R                   R                  UUR                  5       US9nU R                  R                  R                  U5      nU$ )z5Send a Patch request for the Cloud NetApp KMS Config.)r4   r>   
updateMask)r'   -NetappProjectsLocationsKmsConfigsPatchRequestr9   r#   r:   Patch)r   r@   rB   rq   update_requestrr   s         r   rp   !KmsConfigsAdapter.UpdateKmsConfig   sX     	CC ++-" 	D 	$ 
 99??Ir    r#   r'   r   )NNN)	r   r   r   r   r   r   ru   rp   r   r   r    r   r   r      s    ? HL
	r    r   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )r      z<Adapter for the Beta Cloud NetApp Files API for KMS Configs.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   BetaKmsConfigsAdapter.__init__   s]    	
/1**//D!33((DK $55((DMr    r   )r   r   r   r   r   r   r   __classcell__)r   s   @r   r   r      s    D 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   <module>r      sR    T &  ' ' 3 A . ( # )tv tn! !H- r    