Cloud PubSub Client - Class Snapshot (1.47.0)

Reference documentation and code samples for the Cloud PubSub Client class Snapshot.

Represents a Pub/Sub Snapshot

Example:

use Google\Cloud\PubSub\PubSubClient;

$pubsub = new PubSubClient();

$snapshot = $pubsub->snapshot($snapshotName);

Namespace

Google \ Cloud \ PubSub

Methods

__construct

Parameters
NameDescription
connection Google\Cloud\PubSub\Connection\ConnectionInterface

A connection to Cloud Pub/Sub This object is created by PubSubClient, and should not be instantiated outside of this client.

projectId string

The current Project ID.

name string

The snapshot name.

encode bool

Whether certain request arguments should be base64-encoded.

info array

[optional] The snapshot data. When creating a Snapshot, this array must contain a $info.subscription argument with a fully-qualified subscription name.

clientConfig array

[optional] Configuration options for the PubSub client used to handle processing of batch items through the daemon. For valid options please see Google\Cloud\PubSub\PubSubClient::__construct(). Defaults to the options provided to the PubSub client associated with this instance.

name

Get the Snapshot name.

Example:

echo $snapshot->name();
Returns
TypeDescription
string

info

Get the snapshot info.

Example:

$info = $snapshot->info();
Returns
TypeDescription
array

create

Create a new Snapshot.

When creating a snapshot, a subscription name must be supplied at instantiation.

Please note that this method may not yet be available in your project.

Example:

$info = $snapshot->create();
Parameter
NameDescription
options array

[optional] Configuration options.

Returns
TypeDescription
array

delete

Delete the snapshot.

Please note that this method may not yet be available in your project.

Example:

$snapshot->delete();
Parameter
NameDescription
options array

[optional] Configuration options.

Returns
TypeDescription
void

topic

Get the Topic attached to the snapshot, if one exists.

Example:

$topic = $snapshot->topic();
Returns
TypeDescription
Google\Cloud\PubSub\Topic|null

subscription

Get the Subscription attached to the snapshot, if one exists.

Example:

$subscription = $snapshot->subscription();
Returns
TypeDescription
Google\Cloud\PubSub\Subscription|null

__debugInfo