# Google Cloud Backup Dr V1 Client - Class BackupPlan (0.13.0)

0.13.0 (latest) 0.12.1 0.11.1 0.10.0 0.9.0 0.8.1 0.7.0 0.6.2 0.5.1 0.4.2 0.3.0 0.2.0 0.1.0 Reference documentation and code samples for the Google Cloud Backup Dr V1 Client class BackupPlan.

A `BackupPlan` specifies some common fields, such as `description` as well
as one or more `BackupRule` messages. Each `BackupRule` has a retention
policy and defines a schedule by which the system is to perform backup
workloads.

Generated from protobuf message `google.cloud.backupdr.v1.BackupPlan`

## Namespace

Google \\ Cloud \\ BackupDR \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` Output only. Identifier. The resource name of the `BackupPlan`. Format: `projects/{project}/locations/{location}/backupPlans/{backup_plan}` |
| `↳ description` | `string` Optional. The description of the `BackupPlan` resource. The description allows for additional details about `BackupPlan` and its use cases to be provided. An example description is the following: "This is a backup plan that performs a daily backup at 6pm and retains data for 3 months". The description must be at most 2048 characters. |
| `↳ labels` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` Optional. This collection of key/value pairs allows for custom labels to be supplied by the user. Example, {"tag": "Weekly"}. |
| `↳ create_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Output only. When the `BackupPlan` was created. |
| `↳ update_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Output only. When the `BackupPlan` was last updated. |
| `↳ backup_rules` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-backupdr/latest/V1.BackupRule>` Required. The backup rules for this `BackupPlan`. There must be at least one `BackupRule` message. |
| `↳ state` | `int` Output only. The `State` for the `BackupPlan`. |
| `↳ resource_type` | `string` Required. The resource type to which the `BackupPlan` will be applied. Examples include, "compute.googleapis.com/Instance", "sqladmin.googleapis.com/Instance", "alloydb.googleapis.com/Cluster", "compute.googleapis.com/Disk". |
| `↳ etag` | `string` Optional. `etag` is returned from the service in the response. As a user of the service, you may provide an etag value in this field to prevent stale resources. |
| `↳ backup_vault` | `string` Required. Resource name of backup vault which will be used as storage location for backups. Format: projects/{project}/locations/{location}/backupVaults/{backupvault} |
| `↳ backup_vault_service_account` | `string` Output only. The Google Cloud Platform Service Account to be used by the BackupVault for taking backups. Specify the email address of the Backup Vault Service Account. |
| `↳ log_retention_days` | `int|string` Optional. Applicable only for CloudSQL and AlloyDB resource_type. Configures how long logs will be stored. It is defined in "days". This value should be greater than or equal to minimum enforced log retention duration of the backup vault. |
| `↳ supported_resource_types` | `string[]` Output only. All resource types to which backupPlan can be applied. |
| `↳ revision_id` | `string` Output only. The user friendly revision ID of the `BackupPlanRevision`. Example: v0, v1, v2, etc. |
| `↳ revision_name` | `string` Output only. The resource id of the `BackupPlanRevision`. Format: `projects/{project}/locations/{location}/backupPlans/{backup_plan}/revisions/{revision_id}` |

### getName

Output only. Identifier. The resource name of the `BackupPlan`.

Format: `projects/{project}/locations/{location}/backupPlans/{backup_plan}`

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

### setName

Output only. Identifier. The resource name of the `BackupPlan`.

Format: `projects/{project}/locations/{location}/backupPlans/{backup_plan}`

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

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

### getDescription

Optional. The description of the `BackupPlan` resource.

The description allows for additional details about `BackupPlan` and its
use cases to be provided. An example description is the following: "This
is a backup plan that performs a daily backup at 6pm and retains data for 3
months". The description must be at most 2048 characters.

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

### setDescription

Optional. The description of the `BackupPlan` resource.

The description allows for additional details about `BackupPlan` and its
use cases to be provided. An example description is the following: "This
is a backup plan that performs a daily backup at 6pm and retains data for 3
months". The description must be at most 2048 characters.

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

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

### getLabels

Optional. This collection of key/value pairs allows for custom labels to be
supplied by the user. Example, {"tag": "Weekly"}.

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

### setLabels

Optional. This collection of key/value pairs allows for custom labels to be
supplied by the user. Example, {"tag": "Weekly"}.

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

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

### getCreateTime

Output only. When the `BackupPlan` was created.

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

### hasCreateTime

### clearCreateTime

### setCreateTime

Output only. When the `BackupPlan` was created.

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

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

### getUpdateTime

Output only. When the `BackupPlan` was last updated.

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

### hasUpdateTime

### clearUpdateTime

### setUpdateTime

Output only. When the `BackupPlan` was last updated.

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

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

### getBackupRules

Required. The backup rules for this `BackupPlan`. There must be at least
one `BackupRule` message.

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

### setBackupRules

Required. The backup rules for this `BackupPlan`. There must be at least
one `BackupRule` message.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-backupdr/latest/V1.BackupRule>` |

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

### getState

Output only. The `State` for the `BackupPlan`.

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

### setState

Output only. The `State` for the `BackupPlan`.

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

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

### getResourceType

Required. The resource type to which the `BackupPlan` will be applied.

Examples include, "compute.googleapis.com/Instance",
"sqladmin.googleapis.com/Instance", "alloydb.googleapis.com/Cluster",
"compute.googleapis.com/Disk".

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

### setResourceType

Required. The resource type to which the `BackupPlan` will be applied.

Examples include, "compute.googleapis.com/Instance",
"sqladmin.googleapis.com/Instance", "alloydb.googleapis.com/Cluster",
"compute.googleapis.com/Disk".

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

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

### getEtag

Optional. `etag` is returned from the service in the response. As a user of
the service, you may provide an etag value in this field to prevent stale
resources.

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

### setEtag

Optional. `etag` is returned from the service in the response. As a user of
the service, you may provide an etag value in this field to prevent stale
resources.

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

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

### getBackupVault

Required. Resource name of backup vault which will be used as storage
location for backups. Format:
projects/{project}/locations/{location}/backupVaults/{backupvault}

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

### setBackupVault

Required. Resource name of backup vault which will be used as storage
location for backups. Format:
projects/{project}/locations/{location}/backupVaults/{backupvault}

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

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

### getBackupVaultServiceAccount

Output only. The Google Cloud Platform Service Account to be used by the
BackupVault for taking backups. Specify the email address of the Backup
Vault Service Account.

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

### setBackupVaultServiceAccount

Output only. The Google Cloud Platform Service Account to be used by the
BackupVault for taking backups. Specify the email address of the Backup
Vault Service Account.

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

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

### getLogRetentionDays

Optional. Applicable only for CloudSQL and AlloyDB resource_type.

Configures how long logs will be stored. It is defined in "days". This
value should be greater than or equal to minimum enforced log retention
duration of the backup vault.

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

### setLogRetentionDays

Optional. Applicable only for CloudSQL and AlloyDB resource_type.

Configures how long logs will be stored. It is defined in "days". This
value should be greater than or equal to minimum enforced log retention
duration of the backup vault.

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

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

### getSupportedResourceTypes

Output only. All resource types to which backupPlan can be applied.

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

### setSupportedResourceTypes

Output only. All resource types to which backupPlan can be applied.

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

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

### getRevisionId

Output only. The user friendly revision ID of the `BackupPlanRevision`.

Example: v0, v1, v2, etc.

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

### setRevisionId

Output only. The user friendly revision ID of the `BackupPlanRevision`.

Example: v0, v1, v2, etc.

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

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

### getRevisionName

Output only. The resource id of the `BackupPlanRevision`.

Format:
`projects/{project}/locations/{location}/backupPlans/{backup_plan}/revisions/{revision_id}`

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

### setRevisionName

Output only. The resource id of the `BackupPlanRevision`.

Format:
`projects/{project}/locations/{location}/backupPlans/{backup_plan}/revisions/{revision_id}`

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

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