# Configuration

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 Create / interact with Google Cloud RuntimeConfig configs.

### *class* google.cloud.runtimeconfig.config.Config(client, name)

Bases: [`object`](https://docs.python.org/3/library/functions.html#object)

A Config resource in the Cloud RuntimeConfig service.

This consists of metadata and a hierarchy of variables.

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

- **Parameters**

  - **client** ([`google.cloud.runtimeconfig.client.Client`](https://docs.cloud.google.com/python/docs/reference/runtimeconfig/latest/client#google.cloud.runtimeconfig.client.Client)) -- A client which holds credentials and project configuration
    for the config (which requires a project).

  - **name** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) -- The name of the config.

#### *property* client()

The client bound to this config.

#### *property* description()

Description of the config object.

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

- **Return type**

  str, or `NoneType`
- **Returns**

  the description (None until set from the server).

#### exists(client=None)

Determines whether or not this config exists.

- **Parameters**

  **client** ([`Client`](https://docs.cloud.google.com/python/docs/reference/runtimeconfig/latest/client#google.cloud.runtimeconfig.client.Client)) -- (Optional) The client to use. If not passed, falls back to the
  `client` stored on the current config.
- **Return type**

  [bool](https://docs.python.org/3/library/functions.html#bool)
- **Returns**

  True if the config exists in Cloud Runtime Configurator.

#### *property* full_name()

Fully-qualified name of this variable.

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

- **Return type**

  [str](https://docs.python.org/3/library/stdtypes.html#str)
- **Returns**

  The full name based on project and config names.
- **Raises**

  [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) if the config is missing a name.

#### get_variable(variable_name, client=None)

API call: get a variable via a `GET` request.

This will return None if the variable doesn't exist:

    >>> from google.cloud import https://docs.cloud.google.com/python/docs/reference/runtimeconfig/latest
    >>> client = https://docs.cloud.google.com/python/docs/reference/runtimeconfig/latest.https://docs.cloud.google.com/python/docs/reference/runtimeconfig/latest/google.cloud.runtimeconfig.client.Client.html()
    >>> config = client.https://docs.cloud.google.com/python/docs/reference/runtimeconfig/latest/google.cloud.runtimeconfig.client.Client.html('my-config')
    >>> print(config.https://docs.cloud.google.com/python/docs/reference/runtimeconfig/latest/google.cloud.runtimeconfig.config.Config.html#google_cloud_runtimeconfig_config_Config_get_variable('variable-name'))
    <Variable: my-config, variable-name>
    >>> print(config.https://docs.cloud.google.com/python/docs/reference/runtimeconfig/latest/google.cloud.runtimeconfig.config.Config.html#google_cloud_runtimeconfig_config_Config_get_variable('does-not-exist'))
    None

- **Parameters**

  - **variable_name** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) -- The name of the variable to retrieve.

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

- **Return type**

  [`google.cloud.runtimeconfig.variable.Variable`](https://docs.cloud.google.com/python/docs/reference/runtimeconfig/latest/variable#google.cloud.runtimeconfig.variable.Variable) or None
- **Returns**

  The variable object if it exists, otherwise None.

#### list_variables(page_size=None, page_token=None, client=None)

API call: list variables for this config.

This only lists variable names, not the values.

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

- **Parameters**

  - **page_size** ([*int*](https://docs.python.org/3/library/functions.html#int)) -- Optional. The maximum number of variables in each page of results
    from this request. Non-positive values are ignored. Defaults
    to a sensible value set by the API.

  - **page_token** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) -- Optional. If present, return the next batch of variables, using
    the value, which must correspond to the `nextPageToken` value
    returned in the previous response. Deprecated: use the `pages`
    property of the returned iterator instead of manually passing
    the token.

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

- **Return type**

  [`Iterator`](https://googleapis.dev/python/google-api-core/latest/page_iterator.html#google.api_core.page_iterator.Iterator)
- **Returns**

  Iterator of [`Variable`](https://docs.cloud.google.com/python/docs/reference/runtimeconfig/latest/variable#google.cloud.runtimeconfig.variable.Variable)
  belonging to this project.

#### *property* path()

URL path for the config's APIs.

- **Return type**

  [str](https://docs.python.org/3/library/stdtypes.html#str)
- **Returns**

  The URL path based on project and config names.

#### *property* project()

Project bound to the config.

- **Return type**

  [str](https://docs.python.org/3/library/stdtypes.html#str)
- **Returns**

  the project (derived from the client).

#### reload(client=None)

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

This method will reload the newest data for the config.

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

- **Parameters**

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

#### variable(variable_name)

Factory constructor for variable object.

**NOTE**: This will not make an HTTP request; it simply instantiates
a variable object owned by this config.

- **Parameters**

  **variable_name** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) -- The name of the variable to be instantiated.
- **Return type**

  [`google.cloud.runtimeconfig.variable.Variable`](https://docs.cloud.google.com/python/docs/reference/runtimeconfig/latest/variable#google.cloud.runtimeconfig.variable.Variable)
- **Returns**

  The variable object created.