Closed wmendes-ionos closed 2 years ago
Hello!
Thanks for creating this issue! After doing a bit of investigating, I've broken down this issue into these specific/measureable tasks/bugs:
ionosctl label list
in conjunction with a valid type* for --resource-type
flag requires certain IDs provided. For example, for server
, you need to provide server-id
and datacenter-id
, but these parameters are not marked as required.
Only some resources have valid endpoints* in the labels API. Until the next major release, the flag --resource-type
should be responsible for the above set of resources, while for other resources (i.e. nic, lan, k8s nodepools) the users should use -F/--filter for the resourceType
column instead of using this flag.
The default behaivour for unknown --resource-type
values is just to do a simple list, as if no value was provided, hence why sometimes this command provides the same result-set at times as you describe with Volume
and lan
Filter flag doesn't work for any column
We should reach a common decision as a team on what to do with this duplicate functionality. Depending on limitations and performance, perhaps next major release --resource-type
flag could be deprecated, and merged into -F/--filters
flag if it provides a performance increase over simple key/value filtering over the resourceType
column
* As of now, valid types are datacenter,server,volume,ipblock,snapshot.
Thanks again, for opening this issue! As soon as a PR is ready I'll make sure to link it to this issue.
Description
It seems
ionosctl label list
cannot properly interpret flags. For some values it even reacts upon, but the resultset is always the same.Expected behavior
ionosctl label list
interpret and apply flags such as--datacenter-id
,--resource-type
,--server-id
etc.Environment
dev, prod.
Go Version:
Ionosctl version:
OS:
Shell:
How to Reproduce
With a
dev
account try to list labels. for a datacenter.ionosctl label list --datacenter-id ad6eb12c-c20a-4f83-876f-c3a8a9e1fbec
try with a serverionosctl label list --datacenter-id ad6eb12c-c20a-4f83-876f-c3a8a9e1fbec --server-id 03fea0d9-0fde-4351-a3e1-9eea2cfa3a38
note the result is always the same. try filter by a resource typeionosctl label list --resource-type lan
ionosctl label list --resource-type Volume
I still can see other resource-types in the result set. when I use volume --resource-type volume it gives me a 404.when I use
Volume
, I still see other resource-types.