
    }                        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
ddZej                   ej                   ej"                  j$                         G d dej&                                      Zee_        y)z?'Bare Metal Solution snapshot schedule policies update command.    )absolute_import)division)unicode_literals)	BmsClient)base)
exceptions)flags)labels_utilzJ
          Update a Bare Metal Solution snapshot schedule policy.
        a  
          To update an existing policy called ``my-policy'' with new description
          ``my-description'' and replace any existing schedules with one
          that runs every 12 hours, run:

          $ {command} my-policy --description=my-description --schedule="crontab_spec=0 */12 * * *,retention_count=10,prefix=example"

          To add the label 'key1=value1' to a policy, run:

          $ {command} my-policy --update-labels=key1=value1

          To clear all labels, run:

          $ {command} my-policy --clear-labels
    )DESCRIPTIONEXAMPLESc                   &    e Zd ZdZed        Zd Zy)Updatez6Create a Bare Metal Solution snapshot schedule policy.c                     t        j                  | d       t        j                  | d       t        j                  |        | j                  dd       y)	z Register flags for this command.T)
positionalF)requiredz--descriptionz"Textual description of the policy.)helpN)r	   $AddSnapshotSchedulePolicyArgToParser"AddSnapshotScheduleArgListToParserr
   AddUpdateLabelsFlagsadd_argument)parsers    4lib/surface/bms/snapshot_schedule_policies/update.pyArgszUpdate.Args9   sK     
..v$G	,,VeD$$V,
A  C    c                    t               }|j                  j                  j                         }|j                  }|j
                  }d }t        j                  j                  |      }|j                         rY|j                  |      }|j                  |j                  j                  j                  |j                        j!                         }|s'|s%|j                         st#        j$                  d      |j'                  ||||      S )NzNo configuration change was requested. Did you mean to include the flags `--description` `--schedule` `--update-labels``--remove-labels` or `--clear-labels`?)policy_resourcelabelsdescription	schedules)r   CONCEPTSsnapshot_schedule_policyParser   scheduler
   DiffFromUpdateArgsMayHaveUpdatesGetSnapshotSchedulePolicyApplymessagesSnapshotSchedulePolicyLabelsValuer   	GetOrNoner   NoConfigurationChangeErrorUpdateSnapshotSchedulePolicy)	selfargsclientpolicyr   r   labels_updatelabels_difforig_resources	            r   Runz
Update.RunB   s    [F]]3399;F""KIM""11$7K!!#66v>m!''
//
0
0
<
<


  )	  y1K1K1M1134 4
 ..v6C;F9B / D Dr   N)__name__
__module____qualname____doc__staticmethodr   r6    r   r   r   r   4   s!     ?C CDr   r   N)r:   
__future__r   r   r   %googlecloudsdk.api_lib.bms.bms_clientr   googlecloudsdk.callioper   googlecloudsdk.command_lib.bmsr   r	   $googlecloudsdk.command_lib.util.argsr
   DETAILED_HELPHiddenReleaseTracksReleaseTrackALPHAUpdateCommandr   detailed_helpr<   r   r   <module>rI      s    F &  ' ; ( 5 0 <
		0 D%%++,"DT "D - "DH % r   