
    x                         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 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.    )absolute_import)division)unicode_literals)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$   4   s*    			#%::	
< <r   c                 \    [         R                  " SU [        5       [         R                  S9$ )Nzpubsub.projects.schemas)r   	schemasIdr   )r   r   r   r   r#   s    r   GetSchemaResourceSpecr'   <   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   CreateSubscriptionResourceArgr2   D   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   ConceptParserr2   AddToParserparserr/   r+   s      r   AddSubscriptionResourceArgr9   e   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.
r4   N)r   r5   CreateSchemaResourceArgr6   r7   s      r   AddSchemaResourceArgr<   r   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/   r0   r+   r*   	flag_namer   rC   r1   s           r   CreateTopicResourceArgrF   ~   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.
)r0   r+   N)r   r5   rF   r6   )r8   r/   r0   r+   s       r   AddTopicResourceArgrH      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@   rA   zName of the schemazOne or more schemasr)   TrB   )r   r-   r'   r.   rD   s           r   r;   r;      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   r5   r6   )r8   	resourcess     r   AddResourceArgsrL      s     	*66v>r   N)r   )r   )FTT)F)TFTr   )TF)TFTr   )__doc__
__future__r   r   r    googlecloudsdk.calliope.conceptsr   (googlecloudsdk.command_lib.util.conceptsr   r   r   r   r   r    r$   r'   r2   r9   r<   rF   rH   r;   rL   r   r   r   <module>rQ      s     8 &  ' 5 D G-&6
<<< 37B
	7 '+"'$(%,	#L" (,#(%)&.	#L?r   