# Cloud PubSub V1 Client - Class CreateSnapshotRequest (2.19.3)

2.19.3 (latest) 2.19.2 2.18.0 2.17.0 2.16.2 2.15.1 2.14.0 2.13.2 2.12.0 2.11.3 2.10.1 2.9.1 2.8.2 2.7.0 2.6.0 2.5.2 2.4.0 2.3.0 2.2.1 2.1.2 1.50.0 1.49.0 1.48.0 1.47.0 1.46.5 1.45.2 1.44.0 1.43.2 1.42.1 1.41.3 1.40.1 1.39.3 Reference documentation and code samples for the Cloud PubSub V1 Client class CreateSnapshotRequest.

Request for the `CreateSnapshot` method.

Generated from protobuf message `google.pubsub.v1.CreateSnapshotRequest`

## Namespace

Google \\ Cloud \\ PubSub \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` Required. User-provided name for this snapshot. If the name is not provided in the request, the server will assign a random name for this snapshot on the same project as the subscription. Note that for REST API requests, you must specify a name. See the [resource name rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). Format is `projects/{project}/snapshots/{snap}`. |
| `↳ subscription` | `string` Required. The subscription whose backlog the snapshot retains. Specifically, the created snapshot is guaranteed to retain: (a) The existing backlog on the subscription. More precisely, this is defined as the messages in the subscription's backlog that are unacknowledged upon the successful completion of the `CreateSnapshot` request; as well as: (b) Any messages published to the subscription's topic following the successful completion of the CreateSnapshot request. Format is `projects/{project}/subscriptions/{sub}`. |
| `↳ labels` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` Optional. See [Creating and managing labels](https://cloud.google.com/pubsub/docs/labels). |
| `↳ tags` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` Optional. Input only. Immutable. Tag keys/values directly bound to this resource. For example: "123/environment": "production", "123/costCenter": "marketing" See <https://docs.cloud.google.com/pubsub/docs/tags> for more information on using tags with Pub/Sub resources. |

### getName

Required. User-provided name for this snapshot. If the name is not provided
in the request, the server will assign a random name for this snapshot on
the same project as the subscription. Note that for REST API requests, you
must specify a name. See the [resource name
rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).

Format is `projects/{project}/snapshots/{snap}`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

Required. User-provided name for this snapshot. If the name is not provided
in the request, the server will assign a random name for this snapshot on
the same project as the subscription. Note that for REST API requests, you
must specify a name. See the [resource name
rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).

Format is `projects/{project}/snapshots/{snap}`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSubscription

Required. The subscription whose backlog the snapshot retains.

Specifically, the created snapshot is guaranteed to retain:
(a) The existing backlog on the subscription. More precisely, this is
defined as the messages in the subscription's backlog that are
unacknowledged upon the successful completion of the
`CreateSnapshot` request; as well as:
(b) Any messages published to the subscription's topic following the
successful completion of the CreateSnapshot request.
Format is `projects/{project}/subscriptions/{sub}`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setSubscription

Required. The subscription whose backlog the snapshot retains.

Specifically, the created snapshot is guaranteed to retain:
(a) The existing backlog on the subscription. More precisely, this is
defined as the messages in the subscription's backlog that are
unacknowledged upon the successful completion of the
`CreateSnapshot` request; as well as:
(b) Any messages published to the subscription's topic following the
successful completion of the CreateSnapshot request.
Format is `projects/{project}/subscriptions/{sub}`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getLabels

Optional. See [Creating and managing
labels](https://cloud.google.com/pubsub/docs/labels).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |   |

### setLabels

Optional. See [Creating and managing
labels](https://cloud.google.com/pubsub/docs/labels).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getTags

Optional. Input only. Immutable. Tag keys/values directly bound to this
resource. For example:
"123/environment": "production",
"123/costCenter": "marketing"
See <https://docs.cloud.google.com/pubsub/docs/tags> for more information on
using tags with Pub/Sub resources.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |   |

### setTags

Optional. Input only. Immutable. Tag keys/values directly bound to this
resource. For example:
"123/environment": "production",
"123/costCenter": "marketing"
See <https://docs.cloud.google.com/pubsub/docs/tags> for more information on
using tags with Pub/Sub resources.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### static::build

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `name` | `string` Required. User-provided name for this snapshot. If the name is not provided in the request, the server will assign a random name for this snapshot on the same project as the subscription. Note that for REST API requests, you must specify a name. See the [resource name rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). Format is `projects/{project}/snapshots/{snap}`. Please see SubscriberClient::snapshotName() for help formatting this field. |
| `subscription` | `string` Required. The subscription whose backlog the snapshot retains. Specifically, the created snapshot is guaranteed to retain: (a) The existing backlog on the subscription. More precisely, this is defined as the messages in the subscription's backlog that are unacknowledged upon the successful completion of the `CreateSnapshot` request; as well as: (b) Any messages published to the subscription's topic following the successful completion of the CreateSnapshot request. Format is `projects/{project}/subscriptions/{sub}`. Please see SubscriberClient::subscriptionName() for help formatting this field. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-pubsub/latest/V1.CreateSnapshotRequest` |   |