# Google Cloud OsConfig V1 Client - Class FileResource (2.2.3)

2.2.3 (latest) 2.2.2 2.1.0 2.0.5 1.3.5 1.2.2 1.1.1 1.0.5 Reference documentation and code samples for the Google Cloud OsConfig V1 Client class FileResource.

A resource that manages the state of a file.

Generated from protobuf message `google.cloud.osconfig.v1.OSPolicy.Resource.FileResource`

## Namespace

Google \\ Cloud \\ OsConfig \\ V1 \\ OSPolicy \\ Resource

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ file` | `https://docs.cloud.google.com/php/docs/reference/cloud-osconfig/latest/V1.OSPolicy.Resource.File` A remote or local source. |
| `↳ content` | `string` A a file with this content. The size of the content is limited to 1024 characters. |
| `↳ path` | `string` Required. The absolute path of the file within the VM. |
| `↳ state` | `int` Required. Desired state of the file. |
| `↳ permissions` | `string` Consists of three octal digits which represent, in order, the permissions of the owner, group, and other users for the file (similarly to the numeric mode used in the linux chmod utility). Each digit represents a three bit number with the 4 bit corresponding to the read permissions, the 2 bit corresponds to the write bit, and the one bit corresponds to the execute permission. Default behavior is 755. Below are some examples of permissions and their associated values: read, write, and execute: 7 read and execute: 5 read and write: 6 read only: 4 |

### getFile

A remote or local source.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-osconfig/latest/V1.OSPolicy.Resource.File|null` |   |

### hasFile

### setFile

A remote or local source.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-osconfig/latest/V1.OSPolicy.Resource.File` |

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

### getContent

A a file with this content.

The size of the content is limited to 1024 characters.

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

### hasContent

### setContent

A a file with this content.

The size of the content is limited to 1024 characters.

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

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

### getPath

Required. The absolute path of the file within the VM.

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

### setPath

Required. The absolute path of the file within the VM.

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

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

### getState

Required. Desired state of the file.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [DesiredState](https://docs.cloud.google.com/php/docs/reference/cloud-osconfig/latest/V1.OSPolicy.Resource.FileResource.DesiredState). |

### setState

Required. Desired state of the file.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [DesiredState](https://docs.cloud.google.com/php/docs/reference/cloud-osconfig/latest/V1.OSPolicy.Resource.FileResource.DesiredState). |

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

### getPermissions

Consists of three octal digits which represent, in
order, the permissions of the owner, group, and other users for the
file (similarly to the numeric mode used in the linux chmod
utility). Each digit represents a three bit number with the 4 bit
corresponding to the read permissions, the 2 bit corresponds to the
write bit, and the one bit corresponds to the execute permission.

Default behavior is 755.
Below are some examples of permissions and their associated values:
read, write, and execute: 7
read and execute: 5
read and write: 6
read only: 4

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

### setPermissions

Consists of three octal digits which represent, in
order, the permissions of the owner, group, and other users for the
file (similarly to the numeric mode used in the linux chmod
utility). Each digit represents a three bit number with the 4 bit
corresponding to the read permissions, the 2 bit corresponds to the
write bit, and the one bit corresponds to the execute permission.

Default behavior is 755.
Below are some examples of permissions and their associated values:
read, write, and execute: 7
read and execute: 5
read and write: 6
read only: 4

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

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

### getSource

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