As of January 1, 2020 this library no longer supports Python 2 on the latest released version. Library versions released prior to that date will continue to be available. For more information please visit Python 2 support on Google Cloud.

Variables

Create / interact with Google Cloud RuntimeConfig variables.

google.cloud.runtimeconfig.variable.STATE_UNSPECIFIED

The default variable state. See https://cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs.variables#VariableState

google.cloud.runtimeconfig.variable.STATE_UPDATED

Indicates the variable was updated, while variables.watch was executing. See https://cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs.variables#VariableState

google.cloud.runtimeconfig.variable.STATE_DELETED

Indicates the variable was deleted, while variables.watch was executing. See https://cloud.google.com/deployment-manager/runtime-configurator/reference/rest/v1beta1/projects.configs.variables#VariableState

class google.cloud.runtimeconfig.variable.Variable(name, config)[source]

Bases: object

A variable in the Cloud RuntimeConfig service.

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

Parameters
property client

The client bound to this variable.

create(client=None)[source]

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

Parameters

client (Client) – (Optional) The client to use. If not passed, falls back to the client stored on the variable’s config.

Return type

bool

Returns

True if the variable has been created, False on error.

exists(client=None)[source]

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

Parameters

client (Client) – (Optional) The client to use. If not passed, falls back to the client stored on the variable’s config.

Return type

bool

Returns

True if the variable exists in Cloud RuntimeConfig.

classmethod from_api_repr(resource, config)[source]

Factory: construct a Variable given its API representation

Parameters
Return type

google.cloud.runtimeconfig.variable.Variable

Returns

Variable parsed from resource.

property full_name

Fully-qualified name of this variable.

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

Return type

str

Returns

The full name based on config and variable names.

Raises

ValueError if the variable is missing a name.

property path

URL path for the variable’s APIs.

Return type

str

Returns

The URL path based on config and variable names.

reload(client=None)[source]

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

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.

property state

Retrieve the state of the variable.

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

Return type

str

Returns

If set, one of “UPDATED”, “DELETED”, or defaults to “VARIABLE_STATE_UNSPECIFIED”.

property text

Text of the variable, as string.

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

Return type

str or NoneType

Returns

The text of the variable or None if the property is not set locally.

update(client=None)[source]

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

Parameters

client (Client) – (Optional) The client to use. If not passed, falls back to the client stored on the variable’s config.

Return type

bool

Returns

True if the variable has been created, False on error.

property 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

Returns

DatetimeWithNanoseconds, datetime.datetime or NoneType: Datetime object parsed from RFC3339 valid timestamp, or None if the property is not set locally.

Raises

ValueError – if value is not a valid RFC3339 timestamp

property value

Value of the variable, as bytes.

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

Return type

bytes or NoneType

Returns

The value of the variable or None if the property is not set locally.