Azure / azure-rest-api-specs

The source for REST API specifications for Microsoft Azure.
MIT License
2.61k stars 5.01k forks source link

Instance Metadata add tags object/dict #21691

Open Klaas- opened 1 year ago

Klaas- commented 1 year ago

Hi, so I've noticed that you've implemented tags in the instance metadata as a list.

curl -s -H Metadata:true --noproxy "*" "http://169.254.169.254/metadata/instance?api-version=2021-02-01" | jq
[...]
    "tagsList": [
      {
        "name": "TagName1",
        "value": "Value1"
      },
      {
        "name": "TagName2",
        "value": "Value2"
      }
    ],
[...]

But the tags are a dictionary, not a list because the names are unique. You can use to represent it more clearly:

"tagsdict": {
   "TagName1": "Value1",
   "Tagname2": "Value2"
}

If it were a "real" list in your datastructure in backend you would be able to duplicate keys. As in have same name with different values.

{
    "compute": {
      "tagsList": [
        {
          "name": "TagName1",
          "value": "Value1"
        },
        {
          "name": "TagName1",
          "value": "Value3"
        },
        {
          "name": "Tagname2",
          "value": "Value2"
        }
      ]
    }
}

I would like to see a dictionary implemented so that it reflects the data structure of the backend (no duplicated keys allowed).

Greetings Klaas

navba-MSFT commented 1 year ago

Adding service team to look into this.