Configuration#

Create / interact with Google Cloud RuntimeConfig configs.

class google.cloud.runtimeconfig.config.Config(client, name)[source]#

Bases: 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#

The client bound to this config.

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)[source]#

Determines whether or not this config exists.

Parameters:client (Client) – (Optional) The client to use. If not passed, falls back to the client stored on the current config.
Return type:bool
Returns:True if the config exists in Cloud Runtime Configurator.
full_name#

Fully-qualified name of this variable.

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

Return type:str
Returns:The full name based on project and config names.
Raises:ValueError if the config is missing a name.
get_variable(variable_name, client=None)[source]#

API call: get a variable via a GET request.

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

>>> from google.cloud import runtimeconfig
>>> client = runtimeconfig.Client()
>>> config = client.get_config('my-config')
>>> print(config.get_varialbe('variable-name'))
<Variable: my-config, variable-name>
>>> print(config.get_variable('does-not-exist'))
None
Parameters:
  • variable_name (str) – The name of the variable to retrieve.
  • 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 or None

Returns:

The variable object if it exists, otherwise None.

list_variables(page_size=None, page_token=None, client=None)[source]#

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) – (Optional) Maximum number of variables to return per page.
  • page_token (str) – opaque marker for the next “page” of variables. If not passed, will return the first page of variables.
  • client (Client) – (Optional) The client to use. If not passed, falls back to the client stored on the current config.
Return type:

Iterator

Returns:

Iterator of Variable belonging to this project.

path#

URL path for the config’s APIs.

Return type:str
Returns:The URL path based on project and config names.
project#

Project bound to the config.

Return type:str
Returns:the project (derived from the client).
reload(client=None)[source]#

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) – (Optional) The client to use. If not passed, falls back to the client stored on the current config.
variable(variable_name)[source]#

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) – The name of the variable to be instantiated.
Return type:google.cloud.runtimeconfig.variable.Variable
Returns:The variable object created.