
                             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
\5      r " S S\5      r " S S\5      rg)zNCommands for interacting with the Cloud NetApp Files Quota Rules API resource.    )
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S jrS rSrg)QuotaRulesClient   zMWrapper for working with Quota Rules in the Cloud NetApp Files API Client.
  c                 D   Xl         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BETABetaQuotaRulesAdapter_adapterGAQuotaRulesAdapter
ValueErrorformatnetapp_api_utilVERSION_MAP)selfr   s     ?lib/googlecloudsdk/api_lib/netapp/volumes/quota_rules/client.py__init__QuotaRulesClient.__init__   sy    &T..333+-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    QuotaRulesClient.client)   s    ==r   c                 .    U R                   R                  $ r   )r   messagesr!   s    r   r$   QuotaRulesClient.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!QuotaRulesClient.WaitForOperation1   sL     >>..KK55	78E%,,]-?-?-ABD Dr   c                 >   U R                   R                  U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 Volume Quota Rule.)parentquotaRuleId	quotaRule
collection)r$   5NetappProjectsLocationsVolumesQuotaRulesCreateRequestr*   r    %projects_locations_volumes_quotaRulesCreater	   REGISTRYParseRelativeNamenamer   OPERATIONS_COLLECTIONr,   )r   quota_rule_ref
volume_refasync_configrequest	create_opr+   s           r   CreateQuotaRule QuotaRulesClient.CreateQuotaRuleB   s     	KK&++- 	L 	
  AAHHI &&889#B#B 9 M   //r   Nc                     U R                   R                  5       nXl        X'l        X7l        XGl        XWl        Xgl        U$ )zFParses the command line arguments for Create Quota Rule into a config.)r$   	QuotaRuler9   typetargetdiskLimitMibdescriptionlabels)r   r9   quota_rule_typerF   disk_limit_mibrH   rI   
quota_rules           r   ParseQuotaRuleConfig%QuotaRulesClient.ParseQuotaRuleConfigU   s>     ((*JO%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$ )aS  List Cloud NetApp Volume Quota Rules.

Args:
  volume_ref: The parent Volume to list Cloud Netapp Volume QuotaRules.
  limit: The number of Cloud Netapp Volume QuotaRules 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 Volume QuotaRules.
)r/   zLocation {} may be unreachable.pageSize)fieldlimitbatch_size_attribute)r$   3NetappProjectsLocationsVolumesQuotaRulesListRequestr    r5   Listunreachabler   warningr   r   YieldFromListr   QUOTA_RULE_RESOURCE)r   r<   rR   r?   responselocations         r   ListQuotaRulesQuotaRulesClient.ListQuotaRulesh   s     mmOO P G {{@@EEgNH((	kk3::8DE )##99++' r   c                     U R                   R                  UR                  5       S9nU R                  R                  R                  U5      $ )z%Get a Cloud NetApp Volume Quota Rule.r9   )r$   2NetappProjectsLocationsVolumesQuotaRulesGetRequestRelativeNamer    r5   Get)r   r;   r?   s      r   GetQuotaRuleQuotaRulesClient.GetQuotaRule   sE    mmNN((* O G ;;<<@@IIr   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(Delete a Cloud NetApp Volume Quota Rule.r_   r2   )r$   5NetappProjectsLocationsVolumesQuotaRulesDeleteRequestra   r    r5   Deleter	   r7   r8   r9   r   r:   r,   )r   r;   r=   r?   	delete_opr+   s         r   DeleteQuotaRule QuotaRulesClient.DeleteQuotaRule   s     	KK,,. 	L 	
 
 AAHHI &&889#B#B 9 M   //r   c                 <    Ub  X!l         Ub  X1l        Ub  XAl        U$ )a'  Parses updates into a quota rule config.

Args:
  quota_rule_config: The quota rule config to update.
  disk_limit_mib: int, a new disk limit, if any.
  description: str, a new description, if any.
  labels: LabelsValue message, the new labels value, if any.

Returns:
  The quota rule message.
)rG   rH   rI   )r   quota_rule_configrK   rH   rI   s        r   ParseUpdatedQuotaRuleConfig,QuotaRulesClient.ParseUpdatedQuotaRuleConfig   s.    $ !'5$&1#!'r   c                 >   U R                   R                  UR                  5       U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      $ )aE  Updates a Cloud NetApp Volume Quota Rule.

Args:
  quota_rule_ref: the reference to the Quota Rule.
  quota_rule: Quota rule config, the updated quota rule.
  update_mask: str, a comma-separated list of updated fields.
  async_: bool, if False, wait for the operation to complete.

Returns:
  an Operation or Volume message.
)r9   
updateMaskr1   r2   )r$   4NetappProjectsLocationsVolumesQuotaRulesPatchRequestra   r    r5   Patchr	   r7   r8   r9   r   r:   r,   )r   r;   rL   update_maskr=   r?   	update_opr+   s           r   UpdateQuotaRule QuotaRulesClient.UpdateQuotaRule   s     	JJ,,."  	K 	
  AAGGPI&&889#B#B 9 DM  //r   )r   r   )NNNNNNr   )NNN)__name__
__module____qualname____firstlineno____doc__r   r   r   r   propertyr    r$   r,   rA   rM   r\   rc   ri   rm   ru   __static_attributes__ r   r   r   r      s     $(#4#4#9#9 7     " "D"0* &4J0( 40r   r   c                       \ rS rSrSrS rSrg)r      z;Adapter for the Cloud NetApp Files API Quota Rule resource.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   QuotaRulesAdapter.__init__   sN    **--D!33((DK $55((DMr   r    r$   r   N)rw   rx   ry   rz   r{   r   r}   r~   r   r   r   r      s
    C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 Quota Rule resource.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   BetaQuotaRulesAdapter.__init__   s]    	
/1**//D!33((DK $55((DMr   r   )rw   rx   ry   rz   r{   r   r}   __classcell__)r   s   @r   r   r      s    H r   r   N)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      sH     U ' 3 A . ( # )q0v q0h
 
- r   