# Cloud PubSub V1 Client - Class CloudStorageConfig (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 CloudStorageConfig.

Configuration for a Cloud Storage subscription.

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

## Namespace

Google \\ Cloud \\ PubSub \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ bucket` | `string` Required. User-provided name for the Cloud Storage bucket. The bucket must be created by the user. The bucket name must be without any prefix like "gs://". See the [bucket naming requirements](https://cloud.google.com/storage/docs/buckets#naming). |
| `↳ filename_prefix` | `string` Optional. User-provided prefix for Cloud Storage filename. See the [object naming requirements](https://cloud.google.com/storage/docs/objects#naming). |
| `↳ filename_suffix` | `string` Optional. User-provided suffix for Cloud Storage filename. See the [object naming requirements](https://cloud.google.com/storage/docs/objects#naming). Must not end in "/". |
| `↳ filename_datetime_format` | `string` Optional. User-provided format string specifying how to represent datetimes in Cloud Storage filenames. See the [datetime format guidance](https://cloud.google.com/pubsub/docs/create-cloudstorage-subscription#file_names). |
| `↳ text_config` | `https://docs.cloud.google.com/php/docs/reference/cloud-pubsub/latest/V1.CloudStorageConfig.TextConfig` Optional. If set, message data will be written to Cloud Storage in text format. |
| `↳ avro_config` | `https://docs.cloud.google.com/php/docs/reference/cloud-pubsub/latest/V1.CloudStorageConfig.AvroConfig` Optional. If set, message data will be written to Cloud Storage in Avro format. |
| `↳ max_duration` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration` Optional. The maximum duration that can elapse before a new Cloud Storage file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not exceed the subscription's acknowledgment deadline. |
| `↳ max_bytes` | `int|string` Optional. The maximum bytes that can be written to a Cloud Storage file before a new file is created. Min 1 KB, max 10 GiB. The max_bytes limit may be exceeded in cases where messages are larger than the limit. |
| `↳ max_messages` | `int|string` Optional. The maximum number of messages that can be written to a Cloud Storage file before a new file is created. Min 1000 messages. |
| `↳ state` | `int` Output only. An output-only field that indicates whether or not the subscription can receive messages. |
| `↳ service_account_email` | `string` Optional. The service account to use to write to Cloud Storage. The subscription creator or updater that specifies this field must have `iam.serviceAccounts.actAs` permission on the service account. If not specified, the Pub/Sub [service agent](https://cloud.google.com/iam/docs/service-agents), service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used. |

### getBucket

Required. User-provided name for the Cloud Storage bucket.

The bucket must be created by the user. The bucket name must be without
any prefix like "gs://". See the [bucket naming
requirements](https://cloud.google.com/storage/docs/buckets#naming).

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

### setBucket

Required. User-provided name for the Cloud Storage bucket.

The bucket must be created by the user. The bucket name must be without
any prefix like "gs://". See the [bucket naming
requirements](https://cloud.google.com/storage/docs/buckets#naming).

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

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

### getFilenamePrefix

Optional. User-provided prefix for Cloud Storage filename. See the [object
naming requirements](https://cloud.google.com/storage/docs/objects#naming).

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

### setFilenamePrefix

Optional. User-provided prefix for Cloud Storage filename. See the [object
naming requirements](https://cloud.google.com/storage/docs/objects#naming).

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

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

### getFilenameSuffix

Optional. User-provided suffix for Cloud Storage filename. See the [object
naming requirements](https://cloud.google.com/storage/docs/objects#naming).

Must not end in "/".

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

### setFilenameSuffix

Optional. User-provided suffix for Cloud Storage filename. See the [object
naming requirements](https://cloud.google.com/storage/docs/objects#naming).

Must not end in "/".

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

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

### getFilenameDatetimeFormat

Optional. User-provided format string specifying how to represent datetimes
in Cloud Storage filenames. See the [datetime format
guidance](https://cloud.google.com/pubsub/docs/create-cloudstorage-subscription#file_names).

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

### setFilenameDatetimeFormat

Optional. User-provided format string specifying how to represent datetimes
in Cloud Storage filenames. See the [datetime format
guidance](https://cloud.google.com/pubsub/docs/create-cloudstorage-subscription#file_names).

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

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

### getTextConfig

Optional. If set, message data will be written to Cloud Storage in text
format.

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

### hasTextConfig

### setTextConfig

Optional. If set, message data will be written to Cloud Storage in text
format.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-pubsub/latest/V1.CloudStorageConfig.TextConfig` |

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

### getAvroConfig

Optional. If set, message data will be written to Cloud Storage in Avro
format.

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

### hasAvroConfig

### setAvroConfig

Optional. If set, message data will be written to Cloud Storage in Avro
format.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-pubsub/latest/V1.CloudStorageConfig.AvroConfig` |

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

### getMaxDuration

Optional. The maximum duration that can elapse before a new Cloud Storage
file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not
exceed the subscription's acknowledgment deadline.

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

### hasMaxDuration

### clearMaxDuration

### setMaxDuration

Optional. The maximum duration that can elapse before a new Cloud Storage
file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not
exceed the subscription's acknowledgment deadline.

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

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

### getMaxBytes

Optional. The maximum bytes that can be written to a Cloud Storage file
before a new file is created. Min 1 KB, max 10 GiB. The max_bytes limit may
be exceeded in cases where messages are larger than the limit.

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

### setMaxBytes

Optional. The maximum bytes that can be written to a Cloud Storage file
before a new file is created. Min 1 KB, max 10 GiB. The max_bytes limit may
be exceeded in cases where messages are larger than the limit.

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

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

### getMaxMessages

Optional. The maximum number of messages that can be written to a Cloud
Storage file before a new file is created. Min 1000 messages.

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

### setMaxMessages

Optional. The maximum number of messages that can be written to a Cloud
Storage file before a new file is created. Min 1000 messages.

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

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

### getState

Output only. An output-only field that indicates whether or not the
subscription can receive messages.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [State](https://docs.cloud.google.com/php/docs/reference/cloud-pubsub/latest/V1.CloudStorageConfig.State). |

### setState

Output only. An output-only field that indicates whether or not the
subscription can receive messages.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [State](https://docs.cloud.google.com/php/docs/reference/cloud-pubsub/latest/V1.CloudStorageConfig.State). |

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

### getServiceAccountEmail

Optional. The service account to use to write to Cloud Storage. The
subscription creator or updater that specifies this field must have
`iam.serviceAccounts.actAs` permission on the service account. If not
specified, the Pub/Sub
[service agent](https://cloud.google.com/iam/docs/service-agents),
service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.

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

### setServiceAccountEmail

Optional. The service account to use to write to Cloud Storage. The
subscription creator or updater that specifies this field must have
`iam.serviceAccounts.actAs` permission on the service account. If not
specified, the Pub/Sub
[service agent](https://cloud.google.com/iam/docs/service-agents),
service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.

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

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

### getOutputFormat

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