I am using an API to get the available AKS Versions in a pick list in my Utility. I want to show only latest 4 versions in high to low order.
The current version of my code gives all of the available versions in that region-
{
"name": "kubeVersion",
"type": "picklist",
"label": "Kubernetes Version",
"defaultValue": "",
"required": true,
"helpMarkDown": "Select the version of the Kubernetes that needs to be installed on the AKS cluster.",
},
.
.
.
{
"target": "kubeVersion",
"endpointId": "$(ConnectedServiceName)",
"endpointUrl": "{{{endpoint.url}}}/subscriptions/$(endpoint.subscriptionId)/providers/Microsoft.ContainerService/locations/$(rsgLocation)/orchestrators?api-version=2019-04-01&resource-type=managedClusters",
"resultSelector":
"jsonpath:$.properties.orchestrators[*].orchestratorVersion",
"parameters": {
"rsgLocation": "$(rsgLocation)"
}
},
In above code I am giving [*] in jsonpath that selects all of the available values. Which goes like
1.10.12
1.10.13
.
.
.
1.14.6
1.15.3
Could you please help me add filters and sorting there? I want to be sort these values from latest to earliest and take only top 4 versions. Later the requirement might change to 1.X.* and 1.Y.* so I want to be able to filter as well. Could you please tell me what kind of notations these are and where I can learn it from? I'd really appreciate any suggestion to fulfill these requirements.