Class Config (0.33.0)

Config(client, name)

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

NameDescription
client Client

A client which holds credentials and project configuration for the config (which requires a project).

name str

The name of the config.

Inheritance

builtins.object > Config

Properties

client

The client bound to this config.

description

Returns
TypeDescription
str, or ``NoneType``the description (None until set from the server).

full_name

Fully-qualified name of this variable.

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

Exceptions
TypeDescription
`ValueErrorif the config is missing a name.
Returns
TypeDescription
strThe full name based on project and config names.

path

URL path for the config's APIs.

Returns
TypeDescription
strThe URL path based on project and config names.

project

Project bound to the config.

Returns
TypeDescription
strthe project (derived from the client).

Methods

exists

exists(client=None)

Determines whether or not this config exists.

Parameter
NameDescription
client Client

(Optional) The client to use. If not passed, falls back to the client stored on the current config.

Returns
TypeDescription
boolTrue if the config exists in Cloud Runtime Configurator.

get_variable

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 runtimeconfig client = runtimeconfig.Client() config = client.config('my-config') print(config.get_variable('variable-name')) <Variable: my-config, variable-name> print(config.get_variable('does-not-exist')) None

Parameters
NameDescription
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.

Returns
TypeDescription
Variable or NoneThe variable object if it exists, otherwise None.

list_variables

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
NameDescription
page_size 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

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

(Optional) The client to use. If not passed, falls back to the client stored on the current config.

Returns
TypeDescription
`google.api_core.page_iterator.Iterator`Iterator of Variable belonging to this project.

reload

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

Parameter
NameDescription
client Client

(Optional) The client to use. If not passed, falls back to the client stored on the current config.

variable

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.

Parameter
NameDescription
variable_name str

The name of the variable to be instantiated.

Returns
TypeDescription
VariableThe variable object created.