Make GCP Objects Hashable for Reference (Ex. Compute Instance, Compute Project, Secrets Secret) #13045
Open
1 task done
Labels
priority: p2
Moderately-important priority. Fix may not be included in next release.
type: feature request
‘Nice-to-have’ improvement, new feature or different behavior or design.
Determine this is the right repository
Summary of the feature request
Wasn't seeing anything in current issues, but would it be possible to start converting existing Objects to hashable types where it make sense (output only unique IDs)? . For example, trying to use the Compute Project object (https://cloud.google.com/python/docs/reference/compute/latest/google.cloud.compute_v1.types.Project) as a key in a dictionary returns
But, per the project object definition above, there is a field called "_id" that is unique and otuput only that could be used as a hash.To fix the problem I just made a wrapper class with the following:
Same for the "instance" object for general compute with the _id field: https://cloud.google.com/python/docs/reference/compute/latest/google.cloud.compute_v1.types.Instance
Or the "name" field for Secrets objects:https://cloud.google.com/python/docs/reference/secretmanager/latest/google.cloud.secretmanager_v1.types.Secret
The ask is basically to make objects hashable based off output-only unique IDs if those are present in the object themselves.
Desired code experience
Expected results
e.g.
my_new_feature()
should return FOOAPI client name and version
No response
The text was updated successfully, but these errors were encountered: