
    Z                        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  / r " S
 S\R                   5      r " S S\R                   5      r " S S\R                   5      r " S S\R                   5      r " S S\R                   5      r " S S\5      rSS jrSS jrS r " S S\5      rg)z'Utilities for Cloud Pub/Sub Topics API.    )absolute_import)division)unicode_literals)
list_pager)utils)apis)iam_util)
exceptionsc                       \ rS rSrSrSrg)PublishOperationException   z-Error when something went wrong with publish. N__name__
__module____qualname____firstlineno____doc____static_attributes__r       +lib/googlecloudsdk/api_lib/pubsub/topics.pyr   r      s    5r   r   c                       \ rS rSrSrSrg)EmptyMessageException!   z<Error when no message was specified for a Publish operation.r   Nr   r   r   r   r   r   !   s    Dr   r   c                       \ rS rSrSrSrg)NoFieldsSpecifiedError%   z:Error when no fields were specified for a Patch operation.r   Nr   r   r   r   r   r   %   s    Br   r   c                       \ rS rSrSrSrg)InvalidSchemaSettingsException)   z+Error when the schema settings are invalid.r   Nr   r   r   r   r   r   )   s    3r   r   c                       \ rS rSrSrSrg)%ConflictingIngestionSettingsException-   z.Error when the ingestion settings are invalid.r   Nr   r   r   r   r"   r"   -   s    6r   r"   c                       \ rS rSrSrS rSrg)_TopicUpdateSetting1   z*Data container class for updating a topic.c                     Xl         X l        g N
field_namevalue)selfr*   r+   s      r   __init___TopicUpdateSetting.__init__4   s     OJr   r)   N)r   r   r   r   r   r-   r   r   r   r   r%   r%   1   s
    2r   r%   c                 .    [         R                  " SSU S9$ )Npubsubv1no_http)r   GetClientInstancer2   s    r   r4   r4   9   s    			$	@@r   Nc                 @    U =(       d
    [        5       n U R                  $ r(   )r4   MESSAGES_MODULE)clients    r   GetMessagesModuler8   =   s    (&(&			r   c                     UR                  5       nUS:X  a   U R                  R                  R                  $ US:X  a   U R                  R                  R                  $ [        S5      e)Njsonbinaryz5Unknown message encoding. Options are JSON or BINARY.)lowerSchemaSettingsEncodingValueValuesEnumJSONBINARYr   )messagesmessage_encodingencs      r   ParseMessageEncodingrD   B   s^     #F]""::???
h""::AAA
(? r   c                   n   \ rS rSrSrSS jrS r                          SS jr                                      SS jrS r	S	 r
S
 rSS jrSS jrSS jr SS jrS rS rS rS r                                          SS jrSrg)TopicsClientN   z3Client for topics service in the Cloud Pub/Sub API.Nc                     U=(       d
    [        5       U l        U=(       d    [        U5      U l        U R                  R                  U l        U R                  R                  U l        g r(   )r4   r7   r8   rA   projects_topics_serviceprojects_subscriptions_subscriptions_service)r,   r7   rA   s      r   r-   TopicsClient.__init__Q   sG    /-/DK9 1& 9DMKK//DM"&++"D"DDr   c                     U(       a<  U R                   R                  U R                   R                  R                  U5      S9$ g )N)severity)rA   PlatformLogsSettingsSeverityValueValuesEnum)r,   ingestion_log_severitys     r   #_ParseIngestionPlatformLogsSettings0TopicsClient._ParseIngestionPlatformLogsSettingsW   sA    ]]//==55MM$ 0  
 r   c           
         USL=(       a    USL=(       a    USL=(       a    USLnUSL=(       a    USLnU
SL=(       a;    USL=(       a0    USL=(       a%    USL=(       a    USL=(       a    USL=(       a    USLnUSL=(       a    USL=(       a    USL=(       a    USLnUSL=(       a%    USL=(       a    USL=(       a    USL=(       a    USLnU(       aE  U R                   R                  UUUUS9n U R                   R                  U U R                  U5      S9$ U(       a  U R                   R	                  UUU	S9n!US:X  a  U R                   R                  US9U!l        OKUS:X  a   U R                   R                  5       U!l        O%US:X  a  U R                   R                  5       U!l
        U R                   R                  U!U R                  U5      S	9$ U(       aH  U R                   R                  U
UUUUUUS
9n"U R                   R                  U"U R                  U5      S9$ U(       aE  U R                   R                  UUUUS9n#U R                   R                  U#U R                  U5      S9$ U(       aF  U R                   R                  UUUUUS9n$U R                   R                  U$U R                  U5      S9$ U(       a  [        S5      eg)zFReturns an IngestionDataSourceSettings message from the provided args.N)	streamArnconsumerArn
awsRoleArngcpServiceAccount)
awsKinesisplatformLogsSettings)bucketminimumObjectCreateTime	matchGlobtext)	delimiteravropubsub_avro)cloudStorager[   )resourceGroup	namespaceeventHubclientIdtenantIdsubscriptionIdrY   )azureEventHubsr[   )
clusterArntopicrX   rY   )awsMskr[   )bootstrapServer	clusterIdrl   identityPoolIdrY   )confluentCloudr[   z.Must set ingestion settings with log severity.)rA   
AwsKinesisIngestionDataSourceSettingsrS   CloudStorage
TextFormat
textFormat
AvroFormat
avroFormatPubSubAvroFormatpubsubAvroFormatAzureEventHubsAwsMskConfluentCloudr"   )%r,   kinesis_ingestion_stream_arnkinesis_ingestion_consumer_arnkinesis_ingestion_role_arn!kinesis_ingestion_service_accountcloud_storage_ingestion_bucket$cloud_storage_ingestion_input_format&cloud_storage_ingestion_text_delimiter2cloud_storage_ingestion_minimum_object_create_time"cloud_storage_ingestion_match_glob)azure_event_hubs_ingestion_resource_group$azure_event_hubs_ingestion_namespace$azure_event_hubs_ingestion_event_hub$azure_event_hubs_ingestion_client_id$azure_event_hubs_ingestion_tenant_id*azure_event_hubs_ingestion_subscription_id*azure_event_hubs_ingestion_service_accountaws_msk_ingestion_cluster_arnaws_msk_ingestion_topicaws_msk_ingestion_aws_role_arn!aws_msk_ingestion_service_account*confluent_cloud_ingestion_bootstrap_server$confluent_cloud_ingestion_cluster_idconfluent_cloud_ingestion_topic*confluent_cloud_ingestion_identity_pool_id)confluent_cloud_ingestion_service_accountrR   
is_kinesisis_cloud_storageis_azure_event_hubsis_mskis_confluent_cloudkinesis_sourcecloud_storage_sourceazure_event_hubs_source
msk_sourceconfluent_cloud_sources%                                        r   !_ParseIngestionDataSourceSettings.TopicsClient._ParseIngestionDataSourceSettings`   s   J 
&T	1 	<+47	<'t3	< /d:	  7dB ,D8 
 
3$	> 	E1=	E1=	E 2=	E 2=		E
 8tC	E 8tC  
'd	2 	<$D0	<+47	< /d:	  
44	? 	D1=	D,D8	D 8tC	D 7dB  }}//04/=	 0 n ]]66##GG$  7   
!]]77/"T6 8 
 
.	7*.--*B*B< +C +
' 069*.--*B*B*D'/=@040N0N0P-]]66+#GG$  7   
 $ < <A8777CF != ! ]]660#GG$  7   
==''2'3=	 ( j ]]66#GG$  7   
#}};;D8/CE  <   ]]66/#GG$  7   
 1
:  r   c(                 2   U R                   R                  UR                  5       UUS9n(U(       a  UU(l        U(       a.  U R                   R	                  US9n)U(       a  UU)l        U)U(l        U(       a>  U(       a7  [        U R                   U5      n*U R                   R                  UU*U	U
S9U(l	        U R                  UUUUUUUUUUUUUUUUUUUUUU U!U"U#U$S9U(l        U%(       a2   [        R                  " U R                   R                  U%U'5      U(l        U&(       a  U&U(l        U R,                  R/                  U(5      $ ! [        R                   [        R"                  [        R$                  4 a"  n+[        R&                  " U+5      4U+l        e Sn+A+ff = f)aC  Creates a Topic.

Args:
  topic_ref (Resource): Resource reference to the Topic to create.
  labels (LabelsValue): Labels for the topic to create.
  kms_key (str): Full resource name of kms_key to set on Topic or None.
  message_retention_duration (str): How long to retain messages published to
    the Topic.
  message_storage_policy_allowed_regions (list[str]): List of Cloud regions
    in which messages are allowed to be stored at rest.
  message_storage_policy_enforce_in_transit (bool): Whether or not to
    enforce in-transit guarantees for this topic using the allowed regions.
  schema (Resource): Full resource name of schema used to validate messages
    published on Topic.
  message_encoding (str): If a schema is set, the message encoding of
    incoming messages to be validated against the schema.
  first_revision_id (str): If a schema is set, the revision id of the oldest
    revision allowed for validation.
  last_revision_id (str): If a schema is set, the revision id of the newest
    revision allowed for validation.
  kinesis_ingestion_stream_arn (str): The Kinesis data stream ARN to ingest
    data from.
  kinesis_ingestion_consumer_arn (str): The Kinesis data streams consumer
    ARN to use for ingestion.
  kinesis_ingestion_role_arn (str): AWS role ARN to be used for Federated
    Identity authentication with Kinesis.
  kinesis_ingestion_service_account (str): The GCP service account to be
    used for Federated Identity authentication with Kinesis
  cloud_storage_ingestion_bucket (str): The Cloud Storage bucket to ingest
    data from.
  cloud_storage_ingestion_input_format (str): the format of the data in the
    Cloud Storage bucket ('text', 'avro', or 'pubsub_avro').
  cloud_storage_ingestion_text_delimiter (optional[str]): delimiter to use
    with text format when partioning the object.
  cloud_storage_ingestion_minimum_object_create_time (optional[str]): only
    Cloud Storage objects with a larger or equal creation timestamp will be
    ingested.
  cloud_storage_ingestion_match_glob (optional[str]): glob pattern used to
    match Cloud Storage objects that will be ingested. If unset, all objects
    will be ingested.
  azure_event_hubs_ingestion_resource_group (str): The name of the resource
    group within an Azure subscription.
  azure_event_hubs_ingestion_namespace (str): The name of the Azure Event
    Hubs namespace.
  azure_event_hubs_ingestion_event_hub (str): The name of the Azure event
    hub.
  azure_event_hubs_ingestion_client_id (str): The client id of the Azure
    Event Hubs application used to authenticate Pub/Sub.
  azure_event_hubs_ingestion_tenant_id (str): The tenant id of the Azure
    Event Hubs application used to authenticate Pub/Sub.
  azure_event_hubs_ingestion_subscription_id (str): The id of the Azure
    Event Hubs subscription.
  azure_event_hubs_ingestion_service_account (str): The GCP service account
    to be used for Federated Identity authentication with Azure Event Hubs.
  aws_msk_ingestion_cluster_arn (str): The ARN that uniquely identifies the
    MSK cluster.
  aws_msk_ingestion_topic (str): The name of the MSK topic that Pub/Sub will
    import from.
  aws_msk_ingestion_aws_role_arn (str): AWS role ARN to be used for
    Federated Identity authentication with MSK.
  aws_msk_ingestion_service_account (str): The GCP service account to be
    used for Federated Identity authentication with MSK.
  confluent_cloud_ingestion_bootstrap_server (str): The address of the
    Confluent Cloud bootstrap server. The format is url:port.
  confluent_cloud_ingestion_cluster_id (str): The id of the Confluent Cloud
    cluster.
  confluent_cloud_ingestion_topic (str): The name of the Confluent Cloud
    topic that Pub/Sub will import from.
  confluent_cloud_ingestion_identity_pool_id (str): The id of the identity
    pool to be used for Federated Identity authentication with Confluent
    Cloud.
  confluent_cloud_ingestion_service_account (str): The GCP service account
    to be used for Federated Identity authentication with Confluent Cloud.
  ingestion_log_severity (optional[str]): The log severity to use for
    ingestion.
  message_transforms_file (str): The file path to the JSON or YAML file
    containing the message transforms.
  tags (TagsValue): The tag Keys/Values to be bound to the topic.
  enable_vertex_ai_smt (bool): Whether or not to enable Vertex AI message
    transforms.

Returns:
  Topic: The created topic.

Raises:
  InvalidSchemaSettingsException: If an invalid --schema,
      --message-encoding flag comnbination is specified,
      or if the --first_revision_id revision is newer than
      the --last_revision_id specified.
)namelabelsmessageRetentionDurationallowedPersistenceRegionsschemaencodingfirstRevisionIdlastRevisionIdr~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rR   N)rA   TopicRelativeName
kmsKeyNameMessageStoragePolicyenforceInTransitmessageStoragePolicyrD   r=   schemaSettingsr   ingestionDataSourceSettingsr   GetMessageTransformsFromFileMessageTransformmessageTransforms#MessageTransformsInvalidFormatErrorMessageTransformsEmptyFileError!MessageTransformsMissingFileErrorGetErrorMessageargstagsrJ   Create),r,   	topic_refr   kms_keymessage_retention_duration&message_storage_policy_allowed_regions)message_storage_policy_enforce_in_transitr   rB   first_revision_idlast_revision_idr~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rR   message_transforms_filer   enable_vertex_ai_smtrl   message_storage_policyencoding_enumes,                                               r   r   TopicsClient.Create   s   H MM##%!;   E
  e-#}}AA$J  B   
35 	/ $:e "*4==:JKm!]]99 +)	 : e )-(N(N%A'E#=*K'E-Q/U;m+M2[-Q-Q-Q-Q3]3]&C 7'E*K3]-Q(G3]2[55 )O )E%8 "'"D"DMM**# #
 ej==&& 
3
3

/
/

1
1 
 ''*,s   '1E 3F4FFc                     U R                   R                  UR                  5       S9nU R                  R	                  U5      $ )zsGets a Topic.

Args:
  topic_ref (Resource): Resource reference to the Topic to get.

Returns:
  Topic: The topic.
rl   )rA   PubsubProjectsTopicsGetRequestr   rJ   Get)r,   r   get_reqs      r   r   TopicsClient.Get  s@     mm::$$& ; G ==W%%r   c                     U R                   R                  UR                  5       S9nU R                  R	                  U5      $ )zDeletes a Topic.

Args:
  topic_ref (Resource): Resource reference to the Topic to delete.

Returns:
  Empty: An empty response message.
r   )rA   !PubsubProjectsTopicsDeleteRequestr   rJ   Delete)r,   r   
delete_reqs      r   r   TopicsClient.Delete  sA     @@$$& A J ==
++r   c                     U R                   R                  UR                  5       S9nU R                  R	                  U5      $ )zDetaches the subscription from its topic.

Args:
  subscription_ref (Resource): Resource reference to the Subscription to
    detach.

Returns:
  Empty: An empty response message.
)subscription)rA   (PubsubProjectsSubscriptionsDetachRequestr   rL   Detach)r,   subscription_ref
detach_reqs      r   DetachSubscriptionTopicsClient.DetachSubscription  sC     GG%224 H J &&--j99r   c                     U R                   R                  UR                  5       US9n[        R                  " U R
                  UUSSS9$ )a  Lists Topics for a given project.

Args:
  project_ref (Resource): Resource reference to Project to list Topics from.
  page_size (int): the number of entries in each batch (affects requests
    made, but not the yielded results).

Returns:
  A generator of Topics in the Project.
)projectpageSizetopicsr   
batch_sizefieldbatch_size_attribute)rA   PubsubProjectsTopicsListRequestr   r   YieldFromListrJ   )r,   project_ref	page_sizelist_reqs       r   ListTopicsClient.List  sS     }}<<((*Y = H ##' r   c                     U R                   R                  UR                  5       US9nU R                  R                  n[
        R                  " UUUSSS9$ )a  Lists Snapshots for a given topic.

Args:
  topic_ref (Resource): Resource reference to Topic to list snapshots from.
  page_size (int): the number of entries in each batch (affects requests
    made, but not the yielded results).

Returns:
  A generator of Snapshots for the Topic.
rl   r   	snapshotsr   r   )rA   (PubsubProjectsTopicsSnapshotsListRequestr   r7   projects_topics_snapshotsr   r   )r,   r   r   r   list_snaps_services        r   ListSnapshotsTopicsClient.ListSnapshots  s`     }}EE$$& F H >>##' r   c                     U R                   R                  UR                  5       US9nU R                  R                  n[
        R                  " UUUSSS9$ )a,  Lists Subscriptions for a given topic.

Args:
  topic_ref (Resource): Resource reference to Topic to list subscriptions
    from.
  page_size (int): the number of entries in each batch (affects requests
    made, but not the yielded results).

Returns:
  A generator of Subscriptions for the Topic..
r   subscriptionsr   r   )rA   ,PubsubProjectsTopicsSubscriptionsListRequestr   r7   projects_topics_subscriptionsr   r   )r,   r   r   r   list_subs_services        r   ListSubscriptionsTopicsClient.ListSubscriptions#  s`     }}II$$& J H AA##' r   c                    U(       d  U(       d  [        S5      eU R                  R                  UU R                  R                  R                  US9US9nU R                  R	                  U R                  R                  U/S9UR                  5       S9nU R                  R                  U5      nUR                  (       d  [        S5      eU$ )a8  Publishes a message to the given topic.

Args:
  topic_ref (Resource): Resource reference to Topic to publish to.
  message_body (bytes): Message to send.
  attributes (list[AdditionalProperty]): List of attributes to attach to the
    message.
  ordering_key (string): The ordering key to associate with this message.

Returns:
  PublishResponse: Response message with message ids from the API.
Raises:
  EmptyMessageException: If neither message nor attributes is
    specified.
  PublishOperationException: When something went wrong with the publish
    operation.
zdYou cannot send an empty message. You must specify either a MESSAGE, one or more ATTRIBUTE, or both.)additionalProperties)data
attributesorderingKey)rA   )publishRequestrl   z,Publish operation failed with Unknown error.)r   rA   PubsubMessageAttributesValue"PubsubProjectsTopicsPublishRequestPublishRequestr   rJ   Publish
messageIdsr   )r,   r   message_bodyr  ordering_keymessagepublish_reqresults           r   r	  TopicsClient.Publish;  s    ( 
!5  mm))==..>>!+ ? 
 ! * G --BB}}33gY3G$$& C K ]]"";/F%
8  Mr   c                     U R                   R                  UR                  5       U R                   R                  US9S9nU R                  R                  U5      $ )zSets an IAM policy on a Topic.

Args:
  topic_ref (Resource): Resource reference for topic to set IAM policy on.
  policy (Policy): The policy to be added to the Topic.

Returns:
  Policy: the policy which was set.
)policy)resourcesetIamPolicyRequest)rA   'PubsubProjectsTopicsSetIamPolicyRequestr   SetIamPolicyRequestrJ   SetIamPolicy)r,   r   r  requests       r   r  TopicsClient.SetIamPolicyg  sV     mmCC'') MM==V=L D G ==%%g..r   c                     U R                   R                  UR                  5       S9nU R                  R	                  U5      $ )zGets the IAM policy for a Topic.

Args:
  topic_ref (Resource): Resource reference for topic to get the IAM policy
    of.

Returns:
  Policy: the policy for the Topic.
)r  )rA   'PubsubProjectsTopicsGetIamPolicyRequestr   rJ   GetIamPolicy)r,   r   r  s      r   r  TopicsClient.GetIamPolicyw  sA     mmCC'') D G ==%%g..r   c                     U R                  U5      n[        R                  " U R                  R                  XBU5        U R                  X5      $ )aP  Adds an IAM Policy binding to a Topic.

Args:
  topic_ref (Resource): Resource reference for subscription to add IAM
    policy binding to.
  member (str): The member to add.
  role (str): The role to assign to the member.

Returns:
  Policy: the updated policy.
Raises:
  api_exception.HttpException: If either of the requests failed.
)r  r	   AddBindingToIamPolicyrA   Bindingr  r,   r   memberroler  s        r   AddIamPolicyBinding TopicsClient.AddIamPolicyBinding  sA     y)F""4==#8#8&$OY//r   c                 t    U R                  U5      n[        R                  " XBU5        U R                  X5      $ )a_  Removes an IAM Policy binding from a Topic.

Args:
  topic_ref (Resource): Resource reference for subscription to remove IAM
    policy binding from.
  member (str): The member to remove.
  role (str): The role to remove the member from.

Returns:
  Policy: the updated policy.
Raises:
  api_exception.HttpException: If either of the requests failed.
)r  r	   RemoveBindingFromIamPolicyr  r!  s        r   RemoveIamPolicyBinding#TopicsClient.RemoveIamPolicyBinding  s5     y)F''=Y//r   c,                    / n,U(       a  U,R                  [        SU5      5        U(       a  U,R                  [        SU5      5        U(       a  U,R                  [        SU5      5        U(       a  U,R                  [        SS5      5        U(       a  U,R                  [        SS5      5        OIU(       aB  U R                  R                  US9n-U(       a  UU-l        U,R                  [        SU-5      5        U(       a  U,R                  [        SS5      5        OYU	(       aR  U
(       aK  [        U R                  U
5      n.U,R                  [        SU R                  R                  U	U.UUS95      5        U(       a  U,R                  [        S	S5      5        OFU R                  UUUUUUUUUUUUUUUUUU U!U"U#U$U%U&U'U(S
9n/U/b  U,R                  [        S	U/5      5        U)(       aD   U,R                  [        S[        R                  " U R                  R                  U)U+S95      5        U*(       a  U,R                  [        S[         5      5        U R                  R#                  UR%                  5       S9n1/ n2U, H?  n3['        U1U3R(                  U3R*                  5        U2R                  U3R(                  5        MA     U2(       d  [-        S5      eU R                  R/                  U R                  R1                  U1SR3                  U25      S9UR%                  5       S9n4U R4                  R7                  U45      $ ! [        R                  [        R                  [        R                  4 a"  n0[        R                  " U05      4U0l        e Sn0A0ff = f)ae  Updates a Topic.

Args:
  topic_ref (Resource): Resource reference for the topic to be updated.
  labels (LabelsValue): The Cloud labels for the topic.
  kms_key_name (str): The full resource name of the Cloud KMS key to
    associate with the topic, or None.
  message_retention_duration (str): How long to retain messages.
  clear_message_retention_duration (bool): If set, remove retention from the
    topic.
  recompute_message_storage_policy (bool): True to have the API recalculate
    the message storage policy.
  message_storage_policy_allowed_regions (list[str]): List of Cloud regions
    in which messages are allowed to be stored at rest.
  message_storage_policy_enforce_in_transit (bool): Whether or not to
    enforce in-transit guarantees for this topic using the allowed regions.
  schema (Resource): Full resource name of schema used to validate messages
    published on Topic.
  message_encoding (str): If a schema is set, the message encoding of
    incoming messages to be validated against the schema.
  first_revision_id (str): If a schema is set, the revision id of the oldest
    revision allowed for validation.
  last_revision_id (str): If a schema is set, the revision id of the newest
    revision allowed for validation.
  clear_schema_settings (bool): If set, clear schema settings from the
    topic.
  clear_ingestion_data_source_settings (bool): If set, clear
    IngestionDataSourceSettings from the topic.
  kinesis_ingestion_stream_arn (str): The Kinesis data stream ARN to ingest
    data from.
  kinesis_ingestion_consumer_arn (str): The Kinesis data streams consumer
    ARN to use for ingestion.
  kinesis_ingestion_role_arn (str): AWS role ARN to be used for Federated
    Identity authentication with Kinesis.
  kinesis_ingestion_service_account (str): The GCP service account to be
    used for Federated Identity authentication with Kinesis
  cloud_storage_ingestion_bucket (str): The Cloud Storage bucket to ingest
    data from.
  cloud_storage_ingestion_input_format (str): the format of the data in the
    Cloud Storage bucket ('text', 'avro', or 'pubsub_avro').
  cloud_storage_ingestion_text_delimiter (optional[str]): delimiter to use
    with text format when partioning the object.
  cloud_storage_ingestion_minimum_object_create_time (optional[str]): only
    Cloud Storage objects with a larger or equal creation timestamp will be
    ingested.
  cloud_storage_ingestion_match_glob (optional[str]): glob pattern used to
    match Cloud Storage objects that will be ingested. If unset, all objects
    will be ingested.
  azure_event_hubs_ingestion_resource_group (str): The name of the resource
    group within an Azure subscription.
  azure_event_hubs_ingestion_namespace (str): The name of the Azure Event
    Hubs namespace.
  azure_event_hubs_ingestion_event_hub (str): The name of the Azure event
    hub.
  azure_event_hubs_ingestion_client_id (str): The client id of the Azure
    Event Hubs application used to authenticate Pub/Sub.
  azure_event_hubs_ingestion_tenant_id (str): The tenant id of the Azure
    Event Hubs application used to authenticate Pub/Sub.
  azure_event_hubs_ingestion_subscription_id (str): The id of the Azure
    Event Hubs subscription.
  azure_event_hubs_ingestion_service_account (str): The GCP service account
    to be used for Federated Identity authentication with Azure Event Hubs.
  aws_msk_ingestion_cluster_arn (str): The ARN that uniquely identifies the
    MSK cluster.
  aws_msk_ingestion_topic (str): The name of the MSK topic that Pub/Sub will
    import from.
  aws_msk_ingestion_aws_role_arn (str): AWS role ARN to be used for
    Federated Identity authentication with MSK.
  aws_msk_ingestion_service_account (str): The GCP service account to be
    used for Federated Identity authentication with MSK.
  confluent_cloud_ingestion_bootstrap_server (str): The address of the
    Confluent Cloud bootstrap server. The format is url:port.
  confluent_cloud_ingestion_cluster_id (str): The id of the Confluent Cloud
    cluster.
  confluent_cloud_ingestion_topic (str): The name of the Confluent Cloud
    topic that Pub/Sub will import from.
  confluent_cloud_ingestion_identity_pool_id (str): The id of the identity
    pool to be used for Federated Identity authentication with Confluent
    Cloud.
  confluent_cloud_ingestion_service_account (str): The GCP service account
    to be used for Federated Identity authentication with Confluent Cloud.
  ingestion_log_severity (optional[str]): The log severity to use for
    ingestion.
  message_transforms_file (str): The file path to the JSON or YAML file
    containing the message transforms.
  clear_message_transforms (bool): If set, clears all message transforms
    from the topic.
  enable_vertex_ai_smt (bool): If set, enables Vertex AI message
    transforms.

Returns:
  Topic: The updated topic.
Raises:
  NoFieldsSpecifiedError: if no fields were specified.
  PatchConflictingArgumentsError: if conflicting arguments were provided
  InvalidSchemaSettingsException: If an invalid --schema,
      --message-encoding flag comnbination is specified,
      or if the --first_revision_id revision is newer than
      the --last_revision_id specified.
r   r   r   Nr   r   r   r   r   r   r   )r   )r   z*Must specify at least one field to update.,)rl   
updateMask)updateTopicRequestr   )appendr%   rA   r   r   rD   r=   r   r   r   r   r   r   r   r   r   CLEAR_MESSAGE_TRANSFORMS_VALUEr   r   setattrr*   r+   r    PubsubProjectsTopicsPatchRequestUpdateTopicRequestjoinrJ   Patch)5r,   r   r   kms_key_namer    clear_message_retention_duration recompute_message_storage_policyr   r   r   rB   r   r   clear_schema_settings$clear_ingestion_data_source_settingsr~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rR   r   clear_message_transformsr   update_settingsr   r   new_settingsr   rl   update_maskupdate_setting	patch_reqs5                                                        r   r4  TopicsClient.Patch  st   d O06BC0|LM!
(*D
 (
8$
? (01GNO	/#}}AA$J  B   
35 	/ 
46L
M 01A4HI	$*4==:JKm
mm**("3!1	 + 
 ,
;T
B ;;'C)G%?,M)G/S1W=o-O4]/S/S/S/S5_5_(E"9)G,M5_/S*I5_4]!75 < l8 
	! =|L	
 #22MM22+)=		
$  
!#A MMY%;%;%=>EK)e^..0D0DE223 * "#OPP>>==;;CHH[$9 < 
 ##%	 ? I ==y))= 
3
3

/
/

1
1 
 ''*,s   $AL7 73N*NN)rJ   rL   r7   rA   )NN)NNNNNNNNNNNNNNNNNNNNNNNNNN)&NNNNFNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNF)d   )NNN)*NNNFFNFNNNNNFNNNNNNNNNNNNNNNNNNNNNNNNNNNFF)r   r   r   r   r   r-   rS   r   r   r   r   r   r   r   r   r	  r  r  r$  r(  r4  r   r   r   r   rF   rF   N   s   ;E $(%)!%(,%)+/-19=)-04+/+/+/+/1515$("%)(,15+/&*1504!7]D !%-105#'%)!%(,%)+/-19=)-04+/+/+/+/1515$("%)(,15+/&*1504!" QJ'X&,:,.2 IM*X/ /0$0* !%',',-105 +0#'%)!%(,%)+/-19=)-04+/+/+/+/1515$("%)(,15+/&*1504!"$ YS*r   rF   )Fr(   )r   
__future__r   r   r   apitools.base.pyr   googlecloudsdk.api_lib.pubsubr   googlecloudsdk.api_lib.utilr   googlecloudsdk.command_lib.iamr	   googlecloudsdk.corer
   r/  Errorr   r   r   r   r"   objectr%   r4   r8   rD   rF   r   r   r   <module>rJ     s    . &  ' ' / , 3 *!# 6
 0 0 6EJ,, ECZ-- C4Z%5%5 47J,<,< 7& A 
	o*6 o*r   