Config(client, name)
A Config resource in the Cloud RuntimeConfig service.
This consists of metadata and a hierarchy of variables.
Parameters
Name | Description |
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 > ConfigProperties
client
The client bound to this config.
description
Description of the config object.
Type | Description |
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
Type | Description |
`ValueError | if the config is missing a name. |
Type | Description |
str | The full name based on project and config names. |
path
URL path for the config's APIs.
Type | Description |
str | The URL path based on project and config names. |
project
Project bound to the config.
Type | Description |
str | the project (derived from the client). |
Methods
exists
exists(client=None)
Determines whether or not this config exists.
Name | Description |
client |
Client
(Optional) The client to use. If not passed, falls back to the |
Type | Description |
bool | True 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
Name | Description |
variable_name |
str
The name of the variable to retrieve. |
client |
Client
(Optional) The client to use. If not passed, falls back to the |
Type | Description |
Variable or None | The 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.
Name | Description |
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 |
client |
Client
(Optional) The client to use. If not passed, falls back to the |
Type | Description |
`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.
Name | Description |
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.
Name | Description |
variable_name |
str
The name of the variable to be instantiated. |
Type | Description |
Variable | The variable object created. |