Seeks an existing subscription to a point in time or to a given snapshot,
        whichever is provided in the request. Snapshots are used in
        <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
        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. Note that both the subscription and the snapshot
        must be on the same topic.<br><br>
        <b>BETA:</b> This feature is part of a beta release. This API might be
        changed in backward-incompatible ways and is not recommended for production
        use. It is not subject to any SLA or deprecation policy.

        Example:
            >>> from google.cloud import pubsub_v1
            >>>
            >>> client = pubsub_v1.SubscriberClient()
            >>>
            >>> subscription = client.subscription_path('[PROJECT]', '[SUBSCRIPTION]')
            >>>
            >>> response = client.seek(subscription)

        Args:
            subscription (str): The subscription to affect.
            time (Union[dict, ~google.cloud.pubsub_v1.types.Timestamp]): The time to seek to. Messages retained in the subscription that were
                published before this time are marked as acknowledged, and messages
                retained in the subscription that were published after this time are
                marked as unacknowledged. Note that this operation affects only those
                messages retained in the subscription (configured by the combination of
                ``message_retention_duration`` and ``retain_acked_messages``). For
                example, if ``time`` corresponds to a point before the message retention
                window (or to a point before the system's notion of the subscription
                creation time), only retained messages will be marked as unacknowledged,
                and already-expunged messages will not be restored.

                If a dict is provided, it must be of the same form as the protobuf
                message :class:`~google.cloud.pubsub_v1.types.Timestamp`
            snapshot (str): The snapshot to seek to. The snapshot's topic must be the same as that
                of the provided subscription. Format is
                ``projects/{project}/snapshots/{snap}``.
            retry (Optional[google.api_core.retry.Retry]):  A retry object used
                to retry requests. If ``None`` is specified, requests will not
                be retried.
            timeout (Optional[float]): The amount of time, in seconds, to wait
                for the request to complete. Note that if ``retry`` is
                specified, the timeout applies to each individual attempt.
            metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
                that is provided to the method.

        Returns:
            A :class:`~google.cloud.pubsub_v1.types.SeekResponse` instance.

        Raises:
            google.api_core.exceptions.GoogleAPICallError: If the request
                    failed for any reason.
            google.api_core.exceptions.RetryError: If the request failed due
                    to a retryable error and retry attempts failed.
            ValueError: If the parameters are invalid.

def seek(
        self,
        subscription,
        time=None,
        snapshot=None,
        retry=google.api_core.gapic_v1.method.DEFAULT,
        timeout=google.api_core.gapic_v1.method.DEFAULT,
        metadata=None,
    ):
        """
        Seeks an existing subscription to a point in time or to a given snapshot,
        whichever is provided in the request. Snapshots are used in
        <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
        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. Note that both the subscription and the snapshot
        must be on the same topic.<br><br>
        <b>BETA:</b> This feature is part of a beta release. This API might be
        changed in backward-incompatible ways and is not recommended for production
        use. It is not subject to any SLA or deprecation policy.

        Example:
            >>> from google.cloud import pubsub_v1
            >>>
            >>> client = pubsub_v1.SubscriberClient()
            >>>
            >>> subscription = client.subscription_path('[PROJECT]', '[SUBSCRIPTION]')
            >>>
            >>> response = client.seek(subscription)

        Args:
            subscription (str): The subscription to affect.
            time (Union[dict, ~google.cloud.pubsub_v1.types.Timestamp]): The time to seek to. Messages retained in the subscription that were
                published before this time are marked as acknowledged, and messages
                retained in the subscription that were published after this time are
                marked as unacknowledged. Note that this operation affects only those
                messages retained in the subscription (configured by the combination of
                ``message_retention_duration`` and ``retain_acked_messages``). For
                example, if ``time`` corresponds to a point before the message retention
                window (or to a point before the system's notion of the subscription
                creation time), only retained messages will be marked as unacknowledged,
                and already-expunged messages will not be restored.

                If a dict is provided, it must be of the same form as the protobuf
                message :class:`~google.cloud.pubsub_v1.types.Timestamp`
            snapshot (str): The snapshot to seek to. The snapshot's topic must be the same as that
                of the provided subscription. Format is
                ``projects/{project}/snapshots/{snap}``.
            retry (Optional[google.api_core.retry.Retry]):  A retry object used
                to retry requests. If ``None`` is specified, requests will not
                be retried.
            timeout (Optional[float]): The amount of time, in seconds, to wait
                for the request to complete. Note that if ``retry`` is
                specified, the timeout applies to each individual attempt.
            metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
                that is provided to the method.

        Returns:
            A :class:`~google.cloud.pubsub_v1.types.SeekResponse` instance.

        Raises:
            google.api_core.exceptions.GoogleAPICallError: If the request
                    failed for any reason.
            google.api_core.exceptions.RetryError: If the request failed due
                    to a retryable error and retry attempts failed.
            ValueError: If the parameters are invalid.
        """
        # Wrap the transport method to add retry and timeout logic.
        if "seek" not in self._inner_api_calls:
            self._inner_api_calls["seek"] = google.api_core.gapic_v1.method.wrap_method(
                self.transport.seek,
                default_retry=self._method_configs["Seek"].retry,
                default_timeout=self._method_configs["Seek"].timeout,
                client_info=self._client_info,
            )

        # Sanity check: We have some fields which are mutually exclusive;
        # raise ValueError if more than one is sent.
        google.api_core.protobuf_helpers.check_oneof(time=time, snapshot=snapshot)

        request = pubsub_pb2.SeekRequest(
            subscription=subscription, time=time, snapshot=snapshot
        )
        if metadata is None:
            metadata = []
        metadata = list(metadata)
        try:
            routing_header = [("subscription", subscription)]
        except AttributeError:
            pass
        else:
            routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
                routing_header
            )
            metadata.append(routing_metadata)

        return self._inner_api_calls["seek"](
            request, retry=retry, timeout=timeout, metadata=metadata
        )