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);
Methods
__construct
Parameters | |
---|---|
Name | Description |
connection |
Google\Cloud\PubSub\Connection\ConnectionInterface
A connection to Cloud Pub/Sub |
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 |
clientConfig |
array
[optional] Configuration options for the PubSub client used to handle processing of batch items through the daemon. For valid options please see {@see}. Defaults to the options provided to the PubSub client associated with this instance. |
name
Get the Snapshot name.
Example:
echo $snapshot->name();
Returns | |
---|---|
Type | Description |
string |
info
Get the snapshot info.
Example:
$info = $snapshot->info();
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
options |
array
[optional] Configuration options. |
Returns | |
---|---|
Type | Description |
array |
delete
Delete the snapshot.
Please note that this method may not yet be available in your project.
Example:
$snapshot->delete();
Parameter | |
---|---|
Name | Description |
options |
array
[optional] Configuration options. |
Returns | |
---|---|
Type | Description |
void |
topic
Get the Topic attached to the snapshot, if one exists.
Example:
$topic = $snapshot->topic();
Returns | |
---|---|
Type | Description |
Google\Cloud\PubSub\Topic|null |
subscription
Get the Subscription attached to the snapshot, if one exists.
Example:
$subscription = $snapshot->subscription();
Returns | |
---|---|
Type | Description |
Google\Cloud\PubSub\Subscription|null |