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)
Bases: object
A variable in the Cloud RuntimeConfig service.
Parameters
name (str) – The name of the variable. This corresponds to the unique path of the variable in the config.
config (
google.cloud.runtimeconfig.config.Config
) – The config to which this variable belongs.
property client()
The client bound to this variable.
create(client=None)
API call: create the variable via a POST request
Parameters
client (
Client
) – (Optional) The client to use. If not passed, falls back to theclient
stored on the variable’s config.Return type
Returns
True if the variable has been created, False on error.
exists(client=None)
API call: test for the existence of the variable via a GET request
Parameters
client (
Client
) – (Optional) The client to use. If not passed, falls back to theclient
stored on the variable’s config.Return type
Returns
True if the variable exists in Cloud RuntimeConfig.
classmethod from_api_repr(resource, config)
Factory: construct a Variable given its API representation
Parameters
resource (dict) – change set representation returned from the API.
config (
google.cloud.runtimeconfig.config.Config
) – The config to which this variable belongs.
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
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
Returns
The URL path based on config and variable names.
reload(client=None)
API call: reload the variable via a GET
request.
This method will reload the newest data for the variable.
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.
Return type
Returns
If set, one of “UPDATED”, “DELETED”, or defaults to “VARIABLE_STATE_UNSPECIFIED”.
property text()
Text of the variable, as string.
Return type
str or
NoneType
Returns
The text of the variable or
None
if the property is not set locally.
update(client=None)
API call: update the variable via a PUT request
Parameters
client (
Client
) – (Optional) The client to use. If not passed, falls back to theclient
stored on the variable’s config.Return type
Returns
True if the variable has been created, False on error.
property update_time()
Retrieve the timestamp at which the variable was updated.
Returns
DatetimeWithNanoseconds
,datetime.datetime
orNoneType
: Datetime object parsed from RFC3339 valid timestamp, orNone
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.
Return type
bytes or
NoneType
Returns
The value of the variable or
None
if the property is not set locally.