# Google Cloud OsConfig V1 Client - Class Exec (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 Exec.

A file or script to execute.

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

## Namespace

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

## 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 file. |
| `↳ script` | `string` An inline script. The size of the script is limited to 1024 characters. |
| `↳ args` | `string[]` Optional arguments to pass to the source during execution. |
| `↳ interpreter` | `int` Required. The script interpreter to use. |
| `↳ output_file_path` | `string` Only recorded for enforce Exec. Path to an output file (that is created by this Exec) whose content will be recorded in OSPolicyResourceCompliance after a successful run. Absence or failure to read this file will result in this ExecResource being non-compliant. Output file size is limited to 100K bytes. |

### getFile

A remote or local file.

| **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 file.

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

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

### getScript

An inline script.

The size of the script is limited to 1024 characters.

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

### hasScript

### setScript

An inline script.

The size of the script is limited to 1024 characters.

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

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

### getArgs

Optional arguments to pass to the source during execution.

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

### setArgs

Optional arguments to pass to the source during execution.

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

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

### getInterpreter

Required. The script interpreter to use.

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

### setInterpreter

Required. The script interpreter to use.

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

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

### getOutputFilePath

Only recorded for enforce Exec.

Path to an output file (that is created by this Exec) whose
content will be recorded in OSPolicyResourceCompliance after a
successful run. Absence or failure to read this file will result in
this ExecResource being non-compliant. Output file size is limited to
100K bytes.

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

### setOutputFilePath

Only recorded for enforce Exec.

Path to an output file (that is created by this Exec) whose
content will be recorded in OSPolicyResourceCompliance after a
successful run. Absence or failure to read this file will result in
this ExecResource being non-compliant. Output file size is limited to
100K bytes.

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

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

### getSource

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