
                         :   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	rS
rS r\R                  " \R                   R"                  \R                   R$                  \R                   R&                  5       " S S\R(                  5      5       rg)z$Pub/Sub lite-topics publish command.    )absolute_import)division)unicode_literals)arg_parsers)base)	lite_util)resource_argsa;  Publishes a message to the specified Pub/Sub Lite topic. 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
a  To publish a message to a Pub/Sub Lite topic, run:

$ {command} mytopic --location=us-central1-a --message="Hello World!"

To publish a message to a Pub/Sub Lite topic with an ordering key and
attributes, run:

  $ {command} mytopic --location=us-central1-a --message="Hello World!" --ordering-key="key" --attributes=KEY1=VAL1,KEY2=VAL2

To publish a message to a Pub/Sub Lite topic with an event time, run:

  $ {command} mytopic --location=us-central1-a --message="Hello World!" --event-time="2021-01-01T12:00:00Z"
c           
      "   [         R                  " U SSSS9  U R                  SSS9  U R                  SS	[        R                  " [
        [
        S
S9SS9  U R                  SSS9  U R                  S[        R                  R                  SSS9  g)z%Adds publish arguments to the parser.zpubsub.lite_topicz$The pubsub lite topic to publish to.T)resource_path	help_textrequiredz	--messagez;The body of the message to publish to the given topic name.)helpz--attributesz	KEY=VALUEd   )key_type
value_type
max_lengthz}Comma-separated list of attributes. Each ATTRIBUTE has the form
          name="value". You can specify up to 100 attributes.)metavartyper   z--ordering-keyzA string key, used for ordering delivery to subscribers. All
          messages with the same ordering key will be assigned to the same
          partition for ordered delivery.z--event-timeDATETIMEzdA user-specified event time. Run `gcloud topic datetimes` for
          information on time formats.)r   r   r   N)r	   AddResourceArgToParseradd_argumentr   ArgDictstrDatetimeParseparsers    )lib/surface/pubsub/lite_topics/publish.py_AddPublishFlagsr   5   s    &&'6	
 	L  N 	LA	  B 	-  .
 	%%*	  +    c                   8    \ rS rSrSr\\S.r\S 5       r	S r
Srg)PublishR   zPublish Pub/Sub Lite messages.)DESCRIPTIONEXAMPLESc                     [        U 5        g )N)r   r   s    r   ArgsPublish.ArgsY   s
    Vr    c                    [         R                  " S5         SSKJn  UR                  5        nUR                  UR                  R                  R                  5       UR                  UR                  UR                  [        US5      (       a  UR                  OS S9sS S S 5        $ ! [         a    [         R
                  " 5       ef = f! , (       d  f       g = f)Nz!gcloud pubsub lite-topics publishr   )lite_topics
event_time)topic_resourcemessageordering_key
attributesr+   )r   RequirePython36googlecloudsdk.api_lib.pubsubr*   ImportErrorNoGrpcInstalledPublisherClientr"   CONCEPTStopicr   r-   r.   r/   hasattrr+   )selfargsr*   publisher_clients       r   RunPublish.Run]   s    AB(;
 
	$	$	&*:%%,,224,,((__(/l(C(CT__ & O 
'	&  (%%''( 
'	&s   B( A0C( C
C N)__name__
__module____qualname____firstlineno____doc___DESCRIPTION	_EXAMPLESdetailed_helpstaticmethodr'   r;   __static_attributes__r=   r    r   r"   r"   R   s)     '".IF- Or    r"   N)rB   
__future__r   r   r   googlecloudsdk.callioper   r   !googlecloudsdk.command_lib.pubsubr   $googlecloudsdk.command_lib.util.argsr	   rC   rD   r   ReleaseTracksReleaseTrackGABETAALPHACommandr"   r=   r    r   <module>rR      s    + &  ' / ( 7 >		 +: D%%(($*;*;*@*@%%++-Odll O-Or    