The runtimeconfig.v1beta1.variable needs to be updated with "text" property so users will be able to access the text value.
Steps to reproduce with code samples
For creating the config with the name of my-config gcloud beta runtime-config configs create my-config
For creating the key value pair, key is "some-gibberish" and value is "hahahablblblbl" gcloud beta runtime-config configs variables set some-gibberish \ 'hahahablblblbl' --config-name my-config
Now enter the Python command line by typing 'python' in the terminal and then hit enter.
Run following simple Python snippet
from google.cloud import runtimeconfig client = runtimeconfig.Client() config = client.config('my-config') var = config.get_variable('some-gibberish')
Expected output: >>> var.value
But what if we don't need the base64 encoding option given in the documentation?
So we're going to change this gcloud command to store the value of "some-gibberish" as text gcloud beta runtime-config configs variables set some-gibberish \ 'hahahablblblbl' --config-name my-config --is-text
Exit the python command line
Run the gcloud command with --is-text flag
Go to the python command line again, execute the simple Python snippet from earlier.
Output for var.value >>> var.value >>>
Output for var.text >>> var.text Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'Variable' object has no attribute 'text' >>>
For now this would mean that there's no way to retrieve the text values in Python which would force users to store everything as base64 encoded values.
The text was updated successfully, but these errors were encountered:
This PR adds support for variable create and update methods.
The create method has been implemented in the Variable class instead of Config (which would have given symmetry with get_variable) for a couple of reasons:
it allows a more natural workflow of calling config.variable(), setting the desired attribute, then saving
it updates the created variable in place via _set_properties like other variable methods
This also adds support for the text attribute, which can now be used in alternative to the previously supported value. The create and update methods enforce mutual exclusivity of the two attributes.