
                             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 Z
d	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd ZddZd Z	 	 ddZd Zd Zd Zd ZddZy)z4Shared resource flags for Cloud Monitoring commands.    )absolute_import)division)unicode_literals)concepts)concept_parsers)presentation_specsc                  0    t        j                  dd      S )NalertzName of the alert.name	help_textr    ResourceParameterAttributeConfig     :lib/googlecloudsdk/command_lib/monitoring/resource_args.pyAlertAttributeConfigr      s    		2	22
 r   c                  0    t        j                  dd      S )NpolicyzName of the alerting policy.r   r   r   r   r   AlertPolicyAttributeConfigr       s    		2	2.
0 0r   c                  0    t        j                  dd      S )N	conditionz&Name of the alerting policy condition.r   r   r   r   r   ConditionAttributeConfigr   &   s    		2	28
: :r   c                  0    t        j                  dd      S )Nnotification_channelsz!Name of the Notification Channel.r   r   r   r   r   "NotificationChannelAttributeConfigr   ,   s    		2	2"3
5 5r   c                  0    t        j                  dd      S )NsnoozezName of the snooze.r   r   r   r   r   SnoozeAttributeConfigr   2   s    		2	2%
' 'r   c                  0    t        j                  dd      S )Ncheck_idz.Name of the uptime check or synthetic monitor.r   r   r   r   r   UptimeCheckAttributeConfigr"   8   s    		2	2@
B Br   c                  `    t        j                  ddt               t         j                        S )Nzmonitoring.projects.alertsAlert)resource_namealertsId
projectsId)r   ResourceSpecr    DEFAULT_PROJECT_ATTRIBUTE_CONFIGr   r   r   GetAlertResourceSpecr*   >   s*    			"#%::	
 r   c                  `    t        j                  ddt               t         j                        S )Nz!monitoring.projects.alertPolicieszAlert Policy)r%   alertPoliciesIdr'   )r   r(   r   r)   r   r   r   GetAlertPolicyResourceSpecr-   G   s*    			)"02::	
< <r   c                  r    t        j                  ddt               t               t         j                        S )Nz,monitoring.projects.alertPolicies.conditionsr   )r%   conditionsIdr,   r'   )r   r(   r   r   r)   r   r   r   GetConditionResourceSpecr0   O   s0    			4+-02::
< <r   c                  `    t        j                  ddt               t         j                        S )Nz(monitoring.projects.notificationChannelszNotification Channel)r%   notificationChannelsIdr'   )r   r(   r   r)   r   r   r   "GetNotificationChannelResourceSpecr3   X   s*    			0*?A::	
< <r   c                  `    t        j                  ddt               t         j                        S )Nzmonitoring.projects.snoozesSnooze)r%   	snoozesIdr'   )r   r(   r   r)   r   r   r   GetSnoozeResourceSpecr7   `   s*    			#%'::	
< <r   c                  `    t        j                  ddt               t         j                        S )Nz&monitoring.projects.uptimeCheckConfigsz!uptime check or synthetic monitor)r%   uptimeCheckConfigsIdr'   )r   r(   r"   r)   r   r   r   GetUptimeCheckResourceSpecr:   h   s*    			.757::	
< <r   c                 \    |rd}nd}d| z   }t        j                  |t               |d      S )Nalert_policyz--policyzName of the Alert Policy Trequired)r   ResourcePresentationSpecr-   )verb
positionalr   r   s       r   CreateAlertPolicyResourceArgrB   p   s;    DD)D0)		4	4
 "	
 r   c                 h    dj                  |       }t        j                  dt               |dd      S )Nz The name of the Condition to {}.r   TF)r>   prefixes)formatr   r?   r0   )r@   r   s     r   CreateConditionResourceArgrF   ~   s7    077=)		4	4 
 r   c                 Z    |rd}nd}t        j                  | t               ||z   ||      S )a  Create a resource argument for a Cloud Monitoring Notification Channel.

  Args:
    arg_name: str, the name for the arg.
    extra_help: str, the extra_help to describe the resource. This should start
      with the verb, such as 'to update', that is acting on the resource.
    required: bool, if the arg is required.
    plural: bool, if True, use a resource argument that returns a list.

  Returns:
    the PresentationSpec for the resource argument.
  z+Names of one or more Notification Channels z!Name of the Notification Channel )r>   plural)r   r?   r3   )arg_name
extra_helpr>   rH   	help_stems        r   $CreateNotificationChannelResourceArgrL      s;     =I3I		4	4(**
 r   c                 R    d}d| z   }t        j                  |t               |d      S )Nr   zName of the Snooze Tr=   )r   r?   r7   r@   r   r   s      r   CreateSnoozeResourceArgrO      s3    	$#d*)		4	4
	
 r   c                 R    d}d| z   }t        j                  |t               |d      S )Nr!   z.Name of the uptime check or synthetic monitor Tr=   )r   r?   r:   rN   s      r   CreateUptimeResourceArgrQ      s3    	$>E)		4	4
 "	
 r   c                 L    t        j                  |      j                  |        y)zzAdd resource arguments.

  Args:
    parser: the parser for the command.
    resources: a list of resource args to add.
  N)r   ConceptParserAddToParser)parser	resourcess     r   AddResourceArgsrW      s     	*66v>r   c                      d S )Nc                 4    t               j                  |       S )N)r*   CreateResourceURI)xs    r   <lambda>z)GetAlertResourceUriFunc.<locals>.<lambda>   s    ');;A>r   r   r   r   r   GetAlertResourceUriFuncr]      s    	>>r   c           
          t        j                  t        j                  dt	        j
                  ddt        j                        d|z   |      g      j                  |        y)zAdd a resource argument for a Google Cloud Platform Console project.

  Args:
    parser: argparse.ArgumentParser, the parser for the command.
    help_text: str, the help text for the arg.
    required: bool, if the arg is required.
  z	--projectzcloudresourcemanager.projectsproject)r%   	projectIdzProject r=   N)r   rS   r   r?   r   r(   r)   rT   )rU   r   r>   s      r   AddProjectResourceArgra      s^     11



-% AA
 y
 	!  [r   N)T)TF)__doc__
__future__r   r   r    googlecloudsdk.calliope.conceptsr   (googlecloudsdk.command_lib.util.conceptsr   r   r   r   r   r   r   r"   r*   r-   r0   r3   r7   r:   rB   rF   rL   rO   rQ   rW   r]   ra   r   r   r   <module>rf      s    ; &  ' 5 D G0:5'B<<<<< IM056??r   