
    P                         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\R                  5      rg)z+`gcloud monitoring snoozes update` command.    )absolute_import)division)unicode_literals)snoozes)base)flags)resource_args)util)logc                   8    \ rS rSrSrSSS.r\S 5       rS rSr	g	)
Update   zUpdates a snooze.a            Update a snooze.

          If `--snooze-from-file` is specified, then the update rules depend on
          the value of the (optional) `--fields` flag:

            * If `--fields` is specified, then only the specified fields of the
              snooze are updated.
            * Else, all fields of the snooze are replaced. The updated snooze
              can be modified further using the flags from the Snooze
              Settings group below.

          Otherwise, the snooze will be updated with the values specified in
          the flags from the Snooze Settings group.

          For information about the JSON/YAML format of a snooze:
          https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.snoozes
       al            To update a snooze time interval with command-line options, run:

            $ {command} MY-SNOOZE --start-time=START_TIME --end-time=END_TIME

          To update a snooze display name with a file, run:

            $ {command} --snooze-from-file=MY-FILE --fields=display_name

          Sample contents of MY-FILE:

            criteria:
              policies:
              - projects/MY-PROJECT/alertPolicies/MY-POLICY
            interval:
              startTime: '2024-03-01T08:00:00Z'
              endTime: '2024-03-08T04:59:59.500Z'
            displayName: New Snooze with New Display Name
       )DESCRIPTIONEXAMPLESc                     [         R                  " S5      /n[         R                  " X5        [        R                  " U S5        [        R
                  " U S[        R                  SS9  g )Nzto be updated.snoozezSThe list of fields to update. Must specify `--snooze-from-file` if using this flag.T)fields_helpadd_settings_funcupdate)r	   CreateSnoozeResourceArgAddResourceArgsr   AddFileMessageFlag+AddFieldsFlagsWithMutuallyExclusiveSettingsAddSnoozeSettingsFlags)parser	resourcess     (lib/surface/monitoring/snoozes/update.pyArgsUpdate.ArgsH   s\     	--.>?AI!!&4	VX.	55@66    c           	      ^   [         R                  " U/ SQS5        [        R                  " U5        [        R
                  " 5       nUR                  nSnUR                  R                  R                  5       nUR                  (       a"  Sn[         R                  " XR                  SS9nOFUR                  U5      n[        R                  " UUR                  UR                   UR"                  S9  UR$                  (       d]  / n[         R&                  " UUUR                  UR                   UR"                  US9  U(       a  S OSR)                  [+        U5      5      nOSR)                  UR$                  5      nUR-                  XVU5      n[.        R0                  " UR2                  S5        U$ )	N)snooze_from_filedisplay_name
start_timeend_timefieldsr   FT)r   )r#   r$   r%   )r#   r$   r%   field_masks,)r
   ValidateUpdateArgsSpecifiedr   ValidateSnoozeUpdateArgsr   SnoozeClientmessagesCONCEPTSr   Parser"   GetBaseSnoozeMessageFromArgsSnoozeGetValidateSnoozeIntervalr#   r$   r%   r&   ModifySnoozejoinsortedr   r   UpdatedResourcename)	selfargsclientr,   passed_yaml_snooze
snooze_refr   r&   results	            r   Run
Update.RunU   sO   $$	-	
 
""4(!!#FH%%++-J00
f zz*%f""
((__==	 ;;f


((__== *tsxxv/Gfxx$f]]:v6FX.Mr     N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr   r>   __static_attributes__r@   r    r   r   r      s0    $'&-P 
 
0r    r   N)rE   
__future__r   r   r   !googlecloudsdk.api_lib.monitoringr   googlecloudsdk.callioper   %googlecloudsdk.command_lib.monitoringr   r	   r
   googlecloudsdk.corer   UpdateCommandr   r@   r    r   <module>rO      s9    2 &  ' 5 ( 7 ? 6 #hT hr    