As of January 1, 2020 this library no longer supports Python 2 on the latest released version. Library versions released prior to that date will continue to be available. For more information please visit Python 2 support on Google Cloud.

Admin Client API

class google.cloud.pubsublite.admin_client.AdminClient(region: google.cloud.pubsublite.types.location.CloudRegion, credentials: Optional[google.auth.credentials.Credentials] = None, transport: Optional[str] = None, client_options: Optional[google.api_core.client_options.ClientOptions] = None)[source]

An admin client for Pub/Sub Lite. Only operates on a single region.

Create a new AdminClient.

Parameters
  • region – The cloud region to connect to.

  • credentials – The credentials to use when connecting.

  • transport – The transport to use.

  • client_options – The client options to use when connecting. If used, must explicitly set api_endpoint.

create_reservation(reservation: google.cloud.pubsublite_v1.types.common.Reservation) google.cloud.pubsublite_v1.types.common.Reservation[source]

Create a reservation, returns the created reservation.

create_subscription(subscription: google.cloud.pubsublite_v1.types.common.Subscription, target: Union[google.cloud.pubsublite.types.backlog_location.BacklogLocation, google.cloud.pubsublite.types.backlog_location.PublishTime, google.cloud.pubsublite.types.backlog_location.EventTime] = BacklogLocation.END, starting_offset: Optional[google.cloud.pubsublite.types.backlog_location.BacklogLocation] = None) google.cloud.pubsublite_v1.types.common.Subscription[source]

Create a subscription, returns the created subscription. By default a subscription will only receive messages published after the subscription was created.

starting_offset is deprecated. Use target to initialize the subscription to a target location within the message backlog instead. starting_offset has higher precedence if target is also set.

A seek is initiated if the target location is a publish or event time. If the seek fails, the created subscription is not deleted.

create_topic(topic: google.cloud.pubsublite_v1.types.common.Topic) google.cloud.pubsublite_v1.types.common.Topic[source]

Create a topic, returns the created topic.

delete_reservation(reservation_path: google.cloud.pubsublite.types.paths.ReservationPath)[source]

Delete a reservation and all associated messages.

delete_subscription(subscription_path: google.cloud.pubsublite.types.paths.SubscriptionPath)[source]

Delete a subscription and all associated messages.

delete_topic(topic_path: google.cloud.pubsublite.types.paths.TopicPath)[source]

Delete a topic and all associated messages.

get_reservation(reservation_path: google.cloud.pubsublite.types.paths.ReservationPath) google.cloud.pubsublite_v1.types.common.Reservation[source]

Get the reservation object from the server.

get_subscription(subscription_path: google.cloud.pubsublite.types.paths.SubscriptionPath) google.cloud.pubsublite_v1.types.common.Subscription[source]

Get the subscription object from the server.

get_topic(topic_path: google.cloud.pubsublite.types.paths.TopicPath) google.cloud.pubsublite_v1.types.common.Topic[source]

Get the topic object from the server.

get_topic_partition_count(topic_path: google.cloud.pubsublite.types.paths.TopicPath) int[source]

Get the number of partitions in the provided topic.

list_reservation_topics(reservation_path: google.cloud.pubsublite.types.paths.ReservationPath) List[google.cloud.pubsublite.types.paths.TopicPath][source]

List the subscriptions that exist for a given reservation.

list_reservations(location_path: google.cloud.pubsublite.types.paths.LocationPath) List[google.cloud.pubsublite_v1.types.common.Reservation][source]

List the Pub/Sub lite reservations that exist for a project in a given location.

list_subscriptions(location_path: google.cloud.pubsublite.types.paths.LocationPath) List[google.cloud.pubsublite_v1.types.common.Subscription][source]

List the Pub/Sub lite subscriptions that exist for a project in a given location.

list_topic_subscriptions(topic_path: google.cloud.pubsublite.types.paths.TopicPath) List[google.cloud.pubsublite.types.paths.SubscriptionPath][source]

List the subscriptions that exist for a given topic.

list_topics(location_path: google.cloud.pubsublite.types.paths.LocationPath) List[google.cloud.pubsublite_v1.types.common.Topic][source]

List the Pub/Sub lite topics that exist for a project in a given location.

region() google.cloud.pubsublite.types.location.CloudRegion[source]

The region this client is for.

seek_subscription(subscription_path: google.cloud.pubsublite.types.paths.SubscriptionPath, target: Union[google.cloud.pubsublite.types.backlog_location.BacklogLocation, google.cloud.pubsublite.types.backlog_location.PublishTime, google.cloud.pubsublite.types.backlog_location.EventTime]) google.api_core.operation.Operation[source]

Initiate an out-of-band seek for a subscription to a specified target.

The seek target may be timestamps or named positions within the message backlog See https://cloud.google.com/pubsub/lite/docs/seek for more information.

Returns

result type: google.cloud.pubsublite.SeekSubscriptionResponse metadata type: google.cloud.pubsublite.OperationMetadata

Return type

google.api_core.operation.Operation with

update_reservation(reservation: google.cloud.pubsublite_v1.types.common.Reservation, update_mask: google.protobuf.field_mask_pb2.FieldMask) google.cloud.pubsublite_v1.types.common.Reservation[source]

Update the masked fields of the provided reservation.

update_subscription(subscription: google.cloud.pubsublite_v1.types.common.Subscription, update_mask: google.protobuf.field_mask_pb2.FieldMask) google.cloud.pubsublite_v1.types.common.Subscription[source]

Update the masked fields of the provided subscription.

update_topic(topic: google.cloud.pubsublite_v1.types.common.Topic, update_mask: google.protobuf.field_mask_pb2.FieldMask) google.cloud.pubsublite_v1.types.common.Topic[source]

Update the masked fields of the provided topic.