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

Microsoft.NetworkCloud AZ-CLI-EXTENSIONS updated with API version 202… #7893

Merged
merged 12 commits into from
Sep 5, 2024
16 changes: 16 additions & 0 deletions src/networkcloud/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@
Release History
===============

2.0.0b3
++++++++
* This beta version supports NetworkCloud 2024-06-01-preview APIs.
* Note is added regarding Virtual machine memory and disk size being in gibibytes. Avoid using property names `--memory-size-gb` and `--disk-size-gb`.
* New functionality supported in this release:
* ClusterManager commands are updated with custom parameters --mi-system-assigned --mi-user-assigned to support managing identity.
* Cluster commands are updated with custom parameters --mi-system-assigned --mi-user-assigned to support managing identity.
* Cluster can now configure a storage account that will be used for downloading BareMetalMachine command execution results.
* Cluster rack pause functionality support is added with the new command `continue-update-version`.
* KubernetesCluster feature commands are added to manage addons for the Kubernetes cluster.
* BareMetalMachines and StorageAppliance are updated with new properties for secret rotation status.
* KubernetesClusters commands are enhanced to support an alternative load balancer configuration that represents an L2 load balancer in property `l2ServiceLoadBalancerConfiguration`.
* KubernetesClusters commands are enhanced to support additional upgrade settings `drainTimeout` and `maxUnavailable` for initial agent pools.
* KubernetesClusters agentpool commands are enhanced to support additional upgrade settings `drainTimeout` and `maxUnavailable`.
* This version requires a minimum of 2.61 Azure core CLI.

2.0.0b2
++++++++
* Examples updated to include new property user-principal-name for baremetalmachinekeyset and bmckeyset create and update commands.
Expand Down
37 changes: 22 additions & 15 deletions src/networkcloud/README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
# Azure CLI Networkcloud Extension #

This is an extension to Azure CLI to manage Azure Operator Nexus - Network Cloud on-premises clusters and their resources, such as racks, bare metal hosts, virtual machines, workload networks and more.

## How to use ##

Install the latest version of the extension:

```
```cli
az extension add --name networkcloud
```

Validate that the extension is installed correctly:

```
```cli
az networkcloud --help
```

For list of available versions, see [the extension release history][az-cli-networkcloud-cli-versions].

To install a specific version of the networkcloud CLI extension, add `--version` parameter to the command. For example, below installs 0.4.1
To install a specific version of the networkcloud CLI extension, add `--version` parameter to the command. For example, below installs 1.0.0

```
az extension add --name networkcloud --version 0.4.1
```cli
az extension add --name networkcloud --version 1.0.0
```

## Included Features ##

Below is a high-level overview of networkcloud commands.
For more details, please refer to [Azure Operator Nexus - NetworkCloud][networkcloud-microsoft-learn].

### Near-Edge cluster management ##

| Commands | Description |
|------------------------------------------------|------------------------------------------------------------------------------------|
Expand All @@ -35,20 +39,23 @@ Below is a high-level overview of networkcloud commands.
| 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 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][networkcloud-microsoft-learn].

### Tenant resource management ##

| Commands | Description |
|---------------------------------------------|--------------------------------------------------------------|
| az networkcloud kubernetescluster | Provides commands to manage Kubernetes clusters. |
| az networkcloud kubernetescluster agentpool | Provides commands to manage Kubernetes cluster's agent pool. |
| az networkcloud kubernetescluster feature | Provides commands to manage Kubernetes cluster's feature. |
| az networkcloud l2network | Provides commands to manage layer 2 (L2) networks. |
| az networkcloud l3network | Provides commands to manage layer 3 (L3) networks. |
| 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. |

<!-- LINKS - External -->
[networkcloud-microsoft-learn]: https://learn.microsoft.com/en-us/azure/operator-nexus/
Expand Down
59 changes: 59 additions & 0 deletions src/networkcloud/azext_networkcloud/_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,62 @@ def transform_resource_table_output(result):
final_result.append(new_item)

return final_result if is_list else final_result[0]


def transform_kubernetescluster_agentpool_table_output(result):
"""Custom formatting of table output for a kubernetescluster agentpool 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"]
new_item["Mode"] = item["mode"]
new_item["KubernetesVersion"] = item["kubernetesVersion"]
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_kubernetescluster_feature_table_output(result):
"""Custom formatting of table output for a kubernetescluster feature 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"]
new_item["Required"] = item["required"]
new_item["AvailabilityLifecycle"] = item["availabilityLifecycle"]
new_item["Version"] = item["version"]
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]
4 changes: 4 additions & 0 deletions src/networkcloud/azext_networkcloud/aaz/latest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class Cordon(AAZCommand):
"""

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

Expand Down Expand Up @@ -152,7 +152,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2023-10-01-preview",
"api-version", "2024-06-01-preview",
required=True,
),
}
Expand Down Expand Up @@ -217,7 +217,9 @@ def _build_schema_error_detail_read(cls, _schema):
_schema.target = cls._schema_error_detail_read.target
return

cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType()
cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType(
flags={"read_only": True}
)

error_detail_read = _schema_error_detail_read
error_detail_read.additional_info = AAZListType(
Expand All @@ -241,6 +243,9 @@ def _build_schema_error_detail_read(cls, _schema):
additional_info.Element = AAZObjectType()

_element = _schema_error_detail_read.additional_info.Element
_element.info = AAZObjectType(
flags={"read_only": True},
)
_element.type = AAZStrType(
flags={"read_only": True},
)
Expand All @@ -266,6 +271,7 @@ def _build_schema_operation_status_result_read(cls, _schema):
_schema.name = cls._schema_operation_status_result_read.name
_schema.operations = cls._schema_operation_status_result_read.operations
_schema.percent_complete = cls._schema_operation_status_result_read.percent_complete
_schema.properties = cls._schema_operation_status_result_read.properties
_schema.resource_id = cls._schema_operation_status_result_read.resource_id
_schema.start_time = cls._schema_operation_status_result_read.start_time
_schema.status = cls._schema_operation_status_result_read.status
Expand All @@ -276,21 +282,35 @@ def _build_schema_operation_status_result_read(cls, _schema):
operation_status_result_read = _schema_operation_status_result_read
operation_status_result_read.end_time = AAZStrType(
serialized_name="endTime",
flags={"read_only": True},
)
operation_status_result_read.error = AAZObjectType(
flags={"read_only": True},
)
operation_status_result_read.error = AAZObjectType()
cls._build_schema_error_detail_read(operation_status_result_read.error)
operation_status_result_read.id = AAZStrType()
operation_status_result_read.name = AAZStrType()
operation_status_result_read.operations = AAZListType()
operation_status_result_read.id = AAZStrType(
flags={"read_only": True},
)
operation_status_result_read.name = AAZStrType(
flags={"read_only": True},
)
operation_status_result_read.operations = AAZListType(
flags={"read_only": True},
)
operation_status_result_read.percent_complete = AAZFloatType(
serialized_name="percentComplete",
flags={"read_only": True},
)
operation_status_result_read.properties = AAZObjectType(
flags={"client_flatten": True},
)
operation_status_result_read.resource_id = AAZStrType(
serialized_name="resourceId",
flags={"read_only": True},
)
operation_status_result_read.start_time = AAZStrType(
serialized_name="startTime",
flags={"read_only": True},
)
operation_status_result_read.status = AAZStrType(
flags={"required": True},
Expand All @@ -300,12 +320,31 @@ def _build_schema_operation_status_result_read(cls, _schema):
operations.Element = AAZObjectType()
cls._build_schema_operation_status_result_read(operations.Element)

properties = _schema_operation_status_result_read.properties
properties.exit_code = AAZStrType(
serialized_name="exitCode",
flags={"read_only": True},
)
properties.output_head = AAZStrType(
serialized_name="outputHead",
flags={"read_only": True},
)
properties.result_ref = AAZStrType(
serialized_name="resultRef",
flags={"read_only": True},
)
properties.result_url = AAZStrType(
serialized_name="resultUrl",
flags={"read_only": True},
)

_schema.end_time = cls._schema_operation_status_result_read.end_time
_schema.error = cls._schema_operation_status_result_read.error
_schema.id = cls._schema_operation_status_result_read.id
_schema.name = cls._schema_operation_status_result_read.name
_schema.operations = cls._schema_operation_status_result_read.operations
_schema.percent_complete = cls._schema_operation_status_result_read.percent_complete
_schema.properties = cls._schema_operation_status_result_read.properties
_schema.resource_id = cls._schema_operation_status_result_read.resource_id
_schema.start_time = cls._schema_operation_status_result_read.start_time
_schema.status = cls._schema_operation_status_result_read.status
Expand Down
Loading
Loading