# Stackdriver Logging V2 Client - Class LogBucket (2.1.0)

2.1.0 (latest) 2.0.0 1.34.5 1.33.0 1.32.3 1.31.3 1.30.3 1.29.0 1.28.5 1.27.1 1.26.0 1.25.5 1.24.10 Reference documentation and code samples for the Stackdriver Logging V2 Client class LogBucket.

Describes a repository in which log entries are stored.

Generated from protobuf message `google.logging.v2.LogBucket`

## Namespace

Google \\ Cloud \\ Logging \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` Output only. The resource name of the bucket. For example: `projects/my-project/locations/global/buckets/my-bucket` For a list of supported locations, see [Supported Regions](https://cloud.google.com/logging/docs/region-support) For the location of `global` it is unspecified where log entries are actually stored. After a bucket has been created, the location cannot be changed. |
| `↳ description` | `string` Describes this bucket. |
| `↳ create_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Output only. The creation timestamp of the bucket. This is not set for any of the default buckets. |
| `↳ update_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Output only. The last update timestamp of the bucket. |
| `↳ retention_days` | `int` Logs will be retained by default for this amount of time, after which they will automatically be deleted. The minimum retention period is 1 day. If this value is set to zero at bucket creation time, the default time of 30 days will be used. |
| `↳ locked` | `bool` Whether the bucket is locked. The retention period on a locked bucket cannot be changed. Locked buckets may only be deleted if they are empty. |
| `↳ lifecycle_state` | `int` Output only. The bucket lifecycle state. |
| `↳ analytics_enabled` | `bool` Whether log analytics is enabled for this bucket. Once enabled, log analytics features cannot be disabled. |
| `↳ restricted_fields` | `string[]` Log entry field paths that are denied access in this bucket. The following fields and their children are eligible: `textPayload`, `jsonPayload`, `protoPayload`, `httpRequest`, `labels`, `sourceLocation`. Restricting a repeated field will restrict all values. Adding a parent will block all child fields. (e.g. `foo.bar` will block `foo.bar.baz`) |
| `↳ index_configs` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-logging/latest/V2.IndexConfig>` A list of indexed fields and related configuration data. |
| `↳ cmek_settings` | `https://docs.cloud.google.com/php/docs/reference/cloud-logging/latest/V2.CmekSettings` The CMEK settings of the log bucket. If present, new log entries written to this log bucket are encrypted using the CMEK key provided in this configuration. If a log bucket has CMEK settings, the CMEK settings cannot be disabled later by updating the log bucket. Changing the KMS key is allowed. |

### getName

Output only. The resource name of the bucket.

For example:
`projects/my-project/locations/global/buckets/my-bucket`
For a list of supported locations, see [Supported
Regions](https://cloud.google.com/logging/docs/region-support)
For the location of `global` it is unspecified where log entries are
actually stored.
After a bucket has been created, the location cannot be changed.

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

### setName

Output only. The resource name of the bucket.

For example:
`projects/my-project/locations/global/buckets/my-bucket`
For a list of supported locations, see [Supported
Regions](https://cloud.google.com/logging/docs/region-support)
For the location of `global` it is unspecified where log entries are
actually stored.
After a bucket has been created, the location cannot be changed.

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

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

### getDescription

Describes this bucket.

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

### setDescription

Describes this bucket.

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

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

### getCreateTime

Output only. The creation timestamp of the bucket. This is not set for any
of the default buckets.

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

### hasCreateTime

### clearCreateTime

### setCreateTime

Output only. The creation timestamp of the bucket. This is not set for any
of the default buckets.

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

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

### getUpdateTime

Output only. The last update timestamp of the bucket.

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

### hasUpdateTime

### clearUpdateTime

### setUpdateTime

Output only. The last update timestamp of the bucket.

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

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

### getRetentionDays

Logs will be retained by default for this amount of time, after which they
will automatically be deleted. The minimum retention period is 1 day. If
this value is set to zero at bucket creation time, the default time of 30
days will be used.

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

### setRetentionDays

Logs will be retained by default for this amount of time, after which they
will automatically be deleted. The minimum retention period is 1 day. If
this value is set to zero at bucket creation time, the default time of 30
days will be used.

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

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

### getLocked

Whether the bucket is locked.

The retention period on a locked bucket cannot be changed. Locked buckets
may only be deleted if they are empty.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### setLocked

Whether the bucket is locked.

The retention period on a locked bucket cannot be changed. Locked buckets
may only be deleted if they are empty.

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

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

### getLifecycleState

Output only. The bucket lifecycle state.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [LifecycleState](https://docs.cloud.google.com/php/docs/reference/cloud-logging/latest/V2.LifecycleState). |

### setLifecycleState

Output only. The bucket lifecycle state.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [LifecycleState](https://docs.cloud.google.com/php/docs/reference/cloud-logging/latest/V2.LifecycleState). |

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

### getAnalyticsEnabled

Whether log analytics is enabled for this bucket.

Once enabled, log analytics features cannot be disabled.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### setAnalyticsEnabled

Whether log analytics is enabled for this bucket.

Once enabled, log analytics features cannot be disabled.

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

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

### getRestrictedFields

Log entry field paths that are denied access in this bucket.

The following fields and their children are eligible: `textPayload`,
`jsonPayload`, `protoPayload`, `httpRequest`, `labels`, `sourceLocation`.
Restricting a repeated field will restrict all values. Adding a parent will
block all child fields. (e.g. `foo.bar` will block `foo.bar.baz`)

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setRestrictedFields

Log entry field paths that are denied access in this bucket.

The following fields and their children are eligible: `textPayload`,
`jsonPayload`, `protoPayload`, `httpRequest`, `labels`, `sourceLocation`.
Restricting a repeated field will restrict all values. Adding a parent will
block all child fields. (e.g. `foo.bar` will block `foo.bar.baz`)

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

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

### getIndexConfigs

A list of indexed fields and related configuration data.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-logging/latest/V2.IndexConfig>` |   |

### setIndexConfigs

A list of indexed fields and related configuration data.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-logging/latest/V2.IndexConfig>` |

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

### getCmekSettings

The CMEK settings of the log bucket. If present, new log entries written to
this log bucket are encrypted using the CMEK key provided in this
configuration. If a log bucket has CMEK settings, the CMEK settings cannot
be disabled later by updating the log bucket. Changing the KMS key is
allowed.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-logging/latest/V2.CmekSettings|null` |   |

### hasCmekSettings

### clearCmekSettings

### setCmekSettings

The CMEK settings of the log bucket. If present, new log entries written to
this log bucket are encrypted using the CMEK key provided in this
configuration. If a log bucket has CMEK settings, the CMEK settings cannot
be disabled later by updating the log bucket. Changing the KMS key is
allowed.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-logging/latest/V2.CmekSettings` |

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