
    	                         S r SSKJr  SSKJr  SSKJr  S rS rS rS r	SS	 jr
SS
 jr SS jrSS jrSS jr    SS jrSS jr    SS jrS rg)z1Shared resource flags for Cloud Pub/Sub commands.    )concepts)concept_parsers)presentation_specsc                  ,    [         R                  " SSS9$ )NsubscriptionzName of the subscription.name	help_textr    ResourceParameterAttributeConfig     6lib/googlecloudsdk/command_lib/pubsub/resource_args.pySubscriptionAttributeConfigr      s    		2	2+
- -r   c                  ,    [         R                  " SSS9$ )NtopiczName of the topic.r   r   r   r   r   TopicAttributeConfigr      s    		2	2$
& &r   c                  ,    [         R                  " SSS9$ )NschemazName of the schema.r   r   r   r   r   SchemaAttributeConfigr   $   s    		2	24
6 6r   c                  \    [         R                  " SS[        5       [         R                  S9$ )Nzpubsub.projects.subscriptionsr   )resource_namesubscriptionsId
projectsId)r   ResourceSpecr    DEFAULT_PROJECT_ATTRIBUTE_CONFIGr   r   r   GetSubscriptionResourceSpecr   )   s*    			%"13::	
< <r   c                 \    [         R                  " SU [        5       [         R                  S9$ )Nzpubsub.projects.topics)r   topicsIdr   )r   r   r   r   r	   s    r   GetTopicResourceSpecr!   1   s*    			#%::	
< <r   c                 \    [         R                  " SU [        5       [         R                  S9$ )Nzpubsub.projects.schemas)r   	schemasIdr   )r   r   r   r   r    s    r   GetSchemaResourceSpecr$   9   s*    			%'::	
< <r   c           	          U(       a  SnOSnU(       a  SnOSn[         R                  " U[        5       SR                  XP5      UUSS9$ )a  Create a resource argument for a Cloud Pub/Sub Subscription.

Args:
  verb: str, the verb to describe the resource, such as 'to update'.
  plural: bool, if True, use a resource argument that returns a list.
  required: bool, if True, create subscription resource arg will be required.
  positional: bool, if True, means that the subscription ID is a positional
    rather than a flag.

Returns:
  the PresentationSpec for the resource argument.
r   z--subscriptionzOne or more subscriptionszName of the subscription{} {}T)requiredpluralprefixes)r   ResourcePresentationSpecr   format)verbr(   r'   
positionalr	   	help_stems         r   CreateSubscriptionResourceArgr/   A   sO     DD+I*I		4	4
!#nnY%
 r   c                 ^    [         R                  " [        XS9/5      R                  U 5        g)zAdd a resource argument for a Cloud Pub/Sub Subscription.

Args:
  parser: the parser for the command.
  verb: str, the verb to describe the resource, such as 'to update'.
  plural: bool, if True, use a resource argument that returns a list.
r(   N)r   ConceptParserr/   AddToParserparserr,   r(   s      r   AddSubscriptionResourceArgr6   b   s'     $T9:Kr   c                 ^    [         R                  " [        XS9/5      R                  U 5        g)zAdd a resource argument for a Cloud Pub/Sub Schema.

Args:
  parser: the parser for the command.
  verb: str, the verb to describe the resource, such as 'to update'.
  plural: bool, if True, use a resource argument that returns a list.
r1   N)r   r2   CreateSchemaResourceArgr3   r4   s      r   AddSchemaResourceArgr9   o   s)     !8!M !" ##.;v#6r   c           
          U(       a  Un0 nOU(       d  SU-   OSU-   S-   nSSU-   S-   0nSnU(       a  Sn[         R                  " U[        U5      SR                  Xp5      UUUSS	9$ )
aj  Create a resource argument for a Cloud Pub/Sub Topic.

Args:
  verb: str, the verb to describe the resource, such as 'to update'.
  positional: bool, if True, means that the topic ID is a positional rather
    than a flag. If not positional, this also creates a '--topic-project' flag
    as subscriptions and topics do not need to be in the same project.
  plural: bool, if True, use a resource argument that returns a list.
  required: bool, if True, create topic resource arg will be required.
  flag_name: str, name of the topic resource arg (singular).

Returns:
  the PresentationSpec for the resource argument.
--sproject-projectzName of the topiczOne or more topicsr&   Tr'   flag_name_overridesr(   r)   )r   r*   r!   r+   r,   r-   r(   r'   	flag_namer	   r@   r.   s           r   CreateTopicResourceArgrC   {   s    & D#)4)ti/?#/ED$dY&6&CD!)$I		4	4
9%nnY%-
 r   c                 `    [         R                  " [        XUS9/5      R                  U 5        g)a  Add a resource argument for a Cloud Pub/Sub Topic.

Args:
  parser: the parser for the command.
  verb: str, the verb to describe the resource, such as 'to update'.
  positional: bool, if True, means that the topic ID is a positional rather
    than a flag. If not positional, this also creates a '--topic-project' flag
    as subscriptions and topics do not need to be in the same project.
  plural: bool, if True, use a resource argument that returns a list.
)r-   r(   N)r   r2   rC   r3   )r5   r,   r-   r(   s       r   AddTopicResourceArgrE      s)     d&IJKr   c           
          U(       a  Un0 nOU(       d  SU-   OSU-   S-   nSSU-   S-   0nSnU(       a  Sn[         R                  " U[        U5      SR                  Xp5      UUUSS	9$ )
ab  Create a resource argument for a Cloud Pub/Sub Schema.

Args:
  verb: str, the verb to describe the resource, such as 'to update'.
  positional: bool, if True, means that the schema ID is a positional rather
    than a flag. If not positional, this also creates a '--schema-project'
    flag as schemas and topics do not need to be in the same project.
  plural: bool, if True, use a resource argument that returns a list.
  required: bool, if True, schema resource arg will be required.
  flag_name: str, name of the schema resource arg (singular).

Returns:
  the PresentationSpec for the resource argument.
r;   r<   r=   r>   zName of the schemazOne or more schemasr&   Tr?   )r   r*   r$   r+   rA   s           r   r8   r8      s    & D#)4)ti/?#/ED$dY&6&CD")%I		4	4
I&nnY%-
 r   c                 N    [         R                  " U5      R                  U 5        g)zAdd resource arguments for commands that have topic and subscriptions.

Args:
  parser: the parser for the command.
  resources: a list of resource args to add.
N)r   r2   r3   )r5   	resourcess     r   AddResourceArgsrI      s     	*66v>r   N)r   )r   )FTT)F)TFTr   )TF)TFTr   )__doc__ googlecloudsdk.calliope.conceptsr   (googlecloudsdk.command_lib.util.conceptsr   r   r   r   r   r   r!   r$   r/   r6   r9   rC   rE   r8   rI   r   r   r   <module>rM      sz     8 6 D G-&6
<<< 37B
	7 '+"'$(%,	#L" (,#(%)&.	#L?r   