
                            d dl mZ d dlZd dlZd dlmZmZmZmZm	Z	m
Z
mZmZmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d d	lmZ d d
lmZ d dlmZ 	 eej@                  ejB                  jD                  f   Z#d dl&m'Z' d dl&m(Z( d dl)m*Z* d dl)m+Z+ d dl,m-Z- d dl.m/Z/ d dl.m0Z0 ddl1m2Z2m3Z3 ddl4m5Z5 ddl6m7Z7  G d d      Z8ejr                  ju                  ejv                        Z3dZ<y# e$$ r eej@                  e%f   Z#Y w xY w)    )OrderedDictN)	DictMappingMutableMappingMutableSequenceOptionalSequenceTupleTypeUnion)gapic_version)ClientOptions)
exceptions)gapic_v1)retry)timeout)credentials)service_account)iam_policy_pb2)
policy_pb2)duration_pb2)field_mask_pb2)pagers)pubsub)TimeoutType   )PublisherTransportDEFAULT_CLIENT_INFO)PublisherGrpcAsyncIOTransport)PublisherClientc                   l   e Zd ZU dZeed<   ej                  Zej                  Z eej                        Z	 eej                        Z
 eej                        Z eej                        Z eej                        Z eej                        Z eej                        Z eej                         Z eej"                        Z eej$                        Z eej&                        Z eej(                        Z eej*                        Z eej,                        Z eej.                        Z eej0                        Zedefd       Zedefd       ZeZe	 d0dee    fd	       Z!e"d
e#fd       Z$ e%jL                   e'e      jP                   e'e            Z(ddde)ddee*jV                     de,ee#f   dee    de-j\                  j^                  d
df
dZ0	 d0de-jb                  jd                  e-jb                  jd                  dddee,e3jh                  ef      dee   de5de6de7e8eef      d
e3jh                  fdZ9	 d0dde-jb                  jd                  e-jb                  jd                  dddee,e3jt                  ef      dee3jh                     dee;jx                     de5de6de7e8eef      d
e3jh                  fdZ=	 d0dde-jb                  jd                  e-jb                  jd                  dddee,e3j|                  ef      dee   dee?e3j                        de5de6de7e8eef      d
e3j                  fd ZB	 d0de-jb                  jd                  e-jb                  jd                  dd!dee,e3j                  ef      dee   de5de6de7e8eef      d
e3jh                  fd"ZD	 d0de-jb                  jd                  e-jb                  jd                  dd#dee,e3j                  ef      d$ee   de5de6de7e8eef      d
eFj                  fd%ZH	 d0de-jb                  jd                  e-jb                  jd                  dd!dee,e3j                  ef      dee   de5de6de7e8eef      d
eFj                  fd&ZK	 d0de-jb                  jd                  e-jb                  jd                  dd!dee,e3j                  ef      dee   de5de6de7e8eef      d
eFj                  fd'ZN	 d0de-jb                  jd                  e-jb                  jd                  dd!dee,e3j                  ef      dee   de5de6de7e8eef      d
dfd(ZP	 d0e-jb                  jd                  e-jb                  jd                  dd)dee,e3j                  ef      de5de6de7e8eef      d
e3j                  f
d*ZS	 d0e-jb                  jd                  e-jb                  jd                  dd)deeTj                     de5de6de7e8eef      d
eVj                  f
d+ZX	 d0e-jb                  jd                  e-jb                  jd                  dd)deeTj                     de5de6de7e8eef      d
eVj                  f
d,ZZ	 d0e-jb                  jd                  e-jb                  jd                  dd)deeTj                     de5de6de7e8eef      d
eTj                  f
d-Z]d1d.Z^d/ Z_y)2PublisherAsyncClientzdThe service that an application uses to manipulate topics,
    and to send messages to a topic.
    _clientinfoc                 R    t        j                  j                  t        |g|i |S )a~  Creates an instance of this client using the provided credentials
            info.

        Args:
            info (dict): The service account private key info.
            args: Additional arguments to pass to the constructor.
            kwargs: Additional arguments to pass to the constructor.

        Returns:
            PublisherAsyncClient: The constructed client.
        )r    from_service_account_info__func__r"   )clsr$   argskwargss       Clib/third_party/google/pubsub_v1/services/publisher/async_client.pyr&   z.PublisherAsyncClient.from_service_account_info]   s+     88AABVX\n_cngmnn    filenamec                 R    t        j                  j                  t        |g|i |S )a  Creates an instance of this client using the provided credentials
            file.

        Args:
            filename (str): The path to the service account private key json
                file.
            args: Additional arguments to pass to the constructor.
            kwargs: Additional arguments to pass to the constructor.

        Returns:
            PublisherAsyncClient: The constructed client.
        )r    from_service_account_filer'   r"   )r(   r-   r)   r*   s       r+   r/   z.PublisherAsyncClient.from_service_account_filel   s+     88AABVX`rcgrkqrrr,   Nclient_optionsc                 ,    t        j                  |      S )a  Return the API endpoint and client cert source for mutual TLS.

        The client cert source is determined in the following order:
        (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
        client cert source is None.
        (2) if `client_options.client_cert_source` is provided, use the provided one; if the
        default client cert source exists, use the default one; otherwise the client cert
        source is None.

        The API endpoint is determined in the following order:
        (1) if `client_options.api_endpoint` if provided, use the provided one.
        (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
        default mTLS endpoint; if the environment variable is "never", use the default API
        endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
        use the default API endpoint.

        More details can be found at https://google.aip.dev/auth/4114.

        Args:
            client_options (google.api_core.client_options.ClientOptions): Custom options for the
                client. Only the `api_endpoint` and `client_cert_source` properties may be used
                in this method.

        Returns:
            Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
                client cert source to use.

        Raises:
            google.auth.exceptions.MutualTLSChannelError: If any errors happen.
        )r    !get_mtls_endpoint_and_cert_source)r(   r0   s     r+   r2   z6PublisherAsyncClient.get_mtls_endpoint_and_cert_source~   s    D @@PPr,   returnc                 .    | j                   j                  S )zReturns the transport used by the client instance.

        Returns:
            PublisherTransport: The transport used by the client instance.
        )r#   	transportselfs    r+   r5   zPublisherAsyncClient.transport   s     ||%%%r,   grpc_asyncior   r5   r0   client_infor   r5   r:   c                ,    t        ||||      | _        y)a  Instantiates the publisher client.

        Args:
            credentials (Optional[google.auth.credentials.Credentials]): The
                authorization credentials to attach to requests. These
                credentials identify the application to the service; if none
                are specified, the client will attempt to ascertain the
                credentials from the environment.
            transport (Union[str, ~.PublisherTransport]): The
                transport to use. If set to None, a transport is chosen
                automatically.
            client_options (ClientOptions): Custom options for the client. It
                won't take effect if a ``transport`` instance is provided.
                (1) The ``api_endpoint`` property can be used to override the
                default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT
                environment variable can also be used to override the endpoint:
                "always" (always use the default mTLS endpoint), "never" (always
                use the default regular endpoint) and "auto" (auto switch to the
                default mTLS endpoint if client certificate is present, this is
                the default value). However, the ``api_endpoint`` property takes
                precedence if provided.
                (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
                is "true", then the ``client_cert_source`` property can be used
                to provide client certificate for mutual TLS transport. If
                not provided, the default SSL client certificate will be used if
                present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
                set, no client certificate will be used.

        Raises:
            google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
                creation failed for any reason.
        r9   N)r    r#   )r7   r   r5   r0   r:   s        r+   __init__zPublisherAsyncClient.__init__   s    P '#)#	
r,    )namer   r   metadatarequestr>   r   r   r?   c                  K   t        |g      }||rt        d      t        j                  |      }|||_        t
        j                  j                  | j                  j                  j                  t        j                  dddt        j                  t        j                        d      dt               }t#        |      t
        j$                  j'                  d|j                  ff      fz   } |||||	       d{   }|S 7 w)
a	  Creates the given topic with the given name. See the [resource
        name rules]
        (https://cloud.google.com/pubsub/docs/admin#resource_names).

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google import pubsub_v1

            async def sample_create_topic():
                # Create a client
                client = pubsub_v1.PublisherAsyncClient()

                # Initialize request argument(s)
                request = pubsub_v1.Topic(
                    name="name_value",
                )

                # Make the request
                response = await client.create_topic(request=request)

                # Handle the response
                print(response)

        Args:
            request (Optional[Union[google.pubsub_v1.types.Topic, dict]]):
                The request object. A topic resource.
            name (:class:`str`):
                Required. The name of the topic. It must have the format
                ``"projects/{project}/topics/{topic}"``. ``{topic}``
                must start with a letter, and contain only letters
                (``[A-Za-z]``), numbers (``[0-9]``), dashes (``-``),
                underscores (``_``), periods (``.``), tildes (``~``),
                plus (``+``) or percent signs (``%``). It must be
                between 3 and 255 characters in length, and it must not
                start with ``"goog"``.

                This corresponds to the ``name`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (TimeoutType):
                The timeout for this request.
            metadata (Sequence[Tuple[str, str]]): Strings which should be
                sent along with the request as metadata.

        Returns:
            google.pubsub_v1.types.Topic:
                A topic resource.
        N\If the `request` argument is set, then none of the individual field arguments should be set.皙?      N@?initialmaximum
multiplier	predicatedeadlinedefault_retrydefault_timeoutr:   r>   r   r   r?   )any
ValueErrorr   Topicr>   r   method_asyncwrap_methodr#   
_transportcreate_topicretriesRetryif_exception_typecore_exceptionsServiceUnavailabler   tuplerouting_headerto_grpc_metadata)	r7   r@   r>   r   r   r?   has_flattened_paramsrpcresponses	            r+   rV   z!PublisherAsyncClient.create_topic   s    J  #D6{#7@ 
 ,,w' GL ##//LL##00!--!33#66  !+ 0 
" ?##44vw||6L5NO&
 

 	
 
 
s   D DD	D)topicupdate_maskr   r   r?   rb   rc   c                B  K   t        ||g      }||rt        d      t        j                  |      }|||_        |||_        t        j                  j                  | j                  j                  j                  t        j                  dddt        j                  t        j                         d      dt"              }t%        |      t        j&                  j)                  d|j                  j*                  ff      fz   } |||||	       d{   }	|	S 7 w)
a
  Updates an existing topic. Note that certain
        properties of a topic are not modifiable.

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google import pubsub_v1

            async def sample_update_topic():
                # Create a client
                client = pubsub_v1.PublisherAsyncClient()

                # Initialize request argument(s)
                topic = pubsub_v1.Topic()
                topic.name = "name_value"

                request = pubsub_v1.UpdateTopicRequest(
                    topic=topic,
                )

                # Make the request
                response = await client.update_topic(request=request)

                # Handle the response
                print(response)

        Args:
            request (Optional[Union[google.pubsub_v1.types.UpdateTopicRequest, dict]]):
                The request object. Request for the UpdateTopic method.
            topic (:class:`google.pubsub_v1.types.Topic`):
                Required. The updated topic object.
                This corresponds to the ``topic`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
                Required. Indicates which fields in the provided topic
                to update. Must be specified and non-empty. Note that if
                ``update_mask`` contains "message_storage_policy" but
                the ``message_storage_policy`` is not set in the
                ``topic`` provided above, then the updated value is
                determined by the policy configured at the project or
                organization level.

                This corresponds to the ``update_mask`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (TimeoutType):
                The timeout for this request.
            metadata (Sequence[Tuple[str, str]]): Strings which should be
                sent along with the request as metadata.

        Returns:
            google.pubsub_v1.types.Topic:
                A topic resource.
        NrB   rC   rD   rE   rF   rL   z
topic.namerO   )rP   rQ   r   UpdateTopicRequestrb   rc   r   rS   rT   r#   rU   update_topicrW   rX   rY   rZ   r[   r   r\   r]   r^   r>   )
r7   r@   rb   rc   r   r   r?   r_   r`   ra   s
             r+   rf   z!PublisherAsyncClient.update_topicS  s4    X  #E;#78#7@ 
 ++G4 !GM""-G ##//LL##00!--!33#66  !+ 0 
" ?##44 2 235&
 
 	
 
 
s   DDDD)rb   messagesr   r   r?   rg   c                
  K   t        ||g      }||rt        d      t        j                  |      }|||_        |r|j
                  j                  |       t        j                  j                  | j                  j                  j                  t        j                  dddt        j                  t         j"                  t         j$                  t         j&                  t         j(                  t         j*                  t         j,                  t         j.                        d      dt0              }t3        |      t        j4                  j7                  d|j                  ff      fz   } |||||	       d{   }	|	S 7 w)
aq	  Adds one or more messages to the topic. Returns ``NOT_FOUND`` if
        the topic does not exist.

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google import pubsub_v1

            async def sample_publish():
                # Create a client
                client = pubsub_v1.PublisherAsyncClient()

                # Initialize request argument(s)
                request = pubsub_v1.PublishRequest(
                    topic="topic_value",
                )

                # Make the request
                response = await client.publish(request=request)

                # Handle the response
                print(response)

        Args:
            request (Optional[Union[google.pubsub_v1.types.PublishRequest, dict]]):
                The request object. Request for the Publish method.
            topic (:class:`str`):
                Required. The messages in the request will be published
                on this topic. Format is
                ``projects/{project}/topics/{topic}``.

                This corresponds to the ``topic`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            messages (:class:`MutableSequence[google.pubsub_v1.types.PubsubMessage]`):
                Required. The messages to publish.
                This corresponds to the ``messages`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (TimeoutType):
                The timeout for this request.
            metadata (Sequence[Tuple[str, str]]): Strings which should be
                sent along with the request as metadata.

        Returns:
            google.pubsub_v1.types.PublishResponse:
                Response for the Publish method.
        NrB   rC   rD   g      @rF   rL   rb   rO   )rP   rQ   r   PublishRequestrb   rg   extendr   rS   rT   r#   rU   publishrW   rX   rY   rZ   Aborted	CancelledDeadlineExceededInternalServerErrorResourceExhaustedr[   Unknownr   r\   r]   r^   )
r7   r@   rb   rg   r   r   r?   r_   r`   ra   s
             r+   rk   zPublisherAsyncClient.publish  sj    J  #E8#45#7@ 
 ''0 !GM##H- ##//LL##++!--!33#++#--#44#77#55#66#++  !+% 0 
. ?##44w6N5PQ&
 

 	
 
 
s   E8F:F;F)rb   r   r   r?   c                V  K   t        |g      }||rt        d      t        j                  |      }|||_        t
        j                  j                  | j                  j                  j                  t        j                  dddt        j                  t        j                  t        j                   t        j"                        d      dt$              }t'        |      t
        j(                  j+                  d|j                  ff      fz   } |||||	       d{   }|S 7 w)
a  Gets the configuration of a topic.

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google import pubsub_v1

            async def sample_get_topic():
                # Create a client
                client = pubsub_v1.PublisherAsyncClient()

                # Initialize request argument(s)
                request = pubsub_v1.GetTopicRequest(
                    topic="topic_value",
                )

                # Make the request
                response = await client.get_topic(request=request)

                # Handle the response
                print(response)

        Args:
            request (Optional[Union[google.pubsub_v1.types.GetTopicRequest, dict]]):
                The request object. Request for the GetTopic method.
            topic (:class:`str`):
                Required. The name of the topic to get. Format is
                ``projects/{project}/topics/{topic}``.

                This corresponds to the ``topic`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (TimeoutType):
                The timeout for this request.
            metadata (Sequence[Tuple[str, str]]): Strings which should be
                sent along with the request as metadata.

        Returns:
            google.pubsub_v1.types.Topic:
                A topic resource.
        NrB   rC   rD   rE   rF   rL   rb   rO   )rP   rQ   r   GetTopicRequestrb   r   rS   rT   r#   rU   	get_topicrW   rX   rY   rZ   rl   r[   rq   r   r\   r]   r^   	r7   r@   rb   r   r   r?   r_   r`   ra   s	            r+   rt   zPublisherAsyncClient.get_topicP  s+    z  #E7|#7@ 
 ((1 !GM ##//LL##--!--!33#++#66#++
 
 !+ 0 
& ?##44w6N5PQ&
 

 	
 
 
s   DD) D'!D))projectr   r   r?   rv   c                  K   t        |g      }||rt        d      t        j                  |      }|||_        t
        j                  j                  | j                  j                  j                  t        j                  dddt        j                  t        j                  t        j                   t        j"                        d      dt$              }t'        |      t
        j(                  j+                  d|j                  ff      fz   } |||||	       d{   }t-        j.                  ||||
      }|S 7 w)a  Lists matching topics.

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google import pubsub_v1

            async def sample_list_topics():
                # Create a client
                client = pubsub_v1.PublisherAsyncClient()

                # Initialize request argument(s)
                request = pubsub_v1.ListTopicsRequest(
                    project="project_value",
                )

                # Make the request
                page_result = client.list_topics(request=request)

                # Handle the response
                async for response in page_result:
                    print(response)

        Args:
            request (Optional[Union[google.pubsub_v1.types.ListTopicsRequest, dict]]):
                The request object. Request for the ``ListTopics`` method.
            project (:class:`str`):
                Required. The name of the project in which to list
                topics. Format is ``projects/{project-id}``.

                This corresponds to the ``project`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (TimeoutType):
                The timeout for this request.
            metadata (Sequence[Tuple[str, str]]): Strings which should be
                sent along with the request as metadata.

        Returns:
            google.pubsub_v1.services.publisher.pagers.ListTopicsAsyncPager:
                Response for the ListTopics method.

                Iterating over this object will yield results and
                resolve additional pages automatically.

        NrB   rC   rD   rE   rF   rL   rv   rO   methodr@   ra   r?   )rP   rQ   r   ListTopicsRequestrv   r   rS   rT   r#   rU   list_topicsrW   rX   rY   rZ   rl   r[   rq   r   r\   r]   r^   r   ListTopicsAsyncPager)	r7   r@   rv   r   r   r?   r_   r`   ra   s	            r+   r{   z PublisherAsyncClient.list_topics  sI    D  #G9~#7@ 
 **73 %GO ##//LL##//!--!33#++#66#++
 
 !+ 0 
& ?##44y'//6R5TU&
 

 	
 
 ..	
 #
   DE E ! Ec                  K   t        |g      }||rt        d      t        j                  |      }|||_        t
        j                  j                  | j                  j                  j                  t        j                  dddt        j                  t        j                  t        j                   t        j"                        d      dt$              }t'        |      t
        j(                  j+                  d|j                  ff      fz   } |||||	       d{   }t-        j.                  ||||
      }|S 7 w)aQ	  Lists the names of the attached subscriptions on this
        topic.

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google import pubsub_v1

            async def sample_list_topic_subscriptions():
                # Create a client
                client = pubsub_v1.PublisherAsyncClient()

                # Initialize request argument(s)
                request = pubsub_v1.ListTopicSubscriptionsRequest(
                    topic="topic_value",
                )

                # Make the request
                page_result = client.list_topic_subscriptions(request=request)

                # Handle the response
                async for response in page_result:
                    print(response)

        Args:
            request (Optional[Union[google.pubsub_v1.types.ListTopicSubscriptionsRequest, dict]]):
                The request object. Request for the ``ListTopicSubscriptions`` method.
            topic (:class:`str`):
                Required. The name of the topic that subscriptions are
                attached to. Format is
                ``projects/{project}/topics/{topic}``.

                This corresponds to the ``topic`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (TimeoutType):
                The timeout for this request.
            metadata (Sequence[Tuple[str, str]]): Strings which should be
                sent along with the request as metadata.

        Returns:
            google.pubsub_v1.services.publisher.pagers.ListTopicSubscriptionsAsyncPager:
                Response for the ListTopicSubscriptions method.

                Iterating over this object will yield results and
                resolve additional pages automatically.

        NrB   rC   rD   rE   rF   rL   rb   rO   rx   )rP   rQ   r   ListTopicSubscriptionsRequestrb   r   rS   rT   r#   rU   list_topic_subscriptionsrW   rX   rY   rZ   rl   r[   rq   r   r\   r]   r^   r    ListTopicSubscriptionsAsyncPagerru   s	            r+   r   z-PublisherAsyncClient.list_topic_subscriptions<  sI    H  #E7|#7@ 
 66w? !GM ##//LL##<<!--!33#++#66#++
 
 !+ 0 
& ?##44w6N5PQ&
 

 	
 
 ::	
 #
r}   c                  K   t        |g      }||rt        d      t        j                  |      }|||_        t
        j                  j                  | j                  j                  j                  t        j                  dddt        j                  t        j                  t        j                   t        j"                        d      dt$              }t'        |      t
        j(                  j+                  d|j                  ff      fz   } |||||	       d{   }t-        j.                  ||||
      }|S 7 w)a\
  Lists the names of the snapshots on this topic. Snapshots are
        used in
        `Seek <https://cloud.google.com/pubsub/docs/replay-overview>`__
        operations, which allow you to manage message acknowledgments in
        bulk. That is, you can set the acknowledgment state of messages
        in an existing subscription to the state captured by a snapshot.

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google import pubsub_v1

            async def sample_list_topic_snapshots():
                # Create a client
                client = pubsub_v1.PublisherAsyncClient()

                # Initialize request argument(s)
                request = pubsub_v1.ListTopicSnapshotsRequest(
                    topic="topic_value",
                )

                # Make the request
                page_result = client.list_topic_snapshots(request=request)

                # Handle the response
                async for response in page_result:
                    print(response)

        Args:
            request (Optional[Union[google.pubsub_v1.types.ListTopicSnapshotsRequest, dict]]):
                The request object. Request for the ``ListTopicSnapshots`` method.
            topic (:class:`str`):
                Required. The name of the topic that snapshots are
                attached to. Format is
                ``projects/{project}/topics/{topic}``.

                This corresponds to the ``topic`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (TimeoutType):
                The timeout for this request.
            metadata (Sequence[Tuple[str, str]]): Strings which should be
                sent along with the request as metadata.

        Returns:
            google.pubsub_v1.services.publisher.pagers.ListTopicSnapshotsAsyncPager:
                Response for the ListTopicSnapshots method.

                Iterating over this object will yield results and
                resolve additional pages automatically.

        NrB   rC   rD   rE   rF   rL   rb   rO   rx   )rP   rQ   r   ListTopicSnapshotsRequestrb   r   rS   rT   r#   rU   list_topic_snapshotsrW   rX   rY   rZ   rl   r[   rq   r   r\   r]   r^   r   ListTopicSnapshotsAsyncPagerru   s	            r+   r   z)PublisherAsyncClient.list_topic_snapshots  sI    P  #E7|#7@ 
 227; !GM ##//LL##88!--!33#++#66#++
 
 !+ 0 
& ?##44w6N5PQ&
 

 	
 
 66	
 #
r}   c                  K   t        |g      }||rt        d      t        j                  |      }|||_        t
        j                  j                  | j                  j                  j                  t        j                  dddt        j                  t        j                        d      dt               }t#        |      t
        j$                  j'                  d|j                  ff      fz   } |||||	       d{    y7 w)
a  Deletes the topic with the given name. Returns ``NOT_FOUND`` if
        the topic does not exist. After a topic is deleted, a new topic
        may be created with the same name; this is an entirely new topic
        with none of the old configuration or subscriptions. Existing
        subscriptions to this topic are not deleted, but their ``topic``
        field is set to ``_deleted-topic_``.

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google import pubsub_v1

            async def sample_delete_topic():
                # Create a client
                client = pubsub_v1.PublisherAsyncClient()

                # Initialize request argument(s)
                request = pubsub_v1.DeleteTopicRequest(
                    topic="topic_value",
                )

                # Make the request
                await client.delete_topic(request=request)

        Args:
            request (Optional[Union[google.pubsub_v1.types.DeleteTopicRequest, dict]]):
                The request object. Request for the ``DeleteTopic`` method.
            topic (:class:`str`):
                Required. Name of the topic to delete. Format is
                ``projects/{project}/topics/{topic}``.

                This corresponds to the ``topic`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (TimeoutType):
                The timeout for this request.
            metadata (Sequence[Tuple[str, str]]): Strings which should be
                sent along with the request as metadata.
        NrB   rC   rD   rE   rF   rL   rb   rO   )rP   rQ   r   DeleteTopicRequestrb   r   rS   rT   r#   rU   delete_topicrW   rX   rY   rZ   r[   r   r\   r]   r^   )r7   r@   rb   r   r   r?   r_   r`   s           r+   r   z!PublisherAsyncClient.delete_topic>  s    v  #E7|#7@ 
 ++G4 !GM ##//LL##00!--!33#66  !+ 0 
" ?##44w6N5PQ&
 

 	
 	
 	
s   D D
DD
rO   c                  K   t        j                  |      }t        j                  j	                  | j
                  j                  j                  t        j                  dddt        j                  t        j                        d      dt              }t        |      t        j                  j!                  d|j"                  ff      fz   } |||||       d{   }|S 7 w)	a  Detaches a subscription from this topic. All messages retained
        in the subscription are dropped. Subsequent ``Pull`` and
        ``StreamingPull`` requests will return FAILED_PRECONDITION. If
        the subscription is a push subscription, pushes to the endpoint
        will stop.

        .. code-block:: python

            # This snippet has been automatically generated and should be regarded as a
            # code template only.
            # It will require modifications to work:
            # - It may require correct/in-range values for request initialization.
            # - It may require specifying regional endpoints when creating the service
            #   client as shown in:
            #   https://googleapis.dev/python/google-api-core/latest/client_options.html
            from google import pubsub_v1

            async def sample_detach_subscription():
                # Create a client
                client = pubsub_v1.PublisherAsyncClient()

                # Initialize request argument(s)
                request = pubsub_v1.DetachSubscriptionRequest(
                    subscription="subscription_value",
                )

                # Make the request
                response = await client.detach_subscription(request=request)

                # Handle the response
                print(response)

        Args:
            request (Optional[Union[google.pubsub_v1.types.DetachSubscriptionRequest, dict]]):
                The request object. Request for the DetachSubscription
                method.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (TimeoutType):
                The timeout for this request.
            metadata (Sequence[Tuple[str, str]]): Strings which should be
                sent along with the request as metadata.

        Returns:
            google.pubsub_v1.types.DetachSubscriptionResponse:
                Response for the DetachSubscription
                method. Reserved for future use.

        rC   rD   rE   rF   rL   subscriptionrO   N)r   DetachSubscriptionRequestr   rS   rT   r#   rU   detach_subscriptionrW   rX   rY   rZ   r[   r   r\   r]   r^   r   r7   r@   r   r   r?   r`   ra   s          r+   r   z(PublisherAsyncClient.detach_subscription  s     t 227; ##//LL##77!--!33#66  !+ 0 
" ?##44 '"6"679&
 
 	
 
 
s   CC'C%C'c                ~  K   t        |t              rt        j                  di |}t        j
                  j                  | j                  j                  j                  dt              }t        |      t        j                  j                  d|j                  ff      fz   } |||||       d{   }|S 7 w)a  Sets the IAM access control policy on the specified function.

        Replaces any existing policy.

        Args:
            request (:class:`~.policy_pb2.SetIamPolicyRequest`):
                The request object. Request message for `SetIamPolicy`
                method.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (TimeoutType):
                The timeout for this request.
            metadata (Sequence[Tuple[str, str]]): Strings which should be
                sent along with the request as metadata.
        Returns:
            ~.policy_pb2.Policy:
                Defines an Identity and Access Management (IAM) policy.
                It is used to specify access control policies for Cloud
                Platform resources.
                A ``Policy`` is a collection of ``bindings``. A
                ``binding`` binds one or more ``members`` to a single
                ``role``. Members can be user accounts, service
                accounts, Google groups, and domains (such as G Suite).
                A ``role`` is a named list of permissions (defined by
                IAM or configured by users). A ``binding`` can
                optionally specify a ``condition``, which is a logic
                expression that further constrains the role binding
                based on attributes about the request and/or target
                resource.

                **JSON Example**

                ::
                    {
                      "bindings": [
                        {
                          "role": "roles/resourcemanager.organizationAdmin",
                          "members": [
                            "user:mike@example.com",
                            "group:admins@example.com",
                            "domain:google.com",
                            "serviceAccount:my-project-id@appspot.gserviceaccount.com"
                          ]
                        },
                        {
                          "role": "roles/resourcemanager.organizationViewer",
                          "members": ["user:eve@example.com"],
                          "condition": {
                            "title": "expirable access",
                            "description": "Does not grant access after Sep 2020",
                            "expression": "request.time <
                            timestamp('2020-10-01T00:00:00.000Z')",
                          }
                        }
                      ]
                    }

                **YAML Example**

                ::

                    bindings:
                    - members:
                      - user:mike@example.com
                      - group:admins@example.com
                      - domain:google.com
                      - serviceAccount:my-project-id@appspot.gserviceaccount.com
                      role: roles/resourcemanager.organizationAdmin
                    - members:
                      - user:eve@example.com
                      role: roles/resourcemanager.organizationViewer
                      condition:
                        title: expirable access
                        description: Does not grant access after Sep 2020
                        expression: request.time < timestamp('2020-10-01T00:00:00.000Z')

                For a description of IAM and its features, see the `IAM
                developer's
                guide <https://cloud.google.com/iam/docs>`__.
        NrN   r:   resourcerO   r=   )
isinstancedictr   SetIamPolicyRequestr   rS   rT   r#   rU   set_iam_policyr   r\   r]   r^   r   r   s          r+   r   z#PublisherAsyncClient.set_iam_policy  s     x gt$$88C7CG ##//LL##22 + 0 
 ?##44z7CSCS6T5VW&
 

 	
 
 
   B2B=4B;5B=c                ~  K   t        |t              rt        j                  di |}t        j
                  j                  | j                  j                  j                  dt              }t        |      t        j                  j                  d|j                  ff      fz   } |||||       d{   }|S 7 w)a  Gets the IAM access control policy for a function.

        Returns an empty policy if the function exists and does
        not have a policy set.

        Args:
            request (:class:`~.iam_policy_pb2.GetIamPolicyRequest`):
                The request object. Request message for `GetIamPolicy`
                method.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (TimeoutType):
                The timeout for this request.
            metadata (Sequence[Tuple[str, str]]): Strings which should be
                sent along with the request as metadata.
        Returns:
            ~.policy_pb2.Policy:
                Defines an Identity and Access Management (IAM) policy.
                It is used to specify access control policies for Cloud
                Platform resources.
                A ``Policy`` is a collection of ``bindings``. A
                ``binding`` binds one or more ``members`` to a single
                ``role``. Members can be user accounts, service
                accounts, Google groups, and domains (such as G Suite).
                A ``role`` is a named list of permissions (defined by
                IAM or configured by users). A ``binding`` can
                optionally specify a ``condition``, which is a logic
                expression that further constrains the role binding
                based on attributes about the request and/or target
                resource.

                **JSON Example**

                ::

                    {
                      "bindings": [
                        {
                          "role": "roles/resourcemanager.organizationAdmin",
                          "members": [
                            "user:mike@example.com",
                            "group:admins@example.com",
                            "domain:google.com",
                            "serviceAccount:my-project-id@appspot.gserviceaccount.com"
                          ]
                        },
                        {
                          "role": "roles/resourcemanager.organizationViewer",
                          "members": ["user:eve@example.com"],
                          "condition": {
                            "title": "expirable access",
                            "description": "Does not grant access after Sep 2020",
                            "expression": "request.time <
                            timestamp('2020-10-01T00:00:00.000Z')",
                          }
                        }
                      ]
                    }

                **YAML Example**

                ::

                    bindings:
                    - members:
                      - user:mike@example.com
                      - group:admins@example.com
                      - domain:google.com
                      - serviceAccount:my-project-id@appspot.gserviceaccount.com
                      role: roles/resourcemanager.organizationAdmin
                    - members:
                      - user:eve@example.com
                      role: roles/resourcemanager.organizationViewer
                      condition:
                        title: expirable access
                        description: Does not grant access after Sep 2020
                        expression: request.time < timestamp('2020-10-01T00:00:00.000Z')

                For a description of IAM and its features, see the `IAM
                developer's
                guide <https://cloud.google.com/iam/docs>`__.
        Nr   r   rO   r=   )r   r   r   GetIamPolicyRequestr   rS   rT   r#   rU   get_iam_policyr   r\   r]   r^   r   r   s          r+   r   z#PublisherAsyncClient.get_iam_policy~  s     | gt$$88C7CG ##//LL##22 + 0 
 ?##44z7CSCS6T5VW&
 

 	
 
 
r   c                ~  K   t        |t              rt        j                  di |}t        j
                  j                  | j                  j                  j                  dt              }t        |      t        j                  j                  d|j                  ff      fz   } |||||       d{   }|S 7 w)a~  Tests the specified permissions against the IAM access control
            policy for a function.

        If the function does not exist, this will
        return an empty set of permissions, not a NOT_FOUND error.

        Args:
            request (:class:`~.iam_policy_pb2.TestIamPermissionsRequest`):
                The request object. Request message for
                `TestIamPermissions` method.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (TimeoutType):
                The timeout for this request.
            metadata (Sequence[Tuple[str, str]]): Strings which should be
                sent along with the request as metadata.
        Returns:
            ~iam_policy_pb2.PolicyTestIamPermissionsResponse:
                Response message for ``TestIamPermissions`` method.
        Nr   r   rO   r=   )r   r   r   TestIamPermissionsRequestr   rS   rT   r#   rU   test_iam_permissionsr   r\   r]   r^   r   r   s          r+   r   z)PublisherAsyncClient.test_iam_permissions  s     @ gt$$>>IIG ##//LL##88 + 0 
 ?##44z7CSCS6T5VW&
 

 	
 
 
r   c                    K   | S wNr=   r6   s    r+   
__aenter__zPublisherAsyncClient.__aenter__4  s     s   c                 T   K   | j                   j                          d {    y 7 wr   )r5   close)r7   exc_typeexctbs       r+   	__aexit__zPublisherAsyncClient.__aexit__7  s     nn""$$$s   (&(r   )r3   r"   )`__name__
__module____qualname____doc__r    __annotations__DEFAULT_ENDPOINTDEFAULT_MTLS_ENDPOINTstaticmethodschema_pathparse_schema_pathsubscription_pathparse_subscription_path
topic_pathparse_topic_pathcommon_billing_account_path!parse_common_billing_account_pathcommon_folder_pathparse_common_folder_pathcommon_organization_pathparse_common_organization_pathcommon_project_pathparse_common_project_pathcommon_location_pathparse_common_location_pathclassmethodr   r&   strr/   from_service_account_jsonr   r   r2   propertyr   r5   	functoolspartialtypeget_transport_classr   ga_credentialsCredentialsr   r   r:   
ClientInfor<   ry   DEFAULTr   rR   OptionalRetryr   r	   r
   rV   re   r   	FieldMaskrf   ri   r   PubsubMessagePublishResponserk   rs   rt   rz   r   r|   r{   r   r   r   r   r   r   r   r   r   DetachSubscriptionResponser   r   r   r   Policyr   r   r   r   TestIamPermissionsResponser   r   r   r=   r,   r+   r"   r"   :   s	    &77+AA::;K$_%F%FG$_%F%FG*?+R+RSo889J#O$D$DE".33# )599)% &o&H&HI+O,T,TU+O,T,TU%166&" ''J'JK ,_-V-V W'(L(LM!-22" oT o o s s s !:7;!Q%m4!Q !QF &- & & ,)++_1143H =A4B267J-
 n889-
 001	-

 !/-
 ))44-
 
-
b 8<s #'66'66.0s%d 234s sm	s
 s s 5c?+s 
sn EI~ )-:>'66'66.0~% 9 94 ?@A~ %	~
 n667~ ~ ~ 5c?+~ 
~D AE{  $DH'66'66.0{% 5 5t ;<={ }	{
 ?6+?+?@A{ { { 5c?+{ 
		{~ BFm  $'66'66.0m% 6 6 <=>m }	m
 m m 5c?+m 
mb DH{ "&'66'66.0{% 8 8$ >?@{ #	{
 { { 5c?+{ 
	$	${~ PT}  $'66'66.0}% D Dd JKL} }	}
 } } 5c?+} 
	0	0}B LPA  $'66'66.0A% @ @$ FGHA }	A
 A A 5c?+A 
	,	,AJ EIf
  $'66'66.0f
% 9 94 ?@Af
 }	f

 f
 f
 5c?+f
 
f
T LP^  (66'66.0^% @ @$ FGH^ 	^
 ^ 5c?+^ 
	*	*^D AEv  (66'66.0v.<<=v 	v
 v 5c?+v 
		vt AEx  (66'66.0x.<<=x 	x
 x 5c?+x 
		xx GK:  (66'66.0:.BBC: 	:
 : 5c?+: 
	2	2:x%r,   r"   )client_library_version)r"   )=collectionsr   r   retypingr   r   r   r   r   r	   r
   r   r   google.pubsub_v1r   package_versiongoogle.api_core.client_optionsr   google.api_corer   rZ   r   r   rW   r   timeoutsgoogle.authr   r   google.oauth2r   rX   ry   _MethodDefaultr   AttributeErrorobjectgoogle.iam.v1r   r   cloudsdk.google.protobufr   r   #google.pubsub_v1.services.publisherr   google.pubsub_v1.typesr   r   transports.baser   r   transports.grpc_asyncior   clientr    r"   r:   r   __version____all__r=   r,   r+   <module>r      s     $  	
 
 
 > 8 9 $ , / 5 )1'--)G)GGHM ) $ 1 3 6 ) . D B #~% ~%B0 **55*66 6  
 $k0  1'--/0M1s   %C, ,DD