Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
49 changes: 49 additions & 0 deletions linter_exclusions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2096,6 +2096,55 @@ networkcloud virtualmachine create:
isolate_emulator_thread:
rule_exclusions:
- option_length_too_long
networkcloud kubernetescluster create:
parameters:
control_plane_node_configuration:
rule_exclusions:
- option_length_too_long
initial_agent_pool_configurations:
rule_exclusions:
- option_length_too_long
managed_resource_group_configuration:
rule_exclusions:
- option_length_too_long
networkcloud kubernetescluster update:
parameters:
control_plane_node_configuration:
rule_exclusions:
- option_length_too_long
networkcloud kubernetescluster agentpool create:
parameters:
attached_network_configuration:
rule_exclusions:
- option_length_too_long
kubernetes_cluster_name:
rule_exclusions:
- option_length_too_long
networkcloud kubernetescluster agentpool delete:
parameters:
kubernetes_cluster_name:
rule_exclusions:
- option_length_too_long
networkcloud kubernetescluster agentpool update:
parameters:
kubernetes_cluster_name:
rule_exclusions:
- option_length_too_long
networkcloud kubernetescluster agentpool list:
parameters:
kubernetes_cluster_name:
rule_exclusions:
- option_length_too_long
networkcloud kubernetescluster agentpool show:
parameters:
kubernetes_cluster_name:
rule_exclusions:
- option_length_too_long
networkcloud kubernetescluster agentpool wait:
parameters:
kubernetes_cluster_name:
rule_exclusions:
- option_length_too_long
networkfabric controller create:
parameters:
workload_er_connections:
Expand Down
6 changes: 6 additions & 0 deletions src/networkcloud/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
Release History
===============

0.4.0
* This version supports NetworkCloud 2023-05-01-preview APIs.
* It introduces a new resource kubernetescluster and its child resource agentpool.
* The defaultcninetwork and hybridakscluster resources are preserved and will continue using 2022-12-12-preview APIs.
* This version is experimental. Changes to the interface are expected but will be done in backward compatible way where possible.

0.3.0
++++++
* Initial release. This version supports NetworkCloud 2022-12-12-preview APIs.
Expand Down
36 changes: 20 additions & 16 deletions src/networkcloud/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,26 @@ az networkcloud --help

Below is a high-level overview of networkcloud commands.

| Commands | Description|
| ------------- | ------------- |
| az networkcloud baremetalmachine | Provides commands to manage bare metal machines. |
| az networkcloud cluster | Provides commands to manage clusters. |
| Commands | Description |
|------------------------------------------------|------------------------------------------------------------------------------------|
| az networkcloud baremetalmachine | Provides commands to manage bare metal machines. |
| az networkcloud cluster | Provides commands to manage clusters. |
| az networkcloud cluster baremetalmachinekeyset | Provides commands to manage cluster's bare metal machines access via SSH key sets. |
| az networkcloud cluster bmckeyset | Provides commands to manage cluster's baseboard management controller key set. |
| az networkcloud cluster metricsconfiguration | Provides commands to manage cluster's metrics configurations. |
| az networkcloud clustermanager | Provides commands to manage cluster managers. |
| az networkcloud defaultcninetwork | Provides commands to manage default CNI networks. |
| az networkcloud hybridakscluster | Provides commands to manage additional details of Hybrid Aks provisioned clusters. |
| az networkcloud l2network | Provides commands to manage layer 2 (L2) networks. |
| az networkcloud l3network | Provides commands to manage layer 3 (L3) networks. |
| az networkcloud rack | Provides commands to manage racks. |
| az networkcloud racksku | Provides commands to display rack Skus information. |
| az networkcloud storageappliance | Provides commands to manage storage appliances. |
| az networkcloud trunkednetwork | Provides commands to manage trunked networks. |
| az networkcloud virtualmachine | Provides commands to manage virtual machines. |
| az networkcloud cluster bmckeyset | Provides commands to manage cluster's baseboard management controller key set. |
| az networkcloud cluster metricsconfiguration | Provides commands to manage cluster's metrics configurations. |
| az networkcloud clustermanager | Provides commands to manage cluster managers. |
| az networkcloud defaultcninetwork | Provides commands to manage default CNI networks. |
| az networkcloud hybridakscluster | Provides commands to manage additional details of Hybrid Aks provisioned clusters. |
| az networkcloud kubernetescluster | Provides commands to manage Kubernetes clusters. |
| az networkcloud kubernetescluster agentpool | Provides commands to manage Kubernetes cluster's agent pool. |
| az networkcloud l2network | Provides commands to manage layer 2 (L2) networks. |
| az networkcloud l3network | Provides commands to manage layer 3 (L3) networks. |
| az networkcloud rack | Provides commands to manage racks. |
| az networkcloud racksku | Provides commands to display rack Skus information. |
| az networkcloud storageappliance | Provides commands to manage storage appliances. |
| az networkcloud trunkednetwork | Provides commands to manage trunked networks. |
| az networkcloud virtualmachine | Provides commands to manage virtual machines. |
| az networkcloud virtualmachine console | Provides commands to manage virtual machine's consoles. |
| az networkcloud volume | Provides commands to manage volumes. |

For more details, please refer to [Azure Operator Nexus - NetworkCloud](https://learn.microsoft.com/en-us/azure/operator-nexus/).
140 changes: 140 additions & 0 deletions src/networkcloud/azext_networkcloud/_format.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from collections import OrderedDict


def transform_child_resource_table_output(result):
"""Custom formatting of table output for a child resource"""

is_list = isinstance(result, list)

if not is_list:
result = [result]

final_result = []
for item in result:
new_item = OrderedDict()
new_item["Name"] = item["name"]
new_item["ProvisioningState"] = item["provisioningState"]
if item.get("detailedStatus"):
new_item["DetailedStatus"] = item["detailedStatus"]
else:
new_item["DetailedStatus"] = ""
if item.get("detailedStatusMessage"):
new_item["DetailedStatusMessage"] = item["detailedStatusMessage"]
else:
new_item["DetailedStatusMessage"] = ""

final_result.append(new_item)

return final_result if is_list else final_result[0]


def transform_cluster_manager_table_output(result):
"""Custom formatting of table output for ClusterManager"""

is_list = isinstance(result, list)

if not is_list:
result = [result]

final_result = []
for item in result:
new_item = OrderedDict()
new_item["Name"] = item["name"]
new_item["ResourceGroup"] = item["resourceGroup"]
new_item["ProvisioningState"] = item["provisioningState"]
new_item["Location"] = item["location"]

final_result.append(new_item)

return final_result if is_list else final_result[0]


def transform_hydrated_resource_table_output(result):
"""Custom formatting of table output for a hydrated resource"""

is_list = isinstance(result, list)

if not is_list:
result = [result]

final_result = []
for item in result:
new_item = OrderedDict()
new_item["Name"] = item["name"]
new_item["ResourceGroup"] = item["resourceGroup"]
if item.get("detailedStatus"):
new_item["DetailedStatus"] = item["detailedStatus"]
else:
new_item["DetailedStatus"] = ""
if item.get("detailedStatusMessage"):
new_item["DetailedStatusMessage"] = item["detailedStatusMessage"]
else:
new_item["DetailedStatusMessage"] = ""

final_result.append(new_item)

return final_result if is_list else final_result[0]


def transform_rack_sku_table_output(result):
"""Custom formatting of table output for RackSku"""

is_list = isinstance(result, list)

if not is_list:
result = [result]

final_result = []
for item in result:
new_item = OrderedDict()
new_item["Name"] = item["name"]
new_item["RackType"] = item["rackType"]
new_item["MaxClusterSlots"] = item["maxClusterSlots"]
storageAppliances = item.get("storageAppliances")
if storageAppliances:
new_item["StorageAppliances"] = str(len(storageAppliances))
else:
new_item["StorageAppliances"] = "-"
computeMachines = item.get("computeMachines")
if computeMachines:
new_item["ComputeMachines"] = str(len(computeMachines))
else:
new_item["ComputeMachines"] = "-"
new_item["Description"] = item["description"]
final_result.append(new_item)

return final_result if is_list else final_result[0]


def transform_resource_table_output(result):
"""Custom formatting of table output for a resource with the detailed status"""

is_list = isinstance(result, list)

if not is_list:
result = [result]

final_result = []
for item in result:
new_item = OrderedDict()
new_item["Name"] = item["name"]
new_item["ResourceGroup"] = item["resourceGroup"]
new_item["ProvisioningState"] = item["provisioningState"]
if item.get("detailedStatus"):
new_item["DetailedStatus"] = item["detailedStatus"]
else:
new_item["DetailedStatus"] = ""
if item.get("detailedStatusMessage"):
new_item["DetailedStatusMessage"] = item["detailedStatusMessage"]
else:
new_item["DetailedStatusMessage"] = ""
new_item["Location"] = item["location"]

final_result.append(new_item)

return final_result if is_list else final_result[0]
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from ._list import *
from ._power_off import *
from ._reimage import *
from ._replace import *
from ._restart import *
from ._run_command import *
from ._run_data_extract import *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class Cordon(AAZCommand):
"""

_aaz_info = {
"version": "2022-12-12-preview",
"version": "2023-05-01-preview",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/baremetalmachines/{}/cordon", "2022-12-12-preview"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/baremetalmachines/{}/cordon", "2023-05-01-preview"],
]
}

Expand Down Expand Up @@ -98,25 +98,25 @@ def __call__(self, *args, **kwargs):
return self.client.build_lro_polling(
self.ctx.args.no_wait,
session,
self.on_200,
self.on_200_201,
self.on_error,
lro_options={"final-state-via": "location"},
path_format_arguments=self.url_parameters,
)
if session.http_response.status_code in [200]:
if session.http_response.status_code in [204]:
return self.client.build_lro_polling(
self.ctx.args.no_wait,
session,
self.on_200,
self.on_204,
self.on_error,
lro_options={"final-state-via": "location"},
path_format_arguments=self.url_parameters,
)
if session.http_response.status_code in [204]:
if session.http_response.status_code in [200, 201]:
return self.client.build_lro_polling(
self.ctx.args.no_wait,
session,
self.on_204,
self.on_200_201,
self.on_error,
lro_options={"final-state-via": "location"},
path_format_arguments=self.url_parameters,
Expand Down Expand Up @@ -161,7 +161,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2022-12-12-preview",
"api-version", "2023-05-01-preview",
required=True,
),
}
Expand Down Expand Up @@ -190,28 +190,28 @@ def content(self):

return self.serialize_content(_content_value)

def on_200(self, session):
def on_204(self, session):
pass

def on_200_201(self, session):
data = self.deserialize_http_content(session)
self.ctx.set_var(
"instance",
data,
schema_builder=self._build_schema_on_200
schema_builder=self._build_schema_on_200_201
)

_schema_on_200 = None
_schema_on_200_201 = None

@classmethod
def _build_schema_on_200(cls):
if cls._schema_on_200 is not None:
return cls._schema_on_200

cls._schema_on_200 = AAZObjectType()
_CordonHelper._build_schema_operation_status_result_read(cls._schema_on_200)
def _build_schema_on_200_201(cls):
if cls._schema_on_200_201 is not None:
return cls._schema_on_200_201

return cls._schema_on_200
cls._schema_on_200_201 = AAZObjectType()
_CordonHelper._build_schema_operation_status_result_read(cls._schema_on_200_201)

def on_204(self, session):
pass
return cls._schema_on_200_201


class _CordonHelper:
Expand Down
Loading