
                         L   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  e	j"                  e	j$                  j&                         G d
 de	j(                               Z e	j"                  e	j$                  j,                         G d de             Zy)z/Updates a Cloud NetApp Volumes Backup Policies.    )absolute_import)division)unicode_literals)client)base)flags)labels_util)logc                   \    e Zd ZdZdddZej                  j                  Ze	d        Z
d Zy)Update.Update a Cloud NetApp Volumes Backup Policies.z,          Updates a Backup Policy
          a            The following command updates a Backup Policy named BACKUP_POLICY with all possible arguments

              $ {command} BACKUP_POLICY --location=us-central1 --enabled=True --daily-backup-limit=5 --weekly-backup-limit=3 --monthly-backup-limit=2

          To update a Backup Policy named BACKUP_POLICY asynchronously, run the following command:

              $ {command} BACKUP_POLICY --async --location=us-central1 --enabled=True --daily-backup-limit=5 --weekly-backup-limit=3 --monthly-backup-limit=2
              )DESCRIPTIONEXAMPLESc                 .    t        j                  |        y )N)backuppolicies_flagsAddBackupPolicyUpdateArgs)parsers    ,lib/surface/netapp/backup_policies/update.pyArgszUpdate.Args1   s    226:    c           	      :   |j                   j                  j                         }t        j                  | j
                        }t        j                  j                  |      }|j                  |      }|j                         rI|j                  |j                  j                  j                  |j                        j!                         }nd}|j#                  ||j$                  |j&                  |j(                  |j*                  |j,                  |      }g }|j/                  d      r|j1                  d       |j/                  d      r|j1                  d       |j/                  d      r|j1                  d       |j/                  d      r|j1                  d	       |j/                  d
      r|j1                  d
       |j/                  d      s"|j/                  d      s|j/                  d      r|j1                  d       dj3                  |      }	|j5                  |||	|j6                        }
|j6                  rWdj9                  | j;                         j<                        }t>        j@                  jC                  dj9                  |             |
S )zCUpdate a Cloud NetApp Volumes Backup Policy in the current project.N)enableddaily_backup_limitweekly_backup_limitmonthly_backup_limitdescriptionlabelsr   r   dailyBackupLimitr   weeklyBackupLimitr   monthlyBackupLimitr   update_labelsremove_labelsclear_labelsr   ,z%gcloud {} netapp backup-policies listzQCheck the status of the updated backup policy by listing all kms configs:
  $ {} )"CONCEPTSbackup_policyParsebackuppolicies_clientBackupPoliciesClient_RELEASE_TRACKr	   DiffFromUpdateArgsGetBackupPolicyMayHaveUpdatesApplymessagesBackupPolicyLabelsValuer   	GetOrNoneParseUpdatedBackupPolicyr   r   r   r   r   IsSpecifiedappendjoinUpdateBackupPolicyasync_formatReleaseTrackprefixr
   statusPrint)selfargsbackuppolicy_refr   labels_difforig_backuppolicyr   r&   updated_fieldsupdate_maskresultcommands               r   Runz
Update.Run5   s8   }}2288:"778K8KLF""11$7K../?@!!#  
//
&
&
2
24E4L4L	  f3322 44!66$$ 4 M N	"I&,-./-./0./01&M*)O,N+H%((>*K&&-dkkF {{7>>




$
$g 
jj%vg Mr   N)__name__
__module____qualname____doc__detailed_helpr   r;   GAr*   staticmethodr   rH    r   r   r   r      s@    6	- $$''.; ;5r   r   c                   <    e Zd ZdZej
                  j                  Zy)
UpdateBetar   N)rI   rJ   rK   rL   r   r;   BETAr*   rP   r   r   rR   rR   m   s    6$$)).r   rR   N)rL   
__future__r   r   r   -googlecloudsdk.api_lib.netapp.backup_policiesr   r(   googlecloudsdk.callioper   1googlecloudsdk.command_lib.netapp.backup_policiesr   r   $googlecloudsdk.command_lib.util.argsr	   googlecloudsdk.corer
   ReleaseTracksr;   rN   UpdateCommandr   rS   rR   rP   r   r   <module>r\      s    6 &  ' Y ( [ < # D%%(()MT M *M` D%%**+* * ,*r   