
                            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S.r\R                   " \R"                  R$                  5      \R&                   " S S\R(                  5      5       5       rg)z!Command to create a Kafka source.    )absolute_import)division)unicode_literals)kafka_sources)base)flags)labels_util)logz{description}a           To create a new Kafka source `my-kafka-source` in location `us-central1` with the required fields: bootstrap server URI 'https://example-cluster.com:9092', Kafka topics `topic1` and `topic2`, network attachment 'my-network-attachment', and message bus `my-message-bus`, run:

          $ {command} my-kafka-source --location=us-central1 --bootstrap-servers='https://example-cluster.com:9092' --topics='topic1,topic2' --network_attachment=my-network-attachment --message-bus=my-message-bus

        To create a new Kafka source `my-kafka-source` in location `us-central1` with an initial offset of `newest`, run:

          $ {command} my-kafka-source --location=us-central1 --bootstrap-servers='https://example-cluster.com:9092' --topics='topic1,topic2' --network_attachment=my-network-attachment --message-bus=my-message-bus --initial-offset=newest

        To create a new Kafka source `my-kafka-source` in location `us-central1` with consumer group ID `my-kafka-source-group`, run:

          $ {command} my-kafka-source --location=us-central1 --bootstrap-servers='https://example-cluster.com:9092' --topics='topic1,topic2' --network_attachment=my-network-attachment --message-bus=my-message-bus --consumer-group-id=my-kafka-source-group

        To create a new Kafka source `my-kafka-source` in location `us-central1` SASL/Plain authentication with the Kafka broker, run:

          $ {command} my-kafka-source --location=us-central1 --bootstrap-servers='https://example-cluster.com:9092' --topics='topic1,topic2' --network_attachment=my-network-attachment --message-bus=my-message-bus --sasl-mechanism=PLAIN --sasl-username=kafka-username --sasl-password=projects/12345/secrets/my-sasl-secret/versions/1

        To create a new Kafka source `my-kafka-source` in location `us-central1` SASL/SCRAM-SHA-256 authentication with the Kafka broker, run:

          $ {command} my-kafka-source --location=us-central1 --bootstrap-servers='https://example-cluster.com:9092' --topics='topic1,topic2' --network_attachment=my-network-attachment --message-bus=my-message-bus --sasl-mechanism=SCRAM-SHA-256 --sasl-username=kafka-username --sasl-password=projects/12345/secrets/my-sasl-secret/versions/1

        To create a new Kafka source `my-kafka-source` in location `us-central1` SASL/SCRAM-SHA-512 authentication with the Kafka broker, run:

          $ {command} my-kafka-source --location=us-central1 --bootstrap-servers='https://example-cluster.com:9092' --topics='topic1,topic2' --network_attachment=my-network-attachment --message-bus=my-message-bus --sasl-mechanism=SCRAM-SHA-512 --sasl-username=kafka-username --sasl-password=projects/12345/secrets/my-sasl-secret/versions/1

        To create a new Kafka source `my-kafka-source` in location `us-central1` Mutual TLS (mTLS) authentication with the Kafka broker, run:

          $ {command} my-kafka-source --location=us-central1 --bootstrap-servers='https://example-cluster.com:9092' --topics='topic1,topic2' --network_attachment=my-network-attachment --message-bus=my-message-bus --tls-client-certificate=projects/12345/secrets/my-tls-cert/versions/1 --tls-client-key=projects/12345/secrets/my-tls-key/versions/1

        To create a new Kafka source `my-kafka-source` in location `us-central1` with an INFO level logging configuration, run:

          $ {command} my-kafka-source --location=us-central1 --bootstrap-servers='https://example-cluster.com:9092' --topics='topic1,topic2' --network_attachment=my-network-attachment --message-bus=my-message-bus --logging_config=INFO
        )DESCRIPTIONEXAMPLESc                   2    \ rS rSrSr\r\S 5       rS r	Sr
g)CreateA   z Create an Eventarc Kafka source.c                    [         R                  " U5        [         R                  " USS9  [         R                  " USS9  [         R                  " USS9  [         R
                  " USS9  [         R                  " USS9  [         R                  " USS9  [         R                  " US5        [        R                  " U5        [        R                  R                  U5        g )NT)requiredFz'The logging config of the kafka source.)r    AddCreateKafkaSourceResourceArgs!AddKafkaSourceBootstrapServersArgAddKafkaSourceTopicArg AddKafkaSourceConsumerGroupIDArgAddKafkaSourceInitialOffsetArg"AddKafkaSourceNetworkAttachmentArgAddKafkaSourceAuthGroupAddLoggingConfigArgr	   AddCreateLabelsFlagsr   
ASYNC_FLAGAddToParser)clsparsers     ,lib/surface/eventarc/kafka_sources/create.pyArgsCreate.ArgsH   s    	**62	++FTB	  $7	**6EB	((%@	,,VdC	!!&48	f&OP$$V,OO'    c                    [         R                  " 5       nUR                  R                  R	                  5       n[
        R                  " SR                  UR                  UR                  UR                  5      5        UR                  UUR                  UUR                  UR                  UR                  UR                   UR"                  UR$                  UR&                  UR(                  UR*                  UR,                  UR.                  UR0                  [2        R4                  " XR7                  5       5      S95      nUR8                  (       a  U$ UR;                  USU5      $ )zRun the create command.z6Creating kafka source {} for project {} in location {})kafka_source_refbootstrap_serversconsumer_group_idtopicssasl_mechanismsasl_usernamesasl_passwordtls_client_certificatetls_client_keynetwork_attachmentmessage_businitial_offsetlogging_configlabelsCreating)r   KafkaSourceClientV1CONCEPTSkafka_sourceParser
   debugformatkafkaSourcesId
projectsIdlocationsIdr   BuildKafkaSourcer%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r	   ParseCreateArgsLabelsValueClassasync_WaitFor)selfargsclientr$   	operations        r   Run
Create.RunU   s+   ..0F}}11779II@GG++''((	
 -"44"44;;..,,,,#'#>#>..#66((......t5L5L5NO 	  	
I( {{>>)Z1ABBr"    N)__name__
__module____qualname____firstlineno____doc___DETAILED_HELPdetailed_helpclassmethodr    rE   __static_attributes__rG   r"   r   r   r   A   s$     ) -
( 
("Cr"   r   N)rL   
__future__r   r   r   googlecloudsdk.api_lib.eventarcr   googlecloudsdk.callioper   #googlecloudsdk.command_lib.eventarcr   $googlecloudsdk.command_lib.util.argsr	   googlecloudsdk.corer
   rM   ReleaseTracksReleaseTrackBETADefaultUniverseOnlyCreateCommandr   rG   r"   r   <module>r\      s}    ( &  ' 9 ( 5 < # # #L D%%**+4CT 4C  ,4Cr"   