
    *                         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
KJr  SSKJr   " S S\R$                  5      rg)z,`gcloud monitoring policies create` command.    )absolute_import)division)unicode_literals)policies)base)flags)resource_args)util)log)
propertiesc                   6    \ rS rSrSrSS0r\S 5       rS rSr	g)	Create   zCreate a new alerting policy.DESCRIPTIONa            Creates a new alerting policy. An alert policy can be specified as a
          JSON/YAML value passed in as a string through the `--policy` flag or
          as a file through the `--policy-from-file` flag. A basic policy can
          also be specified through command line flags. If a policy is specified
          through `--policy` or `--policy-from-file`, and additional flags are
          supplied, the flags will override the policy's settings and a
          specified condition will be appended to the list of conditions.

          For information about the JSON/YAML format of an alerting policy:
          https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.alertPolicies
       c                     [         R                  " U S5        [         R                  " U 5        [         R                  " U 5        [        R
                  " SSSSS9n[        R                  " X/5        g )Npolicyz--notification-channelsar              to be added to the policy. These should be the resource names (not
            the display name) of the channels. Acceptable formats are:

            * Channel Name: `my-channel`
              * The project specified through `--project` or the default
                project defined by the `core/project` property will be used,
                in that order.
            * Channel Relative Name:
                `projects/my-project/notificationChannels/channel-id0`
            * Channel URI:
                https://monitoring.googleapis.com/v3/projects/my-project/notificationChannels/channel-id0
            FT)arg_name
extra_helprequiredplural)r   AddMessageFlagsAddPolicySettingsFlagsAddConditionSettingsFlagsr	   $CreateNotificationChannelResourceArgAddResourceArgs)parserchannels_resource_args     )lib/surface/monitoring/policies/create.pyArgsCreate.Args1   sb    	&(+	  (	##F+)NN* !" !!&*AB    c                    [         R                  " 5       nUR                  n[        R                  " XR                  5      nUR
                  (       a:  [        R                  " UR
                  UR                  R                  5      Ul	        [        R                  " [        R                  R                  R                  R!                  5       5      nUR#                  XT5      n[$        R&                  " UR(                  S5        U$ )Nzalert policy)r   AlertPolicyClientmessagesr
   CreateAlertPolicyFromArgsuser_labelsParseCreateLabelsAlertPolicyUserLabelsValue
userLabelsprojects_utilParseProjectr   VALUEScoreprojectGetr   r   CreatedResourcename)selfargsclientr$   r   project_refresults          r   Run
Create.RunI   s    '')FH++D//BF00


H00@@Bf 	"":#4#4#9#9#A#A#E#E#GH  ]];/F^4Mr!    N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr   r8   __static_attributes__r:   r!   r   r   r      s1    %  - C C.r!   r   N)r?   
__future__r   r   r   !googlecloudsdk.api_lib.monitoringr   googlecloudsdk.callioper   %googlecloudsdk.command_lib.monitoringr   r	   r
   #googlecloudsdk.command_lib.projectsr+   googlecloudsdk.corer   r   CreateCommandr   r:   r!   r   <module>rJ      s=    3 &  ' 6 ( 7 ? 6 E # *8T 8r!   