
                             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rSrS	rS
rSrSrSrSrSrSrSr/ r " S S\
R.                  5      rSS jrSS jr " S S\5      r " S S\5      rg)z.Utilities for Cloud Pub/Sub Subscriptions API.    )
list_pager)utils)apis)iam_util)
exceptions20zX-Server-Timeoutdefaultneverclearc                       \ rS rSrSrSrg)NoFieldsSpecifiedError'   z:Error when no fields were specified for a Patch operation. N)__name__
__module____qualname____firstlineno____doc____static_attributes__r       2lib/googlecloudsdk/api_lib/pubsub/subscriptions.pyr   r   '   s    Br   r   c                 .    [         R                  " SSU S9$ )Npubsubv1no_http)r   GetClientInstancer   s    r   r   r   +   s    			$	@@r   Nc                 @    U =(       d
    [        5       n U R                  $ N)r   MESSAGES_MODULE)clients    r   GetMessagesModuler"   /   s    (&(&			r   c                       \ rS rSrSrS rSrg)_SubscriptionUpdateSetting4   z1Data container class for updating a subscription.c                     Xl         X l        g r   
field_namevalue)selfr(   r)   s      r   __init__#_SubscriptionUpdateSetting.__init__7   s     OJr   r'   N)r   r   r   r   r   r+   r   r   r   r   r$   r$   4   s
    9r   r$   c                      \ rS rSrSrS#S jrS rS r                                      S$S jrS r	S%S	 jr
S
 rS rS&S jrS#S jrS rS rS rS rS rS rS rS rS rS rS rS rS rS rS r                                            S'S jrS rS r S  r!S! r"S"r#g)(SubscriptionsClient<   z:Client for subscriptions service in the Cloud Pub/Sub API.Nc                     U=(       d
    [        5       U l        U=(       d    [        U5      U l        U R                  R                  U l        g r   )r   r!   r"   messagesprojects_subscriptions_service)r*   r!   r1   s      r   r+   SubscriptionsClient.__init__?   s5    /-/DK9 1& 9DMKK66DMr   c                     U R                   R                  U R                   R                  US9UR                  5       S9nU R                  R                  U5      $ )zAcknowledges one or messages for a Subscription.

Args:
  ack_ids (list[str]): List of ack ids for the messages being ack'd.
  subscription_ref (Resource): Relative name of the subscription for which
    to ack messages for.

Returns:
  None:
)ackIds)acknowledgeRequestsubscription)r1   -PubsubProjectsSubscriptionsAcknowledgeRequestAcknowledgeRequestRelativeNamer3   Acknowledge)r*   ack_idssubscription_refack_reqs       r   AckSubscriptionsClient.AckD   sV     mmII==;;7;K%224 J G
 ==$$W--r   c                     U R                   R                  UR                  5       S9nU R                  R	                  U5      $ )zGets a Subscription from the API.

Args:
  subscription_ref (Resource): Relative name of the subscription to get.

Returns:
  Subscription: the subscription.
r8   )r1   %PubsubProjectsSubscriptionsGetRequestr;   r3   Get)r*   r>   get_reqs      r   rE   SubscriptionsClient.GetV   sA     mmAA%224 B G ==W%%r   c*                    U R                   R                  UR                  5       UR                  5       UUUUUU R                  X5      U
UU R	                  X5      U R                  X5      UU R                  UUUUUU5      U R                  UUUUUUUUUU U!5      U R                  U"U#5      U R                  U$U%U&5      S9n*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)a  Creates a Subscription.

Args:
  subscription_ref (Resource): Resource reference for subscription to be
    created.
  topic_ref (Resource): Resource reference for the associated topic for the
    subscriptions.
  ack_deadline (int): Number of seconds the system will wait for a
    subscriber to ack a message.
  push_config (Message): Message containing the push endpoint for the
    subscription.
  retain_acked_messages (bool): Whether or not to retain acked messages.
  message_retention_duration (int): How long to retained unacked messages.
  labels (Subscriptions.LabelsValue): The labels for the request.
  no_expiration (bool): Whether or not to set no expiration on subscription.
  expiration_period (str): TTL on expiration_policy.
  enable_message_ordering (bool): Whether or not to deliver messages with
    the same ordering key in order.
  filter_string (str): filter string in the Cloud Pub/Sub filter language.
  dead_letter_topic (str): Topic for publishing dead messages.
  max_delivery_attempts (int): Threshold of failed deliveries before sending
    message to the dead letter topic.
  min_retry_delay (str): The minimum delay between consecutive deliveries of
    a given message.
  max_retry_delay (str): The maximum delay between consecutive deliveries of
    a given message.
  enable_exactly_once_delivery (bool): Whether or not to set exactly once
    delivery on the subscription.
  bigquery_table (str): BigQuery table to which to write
  use_topic_schema (bool): Whether or not to use the topic schema when
    writing to BigQuery
  use_table_schema (bool): Whether or not to use the table schema when
    writing to BigQuery
  write_metadata (bool): Whether or not to write metadata fields when
    writing to BigQuery
  drop_unknown_fields (bool): Whether or not to drop fields that are only in
    the topic schema when writing to BigQuery
  bigquery_service_account_email (str): The service account to use when
    writing to BigQuery
  cloud_storage_bucket (str): The name for the Cloud Storage bucket.
  cloud_storage_file_prefix (str): The prefix for Cloud Storage filename.
  cloud_storage_file_suffix (str): The suffix for Cloud Storage filename.
  cloud_storage_file_datetime_format (str): The custom datetime format
    string for Cloud Storage filename.
  cloud_storage_max_bytes (int): The maximum bytes that can be written to a
    Cloud Storage file before a new file is created.
  cloud_storage_max_duration (str): The maximum duration that can elapse
    before a new Cloud Storage file is created.
  cloud_storage_max_messages (int): The maximum number of messages that can
    be written to a Cloud Storage file before a new file is created.
  cloud_storage_output_format (str): The output format for data written to
    Cloud Storage.
  cloud_storage_use_topic_schema (bool): Whether or not to use the topic
    schema when writing to Cloud Storage.
  cloud_storage_write_metadata (bool): Whether or not to write the
    subscription name and other metadata in the output.
  cloud_storage_service_account_email (str): The service account to use when
    writing to Cloud Storage
  pubsub_export_topic (str): The Pubsub topic to which to publish messages.
  pubsub_export_topic_region (str): The Cloud region to which to publish
    messages.
  bigtable_table (str): Bigtable table to which to write.
  bigtable_app_profile_id (str): The app profile to use when writing to
    Bigtable.
  bigtable_service_account_email (str): The service account to use when
    writing to Bigtable.
  message_transforms_file (str): The file path to the JSON or YAML file
    containing the message transforms.
  tags (TagsValue): The tags Keys/Values to be bound to the subscription.
  enable_vertex_ai_smt (bool): Whether or not to enable Vertex AI message
    transforms.

Returns:
  Subscription: the created subscription
)nametopicackDeadlineSeconds
pushConfigretainAckedMessageslabelsmessageRetentionDurationexpirationPolicyenableMessageOrderingfilterdeadLetterPolicyretryPolicyenableExactlyOnceDeliverybigqueryConfigcloudStorageConfigpubsubExportConfigbigtableConfigN)r1   Subscriptionr;   _ExpirationPolicy_DeadLetterPolicy_RetryPolicy_BigQueryConfig_CloudStorageConfig_PubsubExportConfig_BigtableConfigr   GetMessageTransformsFromFileMessageTransformmessageTransforms#MessageTransformsInvalidFormatErrorMessageTransformsEmptyFileError!MessageTransformsMissingFileErrorGetErrorMessageargstagsr3   Create),r*   r>   	topic_refack_deadlinepush_configretain_acked_messagesmessage_retention_durationrN   no_expirationexpiration_periodenable_message_orderingfilter_stringdead_letter_topicmax_delivery_attemptsmin_retry_delaymax_retry_delayenable_exactly_once_deliverybigquery_tableuse_topic_schemause_table_schemawrite_metadatadrop_unknown_fieldsbigquery_service_account_emailcloud_storage_bucketcloud_storage_file_prefixcloud_storage_file_suffix"cloud_storage_file_datetime_formatcloud_storage_max_bytescloud_storage_max_durationcloud_storage_max_messagescloud_storage_output_formatcloud_storage_use_topic_schemacloud_storage_write_metadata#cloud_storage_service_account_emailpubsub_export_topicpubsub_export_topic_regionbigtable_tablebigtable_app_profile_idbigtable_service_account_emailmessage_transforms_filerj   enable_vertex_ai_smtr8   es,                                               r   rk   SubscriptionsClient.Createe   s   n ==--**,$$&'1!;//
 6//
 %%oG">++*
  33 %%.#&&'*(/
  33!;
 ++#*
U . /L` ).)K)KMM**# *
& l==-- 
3
3

/
/

1
1 
 ''*,s   	1D# #3E8E33E8c                     U R                   R                  UR                  5       S9nU R                  R	                  U5      $ )zDeletes a Subscription.

Args:
  subscription_ref (Resource): Resource reference for subscription to be
    deleted.

Returns:
  None:
rC   )r1   (PubsubProjectsSubscriptionsDeleteRequestr;   r3   Delete)r*   r>   
delete_reqs      r   r   SubscriptionsClient.Delete   sA     GG%224 H J ==
++r   c                     U R                   R                  UR                  5       US9n[        R                  " U R
                  UUSSS9$ )a2  Lists Subscriptions for a given project.

Args:
  project_ref (Resource): Resource reference to Project 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 in the project.
)projectpageSizesubscriptionsr   )
batch_sizefieldbatch_size_attribute)r1   &PubsubProjectsSubscriptionsListRequestr;   r   YieldFromListr3   )r*   project_ref	page_sizelist_reqs       r   ListSubscriptionsClient.List/  sT     }}CC((*Y D H ##' r   c                     U R                   R                  U R                   R                  X2S9UR                  5       S9nU R                  R                  U5      $ )a  Modifies the ack deadline for messages for a Subscription.

Args:
  subscription_ref (Resource): Resource reference for subscription to be
    modified.
  ack_ids (list[str]): List of ack ids to modify.
  ack_deadline (int): The new ack deadline for the messages.

Returns:
  None:
)rK   r6   )modifyAckDeadlineRequestr8   )r1   3PubsubProjectsSubscriptionsModifyAckDeadlineRequestModifyAckDeadlineRequestr;   r3   ModifyAckDeadline)r*   r>   r=   rm   mod_reqs        r   r   %SubscriptionsClient.ModifyAckDeadlineF  s^     mmOO!%!G!G+ "H "
 &224	 P G ==**733r   c                     U R                   R                  U R                   R                  US9UR                  5       S9nU R                  R                  U5      $ )zModifies the push endpoint for a Subscription.

Args:
  subscription_ref (Resource): Resource reference for subscription to be
    modified.
  push_config (Message): The new push endpoint for the Subscription.

Returns:
  None:
)rL   )modifyPushConfigRequestr8   )r1   2PubsubProjectsSubscriptionsModifyPushConfigRequestModifyPushConfigRequestr;   r3   ModifyPushConfig)r*   r>   rn   r   s       r   r   $SubscriptionsClient.ModifyPushConfig[  s^     mmNN $ E E" !F !
 &224	 O G ==))'22r   c                 2   U R                   R                  U R                   R                  X#S9UR                  5       S9n[        U R
                  R                  [        '   U R                  R                  U5      nU R
                  R                  [        	 U$ )a  Pulls one or more messages from a Subscription.

Args:
  subscription_ref (Resource): Resource reference for subscription to be
    pulled from.
  max_messages (int): The maximum number of messages to retrieve.
  return_immediately (bool): Whether or not to return immediately without
    waiting for a new message for a bounded amount of time if there is
    nothing to pull right now.

Returns:
  PullResponse: proto containing the received messages.
)maxMessagesreturnImmediately)pullRequestr8   )
r1   &PubsubProjectsSubscriptionsPullRequestPullRequestr;   PULL_RPC_DEADLINE_SECONDSr!   additional_http_headersSERVER_TIMEOUT_HEADERr3   Pull)r*   r>   max_messagesreturn_immediatelypull_req	pull_resps         r   r   SubscriptionsClient.Pulln  s     }}CCMM--$ . 
 &224	 D H 	" 	KK''(=> ""8,I++,ABr   c                     U=(       a    UR                  5       nU R                  R                  U R                  R                  XBS9UR                  5       S9nU R                  R                  U5      $ )a  Reset a Subscription's backlog to point to a given time or snapshot.

Args:
  subscription_ref (Resource): Resource reference for subscription to be
    seeked on.
  time (str): The time to reset to.
  snapshot_ref (Resource): Resource reference to a snapshot..

Returns:
  None:
)snapshottime)seekRequestr8   )r;   r1   &PubsubProjectsSubscriptionsSeekRequestSeekRequestr3   Seek)r*   r>   r   snapshot_refr   seek_reqs         r   r   SubscriptionsClient.Seek  si     ; 9 9 ;H}}CCMM--x-K%224 D H ==h''r   c                     U(       a  U R                   R                  SS9$ U(       a  U R                   R                  US9$ g)zBuild ExpirationPolicy message from argument values.

Args:
  no_expiration (bool): Whether or not to set no expiration on subscription.
  expiration_period (str): TTL on expiration_policy.

Returns:
  ExpirationPolicy message or None.
N)ttl)r1   ExpirationPolicy)r*   rq   rr   s      r   r[   %SubscriptionsClient._ExpirationPolicy  s>     ]]+++55]]++0A+BBr   c                 F    U(       a  U R                   R                  UUS9$ g)a  Builds DeadLetterPolicy message from argument values.

Args:
  dead_letter_topic (str): Topic for publishing dead messages.
  max_delivery_attempts (int): Threshold of failed deliveries before sending
    message to the dead letter topic.

Returns:
  DeadLetterPolicy message or None.
)deadLetterTopicmaxDeliveryAttemptsN)r1   DeadLetterPolicy)r*   ru   rv   s      r   r\   %SubscriptionsClient._DeadLetterPolicy  s.     ]]+++3 ,   r   c                 R    U(       d  U(       a  U R                   R                  XS9$ g)a*  Builds RetryPolicy message from argument values.

Args:
  min_retry_delay (str): The minimum delay between consecutive deliveries of
    a given message.
  max_retry_delay (str): The maximum delay between consecutive deliveries of
    a given message.

Returns:
  DeadLetterPolicy message or None.
)minimumBackoffmaximumBackoffN)r1   RetryPolicy)r*   rw   rx   s      r   r]    SubscriptionsClient._RetryPolicy  s-     /]]&&( '   r   c           	      N    U(       a  U R                   R                  UUUUUUS9$ g)a  Builds BigQueryConfig message from argument values.

Args:
  table (str): The name of the table
  use_topic_schema (bool): Whether or not to use the topic schema
  use_table_schema (bool): Whether or not to use the table schema
  write_metadata (bool): Whether or not to write metadata fields
  drop_unknown_fields (bool): Whether or not to drop fields that are only in
    the topic schema
  service_account_email(str): The service account to use

Returns:
  BigQueryConfig message or None
)tableuseTopicSchemauseTableSchemawriteMetadatadropUnknownFieldsserviceAccountEmailN)r1   BigQueryConfig)r*   r   r{   r|   r}   r~   service_account_emails          r   r^   #SubscriptionsClient._BigQueryConfig  s:    . ]]))))&/3 *   r   c                    U(       a  U R                   R                  UUUUUUUUS9nUS:X  a!  U R                   R                  5       Ul        U$ US:X  a1  U R                   R	                  U
(       a  U
OSU	(       a  U	OSS9Ul        U$ g)a5  Builds CloudStorageConfig message from argument values.

Args:
  bucket (str): The name for the Cloud Storage bucket.
  file_prefix (str): The prefix for Cloud Storage filename.
  file_suffix (str): The suffix for Cloud Storage filename.
  file_datetime_format (str): The custom datetime format string for Cloud
    Storage filename.
  max_bytes (int): The maximum bytes that can be written to a Cloud Storage
    file before a new file is created.
  max_duration (str): The maximum duration that can elapse before a new
    Cloud Storage file is created.
  max_messages (int): The maximum number of messages that can be written to
    a Cloud Storage file before a new file is created.
  output_format (str): The output format for data written to Cloud Storage.
  use_topic_schema (bool): Whether or not to use the topic schema when
    writing to Cloud Storage.
  write_metadata (bool): Whether or not to write the subscription name and
    other metadata in the output.
  service_account_email(str): The service account to use

Returns:
  CloudStorageConfig message or None
)bucketfilenamePrefixfilenameSuffixfilenameDatetimeFormatmaxBytesmaxDurationr   r   textavroFN)r   r   )r1   CloudStorageConfig
TextConfig
textConfig
AvroConfig
avroConfig)r*   r   file_prefixfile_suffixfile_datetime_format	max_bytesmax_durationr   output_formatr{   r}   r   cloud_storage_configs                r   r_   'SubscriptionsClient._CloudStorageConfig  s    L !]]==$$!5""3 > 	 
&	 *.--*B*B*D' "! F"*.--*B*B,:. 0@+T	 +C +
' "!r   c                 D    U(       a  U R                   R                  XS9$ g)zBuilds PubsubExportConfig message from argument values.

Args:
  topic (str): The Pubsub topic to which to publish messages.
  region (str): The Cloud region to which to publish messages.

Returns:
  PubsubExportConfig message or None
)rJ   regionN)r1   PubSubExportConfig)r*   rJ   r   s      r   r`   'SubscriptionsClient._PubsubExportConfig0  s"     ]]--E-IIr   c                 H    U(       a  U R                   R                  UUUS9$ g)a   Builds BigtableConfig message from argument values.

Args:
  table (str): The name of the Bigtable table.
  app_profile_id (str): The app profile to use.
  service_account_email (str): The service account to use.

Returns:
  BigtableConfig message or None
)r   appProfileIdr   N)r1   BigtableConfig)r*   r   app_profile_idr   s       r   ra   #SubscriptionsClient._BigtableConfig>  s1     ]]))%3 *  
 r   c                 <    UR                   [        :X  a  S Ul         g g r   )r)   DEFAULT_MESSAGE_RETENTION_VALUEr*   update_settings     r   _HandleMessageRetentionUpdate1SubscriptionsClient._HandleMessageRetentionUpdateQ  s    >>!n ?r   c                 <    UR                   [        :X  a  S Ul         g g r   )r)   CLEAR_DEAD_LETTER_VALUEr  s     r   _HandleDeadLetterPolicyUpdate1SubscriptionsClient._HandleDeadLetterPolicyUpdateU  s    66!n 7r   c                 <    UR                   [        :X  a  S Ul         g g r   )r)   CLEAR_RETRY_VALUEr  s     r   _HandleRetryPolicyUpdate,SubscriptionsClient._HandleRetryPolicyUpdateY  s    00!n 1r   c                 <    UR                   [        :X  a  S Ul         g g r   )r)   CLEAR_BIGQUERY_CONFIG_VALUEr  s     r   _HandleBigQueryConfigUpdate/SubscriptionsClient._HandleBigQueryConfigUpdate]      ::!n ;r   c                 <    UR                   [        :X  a  S Ul         g g r   )r)    CLEAR_CLOUD_STORAGE_CONFIG_VALUEr  s     r   _HandleCloudStorageConfigUpdate3SubscriptionsClient._HandleCloudStorageConfigUpdatea      ??!n @r   c                 <    UR                   [        :X  a  S Ul         g g r   )r)   "CLEAR_PUSH_NO_WRAPPER_CONFIG_VALUEr  s     r   _HandlePushNoWrapperUpdate.SubscriptionsClient._HandlePushNoWrapperUpdatee  s    AA!n Br   c                 <    UR                   [        :X  a  S Ul         g g r   )r)    CLEAR_PUBSUB_EXPORT_CONFIG_VALUEr  s     r   _HandlePubsubExportConfigUpdate3SubscriptionsClient._HandlePubsubExportConfigUpdatei  r  r   c                 <    UR                   [        :X  a  S Ul         g g r   )r)   CLEAR_BIGTABLE_CONFIG_VALUEr  s     r   _HandleBigtableConfigUpdate/SubscriptionsClient._HandleBigtableConfigUpdatem  r  r   c.                    U"(       a  [         n.OU R                  UUUUUUUUUU U!5      n.U(       a  [        n/OU R                  X5      n/U(       a  [        n0OU R                  X5      n0U(       a  [        n1OU R                  UUUUUU5      n1U&(       a  [        n2OU R                  U$U%5      n2U*(       a  [        n3OU R                  U'U(U)5      n3U#(       a  [        n4OSn4U+(       a.   [        R                  " U R                  R                   U+U-5      n5OSn5U,(       a  [,        n7OSn7[/        SU5      [/        SU5      [/        SU5      [/        SU5      [/        SU5      [/        SU5      [/        SU R1                  Xx5      5      [/        S	U/5      [/        S
U05      [/        SU15      [/        SU.5      [/        SU45      [/        SU25      [/        SU35      [/        SU55      [/        SU75      /n8U R                  R3                  UR5                  5       S9n9/ n:U8 GHx  n;U;R6                  c  M  U;R8                  S:X  a  U R;                  U;5        U;R8                  S	:X  a  U R=                  U;5        U;R8                  S
:X  a  U R?                  U;5        U;R8                  S:X  a  U RA                  U;5        U;R8                  S:X  a  U RC                  U;5        U;R8                  S:X  a  U RE                  U;5        U;R8                  S:X  a  U RG                  U;5        U;R8                  S:X  a2  U RI                  U;5        Uc  U:RK                  U;R8                  5        GM<  [M        U9U;R8                  U;R6                  5        U:RK                  U;R8                  5        GM{     U:(       d  [O        S5      eU R                  RQ                  U R                  RS                  U9SRU                  U:5      S9UR5                  5       S9n<U RV                  RY                  U<5      $ ! [        R"                  [        R$                  [        R&                  4 a"  n6[        R(                  " U65      4U6l        e Sn6A6ff = f)a  Updates a Subscription.

Args:
  subscription_ref (Resource): Resource reference for subscription to be
    updated.
  ack_deadline (int): Number of seconds the system will wait for a
    subscriber to ack a message.
  push_config (Message): Message containing the push endpoint for the
    subscription.
  retain_acked_messages (bool): Whether or not to retain acked messages.
  message_retention_duration (str): How long to retained unacked messages.
  labels (LabelsValue): The Cloud labels for the subscription.
  no_expiration (bool): Whether or not to set no expiration on subscription.
  expiration_period (str): TTL on expiration_policy.
  dead_letter_topic (str): Topic for publishing dead messages.
  max_delivery_attempts (int): Threshold of failed deliveries before sending
    message to the dead letter topic.
  clear_dead_letter_policy (bool): If set, clear the dead letter policy from
    the subscription.
  min_retry_delay (str): The minimum delay between consecutive deliveries of
    a given message.
  max_retry_delay (str): The maximum delay between consecutive deliveries of
    a given message.
  clear_retry_policy (bool): If set, clear the retry policy from the
    subscription.
  enable_exactly_once_delivery (bool): Whether or not to set exactly once
    delivery on the subscription.
  bigquery_table (str): BigQuery table to which to write
  use_topic_schema (bool): Whether or not to use the topic schema when
    writing to BigQuery
  use_table_schema (bool): Whether or not to use the table schema when
    writing to BigQuery
  write_metadata (bool): Whether or not to write metadata fields when
    writing to BigQuery
  drop_unknown_fields (bool): Whether or not to drop fields that are only in
    the topic schema when writing to BigQuery
  bigquery_service_account_email (str): The service account to use when
    writing to BigQuery
  clear_bigquery_config (bool): If set, clear the BigQuery config from the
    subscription
  cloud_storage_bucket (bool): The name for the Cloud Storage bucket.
  cloud_storage_file_prefix (str): The prefix for Cloud Storage filename.
  cloud_storage_file_suffix (str): The suffix for Cloud Storage filename.
  cloud_storage_file_datetime_format (str): The custom datetime format
    string for Cloud Storage filename.
  cloud_storage_max_bytes (int): The maximum bytes that can be written to a
    Cloud Storage file before a new file is created.
  cloud_storage_max_duration (str): The maximum duration that can elapse
    before a new Cloud Storage file is created.
  cloud_storage_max_messages (int): The maximum number of messages that can
    be written to a Cloud Storage file before a new file is created.
  cloud_storage_output_format (str): The output format for data written to
    Cloud Storage.
  cloud_storage_use_topic_schema (bool): Whether or not to use the topic
    schema when writing to Cloud Storage.
  cloud_storage_write_metadata (bool): Whether or not to write the
    subscription name and other metadata in the output.
  cloud_storage_service_account_email (str): The service account to use when
    writing to Cloud Storage
  clear_cloud_storage_config (bool): If set, clear the Cloud Storage config
    from the subscription.
  clear_push_no_wrapper_config (bool): If set, clear the Push No Wrapper
    config from the subscription.
  pubsub_export_topic (str): The Pubsub topic to which to publish messages.
  pubsub_export_topic_region (str): The Cloud region to which to publish
    messages.
  clear_pubsub_export_config (bool): If set, clear the Pubsub export config
    from the subscription.
  bigtable_table (str): Bigtable table to which to write.
  bigtable_app_profile_id (str): The app profile to use when writing to
    Bigtable.
  bigtable_service_account_email (str): The service account to use when
    writing to Bigtable.
  clear_bigtable_config (bool): If set, clear the Bigtable config from the
    subscription.
  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 subscription.
  enable_vertex_ai_smt (bool): If set, enables Vertex AI message transforms.

Returns:
  Subscription: The updated subscription.
Raises:
  NoFieldsSpecifiedError: if no fields were specified.
NrK   rL   rM   rU   rO   rN   rP   rS   rT   rV   rW   zpushConfig.noWrapperrX   rY   rd   )rI   z*Must specify at least one field to update.,)r8   
updateMask)updateSubscriptionRequestrI   )-r  r_   r  r\   r  r]   r  r^   r!  r`   r%  ra   r  r   rb   r1   rc   re   rf   rg   rh   ri   #CLEAR_MESSAGE_TRANSFORMATIONS_VALUEr$   r[   rZ   r;   r)   r(   r  r  r  r  r  r"  r&  r  appendsetattrr   'PubsubProjectsSubscriptionsPatchRequestUpdateSubscriptionRequestjoinr3   Patch)=r*   r>   rm   rn   ro   rp   rN   rq   rr   ru   rv   clear_dead_letter_policyrw   rx   clear_retry_policyry   rz   r{   r|   r}   r~   r   clear_bigquery_configr   r   r   r   r   r   r   r   r   r   r   clear_cloud_storage_configclear_push_no_wrapper_configr   r   clear_pubsub_export_configr   r   r   clear_bigtable_configr   clear_message_transformsr   cloud_storage_config_settingsdead_letter_policyretry_policybigquery_configpubsub_export_configbigtable_configpush_config_no_wrappermessage_transformsr   clear_messagesupdate_settingsr8   update_maskr  	patch_reqs=                                                                r   r2  SubscriptionsClient.Patchq  sP   L "&F#&*&>&>

#
#
,
!
$
$
%
(
&
-'#  211
 &l&&Hl3o,,





(o "=!55
9 3o,,

!
(o $A#"??MM**# 
  :nn 	##7F"<="!#8	
 	#')E	
 	#&(B	
 	#8V4"""=D	
 	##57IJ"=,?"#3_E" "?	
 	#"$:	
 	##79MN"#3_E"#68JK"#6G;O> ==--**, . L K)				)$$(BB

,
,^
<$$(::

,
,^
<$$5

'
'
7$$(88

*
*>
:$$(<<

.
.~
>$$(<<

.
.~
>$$(88

*
*>
:$$(>>

)
).
9 ~889
n779M9MN>445- *. "#OPPEE"&--"I"I%#((;2G #J #
 **,	 F I ==y))c 
3
3

/
/

1
1 
 ''*,s   %,P	 	3Q<QQ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 Subscription.

Args:
  subscription_ref (Resource): Resource reference for subscription to set
    IAM policy on.
  policy (Policy): The policy to be added to the Subscription.

Returns:
  Policy: the policy which was set.
)policy)resourcesetIamPolicyRequest)r1   .PubsubProjectsSubscriptionsSetIamPolicyRequestr;   SetIamPolicyRequestr3   SetIamPolicy)r*   r>   rI  requests       r   rN   SubscriptionsClient.SetIamPolicy  sV     mmJJ!..0 MM==V=L K G ==%%g..r   c                     U R                   R                  UR                  5       S9nU R                  R	                  U5      $ )zGets the IAM policy for a Subscription.

Args:
  subscription_ref (Resource): Resource reference for subscription to get
    the IAM policy of.

Returns:
  Policy: the policy for the Subscription.
)rJ  )r1   .PubsubProjectsSubscriptionsGetIamPolicyRequestr;   r3   GetIamPolicy)r*   r>   rO  s      r   rS   SubscriptionsClient.GetIamPolicy  sA     mmJJ!..0 K G ==%%g..r   c                     U R                  U5      n[        R                  " U R                  R                  XBU5        U R                  X5      $ )a^  Adds an IAM Policy binding to a Subscription.

Args:
  subscription_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.
)rS  r   AddBindingToIamPolicyr1   BindingrN  r*   r>   memberrolerI  s        r   AddIamPolicyBinding'SubscriptionsClient.AddIamPolicyBinding  sC     /0F""4==#8#8&$O-66r   c                 t    U R                  U5      n[        R                  " XBU5        U R                  X5      $ )ah  Removes an IAM Policy binding from a Subscription.

Args:
  subscription_ref (Resource): Resource reference for subscription to remove
    IAM policy binding from.
  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.
)rS  r   RemoveBindingFromIamPolicyrN  rX  s        r   RemoveIamPolicyBinding*SubscriptionsClient.RemoveIamPolicyBinding  s7     /0F''=-66r   )r3   r!   r1   )NN)&NNNNFNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNF)d   )T),NNNNNFNNNFNNFNNNNNNNFNNNNNNNNNNNFFNNFNNNFNFF)$r   r   r   r   r   r+   r@   rE   rk   r   r   r   r   r   r   r[   r\   r]   r^   r_   r`   ra   r  r  r  r  r  r  r"  r&  r2  rN  rS  r[  r_  r   r   r   r   r.   r.   <   s   B7
.$&(  !%" #'%) $ $)-"!%!%"&%)#'*.!%"%)" Uy.v,.4*3&6(& $$ D<|&""""""""  !% $#'%)! $ $)-"!%!%"&%)#'*.!&#(!%!&"%)!"$ ]]*~/"/7$7r   r.   )Fr   )r   apitools.base.pyr   googlecloudsdk.api_lib.pubsubr   googlecloudsdk.api_lib.utilr   googlecloudsdk.command_lib.iamr   googlecloudsdk.corer   r   r   r  NEVER_EXPIRATION_PERIOD_VALUEr  r  r  r  r  r!  r%  r,  Errorr   r   r"   objectr$   r.   r   r   r   <module>rj     s     5 ( / , 3 * ! * "+  ' !  % #*  %, "#*  % &( #CZ-- CA 
 V7& V7r   