Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update response format for aks mesh get upgrades and revisions commands #7033

Merged
merged 5 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/aks-preview/azext_aks_preview/_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def _aks_snapshot_table_format(result):

def aks_mesh_revisions_table_format(result):
"""Format a list of mesh revisions as summary results for display with "-o table". """
revision_table = flatten_mesh_revision_table(result[0]['properties']['meshRevisions'])
revision_table = flatten_mesh_revision_table(result['meshRevisions'])
parsed = compile_jmes("""[].{
revision: revision,
upgrades: upgrades || [`None available`] | sort_versions(@) | join(`, `, @),
Expand All @@ -343,7 +343,7 @@ def flatten_mesh_revision_table(revision_info):

def aks_mesh_upgrades_table_format(result):
"""Format a list of mesh upgrades as summary results for display with "-o table". """
upgrades_table = _format_mesh_revision_entry(result[0]['properties'])
upgrades_table = _format_mesh_revision_entry(result)
parsed = compile_jmes("""[].{
revision: revision,
upgrades: upgrades || [`None available`] | sort_versions(@) | join(`, `, @),
Expand Down
26 changes: 24 additions & 2 deletions src/aks-preview/azext_aks_preview/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -2578,7 +2578,18 @@ def aks_mesh_get_revisions(
client,
location
):
return client.list_mesh_revision_profiles(location)
revisonProfiles = client.list_mesh_revision_profiles(location)
# 'revisonProfiles' is an ItemPaged object
revisions = []
# Iterate over items within pages
for page in revisonProfiles.by_page():
for item in page:
revisions.append(item)

if revisions:
return revisions[0].properties
else:
return None


def aks_mesh_get_upgrades(
Expand All @@ -2587,7 +2598,18 @@ def aks_mesh_get_upgrades(
resource_group_name,
name
):
return client.list_mesh_upgrade_profiles(resource_group_name, name)
upgradeProfiles = client.list_mesh_upgrade_profiles(resource_group_name, name)
# 'upgradeProfiles' is an ItemPaged object
upgrades = []
# Iterate over items within pages
for page in upgradeProfiles.by_page():
for item in page:
upgrades.append(item)

if upgrades:
return upgrades[0].properties
else:
return None


def aks_mesh_upgrade_start(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,44 @@ interactions:
ParameterSetName:
- -l
User-Agent:
- AZURECLI/2.53.0 azsdk-python-azure-mgmt-containerservice/26.0.0b Python/3.8.10
(Linux-6.2.0-1012-azure-x86_64-with-glibc2.29)
- AZURECLI/2.54.0 azsdk-python-azure-mgmt-containerservice/28.0.0b Python/3.8.10
(Linux-6.2.0-1016-azure-x86_64-with-glibc2.29)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/westus2/meshRevisionProfiles?api-version=2023-10-02-preview
response:
body:
string: "{\n \"value\": [\n {\n \"id\": \"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.ContainerService/locations/westus2/meshRevisionProfiles/istio\",\n
\ \"name\": \"istio\",\n \"type\": \"Microsoft.ContainerService/locations/meshRevisionProfiles\",\n
\ \"properties\": {\n \"meshRevisions\": [\n {\n \"revision\":
\"asm-1-17\",\n \"compatibleWith\": [\n {\n \"name\":
\"kubernetes\",\n \"versions\": [\n \"1.25.6\",\n \"1.25.11\",\n
\ \"1.26.3\",\n \"1.26.6\",\n \"1.27.1\",\n \"1.27.3\"\n
\ ]\n }\n ]\n }\n ]\n }\n }\n ]\n }"
\"asm-1-17\",\n \"upgrades\": [\n \"asm-1-18\"\n ],\n \"compatibleWith\":
[\n {\n \"name\": \"kubernetes\",\n \"versions\": [\n
\ \"1.25.11\",\n \"1.25.15\",\n \"1.26.6\",\n \"1.26.10\",\n
\ \"1.27.3\",\n \"1.27.7\",\n \"1.28.0\",\n \"1.28.3\"\n
\ ]\n }\n ]\n },\n {\n \"revision\": \"asm-1-18\",\n
\ \"compatibleWith\": [\n {\n \"name\": \"kubernetes\",\n
\ \"versions\": [\n \"1.25.11\",\n \"1.25.15\",\n
\ \"1.26.6\",\n \"1.26.10\",\n \"1.27.3\",\n \"1.27.7\",\n
\ \"1.28.0\",\n \"1.28.3\"\n ]\n }\n ]\n
\ }\n ]\n }\n }\n ]\n }"
headers:
cache-control:
- no-cache
content-length:
- '617'
- '1040'
content-type:
- application/json
date:
- Tue, 10 Oct 2023 20:15:25 GMT
- Sat, 25 Nov 2023 12:31:30 GMT
expires:
- '-1'
pragma:
- no-cache
server:
- nginx
strict-transport-security:
- max-age=31536000; includeSubDomains
transfer-encoding:
- chunked
vary:
- Accept-Encoding
x-content-type-options:
- nosniff
status:
Expand Down
Loading