
                             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	lmZ dd
lmZ ej"                   G d dej$                               Zy)z+`gcloud monitoring snoozes create` command.    )absolute_import)division)unicode_literals)snoozes)base)flags)util)log)
propertiesc                   0    e Zd ZdZdddZed        Zd Zy)CreatezCreate a new snooze.a            Creates a new snooze. A snooze can be specified as a JSON/YAML value
          passed in as a file through the `--snooze-from-file` flag. A snooze
          can also be specified through command line flags. If a snooze is
          specified through `--snooze-from-file`, and additional flags are
          supplied, the flags will override the snooze's settings.

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

            $ {command} --criteria-policies=LIST_OF_POLICIES
            --criteria-filter=FILTER
            --display-name=DISPLAY_NAME --start-time=START_TIME
            --end-time=END_TIME

          To create a snooze with a file, run:

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

          Sample contents of MY-FILE:

            criteria:
              policies:
              - projects/MY-PROJECT/alertPolicies/MY-POLICY
              filter: 'resource.labels.zone="us-central1-a" AND resource.labels.instance_id="1234567890"'
            interval:
              startTime: '2024-03-01T08:00:00Z'
              endTime: '2024-03-08T04:59:59.500Z'
            displayName: New Snooze
       )DESCRIPTIONEXAMPLESc                 Z    t        j                  | d       t        j                  |        y Nsnooze)r   AddFileMessageFlagAddSnoozeSettingsFlags)parsers    (lib/surface/monitoring/snoozes/create.pyArgszCreate.ArgsF   s     	VX.	  (    c                 \   t        j                         }t        j                  ||j                        }t        j                  t        j                  j                  j                  j                               }|j                  ||      }t        j                  |j                  d       |S r   )r   SnoozeClientr	   CreateSnoozeFromArgsmessagesprojects_utilParseProjectr   VALUEScoreprojectGetr   r
   CreatedResourcename)selfargsclientr   project_refresults         r   Runz
Create.RunK   s    !!#F&&tV__=F 	"":#4#4#9#9#A#A#E#E#GH  ]];/FX.Mr   N)__name__
__module____qualname____doc__detailed_helpstaticmethodr   r*    r   r   r   r      s0    	"-H ) )	r   r   N)r.   
__future__r   r   r   !googlecloudsdk.api_lib.monitoringr   googlecloudsdk.callioper   %googlecloudsdk.command_lib.monitoringr   r	   #googlecloudsdk.command_lib.projectsr   googlecloudsdk.corer
   r   DefaultUniverseOnlyCreateCommandr   r1   r   r   <module>r:      sO    2 &  ' 5 ( 7 6 E # * 5T 5 5r   