
                         &   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  \R"                  " \R$                  R&                  \R$                  R(                  5       " S S\R*                  5      5       rg)z,`gcloud monitoring channels create` command.    )absolute_import)division)unicode_literals)channels)base)flags)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 notification channel.DESCRIPTIONa	            Creates a new notification channel. A channel can be specified as
          JSON/YAML passed in as a string through the `--channel-content` flag
          or as a file through the `--channel-content-from-file` flag.
          A basic channel can also be specified through command line flags. If
          a channel is specified through `--channel-content` or
          `--channel-content-from-file`, and additional flags are supplied, the
          flags will override the given channel's settings.

          For information about the JSON/YAML format of a notification channel:
          https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.notificationChannels

          Additional documentation can for this operation can be found at:
          https://cloud.google.com/monitoring/alerts/using-channels-api

          ## EXAMPLES
          The following commands setup both email and SMS notification channels for the team lead. Note
          that the display name and description focus on the purpose/semantics of the channel rather
          than its destination. This is a best-practice that facilitates swapping/updating notification
          channels in-place (such as when users change teams, projects, roles, companies, etc.) with
          minimal impact to the alerting policies that reference the existing channels. It is also
          a best practice to supply at least two channels of different types for a given person.

            $ {command}               --display-name="Foo Team Lead (Primary)"               --description="Primary contact method for the Foo team lead"               --type=email               --user-labels=team=foo,role=lead,ord=1               --channel-labels=email_address=user@somedomain.tld

            $ {command}               --display-name="Foo Team Lead (Secondary)"               --description="Secondary contact method for the Foo team lead"               --type=sms               --user-labels=team=foo,role=lead,ord=2               --channel-labels=number=123-456-7890
       c                 ^    [         R                  " U S5        [         R                  " U 5        g )Nzchannel-content)r   AddMessageFlags"AddNotificationChannelSettingFlags)parsers    )lib/surface/monitoring/channels/create.pyArgsCreate.ArgsK   s!    	&"34	,,V4    c                    [         R                  " 5       nUR                  n[        R                  " X5      nUR
                  (       a:  [        R                  " UR
                  UR                  R                  5      Ul	        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notification channel)r   NotificationChannelsClientmessagesr	   GetNotificationChannelFromArgsuser_labelsParseCreateLabelsNotificationChannelUserLabelsValue
userLabelschannel_labelsLabelsValuelabelsprojects_utilParseProjectr   VALUEScoreprojectGetr   r
   CreatedResourcename)selfargsclientr   channelproject_refresults          r   Run
Create.RunP   s    002FH11$AG11


H88HHJg--


x;;GGIgn 	"":#4#4#9#9#A#A#E#E#GH  ]];0F%;<Mr    N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr   r2   __static_attributes__r4   r   r   r   r      s0    * $'-R 5 5r   r   N)r9   
__future__r   r   r   !googlecloudsdk.api_lib.monitoringr   googlecloudsdk.callioper   %googlecloudsdk.command_lib.monitoringr   r	   #googlecloudsdk.command_lib.projectsr$   googlecloudsdk.corer
   r   ReleaseTracksReleaseTrackALPHABETACreateCommandr   r4   r   r   <module>rH      sr    3 &  ' 6 ( 7 6 E # * D%%++T->->-C-CDCT C ECr   