hetznercloud/hcloud-python

Ability to retrieve the token's associated project name

Closed this issue · 1 comments

Feature Request

Is your feature request related to a problem? Please describe.
I'm the creator of an open source cloud management tool called Fix Inventory. The tool gives you a birds eye view of your entire cloud infrastructure for e.g. documentation and audit purposes. I'm currently implementing Hetzner Cloud and noticed the API does not provide a method to get a token's project name.

It is very possible that I overlooked something.

In Fix Inventory we're putting all of the cloud account's resources into a large directed graph, with the project name close to the top of that graph root. So that when people have 100 cloud accounts/projects, they can run queries like "show me all the VMs with more than 8 cores in projects A and B".

Describe the solution you'd like

In [1]: from hcloud import Client

In [2]: client = Client(token="MahLgT2mclB...")

In [3]: client.project.name
Out[3]: 'Production'

Describe alternatives you've considered
Right now the user needs to store the project name together with the API token in their config. This is error prone and quickly outdated, for example when someone updates the project name in Hetzner Cloud but forgets to update their Fix Inventory config.

Teachability, Documentation, Adoption, Migration Strategy
Hetzner Cloud projects have a name in the web console. Like:
image
The API should expose those names somehow. This change would not introduce any migration needs and would be fully backwards compatible.

Hey @lloesche,

this is not supported in the current API, there is no "introspection" endpoint for the token to learn about itself.

I have added a +1 to our feedback tracker for this.

As hcloud-python can only implement supported APIs, I will close this issue.