# Class Variable (0.37.0)

0.37.0 (latest) 0.36.1 0.35.0 0.34.0 0.33.3 0.32.6 0.31.0 0.30.0 0.29.2

    Variable(name, config)

A variable in the Cloud RuntimeConfig service.

See
<https://cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs.variables>

| ## Parameters ||
|---|---|
| **Name** | **Description** |
| `name` | `str` The name of the variable. This corresponds to the unique path of the variable in the config. |
| `config` | `https://docs.cloud.google.com/python/docs/reference/runtimeconfig/latest/google.cloud.runtimeconfig.config.Config` The config to which this variable belongs. |

## Properties

### client

The client bound to this variable.

### full_name

Fully-qualified name of this variable.

Example:
`projects/my-project/configs/my-config/variables/my-var`

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `` `ValueError `` | if the variable is missing a name. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `str` | The full name based on config and variable names. |

### path

URL path for the variable's APIs.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `str` | The URL path based on config and variable names. |

### state

Retrieve the state of the variable.

See
<https://cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs.variables#VariableState>

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `str` | If set, one of "UPDATED", "DELETED", or defaults to "VARIABLE_STATE_UNSPECIFIED". |

### text

Text of the variable, as string.

See
<https://cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs.variables>

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `` str or `NoneType` `` | The text of the variable or `None` if the property is not set locally. |

### update_time

Retrieve the timestamp at which the variable was updated.

See
<https://cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs.variables>

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `ValueError` | if value is not a valid RFC3339 timestamp |

### value

Value of the variable, as bytes.

See
<https://cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs.variables>

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `` bytes or `NoneType` `` | The value of the variable or `None` if the property is not set locally. |

## Methods

### create

    create(client=None)

API call: create the variable via a POST request

See
<https://cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs.variables/create>

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `client` | `https://docs.cloud.google.com/python/docs/reference/runtimeconfig/latest/google.cloud.runtimeconfig.client.Client` (Optional) The client to use. If not passed, falls back to the `client` stored on the variable's config. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` | True if the variable has been created, False on error. |

### exists

    exists(client=None)

API call: test for the existence of the variable via a GET request

See
<https://cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs.variables/get>

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `client` | `https://docs.cloud.google.com/python/docs/reference/runtimeconfig/latest/google.cloud.runtimeconfig.client.Client` (Optional) The client to use. If not passed, falls back to the `client` stored on the variable's config. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` | True if the variable exists in Cloud RuntimeConfig. |

### from_api_repr

    from_api_repr(resource, config)

Factory: construct a Variable given its API representation

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `resource` | `dict` change set representation returned from the API. |
| `config` | `https://docs.cloud.google.com/python/docs/reference/runtimeconfig/latest/google.cloud.runtimeconfig.config.Config` The config to which this variable belongs. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/python/docs/reference/runtimeconfig/latest/google.cloud.runtimeconfig.variable.Variable` | Variable parsed from `resource`. |

### reload

    reload(client=None)

API call: reload the variable via a `GET` request.

This method will reload the newest data for the variable.

See
<https://cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs/get>

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `client` | `https://docs.cloud.google.com/python/docs/reference/runtimeconfig/latest/google.cloud.runtimeconfig.client.Client` (Optional) The client to use. If not passed, falls back to the client stored on the current config. |

### update

    update(client=None)

API call: update the variable via a PUT request

See
<https://cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs.variables/update>

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `client` | `https://docs.cloud.google.com/python/docs/reference/runtimeconfig/latest/google.cloud.runtimeconfig.client.Client` (Optional) The client to use. If not passed, falls back to the `client` stored on the variable's config. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` | True if the variable has been created, False on error. |