
    F                     H   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r\R"                  " \R$                  R&                  \R$                  R(                  \R$                  R*                  5       " S S\R,                  5      5       rg)z2Pub/Sub Lite lite-subscriptions subscribe command.    )absolute_import)division)unicode_literals)arg_parsers)base)	lite_util)resource_args)log)resource_printerz>default(
  data,
  message_id,
  ordering_key,
  attributes
)
c                   8    \ rS rSrSrSSS.r\S 5       rS rSr	g	)
	Subscribe&   z1Stream messages from a Pub/Sub Lite subscription.a            Streams messages from a Pub/Sub Lite subscription. This command
          requires Python 3.6 or greater, and requires the grpcio Python package
          to be installed.

          For MacOS, Linux, and Cloud Shell users, to install the gRPC client
          libraries, run:

            $ sudo pip3 install grpcio
            $ export CLOUDSDK_PYTHON_SITEPACKAGES=1
      aZ            To subscribe to a Pub/Sub Lite subscription and automatically
          acknowledge messages, run:

            $ {command} mysubscription --location=us-central1-a --auto-ack

          To subscribe to specific partitions in a subscription, run:

            $ {command} mysubscription --location=us-central1-a --partitions=0,1,2
      )DESCRIPTIONEXAMPLESc                     [         R                  " U SSSS9  U R                  S[        R                  " SS5      SSS	9  U R                  S
SSSS9  U R                  SS[        R
                  " [        S9SS9  g )Nzpubsub.lite_subscriptionTz7The Pub/Sub Lite subscription to receive messages from.)resource_pathrequired	help_textz--num-messages   i  zgThe number of messages to stream before exiting. This value must
        be less than or equal to 1000.)typedefaulthelpz
--auto-ack
store_trueFz>Automatically ACK every message received on this subscription.)actionr   r   z--partitionsINT)element_typezThe partitions this subscriber should connect to to receive
        messages. If empty, partitions will be automatically assigned.)metavarr   r   )r	   AddResourceArgToParseradd_argumentr   
BoundedIntArgListint)parsers    2lib/surface/pubsub/lite_subscriptions/subscribe.pyArgsSubscribe.ArgsE   s    ((0K	M
 ##At,*	  + M	  O
   c2J	  K    c                    [         R                  " S5         SSKJn  [        R                  R                  S5        [        R                  " UR                  =(       d    [        5      nUR                  UR                  R                  R!                  5       UR"                  =(       d    / UR$                  UR&                  5       nSnXQR$                  :  aw  UR)                  5       nU(       aO  UR*                  R-                  S5      nSR                  US   US   5      Ul        UR                  U/5        US-  nXQR$                  :  a  Mw  S S S 5        g ! [         a    [         R
                  " 5       ef = f! , (       d  f       g = f)Nz*gcloud pubsub lite-subscriptions subscriber   )lite_subscriptionszEInitializing the Subscriber stream... This may take up to 30 seconds.,zPartition: {}, Offset: {}r   )r   RequirePython36googlecloudsdk.api_lib.pubsubr)   ImportErrorNoGrpcInstalledr
   outPrintr   PrinterformatMESSAGE_FORMATSubscriberClientCONCEPTSsubscriptionParse
partitionsnum_messagesauto_ackPull
message_idsplit)selfargsr)   printersubscriber_clientreceivedmessagesplitss           r$   RunSubscribe.Run^   s;   JK(B
 GGMMOQ&&t{{'DnEG		,	,""((*DOO,Ar4==
*->h(((#((*%%++C0&:AAQi $'

--	
"
a-( (((	
* 
*  (%%''(
* 
*s   E BE< E9<
F
 N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr%   rE   __static_attributes__rG   r'   r$   r   r   &   s3     :

	
-4 K K0r'   r   N)rL   
__future__r   r   r   googlecloudsdk.callioper   r   !googlecloudsdk.command_lib.pubsubr   $googlecloudsdk.command_lib.util.argsr	   googlecloudsdk.corer
   googlecloudsdk.core.resourcer   r3   ReleaseTracksReleaseTrackGABETAALPHACommandr   rG   r'   r$   <module>r\      s    9 &  ' / ( 7 > # 9 D%%(($*;*;*@*@%%++-M M-Mr'   