# Google Cloud Storage Transfer V1 Client - Class TransferOptions (2.4.0)

2.4.0 (latest) 2.3.2 2.2.1 2.1.1 2.0.2 1.5.0 1.4.5 1.3.1 1.2.0 1.1.1 1.0.6 Reference documentation and code samples for the Google Cloud Storage Transfer V1 Client class TransferOptions.

TransferOptions define the actions to be performed on objects in a transfer.

Generated from protobuf message `google.storagetransfer.v1.TransferOptions`

## Namespace

Google \\ Cloud \\ StorageTransfer \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ overwrite_objects_already_existing_in_sink` | `bool` When to overwrite objects that already exist in the sink. The default is that only objects that are different from the source are overwritten. If true, all objects in the sink whose name matches an object in the source are overwritten with the source object. |
| `↳ delete_objects_unique_in_sink` | `bool` Whether objects that exist only in the sink should be deleted. **Note:** This option and [delete_objects_from_source_after_transfer](https://docs.cloud.google.com/php/docs/reference/cloud-storage-transfer/latest/V1.TransferOptions#_Google_Cloud_StorageTransfer_V1_TransferOptions__getDeleteObjectsFromSourceAfterTransfer__) are mutually exclusive. |
| `↳ delete_objects_from_source_after_transfer` | `bool` Whether objects should be deleted from the source after they are transferred to the sink. **Note:** This option and [delete_objects_unique_in_sink](https://docs.cloud.google.com/php/docs/reference/cloud-storage-transfer/latest/V1.TransferOptions#_Google_Cloud_StorageTransfer_V1_TransferOptions__getDeleteObjectsUniqueInSink__) are mutually exclusive. |
| `↳ overwrite_when` | `int` When to overwrite objects that already exist in the sink. If not set, overwrite behavior is determined by [overwrite_objects_already_existing_in_sink](https://docs.cloud.google.com/php/docs/reference/cloud-storage-transfer/latest/V1.TransferOptions#_Google_Cloud_StorageTransfer_V1_TransferOptions__getOverwriteObjectsAlreadyExistingInSink__). |
| `↳ metadata_options` | `https://docs.cloud.google.com/php/docs/reference/cloud-storage-transfer/latest/V1.MetadataOptions` Represents the selected metadata options for a transfer job. |

### getOverwriteObjectsAlreadyExistingInSink

When to overwrite objects that already exist in the sink. The default is
that only objects that are different from the source are overwritten. If
true, all objects in the sink whose name matches an object in the source
are overwritten with the source object.

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

### setOverwriteObjectsAlreadyExistingInSink

When to overwrite objects that already exist in the sink. The default is
that only objects that are different from the source are overwritten. If
true, all objects in the sink whose name matches an object in the source
are overwritten with the source object.

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

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

### getDeleteObjectsUniqueInSink

Whether objects that exist only in the sink should be deleted.

**Note:** This option and
[delete_objects_from_source_after_transfer](https://docs.cloud.google.com/php/docs/reference/cloud-storage-transfer/latest/V1.TransferOptions#_Google_Cloud_StorageTransfer_V1_TransferOptions__getDeleteObjectsFromSourceAfterTransfer__)
are mutually exclusive.

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

### setDeleteObjectsUniqueInSink

Whether objects that exist only in the sink should be deleted.

**Note:** This option and
[delete_objects_from_source_after_transfer](https://docs.cloud.google.com/php/docs/reference/cloud-storage-transfer/latest/V1.TransferOptions#_Google_Cloud_StorageTransfer_V1_TransferOptions__getDeleteObjectsFromSourceAfterTransfer__)
are mutually exclusive.

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

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

### getDeleteObjectsFromSourceAfterTransfer

Whether objects should be deleted from the source after they are
transferred to the sink.

**Note:** This option and
[delete_objects_unique_in_sink](https://docs.cloud.google.com/php/docs/reference/cloud-storage-transfer/latest/V1.TransferOptions#_Google_Cloud_StorageTransfer_V1_TransferOptions__getDeleteObjectsUniqueInSink__)
are mutually exclusive.

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

### setDeleteObjectsFromSourceAfterTransfer

Whether objects should be deleted from the source after they are
transferred to the sink.

**Note:** This option and
[delete_objects_unique_in_sink](https://docs.cloud.google.com/php/docs/reference/cloud-storage-transfer/latest/V1.TransferOptions#_Google_Cloud_StorageTransfer_V1_TransferOptions__getDeleteObjectsUniqueInSink__)
are mutually exclusive.

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

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

### getOverwriteWhen

When to overwrite objects that already exist in the sink. If not set,
overwrite behavior is determined by
[overwrite_objects_already_existing_in_sink](https://docs.cloud.google.com/php/docs/reference/cloud-storage-transfer/latest/V1.TransferOptions#_Google_Cloud_StorageTransfer_V1_TransferOptions__getOverwriteObjectsAlreadyExistingInSink__).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [OverwriteWhen](https://docs.cloud.google.com/php/docs/reference/cloud-storage-transfer/latest/V1.TransferOptions.OverwriteWhen). |

### setOverwriteWhen

When to overwrite objects that already exist in the sink. If not set,
overwrite behavior is determined by
[overwrite_objects_already_existing_in_sink](https://docs.cloud.google.com/php/docs/reference/cloud-storage-transfer/latest/V1.TransferOptions#_Google_Cloud_StorageTransfer_V1_TransferOptions__getOverwriteObjectsAlreadyExistingInSink__).

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

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

### getMetadataOptions

Represents the selected metadata options for a transfer job.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-storage-transfer/latest/V1.MetadataOptions|null` |   |

### hasMetadataOptions

### clearMetadataOptions

### setMetadataOptions

Represents the selected metadata options for a transfer job.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-storage-transfer/latest/V1.MetadataOptions` |

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