From a431e226b7bf8d56d6b921bdcda1183bc48f9114 Mon Sep 17 00:00:00 2001 From: Priya Shet Date: Thu, 27 Apr 2023 18:51:24 +0000 Subject: [PATCH] NetworkCloud tests added for L3network --- .github/CODEOWNERS | 2 + linter_exclusions.yml | 69 + src/networkcloud/HISTORY.rst | 9 + src/networkcloud/README.md | 5 + .../azext_networkcloud/__init__.py | 42 + src/networkcloud/azext_networkcloud/_help.py | 11 + .../azext_networkcloud/_params.py | 13 + .../azext_networkcloud/aaz/__init__.py | 6 + .../azext_networkcloud/aaz/latest/__init__.py | 6 + .../aaz/latest/networkcloud/__cmd_group.py | 24 + .../aaz/latest/networkcloud/__init__.py | 11 + .../baremetalmachine/__cmd_group.py | 24 + .../networkcloud/baremetalmachine/__init__.py | 26 + .../networkcloud/baremetalmachine/_cordon.py | 326 +++ .../networkcloud/baremetalmachine/_list.py | 758 ++++++ .../baremetalmachine/_power_off.py | 326 +++ .../networkcloud/baremetalmachine/_reimage.py | 301 +++ .../networkcloud/baremetalmachine/_replace.py | 384 +++ .../networkcloud/baremetalmachine/_restart.py | 301 +++ .../baremetalmachine/_run_command.py | 349 +++ .../baremetalmachine/_run_data_extract.py | 366 +++ .../baremetalmachine/_run_read_command.py | 366 +++ .../networkcloud/baremetalmachine/_show.py | 419 ++++ .../networkcloud/baremetalmachine/_start.py | 301 +++ .../baremetalmachine/_uncordon.py | 301 +++ .../networkcloud/baremetalmachine/_update.py | 510 ++++ .../baremetalmachine/_validate_hardware.py | 326 +++ .../networkcloud/baremetalmachine/_wait.py | 414 ++++ .../cloudservicesnetwork/__cmd_group.py | 24 + .../cloudservicesnetwork/__init__.py | 17 + .../cloudservicesnetwork/_create.py | 461 ++++ .../cloudservicesnetwork/_delete.py | 167 ++ .../cloudservicesnetwork/_list.py | 506 ++++ .../cloudservicesnetwork/_show.py | 309 +++ .../cloudservicesnetwork/_update.py | 456 ++++ .../cloudservicesnetwork/_wait.py | 304 +++ .../networkcloud/cluster/__cmd_group.py | 24 + .../latest/networkcloud/cluster/__init__.py | 19 + .../latest/networkcloud/cluster/_create.py | 1026 ++++++++ .../latest/networkcloud/cluster/_delete.py | 167 ++ .../latest/networkcloud/cluster/_deploy.py | 331 +++ .../aaz/latest/networkcloud/cluster/_list.py | 869 +++++++ .../aaz/latest/networkcloud/cluster/_show.py | 550 +++++ .../latest/networkcloud/cluster/_update.py | 967 ++++++++ .../networkcloud/cluster/_update_version.py | 325 +++ .../aaz/latest/networkcloud/cluster/_wait.py | 545 +++++ .../baremetalmachinekeyset/__cmd_group.py | 24 + .../baremetalmachinekeyset/__init__.py | 17 + .../cluster/baremetalmachinekeyset/_create.py | 504 ++++ .../cluster/baremetalmachinekeyset/_delete.py | 180 ++ .../cluster/baremetalmachinekeyset/_list.py | 314 +++ .../cluster/baremetalmachinekeyset/_show.py | 319 +++ .../cluster/baremetalmachinekeyset/_update.py | 472 ++++ .../cluster/baremetalmachinekeyset/_wait.py | 314 +++ .../cluster/bmckeyset/__cmd_group.py | 24 + .../cluster/bmckeyset/__init__.py | 17 + .../networkcloud/cluster/bmckeyset/_create.py | 470 ++++ .../networkcloud/cluster/bmckeyset/_delete.py | 180 ++ .../networkcloud/cluster/bmckeyset/_list.py | 304 +++ .../networkcloud/cluster/bmckeyset/_show.py | 309 +++ .../networkcloud/cluster/bmckeyset/_update.py | 449 ++++ .../networkcloud/cluster/bmckeyset/_wait.py | 304 +++ .../metricsconfiguration/__cmd_group.py | 24 + .../cluster/metricsconfiguration/__init__.py | 17 + .../cluster/metricsconfiguration/_create.py | 377 +++ .../cluster/metricsconfiguration/_delete.py | 180 ++ .../cluster/metricsconfiguration/_list.py | 262 ++ .../cluster/metricsconfiguration/_show.py | 267 +++ .../cluster/metricsconfiguration/_update.py | 372 +++ .../cluster/metricsconfiguration/_wait.py | 262 ++ .../clustermanager/__cmd_group.py | 24 + .../networkcloud/clustermanager/__init__.py | 17 + .../networkcloud/clustermanager/_create.py | 395 +++ .../networkcloud/clustermanager/_delete.py | 167 ++ .../networkcloud/clustermanager/_list.py | 472 ++++ .../networkcloud/clustermanager/_show.py | 276 +++ .../networkcloud/clustermanager/_update.py | 306 +++ .../networkcloud/clustermanager/_wait.py | 271 +++ .../defaultcninetwork/__cmd_group.py | 24 + .../defaultcninetwork/__init__.py | 17 + .../networkcloud/defaultcninetwork/_create.py | 593 +++++ .../networkcloud/defaultcninetwork/_delete.py | 167 ++ .../networkcloud/defaultcninetwork/_list.py | 588 +++++ .../networkcloud/defaultcninetwork/_show.py | 346 +++ .../networkcloud/defaultcninetwork/_update.py | 376 +++ .../networkcloud/defaultcninetwork/_wait.py | 341 +++ .../hybridakscluster/__cmd_group.py | 24 + .../networkcloud/hybridakscluster/__init__.py | 16 + .../networkcloud/hybridakscluster/_list.py | 619 +++++ .../hybridakscluster/_restart_node.py | 325 +++ .../networkcloud/hybridakscluster/_show.py | 409 ++++ .../networkcloud/hybridakscluster/_update.py | 439 ++++ .../networkcloud/hybridakscluster/_wait.py | 404 ++++ .../networkcloud/l2network/__cmd_group.py | 24 + .../latest/networkcloud/l2network/__init__.py | 17 + .../latest/networkcloud/l2network/_create.py | 377 +++ .../latest/networkcloud/l2network/_delete.py | 167 ++ .../latest/networkcloud/l2network/_list.py | 450 ++++ .../latest/networkcloud/l2network/_show.py | 265 ++ .../latest/networkcloud/l2network/_update.py | 295 +++ .../latest/networkcloud/l2network/_wait.py | 260 ++ .../networkcloud/l3network/__cmd_group.py | 24 + .../latest/networkcloud/l3network/__init__.py | 17 + .../latest/networkcloud/l3network/_create.py | 427 ++++ .../latest/networkcloud/l3network/_delete.py | 167 ++ .../latest/networkcloud/l3network/_list.py | 480 ++++ .../latest/networkcloud/l3network/_show.py | 280 +++ .../latest/networkcloud/l3network/_update.py | 310 +++ .../latest/networkcloud/l3network/_wait.py | 275 +++ .../latest/networkcloud/rack/__cmd_group.py | 24 + .../aaz/latest/networkcloud/rack/__init__.py | 15 + .../aaz/latest/networkcloud/rack/_list.py | 434 ++++ .../aaz/latest/networkcloud/rack/_show.py | 257 ++ .../aaz/latest/networkcloud/rack/_update.py | 358 +++ .../aaz/latest/networkcloud/rack/_wait.py | 252 ++ .../networkcloud/racksku/__cmd_group.py | 24 + .../latest/networkcloud/racksku/__init__.py | 13 + .../aaz/latest/networkcloud/racksku/_list.py | 366 +++ .../aaz/latest/networkcloud/racksku/_show.py | 369 +++ .../storageappliance/__cmd_group.py | 24 + .../networkcloud/storageappliance/__init__.py | 18 + .../_disable_remote_vendor_management.py | 301 +++ .../_enable_remote_vendor_management.py | 331 +++ .../networkcloud/storageappliance/_list.py | 496 ++++ .../storageappliance/_run_read_command.py | 366 +++ .../networkcloud/storageappliance/_show.py | 288 +++ .../networkcloud/storageappliance/_update.py | 376 +++ .../networkcloud/storageappliance/_wait.py | 283 +++ .../trunkednetwork/__cmd_group.py | 24 + .../networkcloud/trunkednetwork/__init__.py | 17 + .../networkcloud/trunkednetwork/_create.py | 407 ++++ .../networkcloud/trunkednetwork/_delete.py | 167 ++ .../networkcloud/trunkednetwork/_list.py | 468 ++++ .../networkcloud/trunkednetwork/_show.py | 274 +++ .../networkcloud/trunkednetwork/_update.py | 304 +++ .../networkcloud/trunkednetwork/_wait.py | 269 +++ .../virtualmachine/__cmd_group.py | 24 + .../networkcloud/virtualmachine/__init__.py | 23 + .../virtualmachine/_attach_volume.py | 325 +++ .../networkcloud/virtualmachine/_create.py | 861 +++++++ .../networkcloud/virtualmachine/_delete.py | 167 ++ .../virtualmachine/_detach_volume.py | 325 +++ .../networkcloud/virtualmachine/_list.py | 778 ++++++ .../networkcloud/virtualmachine/_power_off.py | 326 +++ .../networkcloud/virtualmachine/_reimage.py | 301 +++ .../networkcloud/virtualmachine/_restart.py | 301 +++ .../networkcloud/virtualmachine/_show.py | 429 ++++ .../networkcloud/virtualmachine/_start.py | 301 +++ .../networkcloud/virtualmachine/_update.py | 546 +++++ .../networkcloud/virtualmachine/_wait.py | 424 ++++ .../virtualmachine/console/__cmd_group.py | 24 + .../virtualmachine/console/__init__.py | 17 + .../virtualmachine/console/_create.py | 398 +++ .../virtualmachine/console/_delete.py | 180 ++ .../virtualmachine/console/_list.py | 267 +++ .../virtualmachine/console/_show.py | 272 +++ .../virtualmachine/console/_update.py | 390 +++ .../virtualmachine/console/_wait.py | 267 +++ .../latest/networkcloud/volume/__cmd_group.py | 24 + .../latest/networkcloud/volume/__init__.py | 17 + .../aaz/latest/networkcloud/volume/_create.py | 349 +++ .../aaz/latest/networkcloud/volume/_delete.py | 167 ++ .../aaz/latest/networkcloud/volume/_list.py | 424 ++++ .../aaz/latest/networkcloud/volume/_show.py | 252 ++ .../aaz/latest/networkcloud/volume/_update.py | 282 +++ .../aaz/latest/networkcloud/volume/_wait.py | 247 ++ .../aaz/operations/__init__.py | 4 + .../operations/baremetalmachine/__init__.py | 4 + .../baremetalmachine/_run_command.py | 84 + .../baremetalmachine/_run_data_extract.py | 89 + .../baremetalmachine/_run_read_command.py | 88 + .../aaz/operations/cluster/__init__.py | 4 + .../cluster/metricsconfiguration/__init__.py | 4 + .../cluster/metricsconfiguration/_create.py | 33 + .../cluster/metricsconfiguration/_delete.py | 34 + .../cluster/metricsconfiguration/_show.py | 35 + .../cluster/metricsconfiguration/_update.py | 32 + .../cluster/metricsconfiguration/common.py | 31 + .../aaz/operations/custom_properties.py | 198 ++ .../operations/storageappliance/__init__.py | 4 + .../storageappliance/_run_read_command.py | 89 + .../aaz/operations/virtualmachine/__init__.py | 4 + .../aaz/operations/virtualmachine/_create.py | 147 ++ .../virtualmachine/console/__init__.py | 4 + .../virtualmachine/console/_create.py | 35 + .../virtualmachine/console/_delete.py | 37 + .../virtualmachine/console/_show.py | 34 + .../virtualmachine/console/_update.py | 35 + .../virtualmachine/console/common.py | 28 + .../azext_networkcloud/azext_metadata.json | 5 + .../azext_networkcloud/commands.py | 79 + src/networkcloud/azext_networkcloud/custom.py | 14 + .../azext_networkcloud/tests/__init__.py | 6 + .../tests/latest/__init__.py | 6 + .../tests/latest/config.ini | 21 + .../azext_networkcloud/tests/latest/config.py | 41 + .../recordings/test_l3network_scenario1.yaml | 584 +++++ .../tests/latest/test_l3network.py | 120 + .../tests/latest/test_networkcloud.py | 11 + src/networkcloud/report.md | 2131 +++++++++++++++++ src/networkcloud/setup.cfg | 1 + src/networkcloud/setup.py | 49 + src/service_name.json | 5 + 203 files changed, 48839 insertions(+) create mode 100644 src/networkcloud/HISTORY.rst create mode 100644 src/networkcloud/README.md create mode 100644 src/networkcloud/azext_networkcloud/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/_help.py create mode 100644 src/networkcloud/azext_networkcloud/_params.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/__cmd_group.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/__cmd_group.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_cordon.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_list.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_power_off.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_reimage.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_replace.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_restart.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_run_command.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_run_data_extract.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_run_read_command.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_show.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_start.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_uncordon.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_update.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_validate_hardware.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_wait.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/__cmd_group.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/_create.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/_delete.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/_list.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/_show.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/_update.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/_wait.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/__cmd_group.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_create.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_delete.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_deploy.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_list.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_show.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_update.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_update_version.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_wait.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/__cmd_group.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/_create.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/_delete.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/_list.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/_show.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/_update.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/_wait.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/__cmd_group.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/_create.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/_delete.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/_list.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/_show.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/_update.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/_wait.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/__cmd_group.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/_create.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/_delete.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/_list.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/_show.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/_update.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/_wait.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/__cmd_group.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_create.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_delete.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_list.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_show.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_update.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_wait.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/__cmd_group.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/_create.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/_delete.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/_list.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/_show.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/_update.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/_wait.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/hybridakscluster/__cmd_group.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/hybridakscluster/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/hybridakscluster/_list.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/hybridakscluster/_restart_node.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/hybridakscluster/_show.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/hybridakscluster/_update.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/hybridakscluster/_wait.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/__cmd_group.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/_create.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/_delete.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/_list.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/_show.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/_update.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/_wait.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/__cmd_group.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/_create.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/_delete.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/_list.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/_show.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/_update.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/_wait.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/rack/__cmd_group.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/rack/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/rack/_list.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/rack/_show.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/rack/_update.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/rack/_wait.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/racksku/__cmd_group.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/racksku/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/racksku/_list.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/racksku/_show.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/__cmd_group.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_disable_remote_vendor_management.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_enable_remote_vendor_management.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_list.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_run_read_command.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_show.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_update.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_wait.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/__cmd_group.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/_create.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/_delete.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/_list.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/_show.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/_update.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/_wait.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/__cmd_group.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_attach_volume.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_create.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_delete.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_detach_volume.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_list.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_power_off.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_reimage.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_restart.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_show.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_start.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_update.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_wait.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/__cmd_group.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/_create.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/_delete.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/_list.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/_show.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/_update.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/_wait.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/__cmd_group.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/_create.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/_delete.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/_list.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/_show.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/_update.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/_wait.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/operations/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/operations/baremetalmachine/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/operations/baremetalmachine/_run_command.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/operations/baremetalmachine/_run_data_extract.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/operations/baremetalmachine/_run_read_command.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/operations/cluster/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/operations/cluster/metricsconfiguration/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/operations/cluster/metricsconfiguration/_create.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/operations/cluster/metricsconfiguration/_delete.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/operations/cluster/metricsconfiguration/_show.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/operations/cluster/metricsconfiguration/_update.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/operations/cluster/metricsconfiguration/common.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/operations/custom_properties.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/operations/storageappliance/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/operations/storageappliance/_run_read_command.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/_create.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/console/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/console/_create.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/console/_delete.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/console/_show.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/console/_update.py create mode 100644 src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/console/common.py create mode 100644 src/networkcloud/azext_networkcloud/azext_metadata.json create mode 100644 src/networkcloud/azext_networkcloud/commands.py create mode 100644 src/networkcloud/azext_networkcloud/custom.py create mode 100644 src/networkcloud/azext_networkcloud/tests/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/tests/latest/__init__.py create mode 100644 src/networkcloud/azext_networkcloud/tests/latest/config.ini create mode 100644 src/networkcloud/azext_networkcloud/tests/latest/config.py create mode 100644 src/networkcloud/azext_networkcloud/tests/latest/recordings/test_l3network_scenario1.yaml create mode 100644 src/networkcloud/azext_networkcloud/tests/latest/test_l3network.py create mode 100644 src/networkcloud/azext_networkcloud/tests/latest/test_networkcloud.py create mode 100644 src/networkcloud/report.md create mode 100644 src/networkcloud/setup.cfg create mode 100644 src/networkcloud/setup.py diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 693de8e176e..6487eb94fba 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -68,6 +68,8 @@ /src/netappfiles-preview/ @b-lefr +/src/networkcloud/ @kiall @mbashtovaya @priyamshet + /src/network-manager/ @necusjz @kairu-ms @jsntcy /src/healthcareapis/ @fengzhou-msft @iviark diff --git a/linter_exclusions.yml b/linter_exclusions.yml index 41d508e048c..f1d203bc7c0 100644 --- a/linter_exclusions.yml +++ b/linter_exclusions.yml @@ -1980,6 +1980,75 @@ network vwan update: security_provider_name: rule_exclusions: - option_length_too_long +networkcloud cloudservicesnetwork create: + parameters: + enable_default_egress_endpoints: + rule_exclusions: + - no_parameter_defaults_for_update_commands + - option_length_too_long + additional_egress_endpoints: + rule_exclusions: + - option_length_too_long +networkcloud cloudservicesnetwork update: + parameters: + enable_default_egress_endpoints: + rule_exclusions: + - no_parameter_defaults_for_update_commands + - option_length_too_long + additional_egress_endpoints: + rule_exclusions: + - option_length_too_long +networkcloud cluster create: + parameters: + aggregator_or_single_rack_definition: + rule_exclusions: + - option_length_too_long + cluster_service_principal: + rule_exclusions: + - option_length_too_long + compute_deployment_threshold: + rule_exclusions: + - option_length_too_long + compute_rack_definitions: + rule_exclusions: + - option_length_too_long + managed_resource_group_configuration: + rule_exclusions: + - option_length_too_long +networkcloud cluster update: + parameters: + aggregator_or_single_rack_definition: + rule_exclusions: + - option_length_too_long + cluster_service_principal: + rule_exclusions: + - option_length_too_long + compute_deployment_threshold: + rule_exclusions: + - option_length_too_long + compute_rack_definitions: + rule_exclusions: + - option_length_too_long +networkcloud cluster deploy: + parameters: + skip_validations_for_machines: + rule_exclusions: + - option_length_too_long +networkcloud clustermanager create: + parameters: + managed_resource_group_configuration: + rule_exclusions: + - option_length_too_long +networkcloud l3network create: + parameters: + hybrid_aks_ipam_enabled: + rule_exclusions: + - option_length_too_long +networkcloud virtualmachine create: + parameters: + isolate_emulator_thread: + rule_exclusions: + - option_length_too_long notification-hub authorization-rule create: parameters: notification_hub_name: diff --git a/src/networkcloud/HISTORY.rst b/src/networkcloud/HISTORY.rst new file mode 100644 index 00000000000..64e8a8c6a07 --- /dev/null +++ b/src/networkcloud/HISTORY.rst @@ -0,0 +1,9 @@ +.. :changelog: + +Release History +=============== + +0.3.0 +++++++ +* Initial release. This version supports NetworkCloud 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. diff --git a/src/networkcloud/README.md b/src/networkcloud/README.md new file mode 100644 index 00000000000..0f8cc74fb5d --- /dev/null +++ b/src/networkcloud/README.md @@ -0,0 +1,5 @@ +# Azure CLI Networkcloud Extension # +This is an extension to Azure CLI to manage Networkcloud resources. + +## How to use ## +Please add commands usage here. \ No newline at end of file diff --git a/src/networkcloud/azext_networkcloud/__init__.py b/src/networkcloud/azext_networkcloud/__init__.py new file mode 100644 index 00000000000..c89820d8a56 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/__init__.py @@ -0,0 +1,42 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +from azure.cli.core import AzCommandsLoader +from azext_networkcloud._help import helps # pylint: disable=unused-import + + +class NetworkcloudCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + custom_command_type = CliCommandType( + operations_tmpl='azext_networkcloud.custom#{}') + super().__init__(cli_ctx=cli_ctx, + custom_command_type=custom_command_type) + + def load_command_table(self, args): + from azext_networkcloud.commands import load_command_table + from azure.cli.core.aaz import load_aaz_command_table + try: + from . import aaz + except ImportError: + aaz = None + if aaz: + load_aaz_command_table( + loader=self, + aaz_pkg_name=aaz.__name__, + args=args + ) + load_command_table(self, args) + return self.command_table + + def load_arguments(self, command): + from azext_networkcloud._params import load_arguments + load_arguments(self, command) + + +COMMAND_LOADER_CLS = NetworkcloudCommandsLoader diff --git a/src/networkcloud/azext_networkcloud/_help.py b/src/networkcloud/azext_networkcloud/_help.py new file mode 100644 index 00000000000..126d5d00714 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/_help.py @@ -0,0 +1,11 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: disable=line-too-long +# pylint: disable=too-many-lines + +from knack.help_files import helps # pylint: disable=unused-import diff --git a/src/networkcloud/azext_networkcloud/_params.py b/src/networkcloud/azext_networkcloud/_params.py new file mode 100644 index 00000000000..cfcec717c9c --- /dev/null +++ b/src/networkcloud/azext_networkcloud/_params.py @@ -0,0 +1,13 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + + +def load_arguments(self, _): # pylint: disable=unused-argument + pass diff --git a/src/networkcloud/azext_networkcloud/aaz/__init__.py b/src/networkcloud/azext_networkcloud/aaz/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/__init__.py b/src/networkcloud/azext_networkcloud/aaz/latest/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/__cmd_group.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/__cmd_group.py new file mode 100644 index 00000000000..624144bf828 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/__cmd_group.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "networkcloud", + is_experimental=True, +) +class __CMDGroup(AAZCommandGroup): + """Manage Network Cloud resources + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/__init__.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/__init__.py new file mode 100644 index 00000000000..5a9d61963d6 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/__init__.py @@ -0,0 +1,11 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/__cmd_group.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/__cmd_group.py new file mode 100644 index 00000000000..c6373a67441 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/__cmd_group.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "networkcloud baremetalmachine", + is_experimental=True, +) +class __CMDGroup(AAZCommandGroup): + """Manage bare metal machine + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/__init__.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/__init__.py new file mode 100644 index 00000000000..63726030a5b --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/__init__.py @@ -0,0 +1,26 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._cordon import * +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 * +from ._run_read_command import * +from ._show import * +from ._start import * +from ._uncordon import * +from ._update import * +from ._validate_hardware import * +from ._wait import * diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_cordon.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_cordon.py new file mode 100644 index 00000000000..0546b85b5c3 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_cordon.py @@ -0,0 +1,326 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud baremetalmachine cordon", + is_experimental=True, +) +class Cordon(AAZCommand): + """Cordon the provided bare metal machine's Kubernetes node. + + :example: Cordon bare metal machine + az networkcloud baremetalmachine cordon --evacuate "True" --bare-metal-machine-name "bareMetalMachineName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/baremetalmachines/{}/cordon", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.bare_metal_machine_name = AAZStrArg( + options=["-n", "--name", "--bare-metal-machine-name"], + help="The name of the bare metal machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "BareMetalMachineCordonParameters" + + _args_schema = cls._args_schema + _args_schema.evacuate = AAZStrArg( + options=["--evacuate"], + arg_group="BareMetalMachineCordonParameters", + help="The indicator of whether to evacuate the node workload when the bare metal machine is cordoned.", + default="False", + enum={"False": "False", "True": "True"}, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.BareMetalMachinesCordon(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class BareMetalMachinesCordon(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/cordon", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "bareMetalMachineName", self.ctx.args.bare_metal_machine_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"client_flatten": True}} + ) + _builder.set_prop("evacuate", AAZStrType, ".evacuate") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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) + + return cls._schema_on_200 + + def on_204(self, session): + pass + + +class _CordonHelper: + """Helper class for Cordon""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType() + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + _schema_operation_status_result_read = None + + @classmethod + def _build_schema_operation_status_result_read(cls, _schema): + if cls._schema_operation_status_result_read is not None: + _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.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 + return + + cls._schema_operation_status_result_read = _schema_operation_status_result_read = AAZObjectType() + + operation_status_result_read = _schema_operation_status_result_read + operation_status_result_read.end_time = AAZStrType( + serialized_name="endTime", + ) + 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.percent_complete = AAZFloatType( + serialized_name="percentComplete", + ) + operation_status_result_read.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"read_only": True}, + ) + operation_status_result_read.start_time = AAZStrType( + serialized_name="startTime", + ) + operation_status_result_read.status = AAZStrType( + flags={"required": True}, + ) + + operations = _schema_operation_status_result_read.operations + operations.Element = AAZObjectType() + cls._build_schema_operation_status_result_read(operations.Element) + + _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.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 + + +__all__ = ["Cordon"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_list.py new file mode 100644 index 00000000000..913b825a960 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_list.py @@ -0,0 +1,758 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud baremetalmachine list", + is_experimental=True, +) +class List(AAZCommand): + """List bare metal machines in the provided resource group or subscription. + + :example: List bare metal machines for resource group + az networkcloud baremetalmachine list --resource-group "resourceGroupName" + + :example: List bare metal machines for subscription + az networkcloud baremetalmachine list + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.networkcloud/baremetalmachines", "2022-12-12-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/baremetalmachines", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) + condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + if condition_0: + self.BareMetalMachinesListByResourceGroup(ctx=self.ctx)() + if condition_1: + self.BareMetalMachinesListBySubscription(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class BareMetalMachinesListByResourceGroup(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.value.Element.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.bmc_connection_string = AAZStrType( + serialized_name="bmcConnectionString", + flags={"required": True}, + ) + properties.bmc_credentials = AAZObjectType( + serialized_name="bmcCredentials", + flags={"required": True}, + ) + properties.bmc_mac_address = AAZStrType( + serialized_name="bmcMacAddress", + flags={"required": True}, + ) + properties.boot_mac_address = AAZStrType( + serialized_name="bootMacAddress", + flags={"required": True}, + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.cordon_status = AAZStrType( + serialized_name="cordonStatus", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hardware_inventory = AAZObjectType( + serialized_name="hardwareInventory", + ) + properties.hardware_validation_status = AAZObjectType( + serialized_name="hardwareValidationStatus", + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.kubernetes_node_name = AAZStrType( + serialized_name="kubernetesNodeName", + flags={"read_only": True}, + ) + properties.kubernetes_version = AAZStrType( + serialized_name="kubernetesVersion", + flags={"read_only": True}, + ) + properties.machine_details = AAZStrType( + serialized_name="machineDetails", + flags={"required": True}, + ) + properties.machine_name = AAZStrType( + serialized_name="machineName", + flags={"required": True}, + ) + properties.machine_sku_id = AAZStrType( + serialized_name="machineSkuId", + flags={"required": True}, + ) + properties.oam_ipv4_address = AAZStrType( + serialized_name="oamIpv4Address", + flags={"read_only": True}, + ) + properties.oam_ipv6_address = AAZStrType( + serialized_name="oamIpv6Address", + flags={"read_only": True}, + ) + properties.os_image = AAZStrType( + serialized_name="osImage", + flags={"read_only": True}, + ) + properties.power_state = AAZStrType( + serialized_name="powerState", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.rack_id = AAZStrType( + serialized_name="rackId", + flags={"required": True}, + ) + properties.rack_slot = AAZIntType( + serialized_name="rackSlot", + flags={"required": True}, + ) + properties.ready_state = AAZStrType( + serialized_name="readyState", + flags={"read_only": True}, + ) + properties.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"required": True}, + ) + properties.service_tag = AAZStrType( + serialized_name="serviceTag", + flags={"read_only": True}, + ) + properties.virtual_machines_associated_ids = AAZListType( + serialized_name="virtualMachinesAssociatedIds", + flags={"read_only": True}, + ) + + bmc_credentials = cls._schema_on_200.value.Element.properties.bmc_credentials + bmc_credentials.password = AAZStrType( + flags={"required": True, "secret": True}, + ) + bmc_credentials.username = AAZStrType( + flags={"required": True}, + ) + + hardware_inventory = cls._schema_on_200.value.Element.properties.hardware_inventory + hardware_inventory.additional_host_information = AAZStrType( + serialized_name="additionalHostInformation", + flags={"read_only": True}, + ) + hardware_inventory.interfaces = AAZListType( + flags={"read_only": True}, + ) + hardware_inventory.nics = AAZListType( + flags={"read_only": True}, + ) + + interfaces = cls._schema_on_200.value.Element.properties.hardware_inventory.interfaces + interfaces.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.hardware_inventory.interfaces.Element + _element.link_status = AAZStrType( + serialized_name="linkStatus", + flags={"read_only": True}, + ) + _element.mac_address = AAZStrType( + serialized_name="macAddress", + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.network_interface_id = AAZStrType( + serialized_name="networkInterfaceId", + flags={"read_only": True}, + ) + + nics = cls._schema_on_200.value.Element.properties.hardware_inventory.nics + nics.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.hardware_inventory.nics.Element + _element.lldp_neighbor = AAZObjectType( + serialized_name="lldpNeighbor", + ) + _element.mac_address = AAZStrType( + serialized_name="macAddress", + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + + lldp_neighbor = cls._schema_on_200.value.Element.properties.hardware_inventory.nics.Element.lldp_neighbor + lldp_neighbor.port_description = AAZStrType( + serialized_name="portDescription", + flags={"read_only": True}, + ) + lldp_neighbor.port_name = AAZStrType( + serialized_name="portName", + flags={"read_only": True}, + ) + lldp_neighbor.system_description = AAZStrType( + serialized_name="systemDescription", + flags={"read_only": True}, + ) + lldp_neighbor.system_name = AAZStrType( + serialized_name="systemName", + flags={"read_only": True}, + ) + + hardware_validation_status = cls._schema_on_200.value.Element.properties.hardware_validation_status + hardware_validation_status.last_validation_time = AAZStrType( + serialized_name="lastValidationTime", + flags={"read_only": True}, + ) + hardware_validation_status.result = AAZStrType( + flags={"read_only": True}, + ) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200.value.Element.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + virtual_machines_associated_ids = cls._schema_on_200.value.Element.properties.virtual_machines_associated_ids + virtual_machines_associated_ids.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + class BareMetalMachinesListBySubscription(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/bareMetalMachines", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.value.Element.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.bmc_connection_string = AAZStrType( + serialized_name="bmcConnectionString", + flags={"required": True}, + ) + properties.bmc_credentials = AAZObjectType( + serialized_name="bmcCredentials", + flags={"required": True}, + ) + properties.bmc_mac_address = AAZStrType( + serialized_name="bmcMacAddress", + flags={"required": True}, + ) + properties.boot_mac_address = AAZStrType( + serialized_name="bootMacAddress", + flags={"required": True}, + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.cordon_status = AAZStrType( + serialized_name="cordonStatus", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hardware_inventory = AAZObjectType( + serialized_name="hardwareInventory", + ) + properties.hardware_validation_status = AAZObjectType( + serialized_name="hardwareValidationStatus", + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.kubernetes_node_name = AAZStrType( + serialized_name="kubernetesNodeName", + flags={"read_only": True}, + ) + properties.kubernetes_version = AAZStrType( + serialized_name="kubernetesVersion", + flags={"read_only": True}, + ) + properties.machine_details = AAZStrType( + serialized_name="machineDetails", + flags={"required": True}, + ) + properties.machine_name = AAZStrType( + serialized_name="machineName", + flags={"required": True}, + ) + properties.machine_sku_id = AAZStrType( + serialized_name="machineSkuId", + flags={"required": True}, + ) + properties.oam_ipv4_address = AAZStrType( + serialized_name="oamIpv4Address", + flags={"read_only": True}, + ) + properties.oam_ipv6_address = AAZStrType( + serialized_name="oamIpv6Address", + flags={"read_only": True}, + ) + properties.os_image = AAZStrType( + serialized_name="osImage", + flags={"read_only": True}, + ) + properties.power_state = AAZStrType( + serialized_name="powerState", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.rack_id = AAZStrType( + serialized_name="rackId", + flags={"required": True}, + ) + properties.rack_slot = AAZIntType( + serialized_name="rackSlot", + flags={"required": True}, + ) + properties.ready_state = AAZStrType( + serialized_name="readyState", + flags={"read_only": True}, + ) + properties.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"required": True}, + ) + properties.service_tag = AAZStrType( + serialized_name="serviceTag", + flags={"read_only": True}, + ) + properties.virtual_machines_associated_ids = AAZListType( + serialized_name="virtualMachinesAssociatedIds", + flags={"read_only": True}, + ) + + bmc_credentials = cls._schema_on_200.value.Element.properties.bmc_credentials + bmc_credentials.password = AAZStrType( + flags={"required": True, "secret": True}, + ) + bmc_credentials.username = AAZStrType( + flags={"required": True}, + ) + + hardware_inventory = cls._schema_on_200.value.Element.properties.hardware_inventory + hardware_inventory.additional_host_information = AAZStrType( + serialized_name="additionalHostInformation", + flags={"read_only": True}, + ) + hardware_inventory.interfaces = AAZListType( + flags={"read_only": True}, + ) + hardware_inventory.nics = AAZListType( + flags={"read_only": True}, + ) + + interfaces = cls._schema_on_200.value.Element.properties.hardware_inventory.interfaces + interfaces.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.hardware_inventory.interfaces.Element + _element.link_status = AAZStrType( + serialized_name="linkStatus", + flags={"read_only": True}, + ) + _element.mac_address = AAZStrType( + serialized_name="macAddress", + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.network_interface_id = AAZStrType( + serialized_name="networkInterfaceId", + flags={"read_only": True}, + ) + + nics = cls._schema_on_200.value.Element.properties.hardware_inventory.nics + nics.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.hardware_inventory.nics.Element + _element.lldp_neighbor = AAZObjectType( + serialized_name="lldpNeighbor", + ) + _element.mac_address = AAZStrType( + serialized_name="macAddress", + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + + lldp_neighbor = cls._schema_on_200.value.Element.properties.hardware_inventory.nics.Element.lldp_neighbor + lldp_neighbor.port_description = AAZStrType( + serialized_name="portDescription", + flags={"read_only": True}, + ) + lldp_neighbor.port_name = AAZStrType( + serialized_name="portName", + flags={"read_only": True}, + ) + lldp_neighbor.system_description = AAZStrType( + serialized_name="systemDescription", + flags={"read_only": True}, + ) + lldp_neighbor.system_name = AAZStrType( + serialized_name="systemName", + flags={"read_only": True}, + ) + + hardware_validation_status = cls._schema_on_200.value.Element.properties.hardware_validation_status + hardware_validation_status.last_validation_time = AAZStrType( + serialized_name="lastValidationTime", + flags={"read_only": True}, + ) + hardware_validation_status.result = AAZStrType( + flags={"read_only": True}, + ) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200.value.Element.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + virtual_machines_associated_ids = cls._schema_on_200.value.Element.properties.virtual_machines_associated_ids + virtual_machines_associated_ids.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_power_off.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_power_off.py new file mode 100644 index 00000000000..5eea8bd181a --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_power_off.py @@ -0,0 +1,326 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud baremetalmachine power-off", + is_experimental=True, +) +class PowerOff(AAZCommand): + """Power off the provided bare metal machine. + + :example: Power off bare metal machine + az networkcloud baremetalmachine power-off --bare-metal-machine-name "bareMetalMachineName" --skip-shutdown "True" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/baremetalmachines/{}/poweroff", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.bare_metal_machine_name = AAZStrArg( + options=["-n", "--name", "--bare-metal-machine-name"], + help="The name of the bare metal machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "BareMetalMachinePowerOffParameters" + + _args_schema = cls._args_schema + _args_schema.skip_shutdown = AAZStrArg( + options=["--skip-shutdown"], + arg_group="BareMetalMachinePowerOffParameters", + help="The indicator of whether to skip the graceful OS shutdown and power off the bare metal machine immediately.", + default="False", + enum={"False": "False", "True": "True"}, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.BareMetalMachinesPowerOff(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class BareMetalMachinesPowerOff(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/powerOff", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "bareMetalMachineName", self.ctx.args.bare_metal_machine_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"client_flatten": True}} + ) + _builder.set_prop("skipShutdown", AAZStrType, ".skip_shutdown") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _PowerOffHelper._build_schema_operation_status_result_read(cls._schema_on_200) + + return cls._schema_on_200 + + def on_204(self, session): + pass + + +class _PowerOffHelper: + """Helper class for PowerOff""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType() + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + _schema_operation_status_result_read = None + + @classmethod + def _build_schema_operation_status_result_read(cls, _schema): + if cls._schema_operation_status_result_read is not None: + _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.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 + return + + cls._schema_operation_status_result_read = _schema_operation_status_result_read = AAZObjectType() + + operation_status_result_read = _schema_operation_status_result_read + operation_status_result_read.end_time = AAZStrType( + serialized_name="endTime", + ) + 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.percent_complete = AAZFloatType( + serialized_name="percentComplete", + ) + operation_status_result_read.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"read_only": True}, + ) + operation_status_result_read.start_time = AAZStrType( + serialized_name="startTime", + ) + operation_status_result_read.status = AAZStrType( + flags={"required": True}, + ) + + operations = _schema_operation_status_result_read.operations + operations.Element = AAZObjectType() + cls._build_schema_operation_status_result_read(operations.Element) + + _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.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 + + +__all__ = ["PowerOff"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_reimage.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_reimage.py new file mode 100644 index 00000000000..dd8efc63ee1 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_reimage.py @@ -0,0 +1,301 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud baremetalmachine reimage", + is_experimental=True, +) +class Reimage(AAZCommand): + """Reimage the provided bare metal machine. + + :example: Reimage bare metal machine + az networkcloud baremetalmachine reimage --bare-metal-machine-name "bareMetalMachineName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/baremetalmachines/{}/reimage", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.bare_metal_machine_name = AAZStrArg( + options=["-n", "--name", "--bare-metal-machine-name"], + help="The name of the bare metal machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.BareMetalMachinesReimage(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class BareMetalMachinesReimage(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/reimage", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "bareMetalMachineName", self.ctx.args.bare_metal_machine_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _ReimageHelper._build_schema_operation_status_result_read(cls._schema_on_200) + + return cls._schema_on_200 + + def on_204(self, session): + pass + + +class _ReimageHelper: + """Helper class for Reimage""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType() + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + _schema_operation_status_result_read = None + + @classmethod + def _build_schema_operation_status_result_read(cls, _schema): + if cls._schema_operation_status_result_read is not None: + _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.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 + return + + cls._schema_operation_status_result_read = _schema_operation_status_result_read = AAZObjectType() + + operation_status_result_read = _schema_operation_status_result_read + operation_status_result_read.end_time = AAZStrType( + serialized_name="endTime", + ) + 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.percent_complete = AAZFloatType( + serialized_name="percentComplete", + ) + operation_status_result_read.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"read_only": True}, + ) + operation_status_result_read.start_time = AAZStrType( + serialized_name="startTime", + ) + operation_status_result_read.status = AAZStrType( + flags={"required": True}, + ) + + operations = _schema_operation_status_result_read.operations + operations.Element = AAZObjectType() + cls._build_schema_operation_status_result_read(operations.Element) + + _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.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 + + +__all__ = ["Reimage"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_replace.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_replace.py new file mode 100644 index 00000000000..0c8aa35e85c --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_replace.py @@ -0,0 +1,384 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud baremetalmachine replace", + is_experimental=True, +) +class Replace(AAZCommand): + """Replace the provided bare metal machine. + + :example: Replace bare metal machine + az networkcloud baremetalmachine replace --bare-metal-machine-name "bareMetalMachineName" --bmc-credentials password="{password}" username="bmcuser" --bmc-mac-address "00:00:4f:00:57:ad" --boot-mac-address "00:00:4e:00:58:af" --machine-name "name" --serial-number "BM1219XXX" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/baremetalmachines/{}/replace", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.bare_metal_machine_name = AAZStrArg( + options=["-n", "--name", "--bare-metal-machine-name"], + help="The name of the bare metal machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "BareMetalMachineReplaceParameters" + + _args_schema = cls._args_schema + _args_schema.bmc_credentials = AAZObjectArg( + options=["--bmc-credentials"], + arg_group="BareMetalMachineReplaceParameters", + help="The credentials of the baseboard management controller on this bare metal machine.", + ) + _args_schema.bmc_mac_address = AAZStrArg( + options=["--bmc-mac-address"], + arg_group="BareMetalMachineReplaceParameters", + help="The MAC address of the BMC device.", + fmt=AAZStrArgFormat( + pattern="^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$", + ), + ) + _args_schema.boot_mac_address = AAZStrArg( + options=["--boot-mac-address"], + arg_group="BareMetalMachineReplaceParameters", + help="The MAC address of a NIC connected to the PXE network.", + fmt=AAZStrArgFormat( + pattern="^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$", + ), + ) + _args_schema.machine_name = AAZStrArg( + options=["--machine-name"], + arg_group="BareMetalMachineReplaceParameters", + help="The OS-level hostname assigned to this machine.", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + _args_schema.serial_number = AAZStrArg( + options=["--serial-number"], + arg_group="BareMetalMachineReplaceParameters", + help="The serial number of the bare metal machine.", + fmt=AAZStrArgFormat( + max_length=64, + min_length=1, + ), + ) + + bmc_credentials = cls._args_schema.bmc_credentials + bmc_credentials.password = AAZStrArg( + options=["password"], + help="The password of the administrator of the device used during initialization.", + required=True, + fmt=AAZStrArgFormat( + min_length=1, + ), + ) + bmc_credentials.username = AAZStrArg( + options=["username"], + help="The username of the administrator of the device used during initialization.", + required=True, + fmt=AAZStrArgFormat( + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.BareMetalMachinesReplace(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class BareMetalMachinesReplace(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/replace", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "bareMetalMachineName", self.ctx.args.bare_metal_machine_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"client_flatten": True}} + ) + _builder.set_prop("bmcCredentials", AAZObjectType, ".bmc_credentials") + _builder.set_prop("bmcMacAddress", AAZStrType, ".bmc_mac_address") + _builder.set_prop("bootMacAddress", AAZStrType, ".boot_mac_address") + _builder.set_prop("machineName", AAZStrType, ".machine_name") + _builder.set_prop("serialNumber", AAZStrType, ".serial_number") + + bmc_credentials = _builder.get(".bmcCredentials") + if bmc_credentials is not None: + bmc_credentials.set_prop("password", AAZStrType, ".password", typ_kwargs={"flags": {"required": True, "secret": True}}) + bmc_credentials.set_prop("username", AAZStrType, ".username", typ_kwargs={"flags": {"required": True}}) + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _ReplaceHelper._build_schema_operation_status_result_read(cls._schema_on_200) + + return cls._schema_on_200 + + def on_204(self, session): + pass + + +class _ReplaceHelper: + """Helper class for Replace""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType() + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + _schema_operation_status_result_read = None + + @classmethod + def _build_schema_operation_status_result_read(cls, _schema): + if cls._schema_operation_status_result_read is not None: + _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.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 + return + + cls._schema_operation_status_result_read = _schema_operation_status_result_read = AAZObjectType() + + operation_status_result_read = _schema_operation_status_result_read + operation_status_result_read.end_time = AAZStrType( + serialized_name="endTime", + ) + 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.percent_complete = AAZFloatType( + serialized_name="percentComplete", + ) + operation_status_result_read.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"read_only": True}, + ) + operation_status_result_read.start_time = AAZStrType( + serialized_name="startTime", + ) + operation_status_result_read.status = AAZStrType( + flags={"required": True}, + ) + + operations = _schema_operation_status_result_read.operations + operations.Element = AAZObjectType() + cls._build_schema_operation_status_result_read(operations.Element) + + _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.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 + + +__all__ = ["Replace"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_restart.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_restart.py new file mode 100644 index 00000000000..50baaa0378a --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_restart.py @@ -0,0 +1,301 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud baremetalmachine restart", + is_experimental=True, +) +class Restart(AAZCommand): + """Restart the provided bare metal machine. + + :example: Restart bare metal machine + az networkcloud baremetalmachine restart --bare-metal-machine-name "bareMetalMachineName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/baremetalmachines/{}/restart", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.bare_metal_machine_name = AAZStrArg( + options=["-n", "--name", "--bare-metal-machine-name"], + help="The name of the bare metal machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.BareMetalMachinesRestart(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class BareMetalMachinesRestart(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/restart", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "bareMetalMachineName", self.ctx.args.bare_metal_machine_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _RestartHelper._build_schema_operation_status_result_read(cls._schema_on_200) + + return cls._schema_on_200 + + def on_204(self, session): + pass + + +class _RestartHelper: + """Helper class for Restart""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType() + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + _schema_operation_status_result_read = None + + @classmethod + def _build_schema_operation_status_result_read(cls, _schema): + if cls._schema_operation_status_result_read is not None: + _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.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 + return + + cls._schema_operation_status_result_read = _schema_operation_status_result_read = AAZObjectType() + + operation_status_result_read = _schema_operation_status_result_read + operation_status_result_read.end_time = AAZStrType( + serialized_name="endTime", + ) + 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.percent_complete = AAZFloatType( + serialized_name="percentComplete", + ) + operation_status_result_read.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"read_only": True}, + ) + operation_status_result_read.start_time = AAZStrType( + serialized_name="startTime", + ) + operation_status_result_read.status = AAZStrType( + flags={"required": True}, + ) + + operations = _schema_operation_status_result_read.operations + operations.Element = AAZObjectType() + cls._build_schema_operation_status_result_read(operations.Element) + + _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.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 + + +__all__ = ["Restart"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_run_command.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_run_command.py new file mode 100644 index 00000000000..6fccacf1b61 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_run_command.py @@ -0,0 +1,349 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud baremetalmachine run-command", + is_experimental=True, +) +class RunCommand(AAZCommand): + """Run the command or the script on the provided bare metal machine. The URL to storage account with the command execution results and the command exit code can be retrieved from the operation status API once available. + + :example: Run command on bare metal machine + az networkcloud baremetalmachine run-command --bare-metal-machine-name "bareMetalMachineName" --arguments "--argument1" "argument2" --limit-time-seconds 60 --script "cHdkCg==" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/baremetalmachines/{}/runcommand", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.bare_metal_machine_name = AAZStrArg( + options=["-n", "--name", "--bare-metal-machine-name"], + help="The name of the bare metal machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "BareMetalMachineRunCommandParameters" + + _args_schema = cls._args_schema + _args_schema.arguments = AAZListArg( + options=["--arguments"], + arg_group="BareMetalMachineRunCommandParameters", + help="The list of string arguments that will be passed to the script in order as separate arguments.", + ) + _args_schema.limit_time_seconds = AAZIntArg( + options=["--limit-time-seconds"], + arg_group="BareMetalMachineRunCommandParameters", + help="The maximum time the script is allowed to run. If the execution time exceeds the maximum, the script will be stopped, any output produced until then will be captured, and the exit code matching a timeout will be returned (252).", + required=True, + fmt=AAZIntArgFormat( + maximum=14400, + minimum=60, + ), + ) + _args_schema.script = AAZStrArg( + options=["--script"], + arg_group="BareMetalMachineRunCommandParameters", + help="The base64 encoded script to execute on the bare metal machine.", + required=True, + ) + + arguments = cls._args_schema.arguments + arguments.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.BareMetalMachinesRunCommand(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class BareMetalMachinesRunCommand(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/runCommand", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "bareMetalMachineName", self.ctx.args.bare_metal_machine_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("arguments", AAZListType, ".arguments") + _builder.set_prop("limitTimeSeconds", AAZIntType, ".limit_time_seconds", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("script", AAZStrType, ".script", typ_kwargs={"flags": {"required": True}}) + + arguments = _builder.get(".arguments") + if arguments is not None: + arguments.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _RunCommandHelper._build_schema_operation_status_result_read(cls._schema_on_200) + + return cls._schema_on_200 + + def on_204(self, session): + pass + + +class _RunCommandHelper: + """Helper class for RunCommand""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType() + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + _schema_operation_status_result_read = None + + @classmethod + def _build_schema_operation_status_result_read(cls, _schema): + if cls._schema_operation_status_result_read is not None: + _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.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 + return + + cls._schema_operation_status_result_read = _schema_operation_status_result_read = AAZObjectType() + + operation_status_result_read = _schema_operation_status_result_read + operation_status_result_read.end_time = AAZStrType( + serialized_name="endTime", + ) + 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.percent_complete = AAZFloatType( + serialized_name="percentComplete", + ) + operation_status_result_read.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"read_only": True}, + ) + operation_status_result_read.start_time = AAZStrType( + serialized_name="startTime", + ) + operation_status_result_read.status = AAZStrType( + flags={"required": True}, + ) + + operations = _schema_operation_status_result_read.operations + operations.Element = AAZObjectType() + cls._build_schema_operation_status_result_read(operations.Element) + + _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.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 + + +__all__ = ["RunCommand"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_run_data_extract.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_run_data_extract.py new file mode 100644 index 00000000000..49e8665a4a6 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_run_data_extract.py @@ -0,0 +1,366 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud baremetalmachine run-data-extract", + is_experimental=True, +) +class RunDataExtract(AAZCommand): + """Run one or more data extractions on the provided bare metal machine. The URL to storage account with the command execution results and the command exit code can be retrieved from the operation status API once available. + + :example: Run data extraction on bare metal machine + az networkcloud baremetalmachine run-data-extract --bare-metal-machine-name "bareMetalMachineName" --limit-time-seconds 60 --commands '[{"arguments":["SysInfo", "TTYLog"],"command":"hardware-support-data-collection"}]' --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/baremetalmachines/{}/rundataextracts", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.bare_metal_machine_name = AAZStrArg( + options=["-n", "--name", "--bare-metal-machine-name"], + help="The name of the bare metal machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "BareMetalMachineRunDataExtractsParameters" + + _args_schema = cls._args_schema + _args_schema.commands = AAZListArg( + options=["--commands"], + arg_group="BareMetalMachineRunDataExtractsParameters", + help="The list of curated data extraction commands to be executed directly against the target machine.", + required=True, + ) + _args_schema.limit_time_seconds = AAZIntArg( + options=["--limit-time-seconds"], + arg_group="BareMetalMachineRunDataExtractsParameters", + help="The maximum time the commands are allowed to run. If the execution time exceeds the maximum, the script will be stopped, any output produced until then will be captured, and the exit code matching a timeout will be returned (252).", + required=True, + fmt=AAZIntArgFormat( + maximum=14400, + minimum=60, + ), + ) + + commands = cls._args_schema.commands + commands.Element = AAZObjectArg() + + _element = cls._args_schema.commands.Element + _element.arguments = AAZListArg( + options=["arguments"], + help="The list of string arguments that will be passed to the script in order as separate arguments.", + ) + _element.command = AAZStrArg( + options=["command"], + help="The command to execute against the bare metal machine.", + required=True, + ) + + arguments = cls._args_schema.commands.Element.arguments + arguments.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.BareMetalMachinesRunDataExtracts(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class BareMetalMachinesRunDataExtracts(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/runDataExtracts", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "bareMetalMachineName", self.ctx.args.bare_metal_machine_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("commands", AAZListType, ".commands", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("limitTimeSeconds", AAZIntType, ".limit_time_seconds", typ_kwargs={"flags": {"required": True}}) + + commands = _builder.get(".commands") + if commands is not None: + commands.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".commands[]") + if _elements is not None: + _elements.set_prop("arguments", AAZListType, ".arguments") + _elements.set_prop("command", AAZStrType, ".command", typ_kwargs={"flags": {"required": True}}) + + arguments = _builder.get(".commands[].arguments") + if arguments is not None: + arguments.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _RunDataExtractHelper._build_schema_operation_status_result_read(cls._schema_on_200) + + return cls._schema_on_200 + + def on_204(self, session): + pass + + +class _RunDataExtractHelper: + """Helper class for RunDataExtract""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType() + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + _schema_operation_status_result_read = None + + @classmethod + def _build_schema_operation_status_result_read(cls, _schema): + if cls._schema_operation_status_result_read is not None: + _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.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 + return + + cls._schema_operation_status_result_read = _schema_operation_status_result_read = AAZObjectType() + + operation_status_result_read = _schema_operation_status_result_read + operation_status_result_read.end_time = AAZStrType( + serialized_name="endTime", + ) + 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.percent_complete = AAZFloatType( + serialized_name="percentComplete", + ) + operation_status_result_read.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"read_only": True}, + ) + operation_status_result_read.start_time = AAZStrType( + serialized_name="startTime", + ) + operation_status_result_read.status = AAZStrType( + flags={"required": True}, + ) + + operations = _schema_operation_status_result_read.operations + operations.Element = AAZObjectType() + cls._build_schema_operation_status_result_read(operations.Element) + + _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.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 + + +__all__ = ["RunDataExtract"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_run_read_command.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_run_read_command.py new file mode 100644 index 00000000000..af029cf4fe9 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_run_read_command.py @@ -0,0 +1,366 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud baremetalmachine run-read-command", + is_experimental=True, +) +class RunReadCommand(AAZCommand): + """Run one or more read-only commands on the provided bare metal machine. The URL to storage account with the command execution results and the command exit code can be retrieved from the operation status API once available. + + :example: Run and retrieve output from read only commands on bare metal machine + az networkcloud baremetalmachine run-read-command --bare-metal-machine-name "bareMetalMachineName" --limit-time-seconds 60 --commands '[{"command":"kubectl get","arguments":["pods","-A"]},{"command":"ping", "arguments":["192.168.0.99","-c","3"]}]' --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/baremetalmachines/{}/runreadcommands", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.bare_metal_machine_name = AAZStrArg( + options=["-n", "--name", "--bare-metal-machine-name"], + help="The name of the bare metal machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "BareMetalMachineRunReadCommandsParameters" + + _args_schema = cls._args_schema + _args_schema.commands = AAZListArg( + options=["--commands"], + arg_group="BareMetalMachineRunReadCommandsParameters", + help="The list of read-only commands to be executed directly against the target machine.", + required=True, + ) + _args_schema.limit_time_seconds = AAZIntArg( + options=["--limit-time-seconds"], + arg_group="BareMetalMachineRunReadCommandsParameters", + help="The maximum time the commands are allowed to run. If the execution time exceeds the maximum, the script will be stopped, any output produced until then will be captured, and the exit code matching a timeout will be returned (252).", + required=True, + fmt=AAZIntArgFormat( + maximum=14400, + minimum=60, + ), + ) + + commands = cls._args_schema.commands + commands.Element = AAZObjectArg() + + _element = cls._args_schema.commands.Element + _element.arguments = AAZListArg( + options=["arguments"], + help="The list of string arguments that will be passed to the script in order as separate arguments.", + ) + _element.command = AAZStrArg( + options=["command"], + help="The command to execute against the bare metal machine.", + required=True, + ) + + arguments = cls._args_schema.commands.Element.arguments + arguments.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.BareMetalMachinesRunReadCommands(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class BareMetalMachinesRunReadCommands(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/runReadCommands", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "bareMetalMachineName", self.ctx.args.bare_metal_machine_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("commands", AAZListType, ".commands", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("limitTimeSeconds", AAZIntType, ".limit_time_seconds", typ_kwargs={"flags": {"required": True}}) + + commands = _builder.get(".commands") + if commands is not None: + commands.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".commands[]") + if _elements is not None: + _elements.set_prop("arguments", AAZListType, ".arguments") + _elements.set_prop("command", AAZStrType, ".command", typ_kwargs={"flags": {"required": True}}) + + arguments = _builder.get(".commands[].arguments") + if arguments is not None: + arguments.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _RunReadCommandHelper._build_schema_operation_status_result_read(cls._schema_on_200) + + return cls._schema_on_200 + + def on_204(self, session): + pass + + +class _RunReadCommandHelper: + """Helper class for RunReadCommand""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType() + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + _schema_operation_status_result_read = None + + @classmethod + def _build_schema_operation_status_result_read(cls, _schema): + if cls._schema_operation_status_result_read is not None: + _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.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 + return + + cls._schema_operation_status_result_read = _schema_operation_status_result_read = AAZObjectType() + + operation_status_result_read = _schema_operation_status_result_read + operation_status_result_read.end_time = AAZStrType( + serialized_name="endTime", + ) + 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.percent_complete = AAZFloatType( + serialized_name="percentComplete", + ) + operation_status_result_read.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"read_only": True}, + ) + operation_status_result_read.start_time = AAZStrType( + serialized_name="startTime", + ) + operation_status_result_read.status = AAZStrType( + flags={"required": True}, + ) + + operations = _schema_operation_status_result_read.operations + operations.Element = AAZObjectType() + cls._build_schema_operation_status_result_read(operations.Element) + + _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.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 + + +__all__ = ["RunReadCommand"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_show.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_show.py new file mode 100644 index 00000000000..8a377c1150b --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_show.py @@ -0,0 +1,419 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud baremetalmachine show", + is_experimental=True, +) +class Show(AAZCommand): + """Get properties of the provided bare metal machine. + + :example: Get bare metal machine + az networkcloud baremetalmachine show --bare-metal-machine-name "bareMetalMachineName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/baremetalmachines/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.bare_metal_machine_name = AAZStrArg( + options=["-n", "--name", "--bare-metal-machine-name"], + help="The name of the bare metal machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.BareMetalMachinesGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class BareMetalMachinesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "bareMetalMachineName", self.ctx.args.bare_metal_machine_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.bmc_connection_string = AAZStrType( + serialized_name="bmcConnectionString", + flags={"required": True}, + ) + properties.bmc_credentials = AAZObjectType( + serialized_name="bmcCredentials", + flags={"required": True}, + ) + properties.bmc_mac_address = AAZStrType( + serialized_name="bmcMacAddress", + flags={"required": True}, + ) + properties.boot_mac_address = AAZStrType( + serialized_name="bootMacAddress", + flags={"required": True}, + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.cordon_status = AAZStrType( + serialized_name="cordonStatus", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hardware_inventory = AAZObjectType( + serialized_name="hardwareInventory", + ) + properties.hardware_validation_status = AAZObjectType( + serialized_name="hardwareValidationStatus", + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.kubernetes_node_name = AAZStrType( + serialized_name="kubernetesNodeName", + flags={"read_only": True}, + ) + properties.kubernetes_version = AAZStrType( + serialized_name="kubernetesVersion", + flags={"read_only": True}, + ) + properties.machine_details = AAZStrType( + serialized_name="machineDetails", + flags={"required": True}, + ) + properties.machine_name = AAZStrType( + serialized_name="machineName", + flags={"required": True}, + ) + properties.machine_sku_id = AAZStrType( + serialized_name="machineSkuId", + flags={"required": True}, + ) + properties.oam_ipv4_address = AAZStrType( + serialized_name="oamIpv4Address", + flags={"read_only": True}, + ) + properties.oam_ipv6_address = AAZStrType( + serialized_name="oamIpv6Address", + flags={"read_only": True}, + ) + properties.os_image = AAZStrType( + serialized_name="osImage", + flags={"read_only": True}, + ) + properties.power_state = AAZStrType( + serialized_name="powerState", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.rack_id = AAZStrType( + serialized_name="rackId", + flags={"required": True}, + ) + properties.rack_slot = AAZIntType( + serialized_name="rackSlot", + flags={"required": True}, + ) + properties.ready_state = AAZStrType( + serialized_name="readyState", + flags={"read_only": True}, + ) + properties.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"required": True}, + ) + properties.service_tag = AAZStrType( + serialized_name="serviceTag", + flags={"read_only": True}, + ) + properties.virtual_machines_associated_ids = AAZListType( + serialized_name="virtualMachinesAssociatedIds", + flags={"read_only": True}, + ) + + bmc_credentials = cls._schema_on_200.properties.bmc_credentials + bmc_credentials.password = AAZStrType( + flags={"required": True, "secret": True}, + ) + bmc_credentials.username = AAZStrType( + flags={"required": True}, + ) + + hardware_inventory = cls._schema_on_200.properties.hardware_inventory + hardware_inventory.additional_host_information = AAZStrType( + serialized_name="additionalHostInformation", + flags={"read_only": True}, + ) + hardware_inventory.interfaces = AAZListType( + flags={"read_only": True}, + ) + hardware_inventory.nics = AAZListType( + flags={"read_only": True}, + ) + + interfaces = cls._schema_on_200.properties.hardware_inventory.interfaces + interfaces.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.hardware_inventory.interfaces.Element + _element.link_status = AAZStrType( + serialized_name="linkStatus", + flags={"read_only": True}, + ) + _element.mac_address = AAZStrType( + serialized_name="macAddress", + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.network_interface_id = AAZStrType( + serialized_name="networkInterfaceId", + flags={"read_only": True}, + ) + + nics = cls._schema_on_200.properties.hardware_inventory.nics + nics.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.hardware_inventory.nics.Element + _element.lldp_neighbor = AAZObjectType( + serialized_name="lldpNeighbor", + ) + _element.mac_address = AAZStrType( + serialized_name="macAddress", + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + + lldp_neighbor = cls._schema_on_200.properties.hardware_inventory.nics.Element.lldp_neighbor + lldp_neighbor.port_description = AAZStrType( + serialized_name="portDescription", + flags={"read_only": True}, + ) + lldp_neighbor.port_name = AAZStrType( + serialized_name="portName", + flags={"read_only": True}, + ) + lldp_neighbor.system_description = AAZStrType( + serialized_name="systemDescription", + flags={"read_only": True}, + ) + lldp_neighbor.system_name = AAZStrType( + serialized_name="systemName", + flags={"read_only": True}, + ) + + hardware_validation_status = cls._schema_on_200.properties.hardware_validation_status + hardware_validation_status.last_validation_time = AAZStrType( + serialized_name="lastValidationTime", + flags={"read_only": True}, + ) + hardware_validation_status.result = AAZStrType( + flags={"read_only": True}, + ) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + virtual_machines_associated_ids = cls._schema_on_200.properties.virtual_machines_associated_ids + virtual_machines_associated_ids.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_start.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_start.py new file mode 100644 index 00000000000..5dbed671584 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_start.py @@ -0,0 +1,301 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud baremetalmachine start", + is_experimental=True, +) +class Start(AAZCommand): + """Start the provided bare metal machine. + + :example: Start bare metal machine + az networkcloud baremetalmachine start --bare-metal-machine-name "bareMetalMachineName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/baremetalmachines/{}/start", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.bare_metal_machine_name = AAZStrArg( + options=["-n", "--name", "--bare-metal-machine-name"], + help="The name of the bare metal machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.BareMetalMachinesStart(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class BareMetalMachinesStart(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/start", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "bareMetalMachineName", self.ctx.args.bare_metal_machine_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _StartHelper._build_schema_operation_status_result_read(cls._schema_on_200) + + return cls._schema_on_200 + + def on_204(self, session): + pass + + +class _StartHelper: + """Helper class for Start""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType() + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + _schema_operation_status_result_read = None + + @classmethod + def _build_schema_operation_status_result_read(cls, _schema): + if cls._schema_operation_status_result_read is not None: + _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.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 + return + + cls._schema_operation_status_result_read = _schema_operation_status_result_read = AAZObjectType() + + operation_status_result_read = _schema_operation_status_result_read + operation_status_result_read.end_time = AAZStrType( + serialized_name="endTime", + ) + 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.percent_complete = AAZFloatType( + serialized_name="percentComplete", + ) + operation_status_result_read.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"read_only": True}, + ) + operation_status_result_read.start_time = AAZStrType( + serialized_name="startTime", + ) + operation_status_result_read.status = AAZStrType( + flags={"required": True}, + ) + + operations = _schema_operation_status_result_read.operations + operations.Element = AAZObjectType() + cls._build_schema_operation_status_result_read(operations.Element) + + _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.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 + + +__all__ = ["Start"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_uncordon.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_uncordon.py new file mode 100644 index 00000000000..785c664cbe7 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_uncordon.py @@ -0,0 +1,301 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud baremetalmachine uncordon", + is_experimental=True, +) +class Uncordon(AAZCommand): + """Uncordon the provided bare metal machine's Kubernetes node. + + :example: Uncordon bare metal machine + az networkcloud baremetalmachine uncordon --bare-metal-machine-name "bareMetalMachineName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/baremetalmachines/{}/uncordon", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.bare_metal_machine_name = AAZStrArg( + options=["-n", "--name", "--bare-metal-machine-name"], + help="The name of the bare metal machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.BareMetalMachinesUncordon(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class BareMetalMachinesUncordon(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/uncordon", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "bareMetalMachineName", self.ctx.args.bare_metal_machine_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _UncordonHelper._build_schema_operation_status_result_read(cls._schema_on_200) + + return cls._schema_on_200 + + def on_204(self, session): + pass + + +class _UncordonHelper: + """Helper class for Uncordon""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType() + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + _schema_operation_status_result_read = None + + @classmethod + def _build_schema_operation_status_result_read(cls, _schema): + if cls._schema_operation_status_result_read is not None: + _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.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 + return + + cls._schema_operation_status_result_read = _schema_operation_status_result_read = AAZObjectType() + + operation_status_result_read = _schema_operation_status_result_read + operation_status_result_read.end_time = AAZStrType( + serialized_name="endTime", + ) + 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.percent_complete = AAZFloatType( + serialized_name="percentComplete", + ) + operation_status_result_read.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"read_only": True}, + ) + operation_status_result_read.start_time = AAZStrType( + serialized_name="startTime", + ) + operation_status_result_read.status = AAZStrType( + flags={"required": True}, + ) + + operations = _schema_operation_status_result_read.operations + operations.Element = AAZObjectType() + cls._build_schema_operation_status_result_read(operations.Element) + + _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.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 + + +__all__ = ["Uncordon"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_update.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_update.py new file mode 100644 index 00000000000..9d84558c4ac --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_update.py @@ -0,0 +1,510 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud baremetalmachine update", + is_experimental=True, +) +class Update(AAZCommand): + """Update properties of the provided bare metal machine, or update tags associated with the bare metal machine. Properties and tag updates can be done independently. + + :example: Patch bare metal machine + az networkcloud baremetalmachine update --bare-metal-machine-name "bareMetalMachineName" --machine-details "machinedetails" --tags key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/baremetalmachines/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.bare_metal_machine_name = AAZStrArg( + options=["-n", "--name", "--bare-metal-machine-name"], + help="The name of the bare metal machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "BareMetalMachineUpdateParameters" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="BareMetalMachineUpdateParameters", + help="The Azure resource tags that will replace the existing ones.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.machine_details = AAZStrArg( + options=["--machine-details"], + arg_group="Properties", + help="The details provided by the customer during the creation of rack manifests that allows for custom data to be associated with this machine.", + fmt=AAZStrArgFormat( + max_length=256, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.BareMetalMachinesUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class BareMetalMachinesUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}", + **self.url_parameters + ) + + @property + def method(self): + return "PATCH" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "bareMetalMachineName", self.ctx.args.bare_metal_machine_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("machineDetails", AAZStrType, ".machine_details") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _UpdateHelper._build_schema_bare_metal_machine_read(cls._schema_on_200) + + return cls._schema_on_200 + + +class _UpdateHelper: + """Helper class for Update""" + + _schema_bare_metal_machine_read = None + + @classmethod + def _build_schema_bare_metal_machine_read(cls, _schema): + if cls._schema_bare_metal_machine_read is not None: + _schema.extended_location = cls._schema_bare_metal_machine_read.extended_location + _schema.id = cls._schema_bare_metal_machine_read.id + _schema.location = cls._schema_bare_metal_machine_read.location + _schema.name = cls._schema_bare_metal_machine_read.name + _schema.properties = cls._schema_bare_metal_machine_read.properties + _schema.system_data = cls._schema_bare_metal_machine_read.system_data + _schema.tags = cls._schema_bare_metal_machine_read.tags + _schema.type = cls._schema_bare_metal_machine_read.type + return + + cls._schema_bare_metal_machine_read = _schema_bare_metal_machine_read = AAZObjectType() + + bare_metal_machine_read = _schema_bare_metal_machine_read + bare_metal_machine_read.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + bare_metal_machine_read.id = AAZStrType( + flags={"read_only": True}, + ) + bare_metal_machine_read.location = AAZStrType( + flags={"required": True}, + ) + bare_metal_machine_read.name = AAZStrType( + flags={"read_only": True}, + ) + bare_metal_machine_read.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + bare_metal_machine_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + bare_metal_machine_read.tags = AAZDictType() + bare_metal_machine_read.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = _schema_bare_metal_machine_read.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = _schema_bare_metal_machine_read.properties + properties.bmc_connection_string = AAZStrType( + serialized_name="bmcConnectionString", + flags={"required": True}, + ) + properties.bmc_credentials = AAZObjectType( + serialized_name="bmcCredentials", + flags={"required": True}, + ) + properties.bmc_mac_address = AAZStrType( + serialized_name="bmcMacAddress", + flags={"required": True}, + ) + properties.boot_mac_address = AAZStrType( + serialized_name="bootMacAddress", + flags={"required": True}, + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.cordon_status = AAZStrType( + serialized_name="cordonStatus", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hardware_inventory = AAZObjectType( + serialized_name="hardwareInventory", + ) + properties.hardware_validation_status = AAZObjectType( + serialized_name="hardwareValidationStatus", + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.kubernetes_node_name = AAZStrType( + serialized_name="kubernetesNodeName", + flags={"read_only": True}, + ) + properties.kubernetes_version = AAZStrType( + serialized_name="kubernetesVersion", + flags={"read_only": True}, + ) + properties.machine_details = AAZStrType( + serialized_name="machineDetails", + flags={"required": True}, + ) + properties.machine_name = AAZStrType( + serialized_name="machineName", + flags={"required": True}, + ) + properties.machine_sku_id = AAZStrType( + serialized_name="machineSkuId", + flags={"required": True}, + ) + properties.oam_ipv4_address = AAZStrType( + serialized_name="oamIpv4Address", + flags={"read_only": True}, + ) + properties.oam_ipv6_address = AAZStrType( + serialized_name="oamIpv6Address", + flags={"read_only": True}, + ) + properties.os_image = AAZStrType( + serialized_name="osImage", + flags={"read_only": True}, + ) + properties.power_state = AAZStrType( + serialized_name="powerState", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.rack_id = AAZStrType( + serialized_name="rackId", + flags={"required": True}, + ) + properties.rack_slot = AAZIntType( + serialized_name="rackSlot", + flags={"required": True}, + ) + properties.ready_state = AAZStrType( + serialized_name="readyState", + flags={"read_only": True}, + ) + properties.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"required": True}, + ) + properties.service_tag = AAZStrType( + serialized_name="serviceTag", + flags={"read_only": True}, + ) + properties.virtual_machines_associated_ids = AAZListType( + serialized_name="virtualMachinesAssociatedIds", + flags={"read_only": True}, + ) + + bmc_credentials = _schema_bare_metal_machine_read.properties.bmc_credentials + bmc_credentials.password = AAZStrType( + flags={"required": True, "secret": True}, + ) + bmc_credentials.username = AAZStrType( + flags={"required": True}, + ) + + hardware_inventory = _schema_bare_metal_machine_read.properties.hardware_inventory + hardware_inventory.additional_host_information = AAZStrType( + serialized_name="additionalHostInformation", + flags={"read_only": True}, + ) + hardware_inventory.interfaces = AAZListType( + flags={"read_only": True}, + ) + hardware_inventory.nics = AAZListType( + flags={"read_only": True}, + ) + + interfaces = _schema_bare_metal_machine_read.properties.hardware_inventory.interfaces + interfaces.Element = AAZObjectType() + + _element = _schema_bare_metal_machine_read.properties.hardware_inventory.interfaces.Element + _element.link_status = AAZStrType( + serialized_name="linkStatus", + flags={"read_only": True}, + ) + _element.mac_address = AAZStrType( + serialized_name="macAddress", + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.network_interface_id = AAZStrType( + serialized_name="networkInterfaceId", + flags={"read_only": True}, + ) + + nics = _schema_bare_metal_machine_read.properties.hardware_inventory.nics + nics.Element = AAZObjectType() + + _element = _schema_bare_metal_machine_read.properties.hardware_inventory.nics.Element + _element.lldp_neighbor = AAZObjectType( + serialized_name="lldpNeighbor", + ) + _element.mac_address = AAZStrType( + serialized_name="macAddress", + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + + lldp_neighbor = _schema_bare_metal_machine_read.properties.hardware_inventory.nics.Element.lldp_neighbor + lldp_neighbor.port_description = AAZStrType( + serialized_name="portDescription", + flags={"read_only": True}, + ) + lldp_neighbor.port_name = AAZStrType( + serialized_name="portName", + flags={"read_only": True}, + ) + lldp_neighbor.system_description = AAZStrType( + serialized_name="systemDescription", + flags={"read_only": True}, + ) + lldp_neighbor.system_name = AAZStrType( + serialized_name="systemName", + flags={"read_only": True}, + ) + + hardware_validation_status = _schema_bare_metal_machine_read.properties.hardware_validation_status + hardware_validation_status.last_validation_time = AAZStrType( + serialized_name="lastValidationTime", + flags={"read_only": True}, + ) + hardware_validation_status.result = AAZStrType( + flags={"read_only": True}, + ) + + hybrid_aks_clusters_associated_ids = _schema_bare_metal_machine_read.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + virtual_machines_associated_ids = _schema_bare_metal_machine_read.properties.virtual_machines_associated_ids + virtual_machines_associated_ids.Element = AAZStrType() + + system_data = _schema_bare_metal_machine_read.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = _schema_bare_metal_machine_read.tags + tags.Element = AAZStrType() + + _schema.extended_location = cls._schema_bare_metal_machine_read.extended_location + _schema.id = cls._schema_bare_metal_machine_read.id + _schema.location = cls._schema_bare_metal_machine_read.location + _schema.name = cls._schema_bare_metal_machine_read.name + _schema.properties = cls._schema_bare_metal_machine_read.properties + _schema.system_data = cls._schema_bare_metal_machine_read.system_data + _schema.tags = cls._schema_bare_metal_machine_read.tags + _schema.type = cls._schema_bare_metal_machine_read.type + + +__all__ = ["Update"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_validate_hardware.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_validate_hardware.py new file mode 100644 index 00000000000..da22b2e6f41 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_validate_hardware.py @@ -0,0 +1,326 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud baremetalmachine validate-hardware", + is_experimental=True, +) +class ValidateHardware(AAZCommand): + """Validate the hardware of the provided bare metal machine. + + :example: Validate the bare metal machine hardware + az networkcloud baremetalmachine validate-hardware --bare-metal-machine-name "bareMetalMachineName" --resource-group "resourceGroupName" --validation-category "validation-category" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/baremetalmachines/{}/validatehardware", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.bare_metal_machine_name = AAZStrArg( + options=["-n", "--name", "--bare-metal-machine-name"], + help="The name of the bare metal machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "BareMetalMachineValidateHardwareParameters" + + _args_schema = cls._args_schema + _args_schema.validation_category = AAZStrArg( + options=["--validation-category"], + arg_group="BareMetalMachineValidateHardwareParameters", + help="The category of hardware validation to perform.", + required=True, + enum={"BasicValidation": "BasicValidation"}, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.BareMetalMachinesValidateHardware(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class BareMetalMachinesValidateHardware(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}/validateHardware", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "bareMetalMachineName", self.ctx.args.bare_metal_machine_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("validationCategory", AAZStrType, ".validation_category", typ_kwargs={"flags": {"required": True}}) + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _ValidateHardwareHelper._build_schema_operation_status_result_read(cls._schema_on_200) + + return cls._schema_on_200 + + def on_204(self, session): + pass + + +class _ValidateHardwareHelper: + """Helper class for ValidateHardware""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType() + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + _schema_operation_status_result_read = None + + @classmethod + def _build_schema_operation_status_result_read(cls, _schema): + if cls._schema_operation_status_result_read is not None: + _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.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 + return + + cls._schema_operation_status_result_read = _schema_operation_status_result_read = AAZObjectType() + + operation_status_result_read = _schema_operation_status_result_read + operation_status_result_read.end_time = AAZStrType( + serialized_name="endTime", + ) + 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.percent_complete = AAZFloatType( + serialized_name="percentComplete", + ) + operation_status_result_read.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"read_only": True}, + ) + operation_status_result_read.start_time = AAZStrType( + serialized_name="startTime", + ) + operation_status_result_read.status = AAZStrType( + flags={"required": True}, + ) + + operations = _schema_operation_status_result_read.operations + operations.Element = AAZObjectType() + cls._build_schema_operation_status_result_read(operations.Element) + + _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.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 + + +__all__ = ["ValidateHardware"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_wait.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_wait.py new file mode 100644 index 00000000000..99f75197d8d --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/baremetalmachine/_wait.py @@ -0,0 +1,414 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud baremetalmachine wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/baremetalmachines/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.bare_metal_machine_name = AAZStrArg( + options=["-n", "--name", "--bare-metal-machine-name"], + help="The name of the bare metal machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.BareMetalMachinesGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) + return result + + class BareMetalMachinesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/bareMetalMachines/{bareMetalMachineName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "bareMetalMachineName", self.ctx.args.bare_metal_machine_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.bmc_connection_string = AAZStrType( + serialized_name="bmcConnectionString", + flags={"required": True}, + ) + properties.bmc_credentials = AAZObjectType( + serialized_name="bmcCredentials", + flags={"required": True}, + ) + properties.bmc_mac_address = AAZStrType( + serialized_name="bmcMacAddress", + flags={"required": True}, + ) + properties.boot_mac_address = AAZStrType( + serialized_name="bootMacAddress", + flags={"required": True}, + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.cordon_status = AAZStrType( + serialized_name="cordonStatus", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hardware_inventory = AAZObjectType( + serialized_name="hardwareInventory", + ) + properties.hardware_validation_status = AAZObjectType( + serialized_name="hardwareValidationStatus", + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.kubernetes_node_name = AAZStrType( + serialized_name="kubernetesNodeName", + flags={"read_only": True}, + ) + properties.kubernetes_version = AAZStrType( + serialized_name="kubernetesVersion", + flags={"read_only": True}, + ) + properties.machine_details = AAZStrType( + serialized_name="machineDetails", + flags={"required": True}, + ) + properties.machine_name = AAZStrType( + serialized_name="machineName", + flags={"required": True}, + ) + properties.machine_sku_id = AAZStrType( + serialized_name="machineSkuId", + flags={"required": True}, + ) + properties.oam_ipv4_address = AAZStrType( + serialized_name="oamIpv4Address", + flags={"read_only": True}, + ) + properties.oam_ipv6_address = AAZStrType( + serialized_name="oamIpv6Address", + flags={"read_only": True}, + ) + properties.os_image = AAZStrType( + serialized_name="osImage", + flags={"read_only": True}, + ) + properties.power_state = AAZStrType( + serialized_name="powerState", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.rack_id = AAZStrType( + serialized_name="rackId", + flags={"required": True}, + ) + properties.rack_slot = AAZIntType( + serialized_name="rackSlot", + flags={"required": True}, + ) + properties.ready_state = AAZStrType( + serialized_name="readyState", + flags={"read_only": True}, + ) + properties.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"required": True}, + ) + properties.service_tag = AAZStrType( + serialized_name="serviceTag", + flags={"read_only": True}, + ) + properties.virtual_machines_associated_ids = AAZListType( + serialized_name="virtualMachinesAssociatedIds", + flags={"read_only": True}, + ) + + bmc_credentials = cls._schema_on_200.properties.bmc_credentials + bmc_credentials.password = AAZStrType( + flags={"required": True, "secret": True}, + ) + bmc_credentials.username = AAZStrType( + flags={"required": True}, + ) + + hardware_inventory = cls._schema_on_200.properties.hardware_inventory + hardware_inventory.additional_host_information = AAZStrType( + serialized_name="additionalHostInformation", + flags={"read_only": True}, + ) + hardware_inventory.interfaces = AAZListType( + flags={"read_only": True}, + ) + hardware_inventory.nics = AAZListType( + flags={"read_only": True}, + ) + + interfaces = cls._schema_on_200.properties.hardware_inventory.interfaces + interfaces.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.hardware_inventory.interfaces.Element + _element.link_status = AAZStrType( + serialized_name="linkStatus", + flags={"read_only": True}, + ) + _element.mac_address = AAZStrType( + serialized_name="macAddress", + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.network_interface_id = AAZStrType( + serialized_name="networkInterfaceId", + flags={"read_only": True}, + ) + + nics = cls._schema_on_200.properties.hardware_inventory.nics + nics.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.hardware_inventory.nics.Element + _element.lldp_neighbor = AAZObjectType( + serialized_name="lldpNeighbor", + ) + _element.mac_address = AAZStrType( + serialized_name="macAddress", + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + + lldp_neighbor = cls._schema_on_200.properties.hardware_inventory.nics.Element.lldp_neighbor + lldp_neighbor.port_description = AAZStrType( + serialized_name="portDescription", + flags={"read_only": True}, + ) + lldp_neighbor.port_name = AAZStrType( + serialized_name="portName", + flags={"read_only": True}, + ) + lldp_neighbor.system_description = AAZStrType( + serialized_name="systemDescription", + flags={"read_only": True}, + ) + lldp_neighbor.system_name = AAZStrType( + serialized_name="systemName", + flags={"read_only": True}, + ) + + hardware_validation_status = cls._schema_on_200.properties.hardware_validation_status + hardware_validation_status.last_validation_time = AAZStrType( + serialized_name="lastValidationTime", + flags={"read_only": True}, + ) + hardware_validation_status.result = AAZStrType( + flags={"read_only": True}, + ) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + virtual_machines_associated_ids = cls._schema_on_200.properties.virtual_machines_associated_ids + virtual_machines_associated_ids.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/__cmd_group.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/__cmd_group.py new file mode 100644 index 00000000000..e3efc20fe08 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/__cmd_group.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "networkcloud cloudservicesnetwork", + is_experimental=True, +) +class __CMDGroup(AAZCommandGroup): + """Manage cloud services network + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/__init__.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/__init__.py new file mode 100644 index 00000000000..db73033039b --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/__init__.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._list import * +from ._show import * +from ._update import * +from ._wait import * diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/_create.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/_create.py new file mode 100644 index 00000000000..be5acb51877 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/_create.py @@ -0,0 +1,461 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cloudservicesnetwork create", + is_experimental=True, +) +class Create(AAZCommand): + """Create a new cloud services network or update the properties of the existing cloud services network. + + :example: Create or update cloud services network + az networkcloud cloudservicesnetwork create --name "cloudServicesNetworkName" --extended-location name="/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterExtendedLocationName" type="CustomLocation" --location "location" --additional-egress-endpoints "[{\\"category\\":\\"azure-resource-management\\",\\"endpoints\\":[{\\"domainName\\":\\"https://storageaccountex.blob.core.windows.net\\",\\"port\\":443}]}]" --enable-default-egress-endpoints "False" --tags key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/cloudservicesnetworks/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.cloud_services_network_name = AAZStrArg( + options=["-n", "--name", "--cloud-services-network-name"], + help="The name of the cloud services network.", + required=True, + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "CloudServicesNetworkParameters" + + _args_schema = cls._args_schema + _args_schema.extended_location = AAZObjectArg( + options=["--extended-location"], + arg_group="CloudServicesNetworkParameters", + help="The extended location of the cluster associated with the resource.", + required=True, + ) + _args_schema.location = AAZResourceLocationArg( + arg_group="CloudServicesNetworkParameters", + help="The geo-location where the resource lives", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="CloudServicesNetworkParameters", + help="Resource tags.", + ) + + extended_location = cls._args_schema.extended_location + extended_location.name = AAZStrArg( + options=["name"], + help="The resource ID of the extended location on which the resource will be created.", + required=True, + ) + extended_location.type = AAZStrArg( + options=["type"], + help="The extended location type, for example, CustomLocation.", + required=True, + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.additional_egress_endpoints = AAZListArg( + options=["--additional-egress-endpoints"], + arg_group="Properties", + help="The list of egress endpoints. This allows for connection from a Hybrid AKS cluster to the specified endpoint.", + ) + _args_schema.enable_default_egress_endpoints = AAZStrArg( + options=["--enable-default-egress-endpoints"], + arg_group="Properties", + help="The indicator of whether the platform default endpoints are allowed for the egress traffic.", + default="True", + enum={"False": "False", "True": "True"}, + ) + + additional_egress_endpoints = cls._args_schema.additional_egress_endpoints + additional_egress_endpoints.Element = AAZObjectArg() + + _element = cls._args_schema.additional_egress_endpoints.Element + _element.category = AAZStrArg( + options=["category"], + help="The descriptive category name of endpoints accessible by the AKS agent node. For example, azure-resource-management, API server, etc. The platform egress endpoints provided by default will use the category 'default'.", + required=True, + ) + _element.endpoints = AAZListArg( + options=["endpoints"], + help="The list of endpoint dependencies.", + required=True, + ) + + endpoints = cls._args_schema.additional_egress_endpoints.Element.endpoints + endpoints.Element = AAZObjectArg() + + _element = cls._args_schema.additional_egress_endpoints.Element.endpoints.Element + _element.domain_name = AAZStrArg( + options=["domain-name"], + help="The domain name of the dependency.", + required=True, + ) + _element.port = AAZIntArg( + options=["port"], + help="The port of this endpoint.", + fmt=AAZIntArgFormat( + maximum=65535, + minimum=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.CloudServicesNetworksCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class CloudServicesNetworksCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/cloudServicesNetworks/{cloudServicesNetworkName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "cloudServicesNetworkName", self.ctx.args.cloud_services_network_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("extendedLocation", AAZObjectType, ".extended_location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + extended_location = _builder.get(".extendedLocation") + if extended_location is not None: + extended_location.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}}) + extended_location.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("additionalEgressEndpoints", AAZListType, ".additional_egress_endpoints") + properties.set_prop("enableDefaultEgressEndpoints", AAZStrType, ".enable_default_egress_endpoints") + + additional_egress_endpoints = _builder.get(".properties.additionalEgressEndpoints") + if additional_egress_endpoints is not None: + additional_egress_endpoints.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.additionalEgressEndpoints[]") + if _elements is not None: + _elements.set_prop("category", AAZStrType, ".category", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("endpoints", AAZListType, ".endpoints", typ_kwargs={"flags": {"required": True}}) + + endpoints = _builder.get(".properties.additionalEgressEndpoints[].endpoints") + if endpoints is not None: + endpoints.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.additionalEgressEndpoints[].endpoints[]") + if _elements is not None: + _elements.set_prop("domainName", AAZStrType, ".domain_name", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("port", AAZIntType, ".port") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + 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_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200_201.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.additional_egress_endpoints = AAZListType( + serialized_name="additionalEgressEndpoints", + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.enable_default_egress_endpoints = AAZStrType( + serialized_name="enableDefaultEgressEndpoints", + ) + properties.enabled_egress_endpoints = AAZListType( + serialized_name="enabledEgressEndpoints", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.virtual_machines_associated_ids = AAZListType( + serialized_name="virtualMachinesAssociatedIds", + flags={"read_only": True}, + ) + + additional_egress_endpoints = cls._schema_on_200_201.properties.additional_egress_endpoints + additional_egress_endpoints.Element = AAZObjectType() + _CreateHelper._build_schema_egress_endpoint_read(additional_egress_endpoints.Element) + + enabled_egress_endpoints = cls._schema_on_200_201.properties.enabled_egress_endpoints + enabled_egress_endpoints.Element = AAZObjectType() + _CreateHelper._build_schema_egress_endpoint_read(enabled_egress_endpoints.Element) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200_201.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + virtual_machines_associated_ids = cls._schema_on_200_201.properties.virtual_machines_associated_ids + virtual_machines_associated_ids.Element = AAZStrType() + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + _schema_egress_endpoint_read = None + + @classmethod + def _build_schema_egress_endpoint_read(cls, _schema): + if cls._schema_egress_endpoint_read is not None: + _schema.category = cls._schema_egress_endpoint_read.category + _schema.endpoints = cls._schema_egress_endpoint_read.endpoints + return + + cls._schema_egress_endpoint_read = _schema_egress_endpoint_read = AAZObjectType() + + egress_endpoint_read = _schema_egress_endpoint_read + egress_endpoint_read.category = AAZStrType( + flags={"required": True}, + ) + egress_endpoint_read.endpoints = AAZListType( + flags={"required": True}, + ) + + endpoints = _schema_egress_endpoint_read.endpoints + endpoints.Element = AAZObjectType() + + _element = _schema_egress_endpoint_read.endpoints.Element + _element.domain_name = AAZStrType( + serialized_name="domainName", + flags={"required": True}, + ) + _element.port = AAZIntType() + + _schema.category = cls._schema_egress_endpoint_read.category + _schema.endpoints = cls._schema_egress_endpoint_read.endpoints + + +__all__ = ["Create"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/_delete.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/_delete.py new file mode 100644 index 00000000000..f97e33ab1ea --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/_delete.py @@ -0,0 +1,167 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cloudservicesnetwork delete", + is_experimental=True, + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete the provided cloud services network. + + :example: Delete cloud services network + az networkcloud cloudservicesnetwork delete --name "cloudServicesNetworkName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/cloudservicesnetworks/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.cloud_services_network_name = AAZStrArg( + options=["-n", "--name", "--cloud-services-network-name"], + help="The name of the cloud services network.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.CloudServicesNetworksDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class CloudServicesNetworksDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/cloudServicesNetworks/{cloudServicesNetworkName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "cloudServicesNetworkName", self.ctx.args.cloud_services_network_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/_list.py new file mode 100644 index 00000000000..70c1bc57f4d --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/_list.py @@ -0,0 +1,506 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cloudservicesnetwork list", + is_experimental=True, +) +class List(AAZCommand): + """List cloud services networks in the provided resource group or subscription. + + :example: List cloud services networks for subscription + az networkcloud cloudservicesnetwork list + + :example: List cloud services networks for resource group + az networkcloud cloudservicesnetwork list --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.networkcloud/cloudservicesnetworks", "2022-12-12-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/cloudservicesnetworks", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) + condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + if condition_0: + self.CloudServicesNetworksListByResourceGroup(ctx=self.ctx)() + if condition_1: + self.CloudServicesNetworksListBySubscription(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class CloudServicesNetworksListByResourceGroup(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/cloudServicesNetworks", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.value.Element.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.additional_egress_endpoints = AAZListType( + serialized_name="additionalEgressEndpoints", + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.enable_default_egress_endpoints = AAZStrType( + serialized_name="enableDefaultEgressEndpoints", + ) + properties.enabled_egress_endpoints = AAZListType( + serialized_name="enabledEgressEndpoints", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.virtual_machines_associated_ids = AAZListType( + serialized_name="virtualMachinesAssociatedIds", + flags={"read_only": True}, + ) + + additional_egress_endpoints = cls._schema_on_200.value.Element.properties.additional_egress_endpoints + additional_egress_endpoints.Element = AAZObjectType() + _ListHelper._build_schema_egress_endpoint_read(additional_egress_endpoints.Element) + + enabled_egress_endpoints = cls._schema_on_200.value.Element.properties.enabled_egress_endpoints + enabled_egress_endpoints.Element = AAZObjectType() + _ListHelper._build_schema_egress_endpoint_read(enabled_egress_endpoints.Element) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200.value.Element.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + virtual_machines_associated_ids = cls._schema_on_200.value.Element.properties.virtual_machines_associated_ids + virtual_machines_associated_ids.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + class CloudServicesNetworksListBySubscription(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/cloudServicesNetworks", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.value.Element.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.additional_egress_endpoints = AAZListType( + serialized_name="additionalEgressEndpoints", + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.enable_default_egress_endpoints = AAZStrType( + serialized_name="enableDefaultEgressEndpoints", + ) + properties.enabled_egress_endpoints = AAZListType( + serialized_name="enabledEgressEndpoints", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.virtual_machines_associated_ids = AAZListType( + serialized_name="virtualMachinesAssociatedIds", + flags={"read_only": True}, + ) + + additional_egress_endpoints = cls._schema_on_200.value.Element.properties.additional_egress_endpoints + additional_egress_endpoints.Element = AAZObjectType() + _ListHelper._build_schema_egress_endpoint_read(additional_egress_endpoints.Element) + + enabled_egress_endpoints = cls._schema_on_200.value.Element.properties.enabled_egress_endpoints + enabled_egress_endpoints.Element = AAZObjectType() + _ListHelper._build_schema_egress_endpoint_read(enabled_egress_endpoints.Element) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200.value.Element.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + virtual_machines_associated_ids = cls._schema_on_200.value.Element.properties.virtual_machines_associated_ids + virtual_machines_associated_ids.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + _schema_egress_endpoint_read = None + + @classmethod + def _build_schema_egress_endpoint_read(cls, _schema): + if cls._schema_egress_endpoint_read is not None: + _schema.category = cls._schema_egress_endpoint_read.category + _schema.endpoints = cls._schema_egress_endpoint_read.endpoints + return + + cls._schema_egress_endpoint_read = _schema_egress_endpoint_read = AAZObjectType() + + egress_endpoint_read = _schema_egress_endpoint_read + egress_endpoint_read.category = AAZStrType( + flags={"required": True}, + ) + egress_endpoint_read.endpoints = AAZListType( + flags={"required": True}, + ) + + endpoints = _schema_egress_endpoint_read.endpoints + endpoints.Element = AAZObjectType() + + _element = _schema_egress_endpoint_read.endpoints.Element + _element.domain_name = AAZStrType( + serialized_name="domainName", + flags={"required": True}, + ) + _element.port = AAZIntType() + + _schema.category = cls._schema_egress_endpoint_read.category + _schema.endpoints = cls._schema_egress_endpoint_read.endpoints + + +__all__ = ["List"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/_show.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/_show.py new file mode 100644 index 00000000000..bcfcf691f84 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/_show.py @@ -0,0 +1,309 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cloudservicesnetwork show", + is_experimental=True, +) +class Show(AAZCommand): + """Get properties of the provided cloud services network. + + :example: Get cloud services network + az networkcloud cloudservicesnetwork show --name "cloudServicesNetworkName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/cloudservicesnetworks/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.cloud_services_network_name = AAZStrArg( + options=["-n", "--name", "--cloud-services-network-name"], + help="The name of the cloud services network.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.CloudServicesNetworksGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class CloudServicesNetworksGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/cloudServicesNetworks/{cloudServicesNetworkName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "cloudServicesNetworkName", self.ctx.args.cloud_services_network_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.additional_egress_endpoints = AAZListType( + serialized_name="additionalEgressEndpoints", + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.enable_default_egress_endpoints = AAZStrType( + serialized_name="enableDefaultEgressEndpoints", + ) + properties.enabled_egress_endpoints = AAZListType( + serialized_name="enabledEgressEndpoints", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.virtual_machines_associated_ids = AAZListType( + serialized_name="virtualMachinesAssociatedIds", + flags={"read_only": True}, + ) + + additional_egress_endpoints = cls._schema_on_200.properties.additional_egress_endpoints + additional_egress_endpoints.Element = AAZObjectType() + _ShowHelper._build_schema_egress_endpoint_read(additional_egress_endpoints.Element) + + enabled_egress_endpoints = cls._schema_on_200.properties.enabled_egress_endpoints + enabled_egress_endpoints.Element = AAZObjectType() + _ShowHelper._build_schema_egress_endpoint_read(enabled_egress_endpoints.Element) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + virtual_machines_associated_ids = cls._schema_on_200.properties.virtual_machines_associated_ids + virtual_machines_associated_ids.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + _schema_egress_endpoint_read = None + + @classmethod + def _build_schema_egress_endpoint_read(cls, _schema): + if cls._schema_egress_endpoint_read is not None: + _schema.category = cls._schema_egress_endpoint_read.category + _schema.endpoints = cls._schema_egress_endpoint_read.endpoints + return + + cls._schema_egress_endpoint_read = _schema_egress_endpoint_read = AAZObjectType() + + egress_endpoint_read = _schema_egress_endpoint_read + egress_endpoint_read.category = AAZStrType( + flags={"required": True}, + ) + egress_endpoint_read.endpoints = AAZListType( + flags={"required": True}, + ) + + endpoints = _schema_egress_endpoint_read.endpoints + endpoints.Element = AAZObjectType() + + _element = _schema_egress_endpoint_read.endpoints.Element + _element.domain_name = AAZStrType( + serialized_name="domainName", + flags={"required": True}, + ) + _element.port = AAZIntType() + + _schema.category = cls._schema_egress_endpoint_read.category + _schema.endpoints = cls._schema_egress_endpoint_read.endpoints + + +__all__ = ["Show"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/_update.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/_update.py new file mode 100644 index 00000000000..cf81a500f35 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/_update.py @@ -0,0 +1,456 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cloudservicesnetwork update", + is_experimental=True, +) +class Update(AAZCommand): + """Update properties of the provided cloud services network, or update the tags associated with it. Properties and tag updates can be done independently. + + :example: Patch cloud services network + az networkcloud cloudservicesnetwork update --name "cloudServicesNetworkName" --additional-egress-endpoints "[{\\"category\\":\\"azure-resource-management\\",\\"endpoints\\":[{\\"domainName\\":\\"https://storageaccountex.blob.core.windows.net\\",\\"port\\":443}]}]" --enable-default-egress-endpoints "False" --tags key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/cloudservicesnetworks/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.cloud_services_network_name = AAZStrArg( + options=["-n", "--name", "--cloud-services-network-name"], + help="The name of the cloud services network.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "CloudServicesNetworkUpdateParameters" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="CloudServicesNetworkUpdateParameters", + help="The Azure resource tags that will replace the existing ones.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.additional_egress_endpoints = AAZListArg( + options=["--additional-egress-endpoints"], + arg_group="Properties", + help="The list of egress endpoints. This allows for connection from a Hybrid AKS cluster to the specified endpoint.", + ) + _args_schema.enable_default_egress_endpoints = AAZStrArg( + options=["--enable-default-egress-endpoints"], + arg_group="Properties", + help="The indicator of whether the platform default endpoints are allowed for the egress traffic.", + default="True", + enum={"False": "False", "True": "True"}, + ) + + additional_egress_endpoints = cls._args_schema.additional_egress_endpoints + additional_egress_endpoints.Element = AAZObjectArg() + + _element = cls._args_schema.additional_egress_endpoints.Element + _element.category = AAZStrArg( + options=["category"], + help="The descriptive category name of endpoints accessible by the AKS agent node. For example, azure-resource-management, API server, etc. The platform egress endpoints provided by default will use the category 'default'.", + required=True, + ) + _element.endpoints = AAZListArg( + options=["endpoints"], + help="The list of endpoint dependencies.", + required=True, + ) + + endpoints = cls._args_schema.additional_egress_endpoints.Element.endpoints + endpoints.Element = AAZObjectArg() + + _element = cls._args_schema.additional_egress_endpoints.Element.endpoints.Element + _element.domain_name = AAZStrArg( + options=["domain-name"], + help="The domain name of the dependency.", + required=True, + ) + _element.port = AAZIntArg( + options=["port"], + help="The port of this endpoint.", + fmt=AAZIntArgFormat( + maximum=65535, + minimum=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.CloudServicesNetworksUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class CloudServicesNetworksUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/cloudServicesNetworks/{cloudServicesNetworkName}", + **self.url_parameters + ) + + @property + def method(self): + return "PATCH" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "cloudServicesNetworkName", self.ctx.args.cloud_services_network_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("additionalEgressEndpoints", AAZListType, ".additional_egress_endpoints") + properties.set_prop("enableDefaultEgressEndpoints", AAZStrType, ".enable_default_egress_endpoints") + + additional_egress_endpoints = _builder.get(".properties.additionalEgressEndpoints") + if additional_egress_endpoints is not None: + additional_egress_endpoints.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.additionalEgressEndpoints[]") + if _elements is not None: + _elements.set_prop("category", AAZStrType, ".category", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("endpoints", AAZListType, ".endpoints", typ_kwargs={"flags": {"required": True}}) + + endpoints = _builder.get(".properties.additionalEgressEndpoints[].endpoints") + if endpoints is not None: + endpoints.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.additionalEgressEndpoints[].endpoints[]") + if _elements is not None: + _elements.set_prop("domainName", AAZStrType, ".domain_name", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("port", AAZIntType, ".port") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _UpdateHelper._build_schema_cloud_services_network_read(cls._schema_on_200) + + return cls._schema_on_200 + + +class _UpdateHelper: + """Helper class for Update""" + + _schema_cloud_services_network_read = None + + @classmethod + def _build_schema_cloud_services_network_read(cls, _schema): + if cls._schema_cloud_services_network_read is not None: + _schema.extended_location = cls._schema_cloud_services_network_read.extended_location + _schema.id = cls._schema_cloud_services_network_read.id + _schema.location = cls._schema_cloud_services_network_read.location + _schema.name = cls._schema_cloud_services_network_read.name + _schema.properties = cls._schema_cloud_services_network_read.properties + _schema.system_data = cls._schema_cloud_services_network_read.system_data + _schema.tags = cls._schema_cloud_services_network_read.tags + _schema.type = cls._schema_cloud_services_network_read.type + return + + cls._schema_cloud_services_network_read = _schema_cloud_services_network_read = AAZObjectType() + + cloud_services_network_read = _schema_cloud_services_network_read + cloud_services_network_read.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + cloud_services_network_read.id = AAZStrType( + flags={"read_only": True}, + ) + cloud_services_network_read.location = AAZStrType( + flags={"required": True}, + ) + cloud_services_network_read.name = AAZStrType( + flags={"read_only": True}, + ) + cloud_services_network_read.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + cloud_services_network_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + cloud_services_network_read.tags = AAZDictType() + cloud_services_network_read.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = _schema_cloud_services_network_read.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = _schema_cloud_services_network_read.properties + properties.additional_egress_endpoints = AAZListType( + serialized_name="additionalEgressEndpoints", + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.enable_default_egress_endpoints = AAZStrType( + serialized_name="enableDefaultEgressEndpoints", + ) + properties.enabled_egress_endpoints = AAZListType( + serialized_name="enabledEgressEndpoints", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.virtual_machines_associated_ids = AAZListType( + serialized_name="virtualMachinesAssociatedIds", + flags={"read_only": True}, + ) + + additional_egress_endpoints = _schema_cloud_services_network_read.properties.additional_egress_endpoints + additional_egress_endpoints.Element = AAZObjectType() + cls._build_schema_egress_endpoint_read(additional_egress_endpoints.Element) + + enabled_egress_endpoints = _schema_cloud_services_network_read.properties.enabled_egress_endpoints + enabled_egress_endpoints.Element = AAZObjectType() + cls._build_schema_egress_endpoint_read(enabled_egress_endpoints.Element) + + hybrid_aks_clusters_associated_ids = _schema_cloud_services_network_read.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + virtual_machines_associated_ids = _schema_cloud_services_network_read.properties.virtual_machines_associated_ids + virtual_machines_associated_ids.Element = AAZStrType() + + system_data = _schema_cloud_services_network_read.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = _schema_cloud_services_network_read.tags + tags.Element = AAZStrType() + + _schema.extended_location = cls._schema_cloud_services_network_read.extended_location + _schema.id = cls._schema_cloud_services_network_read.id + _schema.location = cls._schema_cloud_services_network_read.location + _schema.name = cls._schema_cloud_services_network_read.name + _schema.properties = cls._schema_cloud_services_network_read.properties + _schema.system_data = cls._schema_cloud_services_network_read.system_data + _schema.tags = cls._schema_cloud_services_network_read.tags + _schema.type = cls._schema_cloud_services_network_read.type + + _schema_egress_endpoint_read = None + + @classmethod + def _build_schema_egress_endpoint_read(cls, _schema): + if cls._schema_egress_endpoint_read is not None: + _schema.category = cls._schema_egress_endpoint_read.category + _schema.endpoints = cls._schema_egress_endpoint_read.endpoints + return + + cls._schema_egress_endpoint_read = _schema_egress_endpoint_read = AAZObjectType() + + egress_endpoint_read = _schema_egress_endpoint_read + egress_endpoint_read.category = AAZStrType( + flags={"required": True}, + ) + egress_endpoint_read.endpoints = AAZListType( + flags={"required": True}, + ) + + endpoints = _schema_egress_endpoint_read.endpoints + endpoints.Element = AAZObjectType() + + _element = _schema_egress_endpoint_read.endpoints.Element + _element.domain_name = AAZStrType( + serialized_name="domainName", + flags={"required": True}, + ) + _element.port = AAZIntType() + + _schema.category = cls._schema_egress_endpoint_read.category + _schema.endpoints = cls._schema_egress_endpoint_read.endpoints + + +__all__ = ["Update"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/_wait.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/_wait.py new file mode 100644 index 00000000000..6c39a7c26b5 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cloudservicesnetwork/_wait.py @@ -0,0 +1,304 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cloudservicesnetwork wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/cloudservicesnetworks/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.cloud_services_network_name = AAZStrArg( + options=["-n", "--name", "--cloud-services-network-name"], + help="The name of the cloud services network.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.CloudServicesNetworksGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) + return result + + class CloudServicesNetworksGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/cloudServicesNetworks/{cloudServicesNetworkName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "cloudServicesNetworkName", self.ctx.args.cloud_services_network_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.additional_egress_endpoints = AAZListType( + serialized_name="additionalEgressEndpoints", + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.enable_default_egress_endpoints = AAZStrType( + serialized_name="enableDefaultEgressEndpoints", + ) + properties.enabled_egress_endpoints = AAZListType( + serialized_name="enabledEgressEndpoints", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.virtual_machines_associated_ids = AAZListType( + serialized_name="virtualMachinesAssociatedIds", + flags={"read_only": True}, + ) + + additional_egress_endpoints = cls._schema_on_200.properties.additional_egress_endpoints + additional_egress_endpoints.Element = AAZObjectType() + _WaitHelper._build_schema_egress_endpoint_read(additional_egress_endpoints.Element) + + enabled_egress_endpoints = cls._schema_on_200.properties.enabled_egress_endpoints + enabled_egress_endpoints.Element = AAZObjectType() + _WaitHelper._build_schema_egress_endpoint_read(enabled_egress_endpoints.Element) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + virtual_machines_associated_ids = cls._schema_on_200.properties.virtual_machines_associated_ids + virtual_machines_associated_ids.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + _schema_egress_endpoint_read = None + + @classmethod + def _build_schema_egress_endpoint_read(cls, _schema): + if cls._schema_egress_endpoint_read is not None: + _schema.category = cls._schema_egress_endpoint_read.category + _schema.endpoints = cls._schema_egress_endpoint_read.endpoints + return + + cls._schema_egress_endpoint_read = _schema_egress_endpoint_read = AAZObjectType() + + egress_endpoint_read = _schema_egress_endpoint_read + egress_endpoint_read.category = AAZStrType( + flags={"required": True}, + ) + egress_endpoint_read.endpoints = AAZListType( + flags={"required": True}, + ) + + endpoints = _schema_egress_endpoint_read.endpoints + endpoints.Element = AAZObjectType() + + _element = _schema_egress_endpoint_read.endpoints.Element + _element.domain_name = AAZStrType( + serialized_name="domainName", + flags={"required": True}, + ) + _element.port = AAZIntType() + + _schema.category = cls._schema_egress_endpoint_read.category + _schema.endpoints = cls._schema_egress_endpoint_read.endpoints + + +__all__ = ["Wait"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/__cmd_group.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/__cmd_group.py new file mode 100644 index 00000000000..920d32a227c --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/__cmd_group.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "networkcloud cluster", + is_experimental=True, +) +class __CMDGroup(AAZCommandGroup): + """Manage cluster + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/__init__.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/__init__.py new file mode 100644 index 00000000000..542ab6cdee0 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/__init__.py @@ -0,0 +1,19 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._deploy import * +from ._list import * +from ._show import * +from ._update import * +from ._update_version import * +from ._wait import * diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_create.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_create.py new file mode 100644 index 00000000000..5f958aecf92 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_create.py @@ -0,0 +1,1026 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cluster create", + is_experimental=True, +) +class Create(AAZCommand): + """Create a new cluster or update the properties of the cluster if it exists. + + :example: Create or update single rack cluster + az networkcloud cluster create --name "clusterName" -g "resourceGroupName" --extended-location name=""/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterManagerExtendedLocationName" type="CustomLocation" --location "eastus" --analytics-workspace-id "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/microsoft.operationalInsights/workspaces/logAnalyticsWorkspaceName" --cluster-location "Foo Street, 3rd Floor, row 9" --cluster-service-principal application-id="12345678-1234-1234-1234-123456789012" password="password" principal-id="00000008-0004-0004-0004-000000000012" tenant-id="80000000-4000-4000-4000-120000000000" --cluster-type "SingleRack" --cluster-version "3.0.0" --compute-deployment-threshold type="PercentSuccess" grouping="PerCluster" value=90 --network-fabric-id "/subscriptions/fca2e8ee-1179-48b8-9532-428ed0873a2e/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/default" --aggregator-or-single-rack-definition "{\"networkRackId\":\"/subscriptions/subscriptionId/resourceGroups/rgName/providers/Microsoft.Network/virtualNetworks/cmName/subnets/ClusterManagerSubnet\",\"rackSkuId\":\"/subscriptions/subscriptionId/providers/Microsoft.NetworkCloud/rackSkus/VLab_Single_DellR750_8C2M_x70r3_9\",\"rackSerialNumber\":\"b99m99r1\",\"rackLocation\":\"b99m99r1\",\"availabilityZone\":\"1\",\"storageApplianceConfigurationData\":[{\"rackSlot\":1,\"adminCredentials\":{\"username\":\"admin\",\"password\":\"admin\"},\"storageApplianceName\":\"name\",\"serialNumber\":\"serial\"}],\"bareMetalMachineConfigurationData\":[{\"bmcCredentials\":{\"password\":\"bmcPassword\",\"username\":\"root\"},\"bmcMacAddress\":\"AA:BB:CC:DD:E7:08\",\"bootMacAddress\":\"AA:BB:CC:F8:71:2E\",\"machineName\":\"lab00r750wkr1\",\"rackSlot\":2,\"serialNumber\":\"5HS7PK3\"},{\"bmcCredentials\":{\"password\":\"bmcPassword\",\"username\":\"root\"},\"bmcMacAddress\":\"AA:BB:CC:FD:DC:76\",\"bootMacAddress\":\"AA:BB:CC:F8:50:CA\",\"machineName\":\"lab00r750wkr8\",\"rackSlot\":11,\"serialNumber\":\"9M56PK3\"}]}" --tags key1="myvalue1" key2="myvalue2" + + :example: Create or update single rack cluster using json file input + az networkcloud cluster create --name "clusterName" -g "resourceGroupName" --extended-location name=""/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterManagerExtendedLocationName" type="CustomLocation" --location "eastus" --analytics-workspace-id "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/microsoft.operationalInsights/workspaces/logAnalyticsWorkspaceName" --cluster-location "Foo Street, 3rd Floor, row 9" --cluster-service-principal application-id="12345678-1234-1234-1234-123456789012" password="password" principal-id="00000008-0004-0004-0004-000000000012" tenant-id="80000000-4000-4000-4000-120000000000" --cluster-type "SingleRack" --cluster-version "3.0.0" --compute-deployment-threshold type="PercentSuccess" grouping="PerCluster" value=90 --network-fabric-id "/subscriptions/fca2e8ee-1179-48b8-9532-428ed0873a2e/resourceGroups/resourceGroupName/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/default" --aggregator-or-single-rack-definition ./aggregator-or-single-rack-definition.json --tags key1="myvalue1" key2="myvalue2" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clusters/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.cluster_name = AAZStrArg( + options=["-n", "--name", "--cluster-name"], + help="The name of the cluster.", + required=True, + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "ClusterParameters" + + _args_schema = cls._args_schema + _args_schema.extended_location = AAZObjectArg( + options=["--extended-location"], + arg_group="ClusterParameters", + help="The extended location of the cluster manager associated with the cluster.", + required=True, + ) + _args_schema.location = AAZResourceLocationArg( + arg_group="ClusterParameters", + help="The geo-location where the resource lives", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="ClusterParameters", + help="Resource tags.", + ) + + extended_location = cls._args_schema.extended_location + extended_location.name = AAZStrArg( + options=["name"], + help="The resource ID of the extended location on which the resource will be created.", + required=True, + ) + extended_location.type = AAZStrArg( + options=["type"], + help="The extended location type, for example, CustomLocation.", + required=True, + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.aggregator_or_single_rack_definition = AAZObjectArg( + options=["--aggregator-or-single-rack-definition"], + arg_group="Properties", + help="The rack definition that is intended to reflect only a single rack in a single rack cluster, or an aggregator rack in a multi-rack cluster.", + required=True, + ) + cls._build_args_rack_definition_create(_args_schema.aggregator_or_single_rack_definition) + _args_schema.analytics_workspace_id = AAZStrArg( + options=["--analytics-workspace-id"], + arg_group="Properties", + help="The resource ID of the Log Analytics Workspace that will be used for storing relevant logs.", + required=True, + ) + _args_schema.cluster_location = AAZStrArg( + options=["--cluster-location"], + arg_group="Properties", + help="The customer-provided location information to identify where the cluster resides.", + fmt=AAZStrArgFormat( + max_length=256, + ), + ) + _args_schema.cluster_service_principal = AAZObjectArg( + options=["--cluster-service-principal"], + arg_group="Properties", + help="The service principal to be used by the cluster during Arc Appliance installation.", + ) + _args_schema.cluster_type = AAZStrArg( + options=["--cluster-type"], + arg_group="Properties", + help="The type of rack configuration for the cluster.", + required=True, + enum={"MultiRack": "MultiRack", "SingleRack": "SingleRack"}, + ) + _args_schema.cluster_version = AAZStrArg( + options=["--cluster-version"], + arg_group="Properties", + help="The current runtime version of the cluster.", + required=True, + ) + _args_schema.compute_deployment_threshold = AAZObjectArg( + options=["--compute-deployment-threshold"], + arg_group="Properties", + help="The validation threshold indicating the allowable failures of compute machines during environment validation and deployment.", + ) + _args_schema.compute_rack_definitions = AAZListArg( + options=["--compute-rack-definitions"], + arg_group="Properties", + help="The list of rack definitions for the compute racks in a multi-rack cluster, or an empty list in a single-rack cluster.", + ) + _args_schema.managed_resource_group_configuration = AAZObjectArg( + options=["--managed-resource-group-configuration"], + arg_group="Properties", + help="The configuration of the managed resource group associated with the resource.", + ) + _args_schema.network_fabric_id = AAZStrArg( + options=["--network-fabric-id"], + arg_group="Properties", + help="The resource ID of the Network Fabric associated with the cluster.", + required=True, + ) + + cluster_service_principal = cls._args_schema.cluster_service_principal + cluster_service_principal.application_id = AAZStrArg( + options=["application-id"], + help="The application ID, also known as client ID, of the service principal.", + required=True, + ) + cluster_service_principal.password = AAZStrArg( + options=["password"], + help="The password of the service principal.", + required=True, + ) + cluster_service_principal.principal_id = AAZStrArg( + options=["principal-id"], + help="The principal ID, also known as the object ID, of the service principal.", + required=True, + ) + cluster_service_principal.tenant_id = AAZStrArg( + options=["tenant-id"], + help="The tenant ID, also known as the directory ID, of the tenant in which the service principal is created.", + required=True, + ) + + compute_deployment_threshold = cls._args_schema.compute_deployment_threshold + compute_deployment_threshold.grouping = AAZStrArg( + options=["grouping"], + help="Selection of how the type evaluation is applied to the cluster calculation.", + required=True, + enum={"PerCluster": "PerCluster", "PerRack": "PerRack"}, + ) + compute_deployment_threshold.type = AAZStrArg( + options=["type"], + help="Selection of how the threshold should be evaluated.", + required=True, + enum={"CountSuccess": "CountSuccess", "PercentSuccess": "PercentSuccess"}, + ) + compute_deployment_threshold.value = AAZIntArg( + options=["value"], + help="The numeric threshold value.", + required=True, + fmt=AAZIntArgFormat( + minimum=0, + ), + ) + + compute_rack_definitions = cls._args_schema.compute_rack_definitions + compute_rack_definitions.Element = AAZObjectArg() + cls._build_args_rack_definition_create(compute_rack_definitions.Element) + + managed_resource_group_configuration = cls._args_schema.managed_resource_group_configuration + managed_resource_group_configuration.location = AAZStrArg( + options=["location"], + help="The location of the managed resource group. If not specified, the location of the parent resource is chosen.", + ) + managed_resource_group_configuration.name = AAZStrArg( + options=["name"], + help="The name for the managed resource group. If not specified, the unique name is automatically generated.", + fmt=AAZStrArgFormat( + max_length=75, + ), + ) + return cls._args_schema + + _args_administrative_credentials_create = None + + @classmethod + def _build_args_administrative_credentials_create(cls, _schema): + if cls._args_administrative_credentials_create is not None: + _schema.password = cls._args_administrative_credentials_create.password + _schema.username = cls._args_administrative_credentials_create.username + return + + cls._args_administrative_credentials_create = AAZObjectArg() + + administrative_credentials_create = cls._args_administrative_credentials_create + administrative_credentials_create.password = AAZStrArg( + options=["password"], + help="The password of the administrator of the device used during initialization.", + required=True, + fmt=AAZStrArgFormat( + min_length=1, + ), + ) + administrative_credentials_create.username = AAZStrArg( + options=["username"], + help="The username of the administrator of the device used during initialization.", + required=True, + fmt=AAZStrArgFormat( + min_length=1, + ), + ) + + _schema.password = cls._args_administrative_credentials_create.password + _schema.username = cls._args_administrative_credentials_create.username + + _args_rack_definition_create = None + + @classmethod + def _build_args_rack_definition_create(cls, _schema): + if cls._args_rack_definition_create is not None: + _schema.availability_zone = cls._args_rack_definition_create.availability_zone + _schema.bare_metal_machine_configuration_data = cls._args_rack_definition_create.bare_metal_machine_configuration_data + _schema.network_rack_id = cls._args_rack_definition_create.network_rack_id + _schema.rack_location = cls._args_rack_definition_create.rack_location + _schema.rack_serial_number = cls._args_rack_definition_create.rack_serial_number + _schema.rack_sku_id = cls._args_rack_definition_create.rack_sku_id + _schema.storage_appliance_configuration_data = cls._args_rack_definition_create.storage_appliance_configuration_data + return + + cls._args_rack_definition_create = AAZObjectArg() + + rack_definition_create = cls._args_rack_definition_create + rack_definition_create.availability_zone = AAZStrArg( + options=["availability-zone"], + help="The zone name used for this rack when created.", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9]{1,10}$", + ), + ) + rack_definition_create.bare_metal_machine_configuration_data = AAZListArg( + options=["bare-metal-machine-configuration-data"], + help="The unordered list of bare metal machine configuration.", + ) + rack_definition_create.network_rack_id = AAZStrArg( + options=["network-rack-id"], + help="The resource ID of the network rack that matches this rack definition.", + required=True, + ) + rack_definition_create.rack_location = AAZStrArg( + options=["rack-location"], + help="The free-form description of the rack's location.", + fmt=AAZStrArgFormat( + max_length=256, + ), + ) + rack_definition_create.rack_serial_number = AAZStrArg( + options=["rack-serial-number"], + help="The unique identifier for the rack within Network Cloud cluster. An alternate unique alphanumeric value other than a serial number may be provided if desired.", + required=True, + fmt=AAZStrArgFormat( + max_length=64, + min_length=1, + ), + ) + rack_definition_create.rack_sku_id = AAZStrArg( + options=["rack-sku-id"], + help="The resource ID of the sku for the rack being added.", + required=True, + ) + rack_definition_create.storage_appliance_configuration_data = AAZListArg( + options=["storage-appliance-configuration-data"], + help="The list of storage appliance configuration data for this rack.", + ) + + bare_metal_machine_configuration_data = cls._args_rack_definition_create.bare_metal_machine_configuration_data + bare_metal_machine_configuration_data.Element = AAZObjectArg() + + _element = cls._args_rack_definition_create.bare_metal_machine_configuration_data.Element + _element.bmc_credentials = AAZObjectArg( + options=["bmc-credentials"], + help="The credentials of the baseboard management controller on this bare metal machine.", + required=True, + ) + cls._build_args_administrative_credentials_create(_element.bmc_credentials) + _element.bmc_mac_address = AAZStrArg( + options=["bmc-mac-address"], + help="The MAC address of the BMC for this machine.", + required=True, + fmt=AAZStrArgFormat( + pattern="^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$", + ), + ) + _element.boot_mac_address = AAZStrArg( + options=["boot-mac-address"], + help="The MAC address associated with the PXE NIC card.", + required=True, + fmt=AAZStrArgFormat( + pattern="^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$", + ), + ) + _element.machine_details = AAZStrArg( + options=["machine-details"], + help="The free-form additional information about the machine, e.g. an asset tag.", + fmt=AAZStrArgFormat( + max_length=256, + ), + ) + _element.machine_name = AAZStrArg( + options=["machine-name"], + help="The user-provided name for the bare metal machine created from this specification. If not provided, the machine name will be generated programmatically.", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + _element.rack_slot = AAZIntArg( + options=["rack-slot"], + help="The slot the physical machine is in the rack based on the BOM configuration.", + required=True, + fmt=AAZIntArgFormat( + maximum=256, + minimum=1, + ), + ) + _element.serial_number = AAZStrArg( + options=["serial-number"], + help="The serial number of the machine. Hardware suppliers may use an alternate value. For example, service tag.", + required=True, + fmt=AAZStrArgFormat( + max_length=64, + ), + ) + + storage_appliance_configuration_data = cls._args_rack_definition_create.storage_appliance_configuration_data + storage_appliance_configuration_data.Element = AAZObjectArg() + + _element = cls._args_rack_definition_create.storage_appliance_configuration_data.Element + _element.admin_credentials = AAZObjectArg( + options=["admin-credentials"], + help="The credentials of the administrative interface on this storage appliance.", + required=True, + ) + cls._build_args_administrative_credentials_create(_element.admin_credentials) + _element.rack_slot = AAZIntArg( + options=["rack-slot"], + help="The slot that storage appliance is in the rack based on the BOM configuration.", + required=True, + fmt=AAZIntArgFormat( + maximum=256, + minimum=1, + ), + ) + _element.serial_number = AAZStrArg( + options=["serial-number"], + help="The serial number of the appliance.", + required=True, + ) + _element.storage_appliance_name = AAZStrArg( + options=["storage-appliance-name"], + help="The user-provided name for the storage appliance that will be created from this specification.", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + + _schema.availability_zone = cls._args_rack_definition_create.availability_zone + _schema.bare_metal_machine_configuration_data = cls._args_rack_definition_create.bare_metal_machine_configuration_data + _schema.network_rack_id = cls._args_rack_definition_create.network_rack_id + _schema.rack_location = cls._args_rack_definition_create.rack_location + _schema.rack_serial_number = cls._args_rack_definition_create.rack_serial_number + _schema.rack_sku_id = cls._args_rack_definition_create.rack_sku_id + _schema.storage_appliance_configuration_data = cls._args_rack_definition_create.storage_appliance_configuration_data + + def _execute_operations(self): + self.pre_operations() + yield self.ClustersCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ClustersCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("extendedLocation", AAZObjectType, ".extended_location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True, "client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + extended_location = _builder.get(".extendedLocation") + if extended_location is not None: + extended_location.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}}) + extended_location.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}}) + + properties = _builder.get(".properties") + if properties is not None: + _CreateHelper._build_schema_rack_definition_create(properties.set_prop("aggregatorOrSingleRackDefinition", AAZObjectType, ".aggregator_or_single_rack_definition", typ_kwargs={"flags": {"required": True}})) + properties.set_prop("analyticsWorkspaceId", AAZStrType, ".analytics_workspace_id", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("clusterLocation", AAZStrType, ".cluster_location") + properties.set_prop("clusterServicePrincipal", AAZObjectType, ".cluster_service_principal") + properties.set_prop("clusterType", AAZStrType, ".cluster_type", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("clusterVersion", AAZStrType, ".cluster_version", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("computeDeploymentThreshold", AAZObjectType, ".compute_deployment_threshold") + properties.set_prop("computeRackDefinitions", AAZListType, ".compute_rack_definitions") + properties.set_prop("managedResourceGroupConfiguration", AAZObjectType, ".managed_resource_group_configuration") + properties.set_prop("networkFabricId", AAZStrType, ".network_fabric_id", typ_kwargs={"flags": {"required": True}}) + + cluster_service_principal = _builder.get(".properties.clusterServicePrincipal") + if cluster_service_principal is not None: + cluster_service_principal.set_prop("applicationId", AAZStrType, ".application_id", typ_kwargs={"flags": {"required": True}}) + cluster_service_principal.set_prop("password", AAZStrType, ".password", typ_kwargs={"flags": {"required": True, "secret": True}}) + cluster_service_principal.set_prop("principalId", AAZStrType, ".principal_id", typ_kwargs={"flags": {"required": True}}) + cluster_service_principal.set_prop("tenantId", AAZStrType, ".tenant_id", typ_kwargs={"flags": {"required": True}}) + + compute_deployment_threshold = _builder.get(".properties.computeDeploymentThreshold") + if compute_deployment_threshold is not None: + compute_deployment_threshold.set_prop("grouping", AAZStrType, ".grouping", typ_kwargs={"flags": {"required": True}}) + compute_deployment_threshold.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}}) + compute_deployment_threshold.set_prop("value", AAZIntType, ".value", typ_kwargs={"flags": {"required": True}}) + + compute_rack_definitions = _builder.get(".properties.computeRackDefinitions") + if compute_rack_definitions is not None: + _CreateHelper._build_schema_rack_definition_create(compute_rack_definitions.set_elements(AAZObjectType, ".")) + + managed_resource_group_configuration = _builder.get(".properties.managedResourceGroupConfiguration") + if managed_resource_group_configuration is not None: + managed_resource_group_configuration.set_prop("location", AAZStrType, ".location") + managed_resource_group_configuration.set_prop("name", AAZStrType, ".name") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + 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_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _CreateHelper._build_schema_extended_location_read(_schema_on_200_201.extended_location) + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.aggregator_or_single_rack_definition = AAZObjectType( + serialized_name="aggregatorOrSingleRackDefinition", + flags={"required": True}, + ) + _CreateHelper._build_schema_rack_definition_read(properties.aggregator_or_single_rack_definition) + properties.analytics_workspace_id = AAZStrType( + serialized_name="analyticsWorkspaceId", + flags={"required": True}, + ) + properties.available_upgrade_versions = AAZListType( + serialized_name="availableUpgradeVersions", + flags={"read_only": True}, + ) + properties.cluster_capacity = AAZObjectType( + serialized_name="clusterCapacity", + ) + properties.cluster_connection_status = AAZStrType( + serialized_name="clusterConnectionStatus", + flags={"read_only": True}, + ) + properties.cluster_extended_location = AAZObjectType( + serialized_name="clusterExtendedLocation", + ) + _CreateHelper._build_schema_extended_location_read(properties.cluster_extended_location) + properties.cluster_location = AAZStrType( + serialized_name="clusterLocation", + ) + properties.cluster_manager_connection_status = AAZStrType( + serialized_name="clusterManagerConnectionStatus", + flags={"read_only": True}, + ) + properties.cluster_manager_id = AAZStrType( + serialized_name="clusterManagerId", + flags={"read_only": True}, + ) + properties.cluster_service_principal = AAZObjectType( + serialized_name="clusterServicePrincipal", + ) + properties.cluster_type = AAZStrType( + serialized_name="clusterType", + flags={"required": True}, + ) + properties.cluster_version = AAZStrType( + serialized_name="clusterVersion", + flags={"required": True}, + ) + properties.compute_deployment_threshold = AAZObjectType( + serialized_name="computeDeploymentThreshold", + ) + properties.compute_rack_definitions = AAZListType( + serialized_name="computeRackDefinitions", + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hybrid_aks_extended_location = AAZObjectType( + serialized_name="hybridAksExtendedLocation", + ) + _CreateHelper._build_schema_extended_location_read(properties.hybrid_aks_extended_location) + properties.managed_resource_group_configuration = AAZObjectType( + serialized_name="managedResourceGroupConfiguration", + ) + properties.manual_action_count = AAZIntType( + serialized_name="manualActionCount", + flags={"read_only": True}, + ) + properties.network_fabric_id = AAZStrType( + serialized_name="networkFabricId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.support_expiry_date = AAZStrType( + serialized_name="supportExpiryDate", + flags={"read_only": True}, + ) + properties.workload_resource_ids = AAZListType( + serialized_name="workloadResourceIds", + flags={"read_only": True}, + ) + + available_upgrade_versions = cls._schema_on_200_201.properties.available_upgrade_versions + available_upgrade_versions.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.available_upgrade_versions.Element + _element.control_impact = AAZStrType( + serialized_name="controlImpact", + flags={"read_only": True}, + ) + _element.expected_duration = AAZStrType( + serialized_name="expectedDuration", + flags={"read_only": True}, + ) + _element.impact_description = AAZStrType( + serialized_name="impactDescription", + flags={"read_only": True}, + ) + _element.support_expiry_date = AAZStrType( + serialized_name="supportExpiryDate", + flags={"read_only": True}, + ) + _element.target_cluster_version = AAZStrType( + serialized_name="targetClusterVersion", + flags={"read_only": True}, + ) + _element.workload_impact = AAZStrType( + serialized_name="workloadImpact", + flags={"read_only": True}, + ) + + cluster_capacity = cls._schema_on_200_201.properties.cluster_capacity + cluster_capacity.available_appliance_storage_gb = AAZIntType( + serialized_name="availableApplianceStorageGB", + ) + cluster_capacity.available_core_count = AAZIntType( + serialized_name="availableCoreCount", + ) + cluster_capacity.available_host_storage_gb = AAZIntType( + serialized_name="availableHostStorageGB", + ) + cluster_capacity.available_memory_gb = AAZIntType( + serialized_name="availableMemoryGB", + ) + cluster_capacity.total_appliance_storage_gb = AAZIntType( + serialized_name="totalApplianceStorageGB", + ) + cluster_capacity.total_core_count = AAZIntType( + serialized_name="totalCoreCount", + ) + cluster_capacity.total_host_storage_gb = AAZIntType( + serialized_name="totalHostStorageGB", + ) + cluster_capacity.total_memory_gb = AAZIntType( + serialized_name="totalMemoryGB", + ) + + cluster_service_principal = cls._schema_on_200_201.properties.cluster_service_principal + cluster_service_principal.application_id = AAZStrType( + serialized_name="applicationId", + flags={"required": True}, + ) + cluster_service_principal.password = AAZStrType( + flags={"required": True, "secret": True}, + ) + cluster_service_principal.principal_id = AAZStrType( + serialized_name="principalId", + flags={"required": True}, + ) + cluster_service_principal.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"required": True}, + ) + + compute_deployment_threshold = cls._schema_on_200_201.properties.compute_deployment_threshold + compute_deployment_threshold.grouping = AAZStrType( + flags={"required": True}, + ) + compute_deployment_threshold.type = AAZStrType( + flags={"required": True}, + ) + compute_deployment_threshold.value = AAZIntType( + flags={"required": True}, + ) + + compute_rack_definitions = cls._schema_on_200_201.properties.compute_rack_definitions + compute_rack_definitions.Element = AAZObjectType() + _CreateHelper._build_schema_rack_definition_read(compute_rack_definitions.Element) + + managed_resource_group_configuration = cls._schema_on_200_201.properties.managed_resource_group_configuration + managed_resource_group_configuration.location = AAZStrType() + managed_resource_group_configuration.name = AAZStrType() + + workload_resource_ids = cls._schema_on_200_201.properties.workload_resource_ids + workload_resource_ids.Element = AAZStrType() + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + @classmethod + def _build_schema_administrative_credentials_create(cls, _builder): + if _builder is None: + return + _builder.set_prop("password", AAZStrType, ".password", typ_kwargs={"flags": {"required": True, "secret": True}}) + _builder.set_prop("username", AAZStrType, ".username", typ_kwargs={"flags": {"required": True}}) + + @classmethod + def _build_schema_rack_definition_create(cls, _builder): + if _builder is None: + return + _builder.set_prop("availabilityZone", AAZStrType, ".availability_zone") + _builder.set_prop("bareMetalMachineConfigurationData", AAZListType, ".bare_metal_machine_configuration_data") + _builder.set_prop("networkRackId", AAZStrType, ".network_rack_id", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("rackLocation", AAZStrType, ".rack_location") + _builder.set_prop("rackSerialNumber", AAZStrType, ".rack_serial_number", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("rackSkuId", AAZStrType, ".rack_sku_id", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("storageApplianceConfigurationData", AAZListType, ".storage_appliance_configuration_data") + + bare_metal_machine_configuration_data = _builder.get(".bareMetalMachineConfigurationData") + if bare_metal_machine_configuration_data is not None: + bare_metal_machine_configuration_data.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".bareMetalMachineConfigurationData[]") + if _elements is not None: + cls._build_schema_administrative_credentials_create(_elements.set_prop("bmcCredentials", AAZObjectType, ".bmc_credentials", typ_kwargs={"flags": {"required": True}})) + _elements.set_prop("bmcMacAddress", AAZStrType, ".bmc_mac_address", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("bootMacAddress", AAZStrType, ".boot_mac_address", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("machineDetails", AAZStrType, ".machine_details") + _elements.set_prop("machineName", AAZStrType, ".machine_name") + _elements.set_prop("rackSlot", AAZIntType, ".rack_slot", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("serialNumber", AAZStrType, ".serial_number", typ_kwargs={"flags": {"required": True}}) + + storage_appliance_configuration_data = _builder.get(".storageApplianceConfigurationData") + if storage_appliance_configuration_data is not None: + storage_appliance_configuration_data.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".storageApplianceConfigurationData[]") + if _elements is not None: + cls._build_schema_administrative_credentials_create(_elements.set_prop("adminCredentials", AAZObjectType, ".admin_credentials", typ_kwargs={"flags": {"required": True}})) + _elements.set_prop("rackSlot", AAZIntType, ".rack_slot", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("serialNumber", AAZStrType, ".serial_number", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("storageApplianceName", AAZStrType, ".storage_appliance_name") + + _schema_administrative_credentials_read = None + + @classmethod + def _build_schema_administrative_credentials_read(cls, _schema): + if cls._schema_administrative_credentials_read is not None: + _schema.password = cls._schema_administrative_credentials_read.password + _schema.username = cls._schema_administrative_credentials_read.username + return + + cls._schema_administrative_credentials_read = _schema_administrative_credentials_read = AAZObjectType() + + administrative_credentials_read = _schema_administrative_credentials_read + administrative_credentials_read.password = AAZStrType( + flags={"required": True, "secret": True}, + ) + administrative_credentials_read.username = AAZStrType( + flags={"required": True}, + ) + + _schema.password = cls._schema_administrative_credentials_read.password + _schema.username = cls._schema_administrative_credentials_read.username + + _schema_extended_location_read = None + + @classmethod + def _build_schema_extended_location_read(cls, _schema): + if cls._schema_extended_location_read is not None: + _schema.name = cls._schema_extended_location_read.name + _schema.type = cls._schema_extended_location_read.type + return + + cls._schema_extended_location_read = _schema_extended_location_read = AAZObjectType() + + extended_location_read = _schema_extended_location_read + extended_location_read.name = AAZStrType( + flags={"required": True}, + ) + extended_location_read.type = AAZStrType( + flags={"required": True}, + ) + + _schema.name = cls._schema_extended_location_read.name + _schema.type = cls._schema_extended_location_read.type + + _schema_rack_definition_read = None + + @classmethod + def _build_schema_rack_definition_read(cls, _schema): + if cls._schema_rack_definition_read is not None: + _schema.availability_zone = cls._schema_rack_definition_read.availability_zone + _schema.bare_metal_machine_configuration_data = cls._schema_rack_definition_read.bare_metal_machine_configuration_data + _schema.network_rack_id = cls._schema_rack_definition_read.network_rack_id + _schema.rack_location = cls._schema_rack_definition_read.rack_location + _schema.rack_serial_number = cls._schema_rack_definition_read.rack_serial_number + _schema.rack_sku_id = cls._schema_rack_definition_read.rack_sku_id + _schema.storage_appliance_configuration_data = cls._schema_rack_definition_read.storage_appliance_configuration_data + return + + cls._schema_rack_definition_read = _schema_rack_definition_read = AAZObjectType() + + rack_definition_read = _schema_rack_definition_read + rack_definition_read.availability_zone = AAZStrType( + serialized_name="availabilityZone", + ) + rack_definition_read.bare_metal_machine_configuration_data = AAZListType( + serialized_name="bareMetalMachineConfigurationData", + ) + rack_definition_read.network_rack_id = AAZStrType( + serialized_name="networkRackId", + flags={"required": True}, + ) + rack_definition_read.rack_location = AAZStrType( + serialized_name="rackLocation", + ) + rack_definition_read.rack_serial_number = AAZStrType( + serialized_name="rackSerialNumber", + flags={"required": True}, + ) + rack_definition_read.rack_sku_id = AAZStrType( + serialized_name="rackSkuId", + flags={"required": True}, + ) + rack_definition_read.storage_appliance_configuration_data = AAZListType( + serialized_name="storageApplianceConfigurationData", + ) + + bare_metal_machine_configuration_data = _schema_rack_definition_read.bare_metal_machine_configuration_data + bare_metal_machine_configuration_data.Element = AAZObjectType() + + _element = _schema_rack_definition_read.bare_metal_machine_configuration_data.Element + _element.bmc_connection_string = AAZStrType( + serialized_name="bmcConnectionString", + flags={"read_only": True}, + ) + _element.bmc_credentials = AAZObjectType( + serialized_name="bmcCredentials", + flags={"required": True}, + ) + cls._build_schema_administrative_credentials_read(_element.bmc_credentials) + _element.bmc_mac_address = AAZStrType( + serialized_name="bmcMacAddress", + flags={"required": True}, + ) + _element.boot_mac_address = AAZStrType( + serialized_name="bootMacAddress", + flags={"required": True}, + ) + _element.machine_details = AAZStrType( + serialized_name="machineDetails", + ) + _element.machine_name = AAZStrType( + serialized_name="machineName", + ) + _element.rack_slot = AAZIntType( + serialized_name="rackSlot", + flags={"required": True}, + ) + _element.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"required": True}, + ) + + storage_appliance_configuration_data = _schema_rack_definition_read.storage_appliance_configuration_data + storage_appliance_configuration_data.Element = AAZObjectType() + + _element = _schema_rack_definition_read.storage_appliance_configuration_data.Element + _element.admin_credentials = AAZObjectType( + serialized_name="adminCredentials", + flags={"required": True}, + ) + cls._build_schema_administrative_credentials_read(_element.admin_credentials) + _element.rack_slot = AAZIntType( + serialized_name="rackSlot", + flags={"required": True}, + ) + _element.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"required": True}, + ) + _element.storage_appliance_name = AAZStrType( + serialized_name="storageApplianceName", + ) + + _schema.availability_zone = cls._schema_rack_definition_read.availability_zone + _schema.bare_metal_machine_configuration_data = cls._schema_rack_definition_read.bare_metal_machine_configuration_data + _schema.network_rack_id = cls._schema_rack_definition_read.network_rack_id + _schema.rack_location = cls._schema_rack_definition_read.rack_location + _schema.rack_serial_number = cls._schema_rack_definition_read.rack_serial_number + _schema.rack_sku_id = cls._schema_rack_definition_read.rack_sku_id + _schema.storage_appliance_configuration_data = cls._schema_rack_definition_read.storage_appliance_configuration_data + + +__all__ = ["Create"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_delete.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_delete.py new file mode 100644 index 00000000000..cc773441933 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_delete.py @@ -0,0 +1,167 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cluster delete", + is_experimental=True, + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete the provided cluster. + + :example: Delete cluster + az networkcloud cluster delete --name "clusterName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clusters/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.cluster_name = AAZStrArg( + options=["-n", "--name", "--cluster-name"], + help="The name of the cluster.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.ClustersDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class ClustersDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_deploy.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_deploy.py new file mode 100644 index 00000000000..749aedb9936 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_deploy.py @@ -0,0 +1,331 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cluster deploy", + is_experimental=True, +) +class Deploy(AAZCommand): + """Deploy the cluster. + + :example: Deploy cluster + az networkcloud cluster deploy --name "clusterName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clusters/{}/deploy", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.cluster_name = AAZStrArg( + options=["-n", "--name", "--cluster-name"], + help="The name of the cluster.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "ClusterDeployParameters" + + _args_schema = cls._args_schema + _args_schema.skip_validations_for_machines = AAZListArg( + options=["--skip-validations-for-machines"], + arg_group="ClusterDeployParameters", + help="The names of bare metal machines in the cluster that should be skipped during environment validation.", + ) + + skip_validations_for_machines = cls._args_schema.skip_validations_for_machines + skip_validations_for_machines.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.ClustersDeploy(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ClustersDeploy(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/deploy", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"client_flatten": True}} + ) + _builder.set_prop("skipValidationsForMachines", AAZListType, ".skip_validations_for_machines") + + skip_validations_for_machines = _builder.get(".skipValidationsForMachines") + if skip_validations_for_machines is not None: + skip_validations_for_machines.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _DeployHelper._build_schema_operation_status_result_read(cls._schema_on_200) + + return cls._schema_on_200 + + def on_204(self, session): + pass + + +class _DeployHelper: + """Helper class for Deploy""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType() + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + _schema_operation_status_result_read = None + + @classmethod + def _build_schema_operation_status_result_read(cls, _schema): + if cls._schema_operation_status_result_read is not None: + _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.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 + return + + cls._schema_operation_status_result_read = _schema_operation_status_result_read = AAZObjectType() + + operation_status_result_read = _schema_operation_status_result_read + operation_status_result_read.end_time = AAZStrType( + serialized_name="endTime", + ) + 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.percent_complete = AAZFloatType( + serialized_name="percentComplete", + ) + operation_status_result_read.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"read_only": True}, + ) + operation_status_result_read.start_time = AAZStrType( + serialized_name="startTime", + ) + operation_status_result_read.status = AAZStrType( + flags={"required": True}, + ) + + operations = _schema_operation_status_result_read.operations + operations.Element = AAZObjectType() + cls._build_schema_operation_status_result_read(operations.Element) + + _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.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 + + +__all__ = ["Deploy"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_list.py new file mode 100644 index 00000000000..19bf063f0a8 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_list.py @@ -0,0 +1,869 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cluster list", + is_experimental=True, +) +class List(AAZCommand): + """List clusters in the provided resource group or subscription. + + :example: List clusters for resource group + az networkcloud cluster list --resource-group "resourceGroupName" + + :example: List clusters for subscription + az networkcloud cluster list + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.networkcloud/clusters", "2022-12-12-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clusters", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) + condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + if condition_0: + self.ClustersListByResourceGroup(ctx=self.ctx)() + if condition_1: + self.ClustersListBySubscription(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class ClustersListByResourceGroup(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _ListHelper._build_schema_extended_location_read(_element.extended_location) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.aggregator_or_single_rack_definition = AAZObjectType( + serialized_name="aggregatorOrSingleRackDefinition", + flags={"required": True}, + ) + _ListHelper._build_schema_rack_definition_read(properties.aggregator_or_single_rack_definition) + properties.analytics_workspace_id = AAZStrType( + serialized_name="analyticsWorkspaceId", + flags={"required": True}, + ) + properties.available_upgrade_versions = AAZListType( + serialized_name="availableUpgradeVersions", + flags={"read_only": True}, + ) + properties.cluster_capacity = AAZObjectType( + serialized_name="clusterCapacity", + ) + properties.cluster_connection_status = AAZStrType( + serialized_name="clusterConnectionStatus", + flags={"read_only": True}, + ) + properties.cluster_extended_location = AAZObjectType( + serialized_name="clusterExtendedLocation", + ) + _ListHelper._build_schema_extended_location_read(properties.cluster_extended_location) + properties.cluster_location = AAZStrType( + serialized_name="clusterLocation", + ) + properties.cluster_manager_connection_status = AAZStrType( + serialized_name="clusterManagerConnectionStatus", + flags={"read_only": True}, + ) + properties.cluster_manager_id = AAZStrType( + serialized_name="clusterManagerId", + flags={"read_only": True}, + ) + properties.cluster_service_principal = AAZObjectType( + serialized_name="clusterServicePrincipal", + ) + properties.cluster_type = AAZStrType( + serialized_name="clusterType", + flags={"required": True}, + ) + properties.cluster_version = AAZStrType( + serialized_name="clusterVersion", + flags={"required": True}, + ) + properties.compute_deployment_threshold = AAZObjectType( + serialized_name="computeDeploymentThreshold", + ) + properties.compute_rack_definitions = AAZListType( + serialized_name="computeRackDefinitions", + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hybrid_aks_extended_location = AAZObjectType( + serialized_name="hybridAksExtendedLocation", + ) + _ListHelper._build_schema_extended_location_read(properties.hybrid_aks_extended_location) + properties.managed_resource_group_configuration = AAZObjectType( + serialized_name="managedResourceGroupConfiguration", + ) + properties.manual_action_count = AAZIntType( + serialized_name="manualActionCount", + flags={"read_only": True}, + ) + properties.network_fabric_id = AAZStrType( + serialized_name="networkFabricId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.support_expiry_date = AAZStrType( + serialized_name="supportExpiryDate", + flags={"read_only": True}, + ) + properties.workload_resource_ids = AAZListType( + serialized_name="workloadResourceIds", + flags={"read_only": True}, + ) + + available_upgrade_versions = cls._schema_on_200.value.Element.properties.available_upgrade_versions + available_upgrade_versions.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.available_upgrade_versions.Element + _element.control_impact = AAZStrType( + serialized_name="controlImpact", + flags={"read_only": True}, + ) + _element.expected_duration = AAZStrType( + serialized_name="expectedDuration", + flags={"read_only": True}, + ) + _element.impact_description = AAZStrType( + serialized_name="impactDescription", + flags={"read_only": True}, + ) + _element.support_expiry_date = AAZStrType( + serialized_name="supportExpiryDate", + flags={"read_only": True}, + ) + _element.target_cluster_version = AAZStrType( + serialized_name="targetClusterVersion", + flags={"read_only": True}, + ) + _element.workload_impact = AAZStrType( + serialized_name="workloadImpact", + flags={"read_only": True}, + ) + + cluster_capacity = cls._schema_on_200.value.Element.properties.cluster_capacity + cluster_capacity.available_appliance_storage_gb = AAZIntType( + serialized_name="availableApplianceStorageGB", + ) + cluster_capacity.available_core_count = AAZIntType( + serialized_name="availableCoreCount", + ) + cluster_capacity.available_host_storage_gb = AAZIntType( + serialized_name="availableHostStorageGB", + ) + cluster_capacity.available_memory_gb = AAZIntType( + serialized_name="availableMemoryGB", + ) + cluster_capacity.total_appliance_storage_gb = AAZIntType( + serialized_name="totalApplianceStorageGB", + ) + cluster_capacity.total_core_count = AAZIntType( + serialized_name="totalCoreCount", + ) + cluster_capacity.total_host_storage_gb = AAZIntType( + serialized_name="totalHostStorageGB", + ) + cluster_capacity.total_memory_gb = AAZIntType( + serialized_name="totalMemoryGB", + ) + + cluster_service_principal = cls._schema_on_200.value.Element.properties.cluster_service_principal + cluster_service_principal.application_id = AAZStrType( + serialized_name="applicationId", + flags={"required": True}, + ) + cluster_service_principal.password = AAZStrType( + flags={"required": True, "secret": True}, + ) + cluster_service_principal.principal_id = AAZStrType( + serialized_name="principalId", + flags={"required": True}, + ) + cluster_service_principal.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"required": True}, + ) + + compute_deployment_threshold = cls._schema_on_200.value.Element.properties.compute_deployment_threshold + compute_deployment_threshold.grouping = AAZStrType( + flags={"required": True}, + ) + compute_deployment_threshold.type = AAZStrType( + flags={"required": True}, + ) + compute_deployment_threshold.value = AAZIntType( + flags={"required": True}, + ) + + compute_rack_definitions = cls._schema_on_200.value.Element.properties.compute_rack_definitions + compute_rack_definitions.Element = AAZObjectType() + _ListHelper._build_schema_rack_definition_read(compute_rack_definitions.Element) + + managed_resource_group_configuration = cls._schema_on_200.value.Element.properties.managed_resource_group_configuration + managed_resource_group_configuration.location = AAZStrType() + managed_resource_group_configuration.name = AAZStrType() + + workload_resource_ids = cls._schema_on_200.value.Element.properties.workload_resource_ids + workload_resource_ids.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + class ClustersListBySubscription(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/clusters", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _ListHelper._build_schema_extended_location_read(_element.extended_location) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.aggregator_or_single_rack_definition = AAZObjectType( + serialized_name="aggregatorOrSingleRackDefinition", + flags={"required": True}, + ) + _ListHelper._build_schema_rack_definition_read(properties.aggregator_or_single_rack_definition) + properties.analytics_workspace_id = AAZStrType( + serialized_name="analyticsWorkspaceId", + flags={"required": True}, + ) + properties.available_upgrade_versions = AAZListType( + serialized_name="availableUpgradeVersions", + flags={"read_only": True}, + ) + properties.cluster_capacity = AAZObjectType( + serialized_name="clusterCapacity", + ) + properties.cluster_connection_status = AAZStrType( + serialized_name="clusterConnectionStatus", + flags={"read_only": True}, + ) + properties.cluster_extended_location = AAZObjectType( + serialized_name="clusterExtendedLocation", + ) + _ListHelper._build_schema_extended_location_read(properties.cluster_extended_location) + properties.cluster_location = AAZStrType( + serialized_name="clusterLocation", + ) + properties.cluster_manager_connection_status = AAZStrType( + serialized_name="clusterManagerConnectionStatus", + flags={"read_only": True}, + ) + properties.cluster_manager_id = AAZStrType( + serialized_name="clusterManagerId", + flags={"read_only": True}, + ) + properties.cluster_service_principal = AAZObjectType( + serialized_name="clusterServicePrincipal", + ) + properties.cluster_type = AAZStrType( + serialized_name="clusterType", + flags={"required": True}, + ) + properties.cluster_version = AAZStrType( + serialized_name="clusterVersion", + flags={"required": True}, + ) + properties.compute_deployment_threshold = AAZObjectType( + serialized_name="computeDeploymentThreshold", + ) + properties.compute_rack_definitions = AAZListType( + serialized_name="computeRackDefinitions", + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hybrid_aks_extended_location = AAZObjectType( + serialized_name="hybridAksExtendedLocation", + ) + _ListHelper._build_schema_extended_location_read(properties.hybrid_aks_extended_location) + properties.managed_resource_group_configuration = AAZObjectType( + serialized_name="managedResourceGroupConfiguration", + ) + properties.manual_action_count = AAZIntType( + serialized_name="manualActionCount", + flags={"read_only": True}, + ) + properties.network_fabric_id = AAZStrType( + serialized_name="networkFabricId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.support_expiry_date = AAZStrType( + serialized_name="supportExpiryDate", + flags={"read_only": True}, + ) + properties.workload_resource_ids = AAZListType( + serialized_name="workloadResourceIds", + flags={"read_only": True}, + ) + + available_upgrade_versions = cls._schema_on_200.value.Element.properties.available_upgrade_versions + available_upgrade_versions.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.available_upgrade_versions.Element + _element.control_impact = AAZStrType( + serialized_name="controlImpact", + flags={"read_only": True}, + ) + _element.expected_duration = AAZStrType( + serialized_name="expectedDuration", + flags={"read_only": True}, + ) + _element.impact_description = AAZStrType( + serialized_name="impactDescription", + flags={"read_only": True}, + ) + _element.support_expiry_date = AAZStrType( + serialized_name="supportExpiryDate", + flags={"read_only": True}, + ) + _element.target_cluster_version = AAZStrType( + serialized_name="targetClusterVersion", + flags={"read_only": True}, + ) + _element.workload_impact = AAZStrType( + serialized_name="workloadImpact", + flags={"read_only": True}, + ) + + cluster_capacity = cls._schema_on_200.value.Element.properties.cluster_capacity + cluster_capacity.available_appliance_storage_gb = AAZIntType( + serialized_name="availableApplianceStorageGB", + ) + cluster_capacity.available_core_count = AAZIntType( + serialized_name="availableCoreCount", + ) + cluster_capacity.available_host_storage_gb = AAZIntType( + serialized_name="availableHostStorageGB", + ) + cluster_capacity.available_memory_gb = AAZIntType( + serialized_name="availableMemoryGB", + ) + cluster_capacity.total_appliance_storage_gb = AAZIntType( + serialized_name="totalApplianceStorageGB", + ) + cluster_capacity.total_core_count = AAZIntType( + serialized_name="totalCoreCount", + ) + cluster_capacity.total_host_storage_gb = AAZIntType( + serialized_name="totalHostStorageGB", + ) + cluster_capacity.total_memory_gb = AAZIntType( + serialized_name="totalMemoryGB", + ) + + cluster_service_principal = cls._schema_on_200.value.Element.properties.cluster_service_principal + cluster_service_principal.application_id = AAZStrType( + serialized_name="applicationId", + flags={"required": True}, + ) + cluster_service_principal.password = AAZStrType( + flags={"required": True, "secret": True}, + ) + cluster_service_principal.principal_id = AAZStrType( + serialized_name="principalId", + flags={"required": True}, + ) + cluster_service_principal.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"required": True}, + ) + + compute_deployment_threshold = cls._schema_on_200.value.Element.properties.compute_deployment_threshold + compute_deployment_threshold.grouping = AAZStrType( + flags={"required": True}, + ) + compute_deployment_threshold.type = AAZStrType( + flags={"required": True}, + ) + compute_deployment_threshold.value = AAZIntType( + flags={"required": True}, + ) + + compute_rack_definitions = cls._schema_on_200.value.Element.properties.compute_rack_definitions + compute_rack_definitions.Element = AAZObjectType() + _ListHelper._build_schema_rack_definition_read(compute_rack_definitions.Element) + + managed_resource_group_configuration = cls._schema_on_200.value.Element.properties.managed_resource_group_configuration + managed_resource_group_configuration.location = AAZStrType() + managed_resource_group_configuration.name = AAZStrType() + + workload_resource_ids = cls._schema_on_200.value.Element.properties.workload_resource_ids + workload_resource_ids.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + _schema_administrative_credentials_read = None + + @classmethod + def _build_schema_administrative_credentials_read(cls, _schema): + if cls._schema_administrative_credentials_read is not None: + _schema.password = cls._schema_administrative_credentials_read.password + _schema.username = cls._schema_administrative_credentials_read.username + return + + cls._schema_administrative_credentials_read = _schema_administrative_credentials_read = AAZObjectType() + + administrative_credentials_read = _schema_administrative_credentials_read + administrative_credentials_read.password = AAZStrType( + flags={"required": True, "secret": True}, + ) + administrative_credentials_read.username = AAZStrType( + flags={"required": True}, + ) + + _schema.password = cls._schema_administrative_credentials_read.password + _schema.username = cls._schema_administrative_credentials_read.username + + _schema_extended_location_read = None + + @classmethod + def _build_schema_extended_location_read(cls, _schema): + if cls._schema_extended_location_read is not None: + _schema.name = cls._schema_extended_location_read.name + _schema.type = cls._schema_extended_location_read.type + return + + cls._schema_extended_location_read = _schema_extended_location_read = AAZObjectType() + + extended_location_read = _schema_extended_location_read + extended_location_read.name = AAZStrType( + flags={"required": True}, + ) + extended_location_read.type = AAZStrType( + flags={"required": True}, + ) + + _schema.name = cls._schema_extended_location_read.name + _schema.type = cls._schema_extended_location_read.type + + _schema_rack_definition_read = None + + @classmethod + def _build_schema_rack_definition_read(cls, _schema): + if cls._schema_rack_definition_read is not None: + _schema.availability_zone = cls._schema_rack_definition_read.availability_zone + _schema.bare_metal_machine_configuration_data = cls._schema_rack_definition_read.bare_metal_machine_configuration_data + _schema.network_rack_id = cls._schema_rack_definition_read.network_rack_id + _schema.rack_location = cls._schema_rack_definition_read.rack_location + _schema.rack_serial_number = cls._schema_rack_definition_read.rack_serial_number + _schema.rack_sku_id = cls._schema_rack_definition_read.rack_sku_id + _schema.storage_appliance_configuration_data = cls._schema_rack_definition_read.storage_appliance_configuration_data + return + + cls._schema_rack_definition_read = _schema_rack_definition_read = AAZObjectType() + + rack_definition_read = _schema_rack_definition_read + rack_definition_read.availability_zone = AAZStrType( + serialized_name="availabilityZone", + ) + rack_definition_read.bare_metal_machine_configuration_data = AAZListType( + serialized_name="bareMetalMachineConfigurationData", + ) + rack_definition_read.network_rack_id = AAZStrType( + serialized_name="networkRackId", + flags={"required": True}, + ) + rack_definition_read.rack_location = AAZStrType( + serialized_name="rackLocation", + ) + rack_definition_read.rack_serial_number = AAZStrType( + serialized_name="rackSerialNumber", + flags={"required": True}, + ) + rack_definition_read.rack_sku_id = AAZStrType( + serialized_name="rackSkuId", + flags={"required": True}, + ) + rack_definition_read.storage_appliance_configuration_data = AAZListType( + serialized_name="storageApplianceConfigurationData", + ) + + bare_metal_machine_configuration_data = _schema_rack_definition_read.bare_metal_machine_configuration_data + bare_metal_machine_configuration_data.Element = AAZObjectType() + + _element = _schema_rack_definition_read.bare_metal_machine_configuration_data.Element + _element.bmc_connection_string = AAZStrType( + serialized_name="bmcConnectionString", + flags={"read_only": True}, + ) + _element.bmc_credentials = AAZObjectType( + serialized_name="bmcCredentials", + flags={"required": True}, + ) + cls._build_schema_administrative_credentials_read(_element.bmc_credentials) + _element.bmc_mac_address = AAZStrType( + serialized_name="bmcMacAddress", + flags={"required": True}, + ) + _element.boot_mac_address = AAZStrType( + serialized_name="bootMacAddress", + flags={"required": True}, + ) + _element.machine_details = AAZStrType( + serialized_name="machineDetails", + ) + _element.machine_name = AAZStrType( + serialized_name="machineName", + ) + _element.rack_slot = AAZIntType( + serialized_name="rackSlot", + flags={"required": True}, + ) + _element.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"required": True}, + ) + + storage_appliance_configuration_data = _schema_rack_definition_read.storage_appliance_configuration_data + storage_appliance_configuration_data.Element = AAZObjectType() + + _element = _schema_rack_definition_read.storage_appliance_configuration_data.Element + _element.admin_credentials = AAZObjectType( + serialized_name="adminCredentials", + flags={"required": True}, + ) + cls._build_schema_administrative_credentials_read(_element.admin_credentials) + _element.rack_slot = AAZIntType( + serialized_name="rackSlot", + flags={"required": True}, + ) + _element.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"required": True}, + ) + _element.storage_appliance_name = AAZStrType( + serialized_name="storageApplianceName", + ) + + _schema.availability_zone = cls._schema_rack_definition_read.availability_zone + _schema.bare_metal_machine_configuration_data = cls._schema_rack_definition_read.bare_metal_machine_configuration_data + _schema.network_rack_id = cls._schema_rack_definition_read.network_rack_id + _schema.rack_location = cls._schema_rack_definition_read.rack_location + _schema.rack_serial_number = cls._schema_rack_definition_read.rack_serial_number + _schema.rack_sku_id = cls._schema_rack_definition_read.rack_sku_id + _schema.storage_appliance_configuration_data = cls._schema_rack_definition_read.storage_appliance_configuration_data + + +__all__ = ["List"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_show.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_show.py new file mode 100644 index 00000000000..f1639d2be91 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_show.py @@ -0,0 +1,550 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cluster show", + is_experimental=True, +) +class Show(AAZCommand): + """Get properties of the provided cluster. + + :example: Get cluster + az networkcloud cluster show --name "clusterName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clusters/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.cluster_name = AAZStrArg( + options=["-n", "--name", "--cluster-name"], + help="The name of the cluster.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ClustersGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ClustersGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _ShowHelper._build_schema_extended_location_read(_schema_on_200.extended_location) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.aggregator_or_single_rack_definition = AAZObjectType( + serialized_name="aggregatorOrSingleRackDefinition", + flags={"required": True}, + ) + _ShowHelper._build_schema_rack_definition_read(properties.aggregator_or_single_rack_definition) + properties.analytics_workspace_id = AAZStrType( + serialized_name="analyticsWorkspaceId", + flags={"required": True}, + ) + properties.available_upgrade_versions = AAZListType( + serialized_name="availableUpgradeVersions", + flags={"read_only": True}, + ) + properties.cluster_capacity = AAZObjectType( + serialized_name="clusterCapacity", + ) + properties.cluster_connection_status = AAZStrType( + serialized_name="clusterConnectionStatus", + flags={"read_only": True}, + ) + properties.cluster_extended_location = AAZObjectType( + serialized_name="clusterExtendedLocation", + ) + _ShowHelper._build_schema_extended_location_read(properties.cluster_extended_location) + properties.cluster_location = AAZStrType( + serialized_name="clusterLocation", + ) + properties.cluster_manager_connection_status = AAZStrType( + serialized_name="clusterManagerConnectionStatus", + flags={"read_only": True}, + ) + properties.cluster_manager_id = AAZStrType( + serialized_name="clusterManagerId", + flags={"read_only": True}, + ) + properties.cluster_service_principal = AAZObjectType( + serialized_name="clusterServicePrincipal", + ) + properties.cluster_type = AAZStrType( + serialized_name="clusterType", + flags={"required": True}, + ) + properties.cluster_version = AAZStrType( + serialized_name="clusterVersion", + flags={"required": True}, + ) + properties.compute_deployment_threshold = AAZObjectType( + serialized_name="computeDeploymentThreshold", + ) + properties.compute_rack_definitions = AAZListType( + serialized_name="computeRackDefinitions", + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hybrid_aks_extended_location = AAZObjectType( + serialized_name="hybridAksExtendedLocation", + ) + _ShowHelper._build_schema_extended_location_read(properties.hybrid_aks_extended_location) + properties.managed_resource_group_configuration = AAZObjectType( + serialized_name="managedResourceGroupConfiguration", + ) + properties.manual_action_count = AAZIntType( + serialized_name="manualActionCount", + flags={"read_only": True}, + ) + properties.network_fabric_id = AAZStrType( + serialized_name="networkFabricId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.support_expiry_date = AAZStrType( + serialized_name="supportExpiryDate", + flags={"read_only": True}, + ) + properties.workload_resource_ids = AAZListType( + serialized_name="workloadResourceIds", + flags={"read_only": True}, + ) + + available_upgrade_versions = cls._schema_on_200.properties.available_upgrade_versions + available_upgrade_versions.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.available_upgrade_versions.Element + _element.control_impact = AAZStrType( + serialized_name="controlImpact", + flags={"read_only": True}, + ) + _element.expected_duration = AAZStrType( + serialized_name="expectedDuration", + flags={"read_only": True}, + ) + _element.impact_description = AAZStrType( + serialized_name="impactDescription", + flags={"read_only": True}, + ) + _element.support_expiry_date = AAZStrType( + serialized_name="supportExpiryDate", + flags={"read_only": True}, + ) + _element.target_cluster_version = AAZStrType( + serialized_name="targetClusterVersion", + flags={"read_only": True}, + ) + _element.workload_impact = AAZStrType( + serialized_name="workloadImpact", + flags={"read_only": True}, + ) + + cluster_capacity = cls._schema_on_200.properties.cluster_capacity + cluster_capacity.available_appliance_storage_gb = AAZIntType( + serialized_name="availableApplianceStorageGB", + ) + cluster_capacity.available_core_count = AAZIntType( + serialized_name="availableCoreCount", + ) + cluster_capacity.available_host_storage_gb = AAZIntType( + serialized_name="availableHostStorageGB", + ) + cluster_capacity.available_memory_gb = AAZIntType( + serialized_name="availableMemoryGB", + ) + cluster_capacity.total_appliance_storage_gb = AAZIntType( + serialized_name="totalApplianceStorageGB", + ) + cluster_capacity.total_core_count = AAZIntType( + serialized_name="totalCoreCount", + ) + cluster_capacity.total_host_storage_gb = AAZIntType( + serialized_name="totalHostStorageGB", + ) + cluster_capacity.total_memory_gb = AAZIntType( + serialized_name="totalMemoryGB", + ) + + cluster_service_principal = cls._schema_on_200.properties.cluster_service_principal + cluster_service_principal.application_id = AAZStrType( + serialized_name="applicationId", + flags={"required": True}, + ) + cluster_service_principal.password = AAZStrType( + flags={"required": True, "secret": True}, + ) + cluster_service_principal.principal_id = AAZStrType( + serialized_name="principalId", + flags={"required": True}, + ) + cluster_service_principal.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"required": True}, + ) + + compute_deployment_threshold = cls._schema_on_200.properties.compute_deployment_threshold + compute_deployment_threshold.grouping = AAZStrType( + flags={"required": True}, + ) + compute_deployment_threshold.type = AAZStrType( + flags={"required": True}, + ) + compute_deployment_threshold.value = AAZIntType( + flags={"required": True}, + ) + + compute_rack_definitions = cls._schema_on_200.properties.compute_rack_definitions + compute_rack_definitions.Element = AAZObjectType() + _ShowHelper._build_schema_rack_definition_read(compute_rack_definitions.Element) + + managed_resource_group_configuration = cls._schema_on_200.properties.managed_resource_group_configuration + managed_resource_group_configuration.location = AAZStrType() + managed_resource_group_configuration.name = AAZStrType() + + workload_resource_ids = cls._schema_on_200.properties.workload_resource_ids + workload_resource_ids.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + _schema_administrative_credentials_read = None + + @classmethod + def _build_schema_administrative_credentials_read(cls, _schema): + if cls._schema_administrative_credentials_read is not None: + _schema.password = cls._schema_administrative_credentials_read.password + _schema.username = cls._schema_administrative_credentials_read.username + return + + cls._schema_administrative_credentials_read = _schema_administrative_credentials_read = AAZObjectType() + + administrative_credentials_read = _schema_administrative_credentials_read + administrative_credentials_read.password = AAZStrType( + flags={"required": True, "secret": True}, + ) + administrative_credentials_read.username = AAZStrType( + flags={"required": True}, + ) + + _schema.password = cls._schema_administrative_credentials_read.password + _schema.username = cls._schema_administrative_credentials_read.username + + _schema_extended_location_read = None + + @classmethod + def _build_schema_extended_location_read(cls, _schema): + if cls._schema_extended_location_read is not None: + _schema.name = cls._schema_extended_location_read.name + _schema.type = cls._schema_extended_location_read.type + return + + cls._schema_extended_location_read = _schema_extended_location_read = AAZObjectType() + + extended_location_read = _schema_extended_location_read + extended_location_read.name = AAZStrType( + flags={"required": True}, + ) + extended_location_read.type = AAZStrType( + flags={"required": True}, + ) + + _schema.name = cls._schema_extended_location_read.name + _schema.type = cls._schema_extended_location_read.type + + _schema_rack_definition_read = None + + @classmethod + def _build_schema_rack_definition_read(cls, _schema): + if cls._schema_rack_definition_read is not None: + _schema.availability_zone = cls._schema_rack_definition_read.availability_zone + _schema.bare_metal_machine_configuration_data = cls._schema_rack_definition_read.bare_metal_machine_configuration_data + _schema.network_rack_id = cls._schema_rack_definition_read.network_rack_id + _schema.rack_location = cls._schema_rack_definition_read.rack_location + _schema.rack_serial_number = cls._schema_rack_definition_read.rack_serial_number + _schema.rack_sku_id = cls._schema_rack_definition_read.rack_sku_id + _schema.storage_appliance_configuration_data = cls._schema_rack_definition_read.storage_appliance_configuration_data + return + + cls._schema_rack_definition_read = _schema_rack_definition_read = AAZObjectType() + + rack_definition_read = _schema_rack_definition_read + rack_definition_read.availability_zone = AAZStrType( + serialized_name="availabilityZone", + ) + rack_definition_read.bare_metal_machine_configuration_data = AAZListType( + serialized_name="bareMetalMachineConfigurationData", + ) + rack_definition_read.network_rack_id = AAZStrType( + serialized_name="networkRackId", + flags={"required": True}, + ) + rack_definition_read.rack_location = AAZStrType( + serialized_name="rackLocation", + ) + rack_definition_read.rack_serial_number = AAZStrType( + serialized_name="rackSerialNumber", + flags={"required": True}, + ) + rack_definition_read.rack_sku_id = AAZStrType( + serialized_name="rackSkuId", + flags={"required": True}, + ) + rack_definition_read.storage_appliance_configuration_data = AAZListType( + serialized_name="storageApplianceConfigurationData", + ) + + bare_metal_machine_configuration_data = _schema_rack_definition_read.bare_metal_machine_configuration_data + bare_metal_machine_configuration_data.Element = AAZObjectType() + + _element = _schema_rack_definition_read.bare_metal_machine_configuration_data.Element + _element.bmc_connection_string = AAZStrType( + serialized_name="bmcConnectionString", + flags={"read_only": True}, + ) + _element.bmc_credentials = AAZObjectType( + serialized_name="bmcCredentials", + flags={"required": True}, + ) + cls._build_schema_administrative_credentials_read(_element.bmc_credentials) + _element.bmc_mac_address = AAZStrType( + serialized_name="bmcMacAddress", + flags={"required": True}, + ) + _element.boot_mac_address = AAZStrType( + serialized_name="bootMacAddress", + flags={"required": True}, + ) + _element.machine_details = AAZStrType( + serialized_name="machineDetails", + ) + _element.machine_name = AAZStrType( + serialized_name="machineName", + ) + _element.rack_slot = AAZIntType( + serialized_name="rackSlot", + flags={"required": True}, + ) + _element.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"required": True}, + ) + + storage_appliance_configuration_data = _schema_rack_definition_read.storage_appliance_configuration_data + storage_appliance_configuration_data.Element = AAZObjectType() + + _element = _schema_rack_definition_read.storage_appliance_configuration_data.Element + _element.admin_credentials = AAZObjectType( + serialized_name="adminCredentials", + flags={"required": True}, + ) + cls._build_schema_administrative_credentials_read(_element.admin_credentials) + _element.rack_slot = AAZIntType( + serialized_name="rackSlot", + flags={"required": True}, + ) + _element.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"required": True}, + ) + _element.storage_appliance_name = AAZStrType( + serialized_name="storageApplianceName", + ) + + _schema.availability_zone = cls._schema_rack_definition_read.availability_zone + _schema.bare_metal_machine_configuration_data = cls._schema_rack_definition_read.bare_metal_machine_configuration_data + _schema.network_rack_id = cls._schema_rack_definition_read.network_rack_id + _schema.rack_location = cls._schema_rack_definition_read.rack_location + _schema.rack_serial_number = cls._schema_rack_definition_read.rack_serial_number + _schema.rack_sku_id = cls._schema_rack_definition_read.rack_sku_id + _schema.storage_appliance_configuration_data = cls._schema_rack_definition_read.storage_appliance_configuration_data + + +__all__ = ["Show"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_update.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_update.py new file mode 100644 index 00000000000..2277ce130bd --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_update.py @@ -0,0 +1,967 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cluster update", + is_experimental=True, +) +class Update(AAZCommand): + """Update the properties of the provided cluster, or update the tags associated with the cluster. Properties and tag updates can be done independently. + + :example: Patch cluster location + az networkcloud cluster update --name "clusterName" --cluster-location "Foo Street, 3rd Floor, row 9" --tags key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" + + :example: Patch cluster aggregatorOrSingleRackDefinition + az networkcloud cluster update --name "clusterName" --aggregator-or-single-rack-definition "{\"networkRackId\":\"/subscriptions/subscriptionId/resourceGroups/rgName/providers/Microsoft.Network/virtualNetworks/cmName/subnets/ClusterManagerSubnet\",\"rackSkuId\":\"/subscriptions/subscriptionId/providers/Microsoft.NetworkCloud/rackSkus/VLab_Single_DellR750_8C2M_x70r3_9\",\"rackSerialNumber\":\"b99m99r1\",\"rackLocation\":\"b99m99r1\",\"availabilityZone\":\"1\",\"storageApplianceConfigurationData\":[{\"rackSlot\":1,\"adminCredentials\":{\"username\":\"admin\",\"password\":\"admin\"},\"storageApplianceName\":\"name\",\"serialNumber\":\"serial\"}],\"bareMetalMachineConfigurationData\":[{\"bmcCredentials\":{\"password\":\"bmcPassword\",\"username\":\"root\"},\"bmcMacAddress\":\"AA:BB:CC:DD:E7:08\",\"bootMacAddress\":\"AA:BB:CC:F8:71:2E\",\"machineName\":\"lab00r750wkr1\",\"rackSlot\":2,\"serialNumber\":\"5HS7PK3\"},{\"bmcCredentials\":{\"password\":\"bmcPassword\",\"username\":\"root\"},\"bmcMacAddress\":\"AA:BB:CC:FD:DC:76\",\"bootMacAddress\":\"AA:BB:CC:F8:50:CA\",\"machineName\":\"lab00r750wkr8\",\"rackSlot\":11,\"serialNumber\":\"9M56PK3\"}]}" --compute-deployment-threshold type="PercentSuccess" grouping="PerCluster" value=90 --tags key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" + + :example: Patch cluster aggregatorOrSingleRackDefinition using json file input + az networkcloud cluster update --name "clusterName" --aggregator-or-single-rack-definition ./aggregator-or-single-rack-definition.json --compute-deployment-threshold type="PercentSuccess" grouping="PerCluster" value=90 --tags key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clusters/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.cluster_name = AAZStrArg( + options=["-n", "--name", "--cluster-name"], + help="The name of the cluster.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "ClusterUpdateParameters" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="ClusterUpdateParameters", + help="The Azure resource tags that will replace the existing ones.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.aggregator_or_single_rack_definition = AAZObjectArg( + options=["--aggregator-or-single-rack-definition"], + arg_group="Properties", + help="The rack definition that is intended to reflect only a single rack in a single rack cluster, or an aggregator rack in a multi-rack cluster.", + ) + cls._build_args_rack_definition_update(_args_schema.aggregator_or_single_rack_definition) + _args_schema.cluster_location = AAZStrArg( + options=["--cluster-location"], + arg_group="Properties", + help="The customer-provided location information to identify where the cluster resides.", + ) + _args_schema.cluster_service_principal = AAZObjectArg( + options=["--cluster-service-principal"], + arg_group="Properties", + help="The service principal to be used by the cluster during Arc Appliance installation.", + ) + _args_schema.compute_deployment_threshold = AAZObjectArg( + options=["--compute-deployment-threshold"], + arg_group="Properties", + help="The validation threshold indicating the allowable failures of compute machines during environment validation and deployment.", + ) + _args_schema.compute_rack_definitions = AAZListArg( + options=["--compute-rack-definitions"], + arg_group="Properties", + help="The list of rack definitions for the compute racks in a multi-rack cluster, or an empty list in a single-rack cluster.", + ) + + cluster_service_principal = cls._args_schema.cluster_service_principal + cluster_service_principal.application_id = AAZStrArg( + options=["application-id"], + help="The application ID, also known as client ID, of the service principal.", + required=True, + ) + cluster_service_principal.password = AAZStrArg( + options=["password"], + help="The password of the service principal.", + required=True, + ) + cluster_service_principal.principal_id = AAZStrArg( + options=["principal-id"], + help="The principal ID, also known as the object ID, of the service principal.", + required=True, + ) + cluster_service_principal.tenant_id = AAZStrArg( + options=["tenant-id"], + help="The tenant ID, also known as the directory ID, of the tenant in which the service principal is created.", + required=True, + ) + + compute_deployment_threshold = cls._args_schema.compute_deployment_threshold + compute_deployment_threshold.grouping = AAZStrArg( + options=["grouping"], + help="Selection of how the type evaluation is applied to the cluster calculation.", + required=True, + enum={"PerCluster": "PerCluster", "PerRack": "PerRack"}, + ) + compute_deployment_threshold.type = AAZStrArg( + options=["type"], + help="Selection of how the threshold should be evaluated.", + required=True, + enum={"CountSuccess": "CountSuccess", "PercentSuccess": "PercentSuccess"}, + ) + compute_deployment_threshold.value = AAZIntArg( + options=["value"], + help="The numeric threshold value.", + required=True, + fmt=AAZIntArgFormat( + minimum=0, + ), + ) + + compute_rack_definitions = cls._args_schema.compute_rack_definitions + compute_rack_definitions.Element = AAZObjectArg() + cls._build_args_rack_definition_update(compute_rack_definitions.Element) + return cls._args_schema + + _args_administrative_credentials_update = None + + @classmethod + def _build_args_administrative_credentials_update(cls, _schema): + if cls._args_administrative_credentials_update is not None: + _schema.password = cls._args_administrative_credentials_update.password + _schema.username = cls._args_administrative_credentials_update.username + return + + cls._args_administrative_credentials_update = AAZObjectArg() + + administrative_credentials_update = cls._args_administrative_credentials_update + administrative_credentials_update.password = AAZStrArg( + options=["password"], + help="The password of the administrator of the device used during initialization.", + required=True, + fmt=AAZStrArgFormat( + min_length=1, + ), + ) + administrative_credentials_update.username = AAZStrArg( + options=["username"], + help="The username of the administrator of the device used during initialization.", + required=True, + fmt=AAZStrArgFormat( + min_length=1, + ), + ) + + _schema.password = cls._args_administrative_credentials_update.password + _schema.username = cls._args_administrative_credentials_update.username + + _args_rack_definition_update = None + + @classmethod + def _build_args_rack_definition_update(cls, _schema): + if cls._args_rack_definition_update is not None: + _schema.availability_zone = cls._args_rack_definition_update.availability_zone + _schema.bare_metal_machine_configuration_data = cls._args_rack_definition_update.bare_metal_machine_configuration_data + _schema.network_rack_id = cls._args_rack_definition_update.network_rack_id + _schema.rack_location = cls._args_rack_definition_update.rack_location + _schema.rack_serial_number = cls._args_rack_definition_update.rack_serial_number + _schema.rack_sku_id = cls._args_rack_definition_update.rack_sku_id + _schema.storage_appliance_configuration_data = cls._args_rack_definition_update.storage_appliance_configuration_data + return + + cls._args_rack_definition_update = AAZObjectArg() + + rack_definition_update = cls._args_rack_definition_update + rack_definition_update.availability_zone = AAZStrArg( + options=["availability-zone"], + help="The zone name used for this rack when created.", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9]{1,10}$", + ), + ) + rack_definition_update.bare_metal_machine_configuration_data = AAZListArg( + options=["bare-metal-machine-configuration-data"], + help="The unordered list of bare metal machine configuration.", + ) + rack_definition_update.network_rack_id = AAZStrArg( + options=["network-rack-id"], + help="The resource ID of the network rack that matches this rack definition.", + required=True, + ) + rack_definition_update.rack_location = AAZStrArg( + options=["rack-location"], + help="The free-form description of the rack's location.", + fmt=AAZStrArgFormat( + max_length=256, + ), + ) + rack_definition_update.rack_serial_number = AAZStrArg( + options=["rack-serial-number"], + help="The unique identifier for the rack within Network Cloud cluster. An alternate unique alphanumeric value other than a serial number may be provided if desired.", + required=True, + fmt=AAZStrArgFormat( + max_length=64, + min_length=1, + ), + ) + rack_definition_update.rack_sku_id = AAZStrArg( + options=["rack-sku-id"], + help="The resource ID of the sku for the rack being added.", + required=True, + ) + rack_definition_update.storage_appliance_configuration_data = AAZListArg( + options=["storage-appliance-configuration-data"], + help="The list of storage appliance configuration data for this rack.", + ) + + bare_metal_machine_configuration_data = cls._args_rack_definition_update.bare_metal_machine_configuration_data + bare_metal_machine_configuration_data.Element = AAZObjectArg() + + _element = cls._args_rack_definition_update.bare_metal_machine_configuration_data.Element + _element.bmc_credentials = AAZObjectArg( + options=["bmc-credentials"], + help="The credentials of the baseboard management controller on this bare metal machine.", + required=True, + ) + cls._build_args_administrative_credentials_update(_element.bmc_credentials) + _element.bmc_mac_address = AAZStrArg( + options=["bmc-mac-address"], + help="The MAC address of the BMC for this machine.", + required=True, + fmt=AAZStrArgFormat( + pattern="^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$", + ), + ) + _element.boot_mac_address = AAZStrArg( + options=["boot-mac-address"], + help="The MAC address associated with the PXE NIC card.", + required=True, + fmt=AAZStrArgFormat( + pattern="^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$", + ), + ) + _element.machine_details = AAZStrArg( + options=["machine-details"], + help="The free-form additional information about the machine, e.g. an asset tag.", + fmt=AAZStrArgFormat( + max_length=256, + ), + ) + _element.machine_name = AAZStrArg( + options=["machine-name"], + help="The user-provided name for the bare metal machine created from this specification. If not provided, the machine name will be generated programmatically.", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + _element.rack_slot = AAZIntArg( + options=["rack-slot"], + help="The slot the physical machine is in the rack based on the BOM configuration.", + required=True, + fmt=AAZIntArgFormat( + maximum=256, + minimum=1, + ), + ) + _element.serial_number = AAZStrArg( + options=["serial-number"], + help="The serial number of the machine. Hardware suppliers may use an alternate value. For example, service tag.", + required=True, + fmt=AAZStrArgFormat( + max_length=64, + ), + ) + + storage_appliance_configuration_data = cls._args_rack_definition_update.storage_appliance_configuration_data + storage_appliance_configuration_data.Element = AAZObjectArg() + + _element = cls._args_rack_definition_update.storage_appliance_configuration_data.Element + _element.admin_credentials = AAZObjectArg( + options=["admin-credentials"], + help="The credentials of the administrative interface on this storage appliance.", + required=True, + ) + cls._build_args_administrative_credentials_update(_element.admin_credentials) + _element.rack_slot = AAZIntArg( + options=["rack-slot"], + help="The slot that storage appliance is in the rack based on the BOM configuration.", + required=True, + fmt=AAZIntArgFormat( + maximum=256, + minimum=1, + ), + ) + _element.serial_number = AAZStrArg( + options=["serial-number"], + help="The serial number of the appliance.", + required=True, + ) + _element.storage_appliance_name = AAZStrArg( + options=["storage-appliance-name"], + help="The user-provided name for the storage appliance that will be created from this specification.", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + + _schema.availability_zone = cls._args_rack_definition_update.availability_zone + _schema.bare_metal_machine_configuration_data = cls._args_rack_definition_update.bare_metal_machine_configuration_data + _schema.network_rack_id = cls._args_rack_definition_update.network_rack_id + _schema.rack_location = cls._args_rack_definition_update.rack_location + _schema.rack_serial_number = cls._args_rack_definition_update.rack_serial_number + _schema.rack_sku_id = cls._args_rack_definition_update.rack_sku_id + _schema.storage_appliance_configuration_data = cls._args_rack_definition_update.storage_appliance_configuration_data + + def _execute_operations(self): + self.pre_operations() + yield self.ClustersUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ClustersUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}", + **self.url_parameters + ) + + @property + def method(self): + return "PATCH" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + _UpdateHelper._build_schema_rack_definition_update(properties.set_prop("aggregatorOrSingleRackDefinition", AAZObjectType, ".aggregator_or_single_rack_definition")) + properties.set_prop("clusterLocation", AAZStrType, ".cluster_location") + properties.set_prop("clusterServicePrincipal", AAZObjectType, ".cluster_service_principal") + properties.set_prop("computeDeploymentThreshold", AAZObjectType, ".compute_deployment_threshold") + properties.set_prop("computeRackDefinitions", AAZListType, ".compute_rack_definitions") + + cluster_service_principal = _builder.get(".properties.clusterServicePrincipal") + if cluster_service_principal is not None: + cluster_service_principal.set_prop("applicationId", AAZStrType, ".application_id", typ_kwargs={"flags": {"required": True}}) + cluster_service_principal.set_prop("password", AAZStrType, ".password", typ_kwargs={"flags": {"required": True, "secret": True}}) + cluster_service_principal.set_prop("principalId", AAZStrType, ".principal_id", typ_kwargs={"flags": {"required": True}}) + cluster_service_principal.set_prop("tenantId", AAZStrType, ".tenant_id", typ_kwargs={"flags": {"required": True}}) + + compute_deployment_threshold = _builder.get(".properties.computeDeploymentThreshold") + if compute_deployment_threshold is not None: + compute_deployment_threshold.set_prop("grouping", AAZStrType, ".grouping", typ_kwargs={"flags": {"required": True}}) + compute_deployment_threshold.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}}) + compute_deployment_threshold.set_prop("value", AAZIntType, ".value", typ_kwargs={"flags": {"required": True}}) + + compute_rack_definitions = _builder.get(".properties.computeRackDefinitions") + if compute_rack_definitions is not None: + _UpdateHelper._build_schema_rack_definition_update(compute_rack_definitions.set_elements(AAZObjectType, ".")) + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _UpdateHelper._build_schema_cluster_read(cls._schema_on_200) + + return cls._schema_on_200 + + +class _UpdateHelper: + """Helper class for Update""" + + @classmethod + def _build_schema_administrative_credentials_update(cls, _builder): + if _builder is None: + return + _builder.set_prop("password", AAZStrType, ".password", typ_kwargs={"flags": {"required": True, "secret": True}}) + _builder.set_prop("username", AAZStrType, ".username", typ_kwargs={"flags": {"required": True}}) + + @classmethod + def _build_schema_rack_definition_update(cls, _builder): + if _builder is None: + return + _builder.set_prop("availabilityZone", AAZStrType, ".availability_zone") + _builder.set_prop("bareMetalMachineConfigurationData", AAZListType, ".bare_metal_machine_configuration_data") + _builder.set_prop("networkRackId", AAZStrType, ".network_rack_id", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("rackLocation", AAZStrType, ".rack_location") + _builder.set_prop("rackSerialNumber", AAZStrType, ".rack_serial_number", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("rackSkuId", AAZStrType, ".rack_sku_id", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("storageApplianceConfigurationData", AAZListType, ".storage_appliance_configuration_data") + + bare_metal_machine_configuration_data = _builder.get(".bareMetalMachineConfigurationData") + if bare_metal_machine_configuration_data is not None: + bare_metal_machine_configuration_data.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".bareMetalMachineConfigurationData[]") + if _elements is not None: + cls._build_schema_administrative_credentials_update(_elements.set_prop("bmcCredentials", AAZObjectType, ".bmc_credentials", typ_kwargs={"flags": {"required": True}})) + _elements.set_prop("bmcMacAddress", AAZStrType, ".bmc_mac_address", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("bootMacAddress", AAZStrType, ".boot_mac_address", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("machineDetails", AAZStrType, ".machine_details") + _elements.set_prop("machineName", AAZStrType, ".machine_name") + _elements.set_prop("rackSlot", AAZIntType, ".rack_slot", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("serialNumber", AAZStrType, ".serial_number", typ_kwargs={"flags": {"required": True}}) + + storage_appliance_configuration_data = _builder.get(".storageApplianceConfigurationData") + if storage_appliance_configuration_data is not None: + storage_appliance_configuration_data.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".storageApplianceConfigurationData[]") + if _elements is not None: + cls._build_schema_administrative_credentials_update(_elements.set_prop("adminCredentials", AAZObjectType, ".admin_credentials", typ_kwargs={"flags": {"required": True}})) + _elements.set_prop("rackSlot", AAZIntType, ".rack_slot", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("serialNumber", AAZStrType, ".serial_number", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("storageApplianceName", AAZStrType, ".storage_appliance_name") + + _schema_administrative_credentials_read = None + + @classmethod + def _build_schema_administrative_credentials_read(cls, _schema): + if cls._schema_administrative_credentials_read is not None: + _schema.password = cls._schema_administrative_credentials_read.password + _schema.username = cls._schema_administrative_credentials_read.username + return + + cls._schema_administrative_credentials_read = _schema_administrative_credentials_read = AAZObjectType() + + administrative_credentials_read = _schema_administrative_credentials_read + administrative_credentials_read.password = AAZStrType( + flags={"required": True, "secret": True}, + ) + administrative_credentials_read.username = AAZStrType( + flags={"required": True}, + ) + + _schema.password = cls._schema_administrative_credentials_read.password + _schema.username = cls._schema_administrative_credentials_read.username + + _schema_cluster_read = None + + @classmethod + def _build_schema_cluster_read(cls, _schema): + if cls._schema_cluster_read is not None: + _schema.extended_location = cls._schema_cluster_read.extended_location + _schema.id = cls._schema_cluster_read.id + _schema.location = cls._schema_cluster_read.location + _schema.name = cls._schema_cluster_read.name + _schema.properties = cls._schema_cluster_read.properties + _schema.system_data = cls._schema_cluster_read.system_data + _schema.tags = cls._schema_cluster_read.tags + _schema.type = cls._schema_cluster_read.type + return + + cls._schema_cluster_read = _schema_cluster_read = AAZObjectType() + + cluster_read = _schema_cluster_read + cluster_read.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + cls._build_schema_extended_location_read(cluster_read.extended_location) + cluster_read.id = AAZStrType( + flags={"read_only": True}, + ) + cluster_read.location = AAZStrType( + flags={"required": True}, + ) + cluster_read.name = AAZStrType( + flags={"read_only": True}, + ) + cluster_read.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + cluster_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + cluster_read.tags = AAZDictType() + cluster_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_cluster_read.properties + properties.aggregator_or_single_rack_definition = AAZObjectType( + serialized_name="aggregatorOrSingleRackDefinition", + flags={"required": True}, + ) + cls._build_schema_rack_definition_read(properties.aggregator_or_single_rack_definition) + properties.analytics_workspace_id = AAZStrType( + serialized_name="analyticsWorkspaceId", + flags={"required": True}, + ) + properties.available_upgrade_versions = AAZListType( + serialized_name="availableUpgradeVersions", + flags={"read_only": True}, + ) + properties.cluster_capacity = AAZObjectType( + serialized_name="clusterCapacity", + ) + properties.cluster_connection_status = AAZStrType( + serialized_name="clusterConnectionStatus", + flags={"read_only": True}, + ) + properties.cluster_extended_location = AAZObjectType( + serialized_name="clusterExtendedLocation", + ) + cls._build_schema_extended_location_read(properties.cluster_extended_location) + properties.cluster_location = AAZStrType( + serialized_name="clusterLocation", + ) + properties.cluster_manager_connection_status = AAZStrType( + serialized_name="clusterManagerConnectionStatus", + flags={"read_only": True}, + ) + properties.cluster_manager_id = AAZStrType( + serialized_name="clusterManagerId", + flags={"read_only": True}, + ) + properties.cluster_service_principal = AAZObjectType( + serialized_name="clusterServicePrincipal", + ) + properties.cluster_type = AAZStrType( + serialized_name="clusterType", + flags={"required": True}, + ) + properties.cluster_version = AAZStrType( + serialized_name="clusterVersion", + flags={"required": True}, + ) + properties.compute_deployment_threshold = AAZObjectType( + serialized_name="computeDeploymentThreshold", + ) + properties.compute_rack_definitions = AAZListType( + serialized_name="computeRackDefinitions", + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hybrid_aks_extended_location = AAZObjectType( + serialized_name="hybridAksExtendedLocation", + ) + cls._build_schema_extended_location_read(properties.hybrid_aks_extended_location) + properties.managed_resource_group_configuration = AAZObjectType( + serialized_name="managedResourceGroupConfiguration", + ) + properties.manual_action_count = AAZIntType( + serialized_name="manualActionCount", + flags={"read_only": True}, + ) + properties.network_fabric_id = AAZStrType( + serialized_name="networkFabricId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.support_expiry_date = AAZStrType( + serialized_name="supportExpiryDate", + flags={"read_only": True}, + ) + properties.workload_resource_ids = AAZListType( + serialized_name="workloadResourceIds", + flags={"read_only": True}, + ) + + available_upgrade_versions = _schema_cluster_read.properties.available_upgrade_versions + available_upgrade_versions.Element = AAZObjectType() + + _element = _schema_cluster_read.properties.available_upgrade_versions.Element + _element.control_impact = AAZStrType( + serialized_name="controlImpact", + flags={"read_only": True}, + ) + _element.expected_duration = AAZStrType( + serialized_name="expectedDuration", + flags={"read_only": True}, + ) + _element.impact_description = AAZStrType( + serialized_name="impactDescription", + flags={"read_only": True}, + ) + _element.support_expiry_date = AAZStrType( + serialized_name="supportExpiryDate", + flags={"read_only": True}, + ) + _element.target_cluster_version = AAZStrType( + serialized_name="targetClusterVersion", + flags={"read_only": True}, + ) + _element.workload_impact = AAZStrType( + serialized_name="workloadImpact", + flags={"read_only": True}, + ) + + cluster_capacity = _schema_cluster_read.properties.cluster_capacity + cluster_capacity.available_appliance_storage_gb = AAZIntType( + serialized_name="availableApplianceStorageGB", + ) + cluster_capacity.available_core_count = AAZIntType( + serialized_name="availableCoreCount", + ) + cluster_capacity.available_host_storage_gb = AAZIntType( + serialized_name="availableHostStorageGB", + ) + cluster_capacity.available_memory_gb = AAZIntType( + serialized_name="availableMemoryGB", + ) + cluster_capacity.total_appliance_storage_gb = AAZIntType( + serialized_name="totalApplianceStorageGB", + ) + cluster_capacity.total_core_count = AAZIntType( + serialized_name="totalCoreCount", + ) + cluster_capacity.total_host_storage_gb = AAZIntType( + serialized_name="totalHostStorageGB", + ) + cluster_capacity.total_memory_gb = AAZIntType( + serialized_name="totalMemoryGB", + ) + + cluster_service_principal = _schema_cluster_read.properties.cluster_service_principal + cluster_service_principal.application_id = AAZStrType( + serialized_name="applicationId", + flags={"required": True}, + ) + cluster_service_principal.password = AAZStrType( + flags={"required": True, "secret": True}, + ) + cluster_service_principal.principal_id = AAZStrType( + serialized_name="principalId", + flags={"required": True}, + ) + cluster_service_principal.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"required": True}, + ) + + compute_deployment_threshold = _schema_cluster_read.properties.compute_deployment_threshold + compute_deployment_threshold.grouping = AAZStrType( + flags={"required": True}, + ) + compute_deployment_threshold.type = AAZStrType( + flags={"required": True}, + ) + compute_deployment_threshold.value = AAZIntType( + flags={"required": True}, + ) + + compute_rack_definitions = _schema_cluster_read.properties.compute_rack_definitions + compute_rack_definitions.Element = AAZObjectType() + cls._build_schema_rack_definition_read(compute_rack_definitions.Element) + + managed_resource_group_configuration = _schema_cluster_read.properties.managed_resource_group_configuration + managed_resource_group_configuration.location = AAZStrType() + managed_resource_group_configuration.name = AAZStrType() + + workload_resource_ids = _schema_cluster_read.properties.workload_resource_ids + workload_resource_ids.Element = AAZStrType() + + system_data = _schema_cluster_read.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = _schema_cluster_read.tags + tags.Element = AAZStrType() + + _schema.extended_location = cls._schema_cluster_read.extended_location + _schema.id = cls._schema_cluster_read.id + _schema.location = cls._schema_cluster_read.location + _schema.name = cls._schema_cluster_read.name + _schema.properties = cls._schema_cluster_read.properties + _schema.system_data = cls._schema_cluster_read.system_data + _schema.tags = cls._schema_cluster_read.tags + _schema.type = cls._schema_cluster_read.type + + _schema_extended_location_read = None + + @classmethod + def _build_schema_extended_location_read(cls, _schema): + if cls._schema_extended_location_read is not None: + _schema.name = cls._schema_extended_location_read.name + _schema.type = cls._schema_extended_location_read.type + return + + cls._schema_extended_location_read = _schema_extended_location_read = AAZObjectType() + + extended_location_read = _schema_extended_location_read + extended_location_read.name = AAZStrType( + flags={"required": True}, + ) + extended_location_read.type = AAZStrType( + flags={"required": True}, + ) + + _schema.name = cls._schema_extended_location_read.name + _schema.type = cls._schema_extended_location_read.type + + _schema_rack_definition_read = None + + @classmethod + def _build_schema_rack_definition_read(cls, _schema): + if cls._schema_rack_definition_read is not None: + _schema.availability_zone = cls._schema_rack_definition_read.availability_zone + _schema.bare_metal_machine_configuration_data = cls._schema_rack_definition_read.bare_metal_machine_configuration_data + _schema.network_rack_id = cls._schema_rack_definition_read.network_rack_id + _schema.rack_location = cls._schema_rack_definition_read.rack_location + _schema.rack_serial_number = cls._schema_rack_definition_read.rack_serial_number + _schema.rack_sku_id = cls._schema_rack_definition_read.rack_sku_id + _schema.storage_appliance_configuration_data = cls._schema_rack_definition_read.storage_appliance_configuration_data + return + + cls._schema_rack_definition_read = _schema_rack_definition_read = AAZObjectType() + + rack_definition_read = _schema_rack_definition_read + rack_definition_read.availability_zone = AAZStrType( + serialized_name="availabilityZone", + ) + rack_definition_read.bare_metal_machine_configuration_data = AAZListType( + serialized_name="bareMetalMachineConfigurationData", + ) + rack_definition_read.network_rack_id = AAZStrType( + serialized_name="networkRackId", + flags={"required": True}, + ) + rack_definition_read.rack_location = AAZStrType( + serialized_name="rackLocation", + ) + rack_definition_read.rack_serial_number = AAZStrType( + serialized_name="rackSerialNumber", + flags={"required": True}, + ) + rack_definition_read.rack_sku_id = AAZStrType( + serialized_name="rackSkuId", + flags={"required": True}, + ) + rack_definition_read.storage_appliance_configuration_data = AAZListType( + serialized_name="storageApplianceConfigurationData", + ) + + bare_metal_machine_configuration_data = _schema_rack_definition_read.bare_metal_machine_configuration_data + bare_metal_machine_configuration_data.Element = AAZObjectType() + + _element = _schema_rack_definition_read.bare_metal_machine_configuration_data.Element + _element.bmc_connection_string = AAZStrType( + serialized_name="bmcConnectionString", + flags={"read_only": True}, + ) + _element.bmc_credentials = AAZObjectType( + serialized_name="bmcCredentials", + flags={"required": True}, + ) + cls._build_schema_administrative_credentials_read(_element.bmc_credentials) + _element.bmc_mac_address = AAZStrType( + serialized_name="bmcMacAddress", + flags={"required": True}, + ) + _element.boot_mac_address = AAZStrType( + serialized_name="bootMacAddress", + flags={"required": True}, + ) + _element.machine_details = AAZStrType( + serialized_name="machineDetails", + ) + _element.machine_name = AAZStrType( + serialized_name="machineName", + ) + _element.rack_slot = AAZIntType( + serialized_name="rackSlot", + flags={"required": True}, + ) + _element.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"required": True}, + ) + + storage_appliance_configuration_data = _schema_rack_definition_read.storage_appliance_configuration_data + storage_appliance_configuration_data.Element = AAZObjectType() + + _element = _schema_rack_definition_read.storage_appliance_configuration_data.Element + _element.admin_credentials = AAZObjectType( + serialized_name="adminCredentials", + flags={"required": True}, + ) + cls._build_schema_administrative_credentials_read(_element.admin_credentials) + _element.rack_slot = AAZIntType( + serialized_name="rackSlot", + flags={"required": True}, + ) + _element.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"required": True}, + ) + _element.storage_appliance_name = AAZStrType( + serialized_name="storageApplianceName", + ) + + _schema.availability_zone = cls._schema_rack_definition_read.availability_zone + _schema.bare_metal_machine_configuration_data = cls._schema_rack_definition_read.bare_metal_machine_configuration_data + _schema.network_rack_id = cls._schema_rack_definition_read.network_rack_id + _schema.rack_location = cls._schema_rack_definition_read.rack_location + _schema.rack_serial_number = cls._schema_rack_definition_read.rack_serial_number + _schema.rack_sku_id = cls._schema_rack_definition_read.rack_sku_id + _schema.storage_appliance_configuration_data = cls._schema_rack_definition_read.storage_appliance_configuration_data + + +__all__ = ["Update"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_update_version.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_update_version.py new file mode 100644 index 00000000000..1b66a4a2b24 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_update_version.py @@ -0,0 +1,325 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cluster update-version", + is_experimental=True, +) +class UpdateVersion(AAZCommand): + """Update the version of the provided cluster to one of the available supported versions. + + :example: Update cluster version + az networkcloud cluster update-version --cluster-name "clusterName" --target-cluster-version "2.0" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clusters/{}/updateversion", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.cluster_name = AAZStrArg( + options=["-n", "--name", "--cluster-name"], + help="The name of the cluster.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "ClusterUpdateVersionParameters" + + _args_schema = cls._args_schema + _args_schema.target_cluster_version = AAZStrArg( + options=["--target-cluster-version"], + arg_group="ClusterUpdateVersionParameters", + help="The version to be applied to the cluster during update.", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.ClustersUpdateVersion(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ClustersUpdateVersion(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/updateVersion", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("targetClusterVersion", AAZStrType, ".target_cluster_version", typ_kwargs={"flags": {"required": True}}) + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _UpdateVersionHelper._build_schema_operation_status_result_read(cls._schema_on_200) + + return cls._schema_on_200 + + def on_204(self, session): + pass + + +class _UpdateVersionHelper: + """Helper class for UpdateVersion""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType() + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + _schema_operation_status_result_read = None + + @classmethod + def _build_schema_operation_status_result_read(cls, _schema): + if cls._schema_operation_status_result_read is not None: + _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.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 + return + + cls._schema_operation_status_result_read = _schema_operation_status_result_read = AAZObjectType() + + operation_status_result_read = _schema_operation_status_result_read + operation_status_result_read.end_time = AAZStrType( + serialized_name="endTime", + ) + 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.percent_complete = AAZFloatType( + serialized_name="percentComplete", + ) + operation_status_result_read.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"read_only": True}, + ) + operation_status_result_read.start_time = AAZStrType( + serialized_name="startTime", + ) + operation_status_result_read.status = AAZStrType( + flags={"required": True}, + ) + + operations = _schema_operation_status_result_read.operations + operations.Element = AAZObjectType() + cls._build_schema_operation_status_result_read(operations.Element) + + _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.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 + + +__all__ = ["UpdateVersion"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_wait.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_wait.py new file mode 100644 index 00000000000..295f82a525e --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/_wait.py @@ -0,0 +1,545 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cluster wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clusters/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.cluster_name = AAZStrArg( + options=["-n", "--name", "--cluster-name"], + help="The name of the cluster.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ClustersGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) + return result + + class ClustersGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _WaitHelper._build_schema_extended_location_read(_schema_on_200.extended_location) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.aggregator_or_single_rack_definition = AAZObjectType( + serialized_name="aggregatorOrSingleRackDefinition", + flags={"required": True}, + ) + _WaitHelper._build_schema_rack_definition_read(properties.aggregator_or_single_rack_definition) + properties.analytics_workspace_id = AAZStrType( + serialized_name="analyticsWorkspaceId", + flags={"required": True}, + ) + properties.available_upgrade_versions = AAZListType( + serialized_name="availableUpgradeVersions", + flags={"read_only": True}, + ) + properties.cluster_capacity = AAZObjectType( + serialized_name="clusterCapacity", + ) + properties.cluster_connection_status = AAZStrType( + serialized_name="clusterConnectionStatus", + flags={"read_only": True}, + ) + properties.cluster_extended_location = AAZObjectType( + serialized_name="clusterExtendedLocation", + ) + _WaitHelper._build_schema_extended_location_read(properties.cluster_extended_location) + properties.cluster_location = AAZStrType( + serialized_name="clusterLocation", + ) + properties.cluster_manager_connection_status = AAZStrType( + serialized_name="clusterManagerConnectionStatus", + flags={"read_only": True}, + ) + properties.cluster_manager_id = AAZStrType( + serialized_name="clusterManagerId", + flags={"read_only": True}, + ) + properties.cluster_service_principal = AAZObjectType( + serialized_name="clusterServicePrincipal", + ) + properties.cluster_type = AAZStrType( + serialized_name="clusterType", + flags={"required": True}, + ) + properties.cluster_version = AAZStrType( + serialized_name="clusterVersion", + flags={"required": True}, + ) + properties.compute_deployment_threshold = AAZObjectType( + serialized_name="computeDeploymentThreshold", + ) + properties.compute_rack_definitions = AAZListType( + serialized_name="computeRackDefinitions", + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hybrid_aks_extended_location = AAZObjectType( + serialized_name="hybridAksExtendedLocation", + ) + _WaitHelper._build_schema_extended_location_read(properties.hybrid_aks_extended_location) + properties.managed_resource_group_configuration = AAZObjectType( + serialized_name="managedResourceGroupConfiguration", + ) + properties.manual_action_count = AAZIntType( + serialized_name="manualActionCount", + flags={"read_only": True}, + ) + properties.network_fabric_id = AAZStrType( + serialized_name="networkFabricId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.support_expiry_date = AAZStrType( + serialized_name="supportExpiryDate", + flags={"read_only": True}, + ) + properties.workload_resource_ids = AAZListType( + serialized_name="workloadResourceIds", + flags={"read_only": True}, + ) + + available_upgrade_versions = cls._schema_on_200.properties.available_upgrade_versions + available_upgrade_versions.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.available_upgrade_versions.Element + _element.control_impact = AAZStrType( + serialized_name="controlImpact", + flags={"read_only": True}, + ) + _element.expected_duration = AAZStrType( + serialized_name="expectedDuration", + flags={"read_only": True}, + ) + _element.impact_description = AAZStrType( + serialized_name="impactDescription", + flags={"read_only": True}, + ) + _element.support_expiry_date = AAZStrType( + serialized_name="supportExpiryDate", + flags={"read_only": True}, + ) + _element.target_cluster_version = AAZStrType( + serialized_name="targetClusterVersion", + flags={"read_only": True}, + ) + _element.workload_impact = AAZStrType( + serialized_name="workloadImpact", + flags={"read_only": True}, + ) + + cluster_capacity = cls._schema_on_200.properties.cluster_capacity + cluster_capacity.available_appliance_storage_gb = AAZIntType( + serialized_name="availableApplianceStorageGB", + ) + cluster_capacity.available_core_count = AAZIntType( + serialized_name="availableCoreCount", + ) + cluster_capacity.available_host_storage_gb = AAZIntType( + serialized_name="availableHostStorageGB", + ) + cluster_capacity.available_memory_gb = AAZIntType( + serialized_name="availableMemoryGB", + ) + cluster_capacity.total_appliance_storage_gb = AAZIntType( + serialized_name="totalApplianceStorageGB", + ) + cluster_capacity.total_core_count = AAZIntType( + serialized_name="totalCoreCount", + ) + cluster_capacity.total_host_storage_gb = AAZIntType( + serialized_name="totalHostStorageGB", + ) + cluster_capacity.total_memory_gb = AAZIntType( + serialized_name="totalMemoryGB", + ) + + cluster_service_principal = cls._schema_on_200.properties.cluster_service_principal + cluster_service_principal.application_id = AAZStrType( + serialized_name="applicationId", + flags={"required": True}, + ) + cluster_service_principal.password = AAZStrType( + flags={"required": True, "secret": True}, + ) + cluster_service_principal.principal_id = AAZStrType( + serialized_name="principalId", + flags={"required": True}, + ) + cluster_service_principal.tenant_id = AAZStrType( + serialized_name="tenantId", + flags={"required": True}, + ) + + compute_deployment_threshold = cls._schema_on_200.properties.compute_deployment_threshold + compute_deployment_threshold.grouping = AAZStrType( + flags={"required": True}, + ) + compute_deployment_threshold.type = AAZStrType( + flags={"required": True}, + ) + compute_deployment_threshold.value = AAZIntType( + flags={"required": True}, + ) + + compute_rack_definitions = cls._schema_on_200.properties.compute_rack_definitions + compute_rack_definitions.Element = AAZObjectType() + _WaitHelper._build_schema_rack_definition_read(compute_rack_definitions.Element) + + managed_resource_group_configuration = cls._schema_on_200.properties.managed_resource_group_configuration + managed_resource_group_configuration.location = AAZStrType() + managed_resource_group_configuration.name = AAZStrType() + + workload_resource_ids = cls._schema_on_200.properties.workload_resource_ids + workload_resource_ids.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + _schema_administrative_credentials_read = None + + @classmethod + def _build_schema_administrative_credentials_read(cls, _schema): + if cls._schema_administrative_credentials_read is not None: + _schema.password = cls._schema_administrative_credentials_read.password + _schema.username = cls._schema_administrative_credentials_read.username + return + + cls._schema_administrative_credentials_read = _schema_administrative_credentials_read = AAZObjectType() + + administrative_credentials_read = _schema_administrative_credentials_read + administrative_credentials_read.password = AAZStrType( + flags={"required": True, "secret": True}, + ) + administrative_credentials_read.username = AAZStrType( + flags={"required": True}, + ) + + _schema.password = cls._schema_administrative_credentials_read.password + _schema.username = cls._schema_administrative_credentials_read.username + + _schema_extended_location_read = None + + @classmethod + def _build_schema_extended_location_read(cls, _schema): + if cls._schema_extended_location_read is not None: + _schema.name = cls._schema_extended_location_read.name + _schema.type = cls._schema_extended_location_read.type + return + + cls._schema_extended_location_read = _schema_extended_location_read = AAZObjectType() + + extended_location_read = _schema_extended_location_read + extended_location_read.name = AAZStrType( + flags={"required": True}, + ) + extended_location_read.type = AAZStrType( + flags={"required": True}, + ) + + _schema.name = cls._schema_extended_location_read.name + _schema.type = cls._schema_extended_location_read.type + + _schema_rack_definition_read = None + + @classmethod + def _build_schema_rack_definition_read(cls, _schema): + if cls._schema_rack_definition_read is not None: + _schema.availability_zone = cls._schema_rack_definition_read.availability_zone + _schema.bare_metal_machine_configuration_data = cls._schema_rack_definition_read.bare_metal_machine_configuration_data + _schema.network_rack_id = cls._schema_rack_definition_read.network_rack_id + _schema.rack_location = cls._schema_rack_definition_read.rack_location + _schema.rack_serial_number = cls._schema_rack_definition_read.rack_serial_number + _schema.rack_sku_id = cls._schema_rack_definition_read.rack_sku_id + _schema.storage_appliance_configuration_data = cls._schema_rack_definition_read.storage_appliance_configuration_data + return + + cls._schema_rack_definition_read = _schema_rack_definition_read = AAZObjectType() + + rack_definition_read = _schema_rack_definition_read + rack_definition_read.availability_zone = AAZStrType( + serialized_name="availabilityZone", + ) + rack_definition_read.bare_metal_machine_configuration_data = AAZListType( + serialized_name="bareMetalMachineConfigurationData", + ) + rack_definition_read.network_rack_id = AAZStrType( + serialized_name="networkRackId", + flags={"required": True}, + ) + rack_definition_read.rack_location = AAZStrType( + serialized_name="rackLocation", + ) + rack_definition_read.rack_serial_number = AAZStrType( + serialized_name="rackSerialNumber", + flags={"required": True}, + ) + rack_definition_read.rack_sku_id = AAZStrType( + serialized_name="rackSkuId", + flags={"required": True}, + ) + rack_definition_read.storage_appliance_configuration_data = AAZListType( + serialized_name="storageApplianceConfigurationData", + ) + + bare_metal_machine_configuration_data = _schema_rack_definition_read.bare_metal_machine_configuration_data + bare_metal_machine_configuration_data.Element = AAZObjectType() + + _element = _schema_rack_definition_read.bare_metal_machine_configuration_data.Element + _element.bmc_connection_string = AAZStrType( + serialized_name="bmcConnectionString", + flags={"read_only": True}, + ) + _element.bmc_credentials = AAZObjectType( + serialized_name="bmcCredentials", + flags={"required": True}, + ) + cls._build_schema_administrative_credentials_read(_element.bmc_credentials) + _element.bmc_mac_address = AAZStrType( + serialized_name="bmcMacAddress", + flags={"required": True}, + ) + _element.boot_mac_address = AAZStrType( + serialized_name="bootMacAddress", + flags={"required": True}, + ) + _element.machine_details = AAZStrType( + serialized_name="machineDetails", + ) + _element.machine_name = AAZStrType( + serialized_name="machineName", + ) + _element.rack_slot = AAZIntType( + serialized_name="rackSlot", + flags={"required": True}, + ) + _element.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"required": True}, + ) + + storage_appliance_configuration_data = _schema_rack_definition_read.storage_appliance_configuration_data + storage_appliance_configuration_data.Element = AAZObjectType() + + _element = _schema_rack_definition_read.storage_appliance_configuration_data.Element + _element.admin_credentials = AAZObjectType( + serialized_name="adminCredentials", + flags={"required": True}, + ) + cls._build_schema_administrative_credentials_read(_element.admin_credentials) + _element.rack_slot = AAZIntType( + serialized_name="rackSlot", + flags={"required": True}, + ) + _element.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"required": True}, + ) + _element.storage_appliance_name = AAZStrType( + serialized_name="storageApplianceName", + ) + + _schema.availability_zone = cls._schema_rack_definition_read.availability_zone + _schema.bare_metal_machine_configuration_data = cls._schema_rack_definition_read.bare_metal_machine_configuration_data + _schema.network_rack_id = cls._schema_rack_definition_read.network_rack_id + _schema.rack_location = cls._schema_rack_definition_read.rack_location + _schema.rack_serial_number = cls._schema_rack_definition_read.rack_serial_number + _schema.rack_sku_id = cls._schema_rack_definition_read.rack_sku_id + _schema.storage_appliance_configuration_data = cls._schema_rack_definition_read.storage_appliance_configuration_data + + +__all__ = ["Wait"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/__cmd_group.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/__cmd_group.py new file mode 100644 index 00000000000..b3a32404039 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/__cmd_group.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "networkcloud cluster baremetalmachinekeyset", + is_experimental=True, +) +class __CMDGroup(AAZCommandGroup): + """Manage cluster's bare metal machine key set + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/__init__.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/__init__.py new file mode 100644 index 00000000000..db73033039b --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/__init__.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._list import * +from ._show import * +from ._update import * +from ._wait import * diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/_create.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/_create.py new file mode 100644 index 00000000000..8cf4246ee24 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/_create.py @@ -0,0 +1,504 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cluster baremetalmachinekeyset create", + is_experimental=True, +) +class Create(AAZCommand): + """Create a new bare metal machine key set or update the existing one for the provided cluster. + + :example: Create or update bare metal machine key set of cluster + az networkcloud cluster baremetalmachinekeyset create --name "bareMetalMachineKeySetName" --extended-location name="/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterExtendedLocationName" type="CustomLocation" --location "location" --azure-group-id "f110271b-XXXX-4163-9b99-214d91660f0e" --expiration "2022-12-31T23:59:59.008Z" --jump-hosts-allowed "192.0.2.1" "192.0.2.5" --os-group-name "standardAccessGroup" --privilege-level "Standard" --user-list '[{"description":"UserDesc","azureUserName":"userABC","sshPublicKey":{"keyData":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDWtG2RiEGfXs+RK19UmovAJiIVUbT6YaYc/t5SjWU=admin@vm"}}]' --tags key1="myvalue1" key2="myvalue2" --cluster-name "clusterName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clusters/{}/baremetalmachinekeysets/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.bare_metal_machine_key_set_name = AAZStrArg( + options=["-n", "--name", "--bare-metal-machine-key-set-name"], + help="The name of the bare metal machine key set.", + required=True, + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the cluster.", + required=True, + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "BareMetalMachineKeySetParameters" + + _args_schema = cls._args_schema + _args_schema.extended_location = AAZObjectArg( + options=["--extended-location"], + arg_group="BareMetalMachineKeySetParameters", + help="The extended location of the cluster associated with the resource.", + required=True, + ) + _args_schema.location = AAZResourceLocationArg( + arg_group="BareMetalMachineKeySetParameters", + help="The geo-location where the resource lives", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="BareMetalMachineKeySetParameters", + help="Resource tags.", + ) + + extended_location = cls._args_schema.extended_location + extended_location.name = AAZStrArg( + options=["name"], + help="The resource ID of the extended location on which the resource will be created.", + required=True, + ) + extended_location.type = AAZStrArg( + options=["type"], + help="The extended location type, for example, CustomLocation.", + required=True, + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.azure_group_id = AAZStrArg( + options=["--azure-group-id"], + arg_group="Properties", + help="The object ID of Azure Active Directory group that all users in the list must be in for access to be granted. Users that are not in the group will not have access.", + required=True, + ) + _args_schema.expiration = AAZDateTimeArg( + options=["--expiration"], + arg_group="Properties", + help="The date and time after which the users in this key set will be removed from the bare metal machines.", + required=True, + ) + _args_schema.jump_hosts_allowed = AAZListArg( + options=["--jump-hosts-allowed"], + arg_group="Properties", + help="The list of IP addresses of jump hosts with management network access from which a login will be allowed for the users.", + required=True, + ) + _args_schema.os_group_name = AAZStrArg( + options=["--os-group-name"], + arg_group="Properties", + help="The name of the group that users will be assigned to on the operating system of the machines.", + fmt=AAZStrArgFormat( + pattern="^([A-Za-z]([A-Za-z0-9]*))$", + max_length=32, + ), + ) + _args_schema.privilege_level = AAZStrArg( + options=["--privilege-level"], + arg_group="Properties", + help="The access level allowed for the users in this key set.", + required=True, + enum={"Standard": "Standard", "Superuser": "Superuser"}, + ) + _args_schema.user_list = AAZListArg( + options=["--user-list"], + arg_group="Properties", + help="The unique list of permitted users.", + required=True, + ) + + jump_hosts_allowed = cls._args_schema.jump_hosts_allowed + jump_hosts_allowed.Element = AAZStrArg() + + user_list = cls._args_schema.user_list + user_list.Element = AAZObjectArg() + + _element = cls._args_schema.user_list.Element + _element.azure_user_name = AAZStrArg( + options=["azure-user-name"], + help="The Azure Active Directory user name (email name).", + required=True, + ) + _element.description = AAZStrArg( + options=["description"], + help="The free-form description for this user.", + fmt=AAZStrArgFormat( + max_length=256, + ), + ) + _element.ssh_public_key = AAZObjectArg( + options=["ssh-public-key"], + help="The SSH public key for this user.", + required=True, + ) + + ssh_public_key = cls._args_schema.user_list.Element.ssh_public_key + ssh_public_key.key_data = AAZStrArg( + options=["key-data"], + help="The public ssh key of the user.", + required=True, + fmt=AAZStrArgFormat( + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.BareMetalMachineKeySetsCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class BareMetalMachineKeySetsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bareMetalMachineKeySets/{bareMetalMachineKeySetName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "bareMetalMachineKeySetName", self.ctx.args.bare_metal_machine_key_set_name, + required=True, + ), + **self.serialize_url_param( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("extendedLocation", AAZObjectType, ".extended_location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True, "client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + extended_location = _builder.get(".extendedLocation") + if extended_location is not None: + extended_location.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}}) + extended_location.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("azureGroupId", AAZStrType, ".azure_group_id", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("expiration", AAZStrType, ".expiration", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("jumpHostsAllowed", AAZListType, ".jump_hosts_allowed", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("osGroupName", AAZStrType, ".os_group_name") + properties.set_prop("privilegeLevel", AAZStrType, ".privilege_level", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("userList", AAZListType, ".user_list", typ_kwargs={"flags": {"required": True}}) + + jump_hosts_allowed = _builder.get(".properties.jumpHostsAllowed") + if jump_hosts_allowed is not None: + jump_hosts_allowed.set_elements(AAZStrType, ".") + + user_list = _builder.get(".properties.userList") + if user_list is not None: + user_list.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.userList[]") + if _elements is not None: + _elements.set_prop("azureUserName", AAZStrType, ".azure_user_name", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("description", AAZStrType, ".description") + _elements.set_prop("sshPublicKey", AAZObjectType, ".ssh_public_key", typ_kwargs={"flags": {"required": True}}) + + ssh_public_key = _builder.get(".properties.userList[].sshPublicKey") + if ssh_public_key is not None: + ssh_public_key.set_prop("keyData", AAZStrType, ".key_data", typ_kwargs={"flags": {"required": True}}) + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + 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_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200_201.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.azure_group_id = AAZStrType( + serialized_name="azureGroupId", + flags={"required": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.expiration = AAZStrType( + flags={"required": True}, + ) + properties.jump_hosts_allowed = AAZListType( + serialized_name="jumpHostsAllowed", + flags={"required": True}, + ) + properties.last_validation = AAZStrType( + serialized_name="lastValidation", + flags={"read_only": True}, + ) + properties.os_group_name = AAZStrType( + serialized_name="osGroupName", + ) + properties.privilege_level = AAZStrType( + serialized_name="privilegeLevel", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.user_list = AAZListType( + serialized_name="userList", + flags={"required": True}, + ) + properties.user_list_status = AAZListType( + serialized_name="userListStatus", + flags={"read_only": True}, + ) + + jump_hosts_allowed = cls._schema_on_200_201.properties.jump_hosts_allowed + jump_hosts_allowed.Element = AAZStrType() + + user_list = cls._schema_on_200_201.properties.user_list + user_list.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.user_list.Element + _element.azure_user_name = AAZStrType( + serialized_name="azureUserName", + flags={"required": True}, + ) + _element.description = AAZStrType() + _element.ssh_public_key = AAZObjectType( + serialized_name="sshPublicKey", + flags={"required": True}, + ) + + ssh_public_key = cls._schema_on_200_201.properties.user_list.Element.ssh_public_key + ssh_public_key.key_data = AAZStrType( + serialized_name="keyData", + flags={"required": True}, + ) + + user_list_status = cls._schema_on_200_201.properties.user_list_status + user_list_status.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.user_list_status.Element + _element.azure_user_name = AAZStrType( + serialized_name="azureUserName", + flags={"read_only": True}, + ) + _element.status = AAZStrType( + flags={"read_only": True}, + ) + _element.status_message = AAZStrType( + serialized_name="statusMessage", + flags={"read_only": True}, + ) + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/_delete.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/_delete.py new file mode 100644 index 00000000000..769e0473b81 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/_delete.py @@ -0,0 +1,180 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cluster baremetalmachinekeyset delete", + is_experimental=True, + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete the bare metal machine key set of the provided cluster. + + :example: Delete bare metal machine key set of cluster + az networkcloud cluster baremetalmachinekeyset delete --name "bareMetalMachineKeySetName" --cluster-name "clusterName" --resource-group "resourceGroupName + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clusters/{}/baremetalmachinekeysets/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.bare_metal_machine_key_set_name = AAZStrArg( + options=["-n", "--name", "--bare-metal-machine-key-set-name"], + help="The name of the bare metal machine key set.", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the cluster.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.BareMetalMachineKeySetsDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class BareMetalMachineKeySetsDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bareMetalMachineKeySets/{bareMetalMachineKeySetName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "bareMetalMachineKeySetName", self.ctx.args.bare_metal_machine_key_set_name, + required=True, + ), + **self.serialize_url_param( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/_list.py new file mode 100644 index 00000000000..ede817b761b --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/_list.py @@ -0,0 +1,314 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cluster baremetalmachinekeyset list", + is_experimental=True, +) +class List(AAZCommand): + """List bare metal machine key sets of the cluster. + + :example: List bare metal machine key sets of the cluster + az networkcloud cluster baremetalmachinekeyset list --cluster-name "clusterName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clusters/{}/baremetalmachinekeysets", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the cluster.", + required=True, + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.BareMetalMachineKeySetsListByResourceGroup(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class BareMetalMachineKeySetsListByResourceGroup(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bareMetalMachineKeySets", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.value.Element.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.azure_group_id = AAZStrType( + serialized_name="azureGroupId", + flags={"required": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.expiration = AAZStrType( + flags={"required": True}, + ) + properties.jump_hosts_allowed = AAZListType( + serialized_name="jumpHostsAllowed", + flags={"required": True}, + ) + properties.last_validation = AAZStrType( + serialized_name="lastValidation", + flags={"read_only": True}, + ) + properties.os_group_name = AAZStrType( + serialized_name="osGroupName", + ) + properties.privilege_level = AAZStrType( + serialized_name="privilegeLevel", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.user_list = AAZListType( + serialized_name="userList", + flags={"required": True}, + ) + properties.user_list_status = AAZListType( + serialized_name="userListStatus", + flags={"read_only": True}, + ) + + jump_hosts_allowed = cls._schema_on_200.value.Element.properties.jump_hosts_allowed + jump_hosts_allowed.Element = AAZStrType() + + user_list = cls._schema_on_200.value.Element.properties.user_list + user_list.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.user_list.Element + _element.azure_user_name = AAZStrType( + serialized_name="azureUserName", + flags={"required": True}, + ) + _element.description = AAZStrType() + _element.ssh_public_key = AAZObjectType( + serialized_name="sshPublicKey", + flags={"required": True}, + ) + + ssh_public_key = cls._schema_on_200.value.Element.properties.user_list.Element.ssh_public_key + ssh_public_key.key_data = AAZStrType( + serialized_name="keyData", + flags={"required": True}, + ) + + user_list_status = cls._schema_on_200.value.Element.properties.user_list_status + user_list_status.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.user_list_status.Element + _element.azure_user_name = AAZStrType( + serialized_name="azureUserName", + flags={"read_only": True}, + ) + _element.status = AAZStrType( + flags={"read_only": True}, + ) + _element.status_message = AAZStrType( + serialized_name="statusMessage", + flags={"read_only": True}, + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/_show.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/_show.py new file mode 100644 index 00000000000..980114833fe --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/_show.py @@ -0,0 +1,319 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cluster baremetalmachinekeyset show", + is_experimental=True, +) +class Show(AAZCommand): + """Get bare metal machine key set of the provided cluster. + + :example: Get bare metal machine key set of cluster + az networkcloud cluster baremetalmachinekeyset show --name "bareMetalMachineKeySetName" --cluster-name "clusterName" --resource-group "resourceGroupName + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clusters/{}/baremetalmachinekeysets/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.bare_metal_machine_key_set_name = AAZStrArg( + options=["-n", "--name", "--bare-metal-machine-key-set-name"], + help="The name of the bare metal machine key set.", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the cluster.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.BareMetalMachineKeySetsGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class BareMetalMachineKeySetsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bareMetalMachineKeySets/{bareMetalMachineKeySetName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "bareMetalMachineKeySetName", self.ctx.args.bare_metal_machine_key_set_name, + required=True, + ), + **self.serialize_url_param( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.azure_group_id = AAZStrType( + serialized_name="azureGroupId", + flags={"required": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.expiration = AAZStrType( + flags={"required": True}, + ) + properties.jump_hosts_allowed = AAZListType( + serialized_name="jumpHostsAllowed", + flags={"required": True}, + ) + properties.last_validation = AAZStrType( + serialized_name="lastValidation", + flags={"read_only": True}, + ) + properties.os_group_name = AAZStrType( + serialized_name="osGroupName", + ) + properties.privilege_level = AAZStrType( + serialized_name="privilegeLevel", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.user_list = AAZListType( + serialized_name="userList", + flags={"required": True}, + ) + properties.user_list_status = AAZListType( + serialized_name="userListStatus", + flags={"read_only": True}, + ) + + jump_hosts_allowed = cls._schema_on_200.properties.jump_hosts_allowed + jump_hosts_allowed.Element = AAZStrType() + + user_list = cls._schema_on_200.properties.user_list + user_list.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.user_list.Element + _element.azure_user_name = AAZStrType( + serialized_name="azureUserName", + flags={"required": True}, + ) + _element.description = AAZStrType() + _element.ssh_public_key = AAZObjectType( + serialized_name="sshPublicKey", + flags={"required": True}, + ) + + ssh_public_key = cls._schema_on_200.properties.user_list.Element.ssh_public_key + ssh_public_key.key_data = AAZStrType( + serialized_name="keyData", + flags={"required": True}, + ) + + user_list_status = cls._schema_on_200.properties.user_list_status + user_list_status.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.user_list_status.Element + _element.azure_user_name = AAZStrType( + serialized_name="azureUserName", + flags={"read_only": True}, + ) + _element.status = AAZStrType( + flags={"read_only": True}, + ) + _element.status_message = AAZStrType( + serialized_name="statusMessage", + flags={"read_only": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/_update.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/_update.py new file mode 100644 index 00000000000..6f64927b31a --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/_update.py @@ -0,0 +1,472 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cluster baremetalmachinekeyset update", + is_experimental=True, +) +class Update(AAZCommand): + """Update properties of bare metal machine key set for the provided cluster, or update the tags associated with it. Properties and tag updates can be done independently. + + :example: Patch bare metal machine key set of cluster + az networkcloud cluster baremetalmachinekeyset update --name "bareMetalMachineKeySetName" --expiration "2022-12-31T23:59:59.008Z" --jump-hosts-allowed "192.0.2.1" "192.0.2.5"--user-list '[{"description":"UserDesc","azureUserName":"userABC","sshPublicKey":{"keyData":"ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+/ojNZfpB3af/YDzwQCZzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm"}}]' --tags key1="myvalue1" key2="myvalue2" --cluster-name "clusterName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clusters/{}/baremetalmachinekeysets/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.bare_metal_machine_key_set_name = AAZStrArg( + options=["-n", "--name", "--bare-metal-machine-key-set-name"], + help="The name of the bare metal machine key set.", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the cluster.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "BareMetalMachineKeySetUpdateParameters" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="BareMetalMachineKeySetUpdateParameters", + help="The Azure resource tags that will replace the existing ones.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.expiration = AAZDateTimeArg( + options=["--expiration"], + arg_group="Properties", + help="The date and time after which the users in this key set will be removed from the bare metal machines.", + ) + _args_schema.jump_hosts_allowed = AAZListArg( + options=["--jump-hosts-allowed"], + arg_group="Properties", + help="The list of IP addresses of jump hosts with management network access from which a login will be allowed for the users.", + ) + _args_schema.user_list = AAZListArg( + options=["--user-list"], + arg_group="Properties", + help="The unique list of permitted users.", + ) + + jump_hosts_allowed = cls._args_schema.jump_hosts_allowed + jump_hosts_allowed.Element = AAZStrArg() + + user_list = cls._args_schema.user_list + user_list.Element = AAZObjectArg() + + _element = cls._args_schema.user_list.Element + _element.azure_user_name = AAZStrArg( + options=["azure-user-name"], + help="The Azure Active Directory user name (email name).", + required=True, + ) + _element.description = AAZStrArg( + options=["description"], + help="The free-form description for this user.", + fmt=AAZStrArgFormat( + max_length=256, + ), + ) + _element.ssh_public_key = AAZObjectArg( + options=["ssh-public-key"], + help="The SSH public key for this user.", + required=True, + ) + + ssh_public_key = cls._args_schema.user_list.Element.ssh_public_key + ssh_public_key.key_data = AAZStrArg( + options=["key-data"], + help="The public ssh key of the user.", + required=True, + fmt=AAZStrArgFormat( + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.BareMetalMachineKeySetsUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class BareMetalMachineKeySetsUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bareMetalMachineKeySets/{bareMetalMachineKeySetName}", + **self.url_parameters + ) + + @property + def method(self): + return "PATCH" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "bareMetalMachineKeySetName", self.ctx.args.bare_metal_machine_key_set_name, + required=True, + ), + **self.serialize_url_param( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("expiration", AAZStrType, ".expiration") + properties.set_prop("jumpHostsAllowed", AAZListType, ".jump_hosts_allowed") + properties.set_prop("userList", AAZListType, ".user_list") + + jump_hosts_allowed = _builder.get(".properties.jumpHostsAllowed") + if jump_hosts_allowed is not None: + jump_hosts_allowed.set_elements(AAZStrType, ".") + + user_list = _builder.get(".properties.userList") + if user_list is not None: + user_list.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.userList[]") + if _elements is not None: + _elements.set_prop("azureUserName", AAZStrType, ".azure_user_name", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("description", AAZStrType, ".description") + _elements.set_prop("sshPublicKey", AAZObjectType, ".ssh_public_key", typ_kwargs={"flags": {"required": True}}) + + ssh_public_key = _builder.get(".properties.userList[].sshPublicKey") + if ssh_public_key is not None: + ssh_public_key.set_prop("keyData", AAZStrType, ".key_data", typ_kwargs={"flags": {"required": True}}) + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _UpdateHelper._build_schema_bare_metal_machine_key_set_read(cls._schema_on_200) + + return cls._schema_on_200 + + +class _UpdateHelper: + """Helper class for Update""" + + _schema_bare_metal_machine_key_set_read = None + + @classmethod + def _build_schema_bare_metal_machine_key_set_read(cls, _schema): + if cls._schema_bare_metal_machine_key_set_read is not None: + _schema.extended_location = cls._schema_bare_metal_machine_key_set_read.extended_location + _schema.id = cls._schema_bare_metal_machine_key_set_read.id + _schema.location = cls._schema_bare_metal_machine_key_set_read.location + _schema.name = cls._schema_bare_metal_machine_key_set_read.name + _schema.properties = cls._schema_bare_metal_machine_key_set_read.properties + _schema.system_data = cls._schema_bare_metal_machine_key_set_read.system_data + _schema.tags = cls._schema_bare_metal_machine_key_set_read.tags + _schema.type = cls._schema_bare_metal_machine_key_set_read.type + return + + cls._schema_bare_metal_machine_key_set_read = _schema_bare_metal_machine_key_set_read = AAZObjectType() + + bare_metal_machine_key_set_read = _schema_bare_metal_machine_key_set_read + bare_metal_machine_key_set_read.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + bare_metal_machine_key_set_read.id = AAZStrType( + flags={"read_only": True}, + ) + bare_metal_machine_key_set_read.location = AAZStrType( + flags={"required": True}, + ) + bare_metal_machine_key_set_read.name = AAZStrType( + flags={"read_only": True}, + ) + bare_metal_machine_key_set_read.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + bare_metal_machine_key_set_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + bare_metal_machine_key_set_read.tags = AAZDictType() + bare_metal_machine_key_set_read.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = _schema_bare_metal_machine_key_set_read.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = _schema_bare_metal_machine_key_set_read.properties + properties.azure_group_id = AAZStrType( + serialized_name="azureGroupId", + flags={"required": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.expiration = AAZStrType( + flags={"required": True}, + ) + properties.jump_hosts_allowed = AAZListType( + serialized_name="jumpHostsAllowed", + flags={"required": True}, + ) + properties.last_validation = AAZStrType( + serialized_name="lastValidation", + flags={"read_only": True}, + ) + properties.os_group_name = AAZStrType( + serialized_name="osGroupName", + ) + properties.privilege_level = AAZStrType( + serialized_name="privilegeLevel", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.user_list = AAZListType( + serialized_name="userList", + flags={"required": True}, + ) + properties.user_list_status = AAZListType( + serialized_name="userListStatus", + flags={"read_only": True}, + ) + + jump_hosts_allowed = _schema_bare_metal_machine_key_set_read.properties.jump_hosts_allowed + jump_hosts_allowed.Element = AAZStrType() + + user_list = _schema_bare_metal_machine_key_set_read.properties.user_list + user_list.Element = AAZObjectType() + + _element = _schema_bare_metal_machine_key_set_read.properties.user_list.Element + _element.azure_user_name = AAZStrType( + serialized_name="azureUserName", + flags={"required": True}, + ) + _element.description = AAZStrType() + _element.ssh_public_key = AAZObjectType( + serialized_name="sshPublicKey", + flags={"required": True}, + ) + + ssh_public_key = _schema_bare_metal_machine_key_set_read.properties.user_list.Element.ssh_public_key + ssh_public_key.key_data = AAZStrType( + serialized_name="keyData", + flags={"required": True}, + ) + + user_list_status = _schema_bare_metal_machine_key_set_read.properties.user_list_status + user_list_status.Element = AAZObjectType() + + _element = _schema_bare_metal_machine_key_set_read.properties.user_list_status.Element + _element.azure_user_name = AAZStrType( + serialized_name="azureUserName", + flags={"read_only": True}, + ) + _element.status = AAZStrType( + flags={"read_only": True}, + ) + _element.status_message = AAZStrType( + serialized_name="statusMessage", + flags={"read_only": True}, + ) + + system_data = _schema_bare_metal_machine_key_set_read.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = _schema_bare_metal_machine_key_set_read.tags + tags.Element = AAZStrType() + + _schema.extended_location = cls._schema_bare_metal_machine_key_set_read.extended_location + _schema.id = cls._schema_bare_metal_machine_key_set_read.id + _schema.location = cls._schema_bare_metal_machine_key_set_read.location + _schema.name = cls._schema_bare_metal_machine_key_set_read.name + _schema.properties = cls._schema_bare_metal_machine_key_set_read.properties + _schema.system_data = cls._schema_bare_metal_machine_key_set_read.system_data + _schema.tags = cls._schema_bare_metal_machine_key_set_read.tags + _schema.type = cls._schema_bare_metal_machine_key_set_read.type + + +__all__ = ["Update"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/_wait.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/_wait.py new file mode 100644 index 00000000000..9233740102a --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/baremetalmachinekeyset/_wait.py @@ -0,0 +1,314 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cluster baremetalmachinekeyset wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clusters/{}/baremetalmachinekeysets/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.bare_metal_machine_key_set_name = AAZStrArg( + options=["-n", "--name", "--bare-metal-machine-key-set-name"], + help="The name of the bare metal machine key set.", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the cluster.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.BareMetalMachineKeySetsGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) + return result + + class BareMetalMachineKeySetsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bareMetalMachineKeySets/{bareMetalMachineKeySetName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "bareMetalMachineKeySetName", self.ctx.args.bare_metal_machine_key_set_name, + required=True, + ), + **self.serialize_url_param( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.azure_group_id = AAZStrType( + serialized_name="azureGroupId", + flags={"required": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.expiration = AAZStrType( + flags={"required": True}, + ) + properties.jump_hosts_allowed = AAZListType( + serialized_name="jumpHostsAllowed", + flags={"required": True}, + ) + properties.last_validation = AAZStrType( + serialized_name="lastValidation", + flags={"read_only": True}, + ) + properties.os_group_name = AAZStrType( + serialized_name="osGroupName", + ) + properties.privilege_level = AAZStrType( + serialized_name="privilegeLevel", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.user_list = AAZListType( + serialized_name="userList", + flags={"required": True}, + ) + properties.user_list_status = AAZListType( + serialized_name="userListStatus", + flags={"read_only": True}, + ) + + jump_hosts_allowed = cls._schema_on_200.properties.jump_hosts_allowed + jump_hosts_allowed.Element = AAZStrType() + + user_list = cls._schema_on_200.properties.user_list + user_list.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.user_list.Element + _element.azure_user_name = AAZStrType( + serialized_name="azureUserName", + flags={"required": True}, + ) + _element.description = AAZStrType() + _element.ssh_public_key = AAZObjectType( + serialized_name="sshPublicKey", + flags={"required": True}, + ) + + ssh_public_key = cls._schema_on_200.properties.user_list.Element.ssh_public_key + ssh_public_key.key_data = AAZStrType( + serialized_name="keyData", + flags={"required": True}, + ) + + user_list_status = cls._schema_on_200.properties.user_list_status + user_list_status.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.user_list_status.Element + _element.azure_user_name = AAZStrType( + serialized_name="azureUserName", + flags={"read_only": True}, + ) + _element.status = AAZStrType( + flags={"read_only": True}, + ) + _element.status_message = AAZStrType( + serialized_name="statusMessage", + flags={"read_only": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/__cmd_group.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/__cmd_group.py new file mode 100644 index 00000000000..33cc7ecd500 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/__cmd_group.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "networkcloud cluster bmckeyset", + is_experimental=True, +) +class __CMDGroup(AAZCommandGroup): + """Manage cluster's baseboard management controller key set + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/__init__.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/__init__.py new file mode 100644 index 00000000000..db73033039b --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/__init__.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._list import * +from ._show import * +from ._update import * +from ._wait import * diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/_create.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/_create.py new file mode 100644 index 00000000000..ee959d97720 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/_create.py @@ -0,0 +1,470 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cluster bmckeyset create", + is_experimental=True, +) +class Create(AAZCommand): + """Create a new baseboard management controller key set or update the existing one for the provided cluster. + + :example: Create or update baseboard management controller key set of cluster + az networkcloud cluster bmckeyset create --name "bmcKeySetName" --extended-location name="/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterExtendedLocationName" type="CustomLocation" --location "location" --azure-group-id "f110271b-XXXX-4163-9b99-214d91660f0e" --expiration "2022-12-31T23:59:59.008Z" --privilege-level "Administrator" --user-list '[{"description":"UserDesc","azureUserName":"userABC","sshPublicKey":{"keyData":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDWtG2RiEGfXs+RK19HU/G8EdEnbTlkl8Kkb5xv6nm+ttTb9FrW/dc9RQvai24VEFJmG4Fmi6Ow/yjxq+jTDuWOSs+LovQpOKm9D8p05JcIOpdCPGA5S+dWIVL+a9jsQmzBbWYxh6oZy5IaEgnWhHotzdCL6apiz6/3SAUUrErjnYYUmovAJiIVUbT6YaYc/t5SjWU= admin@vm"}}]' --tags key1="myvalue1" key2="myvalue2" --cluster-name "clusterName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clusters/{}/bmckeysets/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.bmc_key_set_name = AAZStrArg( + options=["-n", "--name", "--bmc-key-set-name"], + help="The name of the baseboard management controller key set.", + required=True, + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the cluster.", + required=True, + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "BmcKeySetParameters" + + _args_schema = cls._args_schema + _args_schema.extended_location = AAZObjectArg( + options=["--extended-location"], + arg_group="BmcKeySetParameters", + help="The extended location of the cluster associated with the resource.", + required=True, + ) + _args_schema.location = AAZResourceLocationArg( + arg_group="BmcKeySetParameters", + help="The geo-location where the resource lives", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="BmcKeySetParameters", + help="Resource tags.", + ) + + extended_location = cls._args_schema.extended_location + extended_location.name = AAZStrArg( + options=["name"], + help="The resource ID of the extended location on which the resource will be created.", + required=True, + ) + extended_location.type = AAZStrArg( + options=["type"], + help="The extended location type, for example, CustomLocation.", + required=True, + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.azure_group_id = AAZStrArg( + options=["--azure-group-id"], + arg_group="Properties", + help="The object ID of Azure Active Directory group that all users in the list must be in for access to be granted. Users that are not in the group will not have access.", + required=True, + ) + _args_schema.expiration = AAZDateTimeArg( + options=["--expiration"], + arg_group="Properties", + help="The date and time after which the users in this key set will be removed from the baseboard management controllers.", + required=True, + ) + _args_schema.privilege_level = AAZStrArg( + options=["--privilege-level"], + arg_group="Properties", + help="The access level allowed for the users in this key set.", + required=True, + enum={"Administrator": "Administrator", "ReadOnly": "ReadOnly"}, + ) + _args_schema.user_list = AAZListArg( + options=["--user-list"], + arg_group="Properties", + help="The unique list of permitted users.", + required=True, + ) + + user_list = cls._args_schema.user_list + user_list.Element = AAZObjectArg() + + _element = cls._args_schema.user_list.Element + _element.azure_user_name = AAZStrArg( + options=["azure-user-name"], + help="The Azure Active Directory user name (email name).", + required=True, + ) + _element.description = AAZStrArg( + options=["description"], + help="The free-form description for this user.", + fmt=AAZStrArgFormat( + max_length=256, + ), + ) + _element.ssh_public_key = AAZObjectArg( + options=["ssh-public-key"], + help="The SSH public key for this user.", + required=True, + ) + + ssh_public_key = cls._args_schema.user_list.Element.ssh_public_key + ssh_public_key.key_data = AAZStrArg( + options=["key-data"], + help="The public ssh key of the user.", + required=True, + fmt=AAZStrArgFormat( + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.BmcKeySetsCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class BmcKeySetsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bmcKeySets/{bmcKeySetName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "bmcKeySetName", self.ctx.args.bmc_key_set_name, + required=True, + ), + **self.serialize_url_param( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("extendedLocation", AAZObjectType, ".extended_location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True, "client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + extended_location = _builder.get(".extendedLocation") + if extended_location is not None: + extended_location.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}}) + extended_location.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("azureGroupId", AAZStrType, ".azure_group_id", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("expiration", AAZStrType, ".expiration", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("privilegeLevel", AAZStrType, ".privilege_level", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("userList", AAZListType, ".user_list", typ_kwargs={"flags": {"required": True}}) + + user_list = _builder.get(".properties.userList") + if user_list is not None: + user_list.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.userList[]") + if _elements is not None: + _elements.set_prop("azureUserName", AAZStrType, ".azure_user_name", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("description", AAZStrType, ".description") + _elements.set_prop("sshPublicKey", AAZObjectType, ".ssh_public_key", typ_kwargs={"flags": {"required": True}}) + + ssh_public_key = _builder.get(".properties.userList[].sshPublicKey") + if ssh_public_key is not None: + ssh_public_key.set_prop("keyData", AAZStrType, ".key_data", typ_kwargs={"flags": {"required": True}}) + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + 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_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200_201.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.azure_group_id = AAZStrType( + serialized_name="azureGroupId", + flags={"required": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.expiration = AAZStrType( + flags={"required": True}, + ) + properties.last_validation = AAZStrType( + serialized_name="lastValidation", + flags={"read_only": True}, + ) + properties.privilege_level = AAZStrType( + serialized_name="privilegeLevel", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.user_list = AAZListType( + serialized_name="userList", + flags={"required": True}, + ) + properties.user_list_status = AAZListType( + serialized_name="userListStatus", + flags={"read_only": True}, + ) + + user_list = cls._schema_on_200_201.properties.user_list + user_list.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.user_list.Element + _element.azure_user_name = AAZStrType( + serialized_name="azureUserName", + flags={"required": True}, + ) + _element.description = AAZStrType() + _element.ssh_public_key = AAZObjectType( + serialized_name="sshPublicKey", + flags={"required": True}, + ) + + ssh_public_key = cls._schema_on_200_201.properties.user_list.Element.ssh_public_key + ssh_public_key.key_data = AAZStrType( + serialized_name="keyData", + flags={"required": True}, + ) + + user_list_status = cls._schema_on_200_201.properties.user_list_status + user_list_status.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.user_list_status.Element + _element.azure_user_name = AAZStrType( + serialized_name="azureUserName", + flags={"read_only": True}, + ) + _element.status = AAZStrType( + flags={"read_only": True}, + ) + _element.status_message = AAZStrType( + serialized_name="statusMessage", + flags={"read_only": True}, + ) + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/_delete.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/_delete.py new file mode 100644 index 00000000000..58b926c8b9a --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/_delete.py @@ -0,0 +1,180 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cluster bmckeyset delete", + is_experimental=True, + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete the baseboard management controller key set of the provided cluster. + + :example: Delete baseboard management controller key set of cluster + az networkcloud cluster bmckeyset delete --name "bmcKeySetName" --cluster-name "clusterName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clusters/{}/bmckeysets/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.bmc_key_set_name = AAZStrArg( + options=["-n", "--name", "--bmc-key-set-name"], + help="The name of the baseboard management controller key set.", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the cluster.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.BmcKeySetsDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class BmcKeySetsDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bmcKeySets/{bmcKeySetName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "bmcKeySetName", self.ctx.args.bmc_key_set_name, + required=True, + ), + **self.serialize_url_param( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/_list.py new file mode 100644 index 00000000000..dca0020a9fd --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/_list.py @@ -0,0 +1,304 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cluster bmckeyset list", + is_experimental=True, +) +class List(AAZCommand): + """List baseboard management controller key sets of the cluster. + + :example: List baseboard management controller key sets of the cluster + az networkcloud cluster bmckeyset list --cluster-name "clusterName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clusters/{}/bmckeysets", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the cluster.", + required=True, + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.BmcKeySetsListByResourceGroup(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class BmcKeySetsListByResourceGroup(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bmcKeySets", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.value.Element.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.azure_group_id = AAZStrType( + serialized_name="azureGroupId", + flags={"required": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.expiration = AAZStrType( + flags={"required": True}, + ) + properties.last_validation = AAZStrType( + serialized_name="lastValidation", + flags={"read_only": True}, + ) + properties.privilege_level = AAZStrType( + serialized_name="privilegeLevel", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.user_list = AAZListType( + serialized_name="userList", + flags={"required": True}, + ) + properties.user_list_status = AAZListType( + serialized_name="userListStatus", + flags={"read_only": True}, + ) + + user_list = cls._schema_on_200.value.Element.properties.user_list + user_list.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.user_list.Element + _element.azure_user_name = AAZStrType( + serialized_name="azureUserName", + flags={"required": True}, + ) + _element.description = AAZStrType() + _element.ssh_public_key = AAZObjectType( + serialized_name="sshPublicKey", + flags={"required": True}, + ) + + ssh_public_key = cls._schema_on_200.value.Element.properties.user_list.Element.ssh_public_key + ssh_public_key.key_data = AAZStrType( + serialized_name="keyData", + flags={"required": True}, + ) + + user_list_status = cls._schema_on_200.value.Element.properties.user_list_status + user_list_status.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.user_list_status.Element + _element.azure_user_name = AAZStrType( + serialized_name="azureUserName", + flags={"read_only": True}, + ) + _element.status = AAZStrType( + flags={"read_only": True}, + ) + _element.status_message = AAZStrType( + serialized_name="statusMessage", + flags={"read_only": True}, + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/_show.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/_show.py new file mode 100644 index 00000000000..913565988a6 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/_show.py @@ -0,0 +1,309 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cluster bmckeyset show", + is_experimental=True, +) +class Show(AAZCommand): + """Get baseboard management controller key set of the provided cluster. + + :example: Get baseboard management controller key set of cluster + az networkcloud cluster bmckeyset show --name "bmcKeySetName" --cluster-name "clusterName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clusters/{}/bmckeysets/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.bmc_key_set_name = AAZStrArg( + options=["-n", "--name", "--bmc-key-set-name"], + help="The name of the baseboard management controller key set.", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the cluster.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.BmcKeySetsGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class BmcKeySetsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bmcKeySets/{bmcKeySetName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "bmcKeySetName", self.ctx.args.bmc_key_set_name, + required=True, + ), + **self.serialize_url_param( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.azure_group_id = AAZStrType( + serialized_name="azureGroupId", + flags={"required": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.expiration = AAZStrType( + flags={"required": True}, + ) + properties.last_validation = AAZStrType( + serialized_name="lastValidation", + flags={"read_only": True}, + ) + properties.privilege_level = AAZStrType( + serialized_name="privilegeLevel", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.user_list = AAZListType( + serialized_name="userList", + flags={"required": True}, + ) + properties.user_list_status = AAZListType( + serialized_name="userListStatus", + flags={"read_only": True}, + ) + + user_list = cls._schema_on_200.properties.user_list + user_list.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.user_list.Element + _element.azure_user_name = AAZStrType( + serialized_name="azureUserName", + flags={"required": True}, + ) + _element.description = AAZStrType() + _element.ssh_public_key = AAZObjectType( + serialized_name="sshPublicKey", + flags={"required": True}, + ) + + ssh_public_key = cls._schema_on_200.properties.user_list.Element.ssh_public_key + ssh_public_key.key_data = AAZStrType( + serialized_name="keyData", + flags={"required": True}, + ) + + user_list_status = cls._schema_on_200.properties.user_list_status + user_list_status.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.user_list_status.Element + _element.azure_user_name = AAZStrType( + serialized_name="azureUserName", + flags={"read_only": True}, + ) + _element.status = AAZStrType( + flags={"read_only": True}, + ) + _element.status_message = AAZStrType( + serialized_name="statusMessage", + flags={"read_only": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/_update.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/_update.py new file mode 100644 index 00000000000..6cc86cb29d7 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/_update.py @@ -0,0 +1,449 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cluster bmckeyset update", + is_experimental=True, +) +class Update(AAZCommand): + """Update properties of baseboard management controller key set for the provided cluster, or update the tags associated with it. Properties and tag updates can be done independently. + + :example: Patch baseboard management controller key set of cluster + az networkcloud cluster bmckeyset update --name "bmcKeySetName" --expiration "2022-12-31T23:59:59.008Z" --user-list '[{"description":"UserDesc","azureUserName":"userABC","sshPublicKey":{"keyData":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDWtG2RiEGfXs+RK19HU/G8EdEnbTlkl8Kkb5xv6nm+ttTb9FrW/dc9RQvai24VEFJmG4Fmi6Ow/yjxq+jTDuWOSs+LovQpOKm9D8p05JcIOpdCPGA5S+dWIVL+a9jsQmzBbWYxh6oZy5IaEgnWhHotzdCL6apiz6/3SAUUrErjnYYUmovAJiIVUbT6YaYc/t5SjWU= admin@vm"}}]' --tags key1="myvalue1" key2="myvalue2" --cluster-name "clusterName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clusters/{}/bmckeysets/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.bmc_key_set_name = AAZStrArg( + options=["-n", "--name", "--bmc-key-set-name"], + help="The name of the baseboard management controller key set.", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the cluster.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "BmcKeySetUpdateParameters" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="BmcKeySetUpdateParameters", + help="The Azure resource tags that will replace the existing ones.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.expiration = AAZDateTimeArg( + options=["--expiration"], + arg_group="Properties", + help="The date and time after which the users in this key set will be removed from the baseboard management controllers.", + ) + _args_schema.user_list = AAZListArg( + options=["--user-list"], + arg_group="Properties", + help="The unique list of permitted users.", + ) + + user_list = cls._args_schema.user_list + user_list.Element = AAZObjectArg() + + _element = cls._args_schema.user_list.Element + _element.azure_user_name = AAZStrArg( + options=["azure-user-name"], + help="The Azure Active Directory user name (email name).", + required=True, + ) + _element.description = AAZStrArg( + options=["description"], + help="The free-form description for this user.", + fmt=AAZStrArgFormat( + max_length=256, + ), + ) + _element.ssh_public_key = AAZObjectArg( + options=["ssh-public-key"], + help="The SSH public key for this user.", + required=True, + ) + + ssh_public_key = cls._args_schema.user_list.Element.ssh_public_key + ssh_public_key.key_data = AAZStrArg( + options=["key-data"], + help="The public ssh key of the user.", + required=True, + fmt=AAZStrArgFormat( + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.BmcKeySetsUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class BmcKeySetsUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bmcKeySets/{bmcKeySetName}", + **self.url_parameters + ) + + @property + def method(self): + return "PATCH" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "bmcKeySetName", self.ctx.args.bmc_key_set_name, + required=True, + ), + **self.serialize_url_param( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("expiration", AAZStrType, ".expiration") + properties.set_prop("userList", AAZListType, ".user_list") + + user_list = _builder.get(".properties.userList") + if user_list is not None: + user_list.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.userList[]") + if _elements is not None: + _elements.set_prop("azureUserName", AAZStrType, ".azure_user_name", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("description", AAZStrType, ".description") + _elements.set_prop("sshPublicKey", AAZObjectType, ".ssh_public_key", typ_kwargs={"flags": {"required": True}}) + + ssh_public_key = _builder.get(".properties.userList[].sshPublicKey") + if ssh_public_key is not None: + ssh_public_key.set_prop("keyData", AAZStrType, ".key_data", typ_kwargs={"flags": {"required": True}}) + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _UpdateHelper._build_schema_bmc_key_set_read(cls._schema_on_200) + + return cls._schema_on_200 + + +class _UpdateHelper: + """Helper class for Update""" + + _schema_bmc_key_set_read = None + + @classmethod + def _build_schema_bmc_key_set_read(cls, _schema): + if cls._schema_bmc_key_set_read is not None: + _schema.extended_location = cls._schema_bmc_key_set_read.extended_location + _schema.id = cls._schema_bmc_key_set_read.id + _schema.location = cls._schema_bmc_key_set_read.location + _schema.name = cls._schema_bmc_key_set_read.name + _schema.properties = cls._schema_bmc_key_set_read.properties + _schema.system_data = cls._schema_bmc_key_set_read.system_data + _schema.tags = cls._schema_bmc_key_set_read.tags + _schema.type = cls._schema_bmc_key_set_read.type + return + + cls._schema_bmc_key_set_read = _schema_bmc_key_set_read = AAZObjectType() + + bmc_key_set_read = _schema_bmc_key_set_read + bmc_key_set_read.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + bmc_key_set_read.id = AAZStrType( + flags={"read_only": True}, + ) + bmc_key_set_read.location = AAZStrType( + flags={"required": True}, + ) + bmc_key_set_read.name = AAZStrType( + flags={"read_only": True}, + ) + bmc_key_set_read.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + bmc_key_set_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + bmc_key_set_read.tags = AAZDictType() + bmc_key_set_read.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = _schema_bmc_key_set_read.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = _schema_bmc_key_set_read.properties + properties.azure_group_id = AAZStrType( + serialized_name="azureGroupId", + flags={"required": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.expiration = AAZStrType( + flags={"required": True}, + ) + properties.last_validation = AAZStrType( + serialized_name="lastValidation", + flags={"read_only": True}, + ) + properties.privilege_level = AAZStrType( + serialized_name="privilegeLevel", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.user_list = AAZListType( + serialized_name="userList", + flags={"required": True}, + ) + properties.user_list_status = AAZListType( + serialized_name="userListStatus", + flags={"read_only": True}, + ) + + user_list = _schema_bmc_key_set_read.properties.user_list + user_list.Element = AAZObjectType() + + _element = _schema_bmc_key_set_read.properties.user_list.Element + _element.azure_user_name = AAZStrType( + serialized_name="azureUserName", + flags={"required": True}, + ) + _element.description = AAZStrType() + _element.ssh_public_key = AAZObjectType( + serialized_name="sshPublicKey", + flags={"required": True}, + ) + + ssh_public_key = _schema_bmc_key_set_read.properties.user_list.Element.ssh_public_key + ssh_public_key.key_data = AAZStrType( + serialized_name="keyData", + flags={"required": True}, + ) + + user_list_status = _schema_bmc_key_set_read.properties.user_list_status + user_list_status.Element = AAZObjectType() + + _element = _schema_bmc_key_set_read.properties.user_list_status.Element + _element.azure_user_name = AAZStrType( + serialized_name="azureUserName", + flags={"read_only": True}, + ) + _element.status = AAZStrType( + flags={"read_only": True}, + ) + _element.status_message = AAZStrType( + serialized_name="statusMessage", + flags={"read_only": True}, + ) + + system_data = _schema_bmc_key_set_read.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = _schema_bmc_key_set_read.tags + tags.Element = AAZStrType() + + _schema.extended_location = cls._schema_bmc_key_set_read.extended_location + _schema.id = cls._schema_bmc_key_set_read.id + _schema.location = cls._schema_bmc_key_set_read.location + _schema.name = cls._schema_bmc_key_set_read.name + _schema.properties = cls._schema_bmc_key_set_read.properties + _schema.system_data = cls._schema_bmc_key_set_read.system_data + _schema.tags = cls._schema_bmc_key_set_read.tags + _schema.type = cls._schema_bmc_key_set_read.type + + +__all__ = ["Update"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/_wait.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/_wait.py new file mode 100644 index 00000000000..8eb4cfdc1cf --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/bmckeyset/_wait.py @@ -0,0 +1,304 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cluster bmckeyset wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clusters/{}/bmckeysets/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.bmc_key_set_name = AAZStrArg( + options=["-n", "--name", "--bmc-key-set-name"], + help="The name of the baseboard management controller key set.", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the cluster.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.BmcKeySetsGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) + return result + + class BmcKeySetsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/bmcKeySets/{bmcKeySetName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "bmcKeySetName", self.ctx.args.bmc_key_set_name, + required=True, + ), + **self.serialize_url_param( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.azure_group_id = AAZStrType( + serialized_name="azureGroupId", + flags={"required": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.expiration = AAZStrType( + flags={"required": True}, + ) + properties.last_validation = AAZStrType( + serialized_name="lastValidation", + flags={"read_only": True}, + ) + properties.privilege_level = AAZStrType( + serialized_name="privilegeLevel", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.user_list = AAZListType( + serialized_name="userList", + flags={"required": True}, + ) + properties.user_list_status = AAZListType( + serialized_name="userListStatus", + flags={"read_only": True}, + ) + + user_list = cls._schema_on_200.properties.user_list + user_list.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.user_list.Element + _element.azure_user_name = AAZStrType( + serialized_name="azureUserName", + flags={"required": True}, + ) + _element.description = AAZStrType() + _element.ssh_public_key = AAZObjectType( + serialized_name="sshPublicKey", + flags={"required": True}, + ) + + ssh_public_key = cls._schema_on_200.properties.user_list.Element.ssh_public_key + ssh_public_key.key_data = AAZStrType( + serialized_name="keyData", + flags={"required": True}, + ) + + user_list_status = cls._schema_on_200.properties.user_list_status + user_list_status.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.user_list_status.Element + _element.azure_user_name = AAZStrType( + serialized_name="azureUserName", + flags={"read_only": True}, + ) + _element.status = AAZStrType( + flags={"read_only": True}, + ) + _element.status_message = AAZStrType( + serialized_name="statusMessage", + flags={"read_only": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/__cmd_group.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/__cmd_group.py new file mode 100644 index 00000000000..8c2d04d7321 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/__cmd_group.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "networkcloud cluster metricsconfiguration", + is_experimental=True, +) +class __CMDGroup(AAZCommandGroup): + """Manage cluster's metrics configuration + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/__init__.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/__init__.py new file mode 100644 index 00000000000..db73033039b --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/__init__.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._list import * +from ._show import * +from ._update import * +from ._wait import * diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/_create.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/_create.py new file mode 100644 index 00000000000..d80c8d2c9b3 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/_create.py @@ -0,0 +1,377 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cluster metricsconfiguration create", + is_experimental=True, +) +class Create(AAZCommand): + """Create the metrics configuration of the provided cluster. + + :example: Update metrics configuration of cluster + az networkcloud cluster metricsconfiguration create --cluster-name "clusterName" --extended-location name="/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterExtendedLocationName" type="CustomLocation" --location "location" --collection-interval 15 --enabled-metrics "metric1" "metric2" --tags key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clusters/{}/metricsconfigurations/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the cluster.", + required=True, + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.metrics_configuration_name = AAZStrArg( + options=["-n", "--name", "--metrics-configuration-name"], + help="The name of the metrics configuration for the cluster.", + required=True, + fmt=AAZStrArgFormat( + pattern="^default$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "MetricsConfigurationParameters" + + _args_schema = cls._args_schema + _args_schema.extended_location = AAZObjectArg( + options=["--extended-location"], + arg_group="MetricsConfigurationParameters", + help="The extended location of the cluster associated with the resource.", + required=True, + ) + _args_schema.location = AAZResourceLocationArg( + arg_group="MetricsConfigurationParameters", + help="The geo-location where the resource lives", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="MetricsConfigurationParameters", + help="Resource tags.", + ) + + extended_location = cls._args_schema.extended_location + extended_location.name = AAZStrArg( + options=["name"], + help="The resource ID of the extended location on which the resource will be created.", + required=True, + ) + extended_location.type = AAZStrArg( + options=["type"], + help="The extended location type, for example, CustomLocation.", + required=True, + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.collection_interval = AAZIntArg( + options=["--collection-interval"], + arg_group="Properties", + help="The interval in minutes by which metrics will be collected.", + required=True, + fmt=AAZIntArgFormat( + maximum=1440, + minimum=1, + ), + ) + _args_schema.enabled_metrics = AAZListArg( + options=["--enabled-metrics"], + arg_group="Properties", + help="The list of metric names that have been chosen to be enabled in addition to the core set of enabled metrics.", + ) + + enabled_metrics = cls._args_schema.enabled_metrics + enabled_metrics.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.MetricsConfigurationsCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class MetricsConfigurationsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/metricsConfigurations/{metricsConfigurationName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "metricsConfigurationName", self.ctx.args.metrics_configuration_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("extendedLocation", AAZObjectType, ".extended_location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True, "client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + extended_location = _builder.get(".extendedLocation") + if extended_location is not None: + extended_location.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}}) + extended_location.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("collectionInterval", AAZIntType, ".collection_interval", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("enabledMetrics", AAZListType, ".enabled_metrics") + + enabled_metrics = _builder.get(".properties.enabledMetrics") + if enabled_metrics is not None: + enabled_metrics.set_elements(AAZStrType, ".") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + 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_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200_201.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.collection_interval = AAZIntType( + serialized_name="collectionInterval", + flags={"required": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.disabled_metrics = AAZListType( + serialized_name="disabledMetrics", + flags={"read_only": True}, + ) + properties.enabled_metrics = AAZListType( + serialized_name="enabledMetrics", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + disabled_metrics = cls._schema_on_200_201.properties.disabled_metrics + disabled_metrics.Element = AAZStrType() + + enabled_metrics = cls._schema_on_200_201.properties.enabled_metrics + enabled_metrics.Element = AAZStrType() + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/_delete.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/_delete.py new file mode 100644 index 00000000000..e6b23870885 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/_delete.py @@ -0,0 +1,180 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cluster metricsconfiguration delete", + is_experimental=True, + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete the metrics configuration of the provided cluster. + + :example: Delete metrics configuration of cluster + az networkcloud cluster metricsconfiguration delete --cluster-name "clusterName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clusters/{}/metricsconfigurations/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the cluster.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.metrics_configuration_name = AAZStrArg( + options=["-n", "--name", "--metrics-configuration-name"], + help="The name of the metrics configuration for the cluster.", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^default$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.MetricsConfigurationsDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class MetricsConfigurationsDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/metricsConfigurations/{metricsConfigurationName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "metricsConfigurationName", self.ctx.args.metrics_configuration_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/_list.py new file mode 100644 index 00000000000..d0f8a61a44a --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/_list.py @@ -0,0 +1,262 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cluster metricsconfiguration list", + is_experimental=True, +) +class List(AAZCommand): + """List metrics configurations of the cluster. + + :example: List metrics configurations of the cluster + az networkcloud cluster metricsconfiguration list --cluster-name "clusterName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clusters/{}/metricsconfigurations", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the cluster.", + required=True, + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.MetricsConfigurationsListByResourceGroup(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class MetricsConfigurationsListByResourceGroup(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/metricsConfigurations", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.value.Element.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.collection_interval = AAZIntType( + serialized_name="collectionInterval", + flags={"required": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.disabled_metrics = AAZListType( + serialized_name="disabledMetrics", + flags={"read_only": True}, + ) + properties.enabled_metrics = AAZListType( + serialized_name="enabledMetrics", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + disabled_metrics = cls._schema_on_200.value.Element.properties.disabled_metrics + disabled_metrics.Element = AAZStrType() + + enabled_metrics = cls._schema_on_200.value.Element.properties.enabled_metrics + enabled_metrics.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/_show.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/_show.py new file mode 100644 index 00000000000..f315716de45 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/_show.py @@ -0,0 +1,267 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cluster metricsconfiguration show", + is_experimental=True, +) +class Show(AAZCommand): + """Get metrics configuration of the provided cluster. + + :example: Get metrics configuration of cluster + az networkcloud cluster metricsconfiguration show --cluster-name "clusterName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clusters/{}/metricsconfigurations/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the cluster.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.metrics_configuration_name = AAZStrArg( + options=["-n", "--name", "--metrics-configuration-name"], + help="The name of the metrics configuration for the cluster.", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^default$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.MetricsConfigurationsGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class MetricsConfigurationsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/metricsConfigurations/{metricsConfigurationName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "metricsConfigurationName", self.ctx.args.metrics_configuration_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.collection_interval = AAZIntType( + serialized_name="collectionInterval", + flags={"required": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.disabled_metrics = AAZListType( + serialized_name="disabledMetrics", + flags={"read_only": True}, + ) + properties.enabled_metrics = AAZListType( + serialized_name="enabledMetrics", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + disabled_metrics = cls._schema_on_200.properties.disabled_metrics + disabled_metrics.Element = AAZStrType() + + enabled_metrics = cls._schema_on_200.properties.enabled_metrics + enabled_metrics.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/_update.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/_update.py new file mode 100644 index 00000000000..0ec45b5c31b --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/_update.py @@ -0,0 +1,372 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cluster metricsconfiguration update", + is_experimental=True, +) +class Update(AAZCommand): + """Update properties of metrics configuration for the provided cluster, or update the tags associated with it. Properties and tag updates can be done independently. + + :example: Patch metrics configuration of cluster + az networkcloud cluster metricsconfiguration update --cluster-name "clusterName" --collection-interval 15 --enabled-metrics "metric1" "metric2" --tags key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clusters/{}/metricsconfigurations/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the cluster.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.metrics_configuration_name = AAZStrArg( + options=["-n", "--name", "--metrics-configuration-name"], + help="The name of the metrics configuration for the cluster.", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^default$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "MetricsConfigurationUpdateParameters" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="MetricsConfigurationUpdateParameters", + help="The Azure resource tags that will replace the existing ones.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.collection_interval = AAZIntArg( + options=["--collection-interval"], + arg_group="Properties", + help="The interval in minutes by which metrics will be collected.", + fmt=AAZIntArgFormat( + maximum=1440, + minimum=1, + ), + ) + _args_schema.enabled_metrics = AAZListArg( + options=["--enabled-metrics"], + arg_group="Properties", + help="The list of metric names that have been chosen to be enabled in addition to the core set of enabled metrics.", + ) + + enabled_metrics = cls._args_schema.enabled_metrics + enabled_metrics.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.MetricsConfigurationsUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class MetricsConfigurationsUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/metricsConfigurations/{metricsConfigurationName}", + **self.url_parameters + ) + + @property + def method(self): + return "PATCH" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "metricsConfigurationName", self.ctx.args.metrics_configuration_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("collectionInterval", AAZIntType, ".collection_interval") + properties.set_prop("enabledMetrics", AAZListType, ".enabled_metrics") + + enabled_metrics = _builder.get(".properties.enabledMetrics") + if enabled_metrics is not None: + enabled_metrics.set_elements(AAZStrType, ".") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _UpdateHelper._build_schema_cluster_metrics_configuration_read(cls._schema_on_200) + + return cls._schema_on_200 + + +class _UpdateHelper: + """Helper class for Update""" + + _schema_cluster_metrics_configuration_read = None + + @classmethod + def _build_schema_cluster_metrics_configuration_read(cls, _schema): + if cls._schema_cluster_metrics_configuration_read is not None: + _schema.extended_location = cls._schema_cluster_metrics_configuration_read.extended_location + _schema.id = cls._schema_cluster_metrics_configuration_read.id + _schema.location = cls._schema_cluster_metrics_configuration_read.location + _schema.name = cls._schema_cluster_metrics_configuration_read.name + _schema.properties = cls._schema_cluster_metrics_configuration_read.properties + _schema.system_data = cls._schema_cluster_metrics_configuration_read.system_data + _schema.tags = cls._schema_cluster_metrics_configuration_read.tags + _schema.type = cls._schema_cluster_metrics_configuration_read.type + return + + cls._schema_cluster_metrics_configuration_read = _schema_cluster_metrics_configuration_read = AAZObjectType() + + cluster_metrics_configuration_read = _schema_cluster_metrics_configuration_read + cluster_metrics_configuration_read.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + cluster_metrics_configuration_read.id = AAZStrType( + flags={"read_only": True}, + ) + cluster_metrics_configuration_read.location = AAZStrType( + flags={"required": True}, + ) + cluster_metrics_configuration_read.name = AAZStrType( + flags={"read_only": True}, + ) + cluster_metrics_configuration_read.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + cluster_metrics_configuration_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + cluster_metrics_configuration_read.tags = AAZDictType() + cluster_metrics_configuration_read.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = _schema_cluster_metrics_configuration_read.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = _schema_cluster_metrics_configuration_read.properties + properties.collection_interval = AAZIntType( + serialized_name="collectionInterval", + flags={"required": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.disabled_metrics = AAZListType( + serialized_name="disabledMetrics", + flags={"read_only": True}, + ) + properties.enabled_metrics = AAZListType( + serialized_name="enabledMetrics", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + disabled_metrics = _schema_cluster_metrics_configuration_read.properties.disabled_metrics + disabled_metrics.Element = AAZStrType() + + enabled_metrics = _schema_cluster_metrics_configuration_read.properties.enabled_metrics + enabled_metrics.Element = AAZStrType() + + system_data = _schema_cluster_metrics_configuration_read.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = _schema_cluster_metrics_configuration_read.tags + tags.Element = AAZStrType() + + _schema.extended_location = cls._schema_cluster_metrics_configuration_read.extended_location + _schema.id = cls._schema_cluster_metrics_configuration_read.id + _schema.location = cls._schema_cluster_metrics_configuration_read.location + _schema.name = cls._schema_cluster_metrics_configuration_read.name + _schema.properties = cls._schema_cluster_metrics_configuration_read.properties + _schema.system_data = cls._schema_cluster_metrics_configuration_read.system_data + _schema.tags = cls._schema_cluster_metrics_configuration_read.tags + _schema.type = cls._schema_cluster_metrics_configuration_read.type + + +__all__ = ["Update"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/_wait.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/_wait.py new file mode 100644 index 00000000000..8f9e568762b --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/_wait.py @@ -0,0 +1,262 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud cluster metricsconfiguration wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clusters/{}/metricsconfigurations/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.cluster_name = AAZStrArg( + options=["--cluster-name"], + help="The name of the cluster.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.metrics_configuration_name = AAZStrArg( + options=["-n", "--name", "--metrics-configuration-name"], + help="The name of the metrics configuration for the cluster.", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^default$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.MetricsConfigurationsGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) + return result + + class MetricsConfigurationsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/metricsConfigurations/{metricsConfigurationName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterName", self.ctx.args.cluster_name, + required=True, + ), + **self.serialize_url_param( + "metricsConfigurationName", self.ctx.args.metrics_configuration_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.collection_interval = AAZIntType( + serialized_name="collectionInterval", + flags={"required": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.disabled_metrics = AAZListType( + serialized_name="disabledMetrics", + flags={"read_only": True}, + ) + properties.enabled_metrics = AAZListType( + serialized_name="enabledMetrics", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + disabled_metrics = cls._schema_on_200.properties.disabled_metrics + disabled_metrics.Element = AAZStrType() + + enabled_metrics = cls._schema_on_200.properties.enabled_metrics + enabled_metrics.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/__cmd_group.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/__cmd_group.py new file mode 100644 index 00000000000..d10df556dad --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/__cmd_group.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "networkcloud clustermanager", + is_experimental=True, +) +class __CMDGroup(AAZCommandGroup): + """Manage cluster manager + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/__init__.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/__init__.py new file mode 100644 index 00000000000..db73033039b --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/__init__.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._list import * +from ._show import * +from ._update import * +from ._wait import * diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_create.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_create.py new file mode 100644 index 00000000000..17de61aba3e --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_create.py @@ -0,0 +1,395 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud clustermanager create", + is_experimental=True, +) +class Create(AAZCommand): + """Create a new cluster manager or update properties of the cluster manager if it exists. + + :example: Create or update cluster manager + az networkcloud clustermanager create --name "clusterManagerName" --location "location" --analytics-workspace-id "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/microsoft.operationalInsights/workspaces/logAnalyticsWorkspaceName" --fabric-controller-id "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/networkFabricControllers/fabricControllerName" --managed-resource-group-configuration name="my-managed-rg" --tags key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clustermanagers/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.cluster_manager_name = AAZStrArg( + options=["-n", "--name", "--cluster-manager-name"], + help="The name of the cluster manager.", + required=True, + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "ClusterManagerParameters" + + _args_schema = cls._args_schema + _args_schema.location = AAZResourceLocationArg( + arg_group="ClusterManagerParameters", + help="The geo-location where the resource lives", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="ClusterManagerParameters", + help="Resource tags.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.analytics_workspace_id = AAZStrArg( + options=["--analytics-workspace-id"], + arg_group="Properties", + help="The resource ID of the Log Analytics workspace that is used for the logs collection.", + ) + _args_schema.availability_zones = AAZListArg( + options=["--availability-zones"], + arg_group="Properties", + help="Field deprecated, this value will no longer influence the cluster manager allocation process and will be removed in a future version. The Azure availability zones within the region that will be used to support the cluster manager resource.", + ) + _args_schema.fabric_controller_id = AAZStrArg( + options=["--fabric-controller-id"], + arg_group="Properties", + help="The resource ID of the fabric controller that has one to one mapping with the cluster manager.", + required=True, + ) + _args_schema.managed_resource_group_configuration = AAZObjectArg( + options=["--managed-resource-group-configuration"], + arg_group="Properties", + help="The configuration of the managed resource group associated with the resource.", + ) + _args_schema.vm_size = AAZStrArg( + options=["--vm-size"], + arg_group="Properties", + help="Field deprecated, this value will no longer influence the cluster manager allocation process and will be removed in a future version. The size of the Azure virtual machines to use for hosting the cluster manager resource.", + ) + + availability_zones = cls._args_schema.availability_zones + availability_zones.Element = AAZStrArg() + + managed_resource_group_configuration = cls._args_schema.managed_resource_group_configuration + managed_resource_group_configuration.location = AAZStrArg( + options=["location"], + help="The location of the managed resource group. If not specified, the location of the parent resource is chosen.", + ) + managed_resource_group_configuration.name = AAZStrArg( + options=["name"], + help="The name for the managed resource group. If not specified, the unique name is automatically generated.", + fmt=AAZStrArgFormat( + max_length=75, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.ClusterManagersCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ClusterManagersCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusterManagers/{clusterManagerName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterManagerName", self.ctx.args.cluster_manager_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True, "client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("analyticsWorkspaceId", AAZStrType, ".analytics_workspace_id") + properties.set_prop("availabilityZones", AAZListType, ".availability_zones") + properties.set_prop("fabricControllerId", AAZStrType, ".fabric_controller_id", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("managedResourceGroupConfiguration", AAZObjectType, ".managed_resource_group_configuration") + properties.set_prop("vmSize", AAZStrType, ".vm_size") + + availability_zones = _builder.get(".properties.availabilityZones") + if availability_zones is not None: + availability_zones.set_elements(AAZStrType, ".") + + managed_resource_group_configuration = _builder.get(".properties.managedResourceGroupConfiguration") + if managed_resource_group_configuration is not None: + managed_resource_group_configuration.set_prop("location", AAZStrType, ".location") + managed_resource_group_configuration.set_prop("name", AAZStrType, ".name") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + 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_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.analytics_workspace_id = AAZStrType( + serialized_name="analyticsWorkspaceId", + ) + properties.availability_zones = AAZListType( + serialized_name="availabilityZones", + ) + properties.cluster_versions = AAZListType( + serialized_name="clusterVersions", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.fabric_controller_id = AAZStrType( + serialized_name="fabricControllerId", + flags={"required": True}, + ) + properties.managed_resource_group_configuration = AAZObjectType( + serialized_name="managedResourceGroupConfiguration", + ) + properties.manager_extended_location = AAZObjectType( + serialized_name="managerExtendedLocation", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.vm_size = AAZStrType( + serialized_name="vmSize", + ) + + availability_zones = cls._schema_on_200_201.properties.availability_zones + availability_zones.Element = AAZStrType() + + cluster_versions = cls._schema_on_200_201.properties.cluster_versions + cluster_versions.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.cluster_versions.Element + _element.support_expiry_date = AAZStrType( + serialized_name="supportExpiryDate", + flags={"read_only": True}, + ) + _element.target_cluster_version = AAZStrType( + serialized_name="targetClusterVersion", + flags={"read_only": True}, + ) + + managed_resource_group_configuration = cls._schema_on_200_201.properties.managed_resource_group_configuration + managed_resource_group_configuration.location = AAZStrType() + managed_resource_group_configuration.name = AAZStrType() + + manager_extended_location = cls._schema_on_200_201.properties.manager_extended_location + manager_extended_location.name = AAZStrType( + flags={"required": True}, + ) + manager_extended_location.type = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_delete.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_delete.py new file mode 100644 index 00000000000..15ee9471b67 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_delete.py @@ -0,0 +1,167 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud clustermanager delete", + is_experimental=True, + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete the provided cluster manager. + + :example: Delete cluster manager + az networkcloud clustermanager delete --name "clusterManagerName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clustermanagers/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.cluster_manager_name = AAZStrArg( + options=["-n", "--name", "--cluster-manager-name"], + help="The name of the cluster manager.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.ClusterManagersDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class ClusterManagersDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusterManagers/{clusterManagerName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterManagerName", self.ctx.args.cluster_manager_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_list.py new file mode 100644 index 00000000000..3d868d924b2 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_list.py @@ -0,0 +1,472 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud clustermanager list", + is_experimental=True, +) +class List(AAZCommand): + """List cluster managers in the provided resource group or subscription. + + :example: List cluster managers for subscription + az networkcloud clustermanager list + + :example: List cluster managers for resource group + az networkcloud clustermanager list --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.networkcloud/clustermanagers", "2022-12-12-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clustermanagers", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) + condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + if condition_0: + self.ClusterManagersListByResourceGroup(ctx=self.ctx)() + if condition_1: + self.ClusterManagersListBySubscription(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class ClusterManagersListByResourceGroup(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusterManagers", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.analytics_workspace_id = AAZStrType( + serialized_name="analyticsWorkspaceId", + ) + properties.availability_zones = AAZListType( + serialized_name="availabilityZones", + ) + properties.cluster_versions = AAZListType( + serialized_name="clusterVersions", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.fabric_controller_id = AAZStrType( + serialized_name="fabricControllerId", + flags={"required": True}, + ) + properties.managed_resource_group_configuration = AAZObjectType( + serialized_name="managedResourceGroupConfiguration", + ) + properties.manager_extended_location = AAZObjectType( + serialized_name="managerExtendedLocation", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.vm_size = AAZStrType( + serialized_name="vmSize", + ) + + availability_zones = cls._schema_on_200.value.Element.properties.availability_zones + availability_zones.Element = AAZStrType() + + cluster_versions = cls._schema_on_200.value.Element.properties.cluster_versions + cluster_versions.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.cluster_versions.Element + _element.support_expiry_date = AAZStrType( + serialized_name="supportExpiryDate", + flags={"read_only": True}, + ) + _element.target_cluster_version = AAZStrType( + serialized_name="targetClusterVersion", + flags={"read_only": True}, + ) + + managed_resource_group_configuration = cls._schema_on_200.value.Element.properties.managed_resource_group_configuration + managed_resource_group_configuration.location = AAZStrType() + managed_resource_group_configuration.name = AAZStrType() + + manager_extended_location = cls._schema_on_200.value.Element.properties.manager_extended_location + manager_extended_location.name = AAZStrType( + flags={"required": True}, + ) + manager_extended_location.type = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + class ClusterManagersListBySubscription(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/clusterManagers", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.analytics_workspace_id = AAZStrType( + serialized_name="analyticsWorkspaceId", + ) + properties.availability_zones = AAZListType( + serialized_name="availabilityZones", + ) + properties.cluster_versions = AAZListType( + serialized_name="clusterVersions", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.fabric_controller_id = AAZStrType( + serialized_name="fabricControllerId", + flags={"required": True}, + ) + properties.managed_resource_group_configuration = AAZObjectType( + serialized_name="managedResourceGroupConfiguration", + ) + properties.manager_extended_location = AAZObjectType( + serialized_name="managerExtendedLocation", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.vm_size = AAZStrType( + serialized_name="vmSize", + ) + + availability_zones = cls._schema_on_200.value.Element.properties.availability_zones + availability_zones.Element = AAZStrType() + + cluster_versions = cls._schema_on_200.value.Element.properties.cluster_versions + cluster_versions.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.cluster_versions.Element + _element.support_expiry_date = AAZStrType( + serialized_name="supportExpiryDate", + flags={"read_only": True}, + ) + _element.target_cluster_version = AAZStrType( + serialized_name="targetClusterVersion", + flags={"read_only": True}, + ) + + managed_resource_group_configuration = cls._schema_on_200.value.Element.properties.managed_resource_group_configuration + managed_resource_group_configuration.location = AAZStrType() + managed_resource_group_configuration.name = AAZStrType() + + manager_extended_location = cls._schema_on_200.value.Element.properties.manager_extended_location + manager_extended_location.name = AAZStrType( + flags={"required": True}, + ) + manager_extended_location.type = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_show.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_show.py new file mode 100644 index 00000000000..971e149bd8c --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_show.py @@ -0,0 +1,276 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud clustermanager show", + is_experimental=True, +) +class Show(AAZCommand): + """Get the properties of the provided cluster manager. + + :example: Get cluster manager + az networkcloud clustermanager show --name "clusterManagerName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clustermanagers/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.cluster_manager_name = AAZStrArg( + options=["-n", "--name", "--cluster-manager-name"], + help="The name of the cluster manager.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ClusterManagersGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ClusterManagersGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusterManagers/{clusterManagerName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterManagerName", self.ctx.args.cluster_manager_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.analytics_workspace_id = AAZStrType( + serialized_name="analyticsWorkspaceId", + ) + properties.availability_zones = AAZListType( + serialized_name="availabilityZones", + ) + properties.cluster_versions = AAZListType( + serialized_name="clusterVersions", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.fabric_controller_id = AAZStrType( + serialized_name="fabricControllerId", + flags={"required": True}, + ) + properties.managed_resource_group_configuration = AAZObjectType( + serialized_name="managedResourceGroupConfiguration", + ) + properties.manager_extended_location = AAZObjectType( + serialized_name="managerExtendedLocation", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.vm_size = AAZStrType( + serialized_name="vmSize", + ) + + availability_zones = cls._schema_on_200.properties.availability_zones + availability_zones.Element = AAZStrType() + + cluster_versions = cls._schema_on_200.properties.cluster_versions + cluster_versions.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.cluster_versions.Element + _element.support_expiry_date = AAZStrType( + serialized_name="supportExpiryDate", + flags={"read_only": True}, + ) + _element.target_cluster_version = AAZStrType( + serialized_name="targetClusterVersion", + flags={"read_only": True}, + ) + + managed_resource_group_configuration = cls._schema_on_200.properties.managed_resource_group_configuration + managed_resource_group_configuration.location = AAZStrType() + managed_resource_group_configuration.name = AAZStrType() + + manager_extended_location = cls._schema_on_200.properties.manager_extended_location + manager_extended_location.name = AAZStrType( + flags={"required": True}, + ) + manager_extended_location.type = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_update.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_update.py new file mode 100644 index 00000000000..fdca7c39b24 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_update.py @@ -0,0 +1,306 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud clustermanager update", + is_experimental=True, +) +class Update(AAZCommand): + """Update properties of the provided cluster manager, or update the tags assigned to the cluster manager. Properties and tag updates can be done independently. + + :example: Update tags for cluster manager + az networkcloud clustermanager update --name "clusterManagerName" --tags key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clustermanagers/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.cluster_manager_name = AAZStrArg( + options=["-n", "--name", "--cluster-manager-name"], + help="The name of the cluster manager.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "ClusterManagerUpdateParameters" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="ClusterManagerUpdateParameters", + help="The Azure resource tags that will replace the existing ones.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ClusterManagersUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ClusterManagersUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusterManagers/{clusterManagerName}", + **self.url_parameters + ) + + @property + def method(self): + return "PATCH" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterManagerName", self.ctx.args.cluster_manager_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"client_flatten": True}} + ) + _builder.set_prop("tags", AAZDictType, ".tags") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.analytics_workspace_id = AAZStrType( + serialized_name="analyticsWorkspaceId", + ) + properties.availability_zones = AAZListType( + serialized_name="availabilityZones", + ) + properties.cluster_versions = AAZListType( + serialized_name="clusterVersions", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.fabric_controller_id = AAZStrType( + serialized_name="fabricControllerId", + flags={"required": True}, + ) + properties.managed_resource_group_configuration = AAZObjectType( + serialized_name="managedResourceGroupConfiguration", + ) + properties.manager_extended_location = AAZObjectType( + serialized_name="managerExtendedLocation", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.vm_size = AAZStrType( + serialized_name="vmSize", + ) + + availability_zones = cls._schema_on_200.properties.availability_zones + availability_zones.Element = AAZStrType() + + cluster_versions = cls._schema_on_200.properties.cluster_versions + cluster_versions.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.cluster_versions.Element + _element.support_expiry_date = AAZStrType( + serialized_name="supportExpiryDate", + flags={"read_only": True}, + ) + _element.target_cluster_version = AAZStrType( + serialized_name="targetClusterVersion", + flags={"read_only": True}, + ) + + managed_resource_group_configuration = cls._schema_on_200.properties.managed_resource_group_configuration + managed_resource_group_configuration.location = AAZStrType() + managed_resource_group_configuration.name = AAZStrType() + + manager_extended_location = cls._schema_on_200.properties.manager_extended_location + manager_extended_location.name = AAZStrType( + flags={"required": True}, + ) + manager_extended_location.type = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _UpdateHelper: + """Helper class for Update""" + + +__all__ = ["Update"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_wait.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_wait.py new file mode 100644 index 00000000000..8e86ae52140 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/clustermanager/_wait.py @@ -0,0 +1,271 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud clustermanager wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clustermanagers/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.cluster_manager_name = AAZStrArg( + options=["-n", "--name", "--cluster-manager-name"], + help="The name of the cluster manager.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ClusterManagersGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) + return result + + class ClusterManagersGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusterManagers/{clusterManagerName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "clusterManagerName", self.ctx.args.cluster_manager_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.analytics_workspace_id = AAZStrType( + serialized_name="analyticsWorkspaceId", + ) + properties.availability_zones = AAZListType( + serialized_name="availabilityZones", + ) + properties.cluster_versions = AAZListType( + serialized_name="clusterVersions", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.fabric_controller_id = AAZStrType( + serialized_name="fabricControllerId", + flags={"required": True}, + ) + properties.managed_resource_group_configuration = AAZObjectType( + serialized_name="managedResourceGroupConfiguration", + ) + properties.manager_extended_location = AAZObjectType( + serialized_name="managerExtendedLocation", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.vm_size = AAZStrType( + serialized_name="vmSize", + ) + + availability_zones = cls._schema_on_200.properties.availability_zones + availability_zones.Element = AAZStrType() + + cluster_versions = cls._schema_on_200.properties.cluster_versions + cluster_versions.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.cluster_versions.Element + _element.support_expiry_date = AAZStrType( + serialized_name="supportExpiryDate", + flags={"read_only": True}, + ) + _element.target_cluster_version = AAZStrType( + serialized_name="targetClusterVersion", + flags={"read_only": True}, + ) + + managed_resource_group_configuration = cls._schema_on_200.properties.managed_resource_group_configuration + managed_resource_group_configuration.location = AAZStrType() + managed_resource_group_configuration.name = AAZStrType() + + manager_extended_location = cls._schema_on_200.properties.manager_extended_location + manager_extended_location.name = AAZStrType( + flags={"required": True}, + ) + manager_extended_location.type = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/__cmd_group.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/__cmd_group.py new file mode 100644 index 00000000000..8509d39c70b --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/__cmd_group.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "networkcloud defaultcninetwork", + is_experimental=True, +) +class __CMDGroup(AAZCommandGroup): + """Manage default CNI network + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/__init__.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/__init__.py new file mode 100644 index 00000000000..db73033039b --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/__init__.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._list import * +from ._show import * +from ._update import * +from ._wait import * diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/_create.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/_create.py new file mode 100644 index 00000000000..21e1065ca65 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/_create.py @@ -0,0 +1,593 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud defaultcninetwork create", + is_experimental=True, +) +class Create(AAZCommand): + """Create a new default CNI network or update the properties of the existing default CNI network. + + :example: Create or update default CNI network + az networkcloud defaultcninetwork create --name "defaultCniNetworkName" --extended-location name="/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterExtendedLocationName" type="CustomLocation" --location "location" --cni-bgp-configuration '{"bgp-peers":[{"as-number":"64497","peer-ip":"203.0.113.254"}],"communityAdvertisements":[{"communities":["64512","100"],"subnet-prefix":"192.0.2.0/27"}],"service-external-prefixes":["192.0.2.0/28"],"service-load-balancer-prefixes":["192.0.2.16/28"]}' --ip-allocation-type "DualStack" --ipv4-connected-prefix "203.0.113.0/24" --ipv6-connected-prefix "2001:db8:0:3::/64" --l3-isolation-domain-id "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/l3IsolationDomainName" --vlan 12 --tags key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/defaultcninetworks/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.default_cni_network_name = AAZStrArg( + options=["-n", "--name", "--default-cni-network-name"], + help="The name of the default CNI network.", + required=True, + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "DefaultCniNetworkParameters" + + _args_schema = cls._args_schema + _args_schema.extended_location = AAZObjectArg( + options=["--extended-location"], + arg_group="DefaultCniNetworkParameters", + help="The extended location of the cluster associated with the resource.", + required=True, + ) + _args_schema.location = AAZResourceLocationArg( + arg_group="DefaultCniNetworkParameters", + help="The geo-location where the resource lives", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="DefaultCniNetworkParameters", + help="Resource tags.", + ) + + extended_location = cls._args_schema.extended_location + extended_location.name = AAZStrArg( + options=["name"], + help="The resource ID of the extended location on which the resource will be created.", + required=True, + ) + extended_location.type = AAZStrArg( + options=["type"], + help="The extended location type, for example, CustomLocation.", + required=True, + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.cni_bgp_configuration = AAZObjectArg( + options=["--cni-bgp-configuration"], + arg_group="Properties", + help="The Calico BGP configuration.", + ) + _args_schema.ip_allocation_type = AAZStrArg( + options=["--ip-allocation-type"], + arg_group="Properties", + help="The type of the IP address allocation.", + default="DualStack", + enum={"DualStack": "DualStack", "IPV4": "IPV4", "IPV6": "IPV6"}, + ) + _args_schema.ipv4_connected_prefix = AAZStrArg( + options=["--ipv4-connected-prefix"], + arg_group="Properties", + help="The IPV4 prefix (CIDR) assigned to this default CNI network. It is required when the IP allocation type is IPV4 or DualStack.", + ) + _args_schema.ipv6_connected_prefix = AAZStrArg( + options=["--ipv6-connected-prefix"], + arg_group="Properties", + help="The IPV6 prefix (CIDR) assigned to this default CNI network. It is required when the IP allocation type is IPV6 or DualStack.", + ) + _args_schema.l3_isolation_domain_id = AAZStrArg( + options=["--l3-isolation-domain-id"], + arg_group="Properties", + help="The resource ID of the Network Fabric l3IsolationDomain.", + required=True, + ) + _args_schema.vlan = AAZIntArg( + options=["--vlan"], + arg_group="Properties", + help="The VLAN from the l3IsolationDomain that is used for this network.", + required=True, + fmt=AAZIntArgFormat( + maximum=4094, + minimum=1, + ), + ) + + cni_bgp_configuration = cls._args_schema.cni_bgp_configuration + cni_bgp_configuration.bgp_peers = AAZListArg( + options=["bgp-peers"], + help="The list of BgpPeer entities that the Hybrid AKS cluster will peer with in addition to peering that occurs automatically with the switch fabric.", + ) + cni_bgp_configuration.community_advertisements = AAZListArg( + options=["community-advertisements"], + help="The list of prefix community advertisement properties. Each prefix community specifies a prefix, and the communities that should be associated with that prefix when it is announced.", + ) + cni_bgp_configuration.node_mesh_password = AAZStrArg( + options=["node-mesh-password"], + help="The password of the Calico node mesh. It defaults to a randomly-generated string when not provided.", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9]{0,80}$", + max_length=80, + ), + ) + cni_bgp_configuration.service_external_prefixes = AAZListArg( + options=["service-external-prefixes"], + help="The subnet blocks in CIDR format for Kubernetes service external IPs to be advertised over BGP.", + ) + cni_bgp_configuration.service_load_balancer_prefixes = AAZListArg( + options=["service-load-balancer-prefixes"], + help="The subnet blocks in CIDR format for Kubernetes load balancers. Load balancer IPs will only be advertised if they are within one of these blocks.", + ) + + bgp_peers = cls._args_schema.cni_bgp_configuration.bgp_peers + bgp_peers.Element = AAZObjectArg() + + _element = cls._args_schema.cni_bgp_configuration.bgp_peers.Element + _element.as_number = AAZIntArg( + options=["as-number"], + help="The ASN (Autonomous System Number) of the BGP peer.", + required=True, + fmt=AAZIntArgFormat( + maximum=4294967295, + minimum=0, + ), + ) + _element.password = AAZStrArg( + options=["password"], + help="The password for this peering neighbor. It defaults to no password if not specified.", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9]{0,80}$", + max_length=80, + ), + ) + _element.peer_ip = AAZStrArg( + options=["peer-ip"], + help="The IPv4 or IPv6 address to peer with the associated CNI Network. The IP version type will drive a peering with the same version type from the Default CNI Network. For example, IPv4 to IPv4 or IPv6 to IPv6.", + required=True, + ) + + community_advertisements = cls._args_schema.cni_bgp_configuration.community_advertisements + community_advertisements.Element = AAZObjectArg() + + _element = cls._args_schema.cni_bgp_configuration.community_advertisements.Element + _element.communities = AAZListArg( + options=["communities"], + help="The list of community strings to announce with this prefix.", + required=True, + ) + _element.subnet_prefix = AAZStrArg( + options=["subnet-prefix"], + help="The subnet in CIDR format for which properties should be advertised.", + required=True, + ) + + communities = cls._args_schema.cni_bgp_configuration.community_advertisements.Element.communities + communities.Element = AAZStrArg() + + service_external_prefixes = cls._args_schema.cni_bgp_configuration.service_external_prefixes + service_external_prefixes.Element = AAZStrArg() + + service_load_balancer_prefixes = cls._args_schema.cni_bgp_configuration.service_load_balancer_prefixes + service_load_balancer_prefixes.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.DefaultCniNetworksCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class DefaultCniNetworksCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/defaultCniNetworks/{defaultCniNetworkName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "defaultCniNetworkName", self.ctx.args.default_cni_network_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("extendedLocation", AAZObjectType, ".extended_location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True, "client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + extended_location = _builder.get(".extendedLocation") + if extended_location is not None: + extended_location.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}}) + extended_location.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("cniBgpConfiguration", AAZObjectType, ".cni_bgp_configuration") + properties.set_prop("ipAllocationType", AAZStrType, ".ip_allocation_type") + properties.set_prop("ipv4ConnectedPrefix", AAZStrType, ".ipv4_connected_prefix") + properties.set_prop("ipv6ConnectedPrefix", AAZStrType, ".ipv6_connected_prefix") + properties.set_prop("l3IsolationDomainId", AAZStrType, ".l3_isolation_domain_id", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("vlan", AAZIntType, ".vlan", typ_kwargs={"flags": {"required": True}}) + + cni_bgp_configuration = _builder.get(".properties.cniBgpConfiguration") + if cni_bgp_configuration is not None: + cni_bgp_configuration.set_prop("bgpPeers", AAZListType, ".bgp_peers") + cni_bgp_configuration.set_prop("communityAdvertisements", AAZListType, ".community_advertisements") + cni_bgp_configuration.set_prop("nodeMeshPassword", AAZStrType, ".node_mesh_password", typ_kwargs={"flags": {"secret": True}}) + cni_bgp_configuration.set_prop("serviceExternalPrefixes", AAZListType, ".service_external_prefixes") + cni_bgp_configuration.set_prop("serviceLoadBalancerPrefixes", AAZListType, ".service_load_balancer_prefixes") + + bgp_peers = _builder.get(".properties.cniBgpConfiguration.bgpPeers") + if bgp_peers is not None: + bgp_peers.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.cniBgpConfiguration.bgpPeers[]") + if _elements is not None: + _elements.set_prop("asNumber", AAZIntType, ".as_number", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("password", AAZStrType, ".password", typ_kwargs={"flags": {"secret": True}}) + _elements.set_prop("peerIp", AAZStrType, ".peer_ip", typ_kwargs={"flags": {"required": True}}) + + community_advertisements = _builder.get(".properties.cniBgpConfiguration.communityAdvertisements") + if community_advertisements is not None: + community_advertisements.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.cniBgpConfiguration.communityAdvertisements[]") + if _elements is not None: + _elements.set_prop("communities", AAZListType, ".communities", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("subnetPrefix", AAZStrType, ".subnet_prefix", typ_kwargs={"flags": {"required": True}}) + + communities = _builder.get(".properties.cniBgpConfiguration.communityAdvertisements[].communities") + if communities is not None: + communities.set_elements(AAZStrType, ".") + + service_external_prefixes = _builder.get(".properties.cniBgpConfiguration.serviceExternalPrefixes") + if service_external_prefixes is not None: + service_external_prefixes.set_elements(AAZStrType, ".") + + service_load_balancer_prefixes = _builder.get(".properties.cniBgpConfiguration.serviceLoadBalancerPrefixes") + if service_load_balancer_prefixes is not None: + service_load_balancer_prefixes.set_elements(AAZStrType, ".") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + 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_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200_201.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.cni_as_number = AAZIntType( + serialized_name="cniAsNumber", + flags={"read_only": True}, + ) + properties.cni_bgp_configuration = AAZObjectType( + serialized_name="cniBgpConfiguration", + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.fabric_bgp_peers = AAZListType( + serialized_name="fabricBgpPeers", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + flags={"read_only": True}, + ) + properties.ip_allocation_type = AAZStrType( + serialized_name="ipAllocationType", + ) + properties.ipv4_connected_prefix = AAZStrType( + serialized_name="ipv4ConnectedPrefix", + ) + properties.ipv6_connected_prefix = AAZStrType( + serialized_name="ipv6ConnectedPrefix", + ) + properties.l3_isolation_domain_id = AAZStrType( + serialized_name="l3IsolationDomainId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.vlan = AAZIntType( + flags={"required": True}, + ) + + cni_bgp_configuration = cls._schema_on_200_201.properties.cni_bgp_configuration + cni_bgp_configuration.bgp_peers = AAZListType( + serialized_name="bgpPeers", + ) + cni_bgp_configuration.community_advertisements = AAZListType( + serialized_name="communityAdvertisements", + ) + cni_bgp_configuration.service_external_prefixes = AAZListType( + serialized_name="serviceExternalPrefixes", + ) + cni_bgp_configuration.service_load_balancer_prefixes = AAZListType( + serialized_name="serviceLoadBalancerPrefixes", + ) + + bgp_peers = cls._schema_on_200_201.properties.cni_bgp_configuration.bgp_peers + bgp_peers.Element = AAZObjectType() + _CreateHelper._build_schema_bgp_peer_read(bgp_peers.Element) + + community_advertisements = cls._schema_on_200_201.properties.cni_bgp_configuration.community_advertisements + community_advertisements.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.cni_bgp_configuration.community_advertisements.Element + _element.communities = AAZListType( + flags={"required": True}, + ) + _element.subnet_prefix = AAZStrType( + serialized_name="subnetPrefix", + flags={"required": True}, + ) + + communities = cls._schema_on_200_201.properties.cni_bgp_configuration.community_advertisements.Element.communities + communities.Element = AAZStrType() + + service_external_prefixes = cls._schema_on_200_201.properties.cni_bgp_configuration.service_external_prefixes + service_external_prefixes.Element = AAZStrType() + + service_load_balancer_prefixes = cls._schema_on_200_201.properties.cni_bgp_configuration.service_load_balancer_prefixes + service_load_balancer_prefixes.Element = AAZStrType() + + fabric_bgp_peers = cls._schema_on_200_201.properties.fabric_bgp_peers + fabric_bgp_peers.Element = AAZObjectType() + _CreateHelper._build_schema_bgp_peer_read(fabric_bgp_peers.Element) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200_201.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + _schema_bgp_peer_read = None + + @classmethod + def _build_schema_bgp_peer_read(cls, _schema): + if cls._schema_bgp_peer_read is not None: + _schema.as_number = cls._schema_bgp_peer_read.as_number + _schema.peer_ip = cls._schema_bgp_peer_read.peer_ip + return + + cls._schema_bgp_peer_read = _schema_bgp_peer_read = AAZObjectType() + + bgp_peer_read = _schema_bgp_peer_read + bgp_peer_read.as_number = AAZIntType( + serialized_name="asNumber", + flags={"required": True}, + ) + bgp_peer_read.peer_ip = AAZStrType( + serialized_name="peerIp", + flags={"required": True}, + ) + + _schema.as_number = cls._schema_bgp_peer_read.as_number + _schema.peer_ip = cls._schema_bgp_peer_read.peer_ip + + +__all__ = ["Create"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/_delete.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/_delete.py new file mode 100644 index 00000000000..511228d2850 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/_delete.py @@ -0,0 +1,167 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud defaultcninetwork delete", + is_experimental=True, + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete the provided default CNI network. + + :example: Delete default CNI network + az networkcloud defaultcninetwork delete --name "defaultCniNetworkName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/defaultcninetworks/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.default_cni_network_name = AAZStrArg( + options=["-n", "--name", "--default-cni-network-name"], + help="The name of the default CNI network.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.DefaultCniNetworksDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class DefaultCniNetworksDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/defaultCniNetworks/{defaultCniNetworkName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "defaultCniNetworkName", self.ctx.args.default_cni_network_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/_list.py new file mode 100644 index 00000000000..6be1a6d447a --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/_list.py @@ -0,0 +1,588 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud defaultcninetwork list", + is_experimental=True, +) +class List(AAZCommand): + """List default CNI networks in the provided resource group or subscription. + + :example: List default CNI networks for resource group + az networkcloud defaultcninetwork list --resource-group "resourceGroupName" + + :example: List default CNI networks for subscription + az networkcloud defaultcninetwork list + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.networkcloud/defaultcninetworks", "2022-12-12-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/defaultcninetworks", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) + condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + if condition_0: + self.DefaultCniNetworksListByResourceGroup(ctx=self.ctx)() + if condition_1: + self.DefaultCniNetworksListBySubscription(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class DefaultCniNetworksListByResourceGroup(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/defaultCniNetworks", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.value.Element.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.cni_as_number = AAZIntType( + serialized_name="cniAsNumber", + flags={"read_only": True}, + ) + properties.cni_bgp_configuration = AAZObjectType( + serialized_name="cniBgpConfiguration", + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.fabric_bgp_peers = AAZListType( + serialized_name="fabricBgpPeers", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + flags={"read_only": True}, + ) + properties.ip_allocation_type = AAZStrType( + serialized_name="ipAllocationType", + ) + properties.ipv4_connected_prefix = AAZStrType( + serialized_name="ipv4ConnectedPrefix", + ) + properties.ipv6_connected_prefix = AAZStrType( + serialized_name="ipv6ConnectedPrefix", + ) + properties.l3_isolation_domain_id = AAZStrType( + serialized_name="l3IsolationDomainId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.vlan = AAZIntType( + flags={"required": True}, + ) + + cni_bgp_configuration = cls._schema_on_200.value.Element.properties.cni_bgp_configuration + cni_bgp_configuration.bgp_peers = AAZListType( + serialized_name="bgpPeers", + ) + cni_bgp_configuration.community_advertisements = AAZListType( + serialized_name="communityAdvertisements", + ) + cni_bgp_configuration.service_external_prefixes = AAZListType( + serialized_name="serviceExternalPrefixes", + ) + cni_bgp_configuration.service_load_balancer_prefixes = AAZListType( + serialized_name="serviceLoadBalancerPrefixes", + ) + + bgp_peers = cls._schema_on_200.value.Element.properties.cni_bgp_configuration.bgp_peers + bgp_peers.Element = AAZObjectType() + _ListHelper._build_schema_bgp_peer_read(bgp_peers.Element) + + community_advertisements = cls._schema_on_200.value.Element.properties.cni_bgp_configuration.community_advertisements + community_advertisements.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.cni_bgp_configuration.community_advertisements.Element + _element.communities = AAZListType( + flags={"required": True}, + ) + _element.subnet_prefix = AAZStrType( + serialized_name="subnetPrefix", + flags={"required": True}, + ) + + communities = cls._schema_on_200.value.Element.properties.cni_bgp_configuration.community_advertisements.Element.communities + communities.Element = AAZStrType() + + service_external_prefixes = cls._schema_on_200.value.Element.properties.cni_bgp_configuration.service_external_prefixes + service_external_prefixes.Element = AAZStrType() + + service_load_balancer_prefixes = cls._schema_on_200.value.Element.properties.cni_bgp_configuration.service_load_balancer_prefixes + service_load_balancer_prefixes.Element = AAZStrType() + + fabric_bgp_peers = cls._schema_on_200.value.Element.properties.fabric_bgp_peers + fabric_bgp_peers.Element = AAZObjectType() + _ListHelper._build_schema_bgp_peer_read(fabric_bgp_peers.Element) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200.value.Element.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + class DefaultCniNetworksListBySubscription(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/defaultCniNetworks", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.value.Element.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.cni_as_number = AAZIntType( + serialized_name="cniAsNumber", + flags={"read_only": True}, + ) + properties.cni_bgp_configuration = AAZObjectType( + serialized_name="cniBgpConfiguration", + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.fabric_bgp_peers = AAZListType( + serialized_name="fabricBgpPeers", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + flags={"read_only": True}, + ) + properties.ip_allocation_type = AAZStrType( + serialized_name="ipAllocationType", + ) + properties.ipv4_connected_prefix = AAZStrType( + serialized_name="ipv4ConnectedPrefix", + ) + properties.ipv6_connected_prefix = AAZStrType( + serialized_name="ipv6ConnectedPrefix", + ) + properties.l3_isolation_domain_id = AAZStrType( + serialized_name="l3IsolationDomainId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.vlan = AAZIntType( + flags={"required": True}, + ) + + cni_bgp_configuration = cls._schema_on_200.value.Element.properties.cni_bgp_configuration + cni_bgp_configuration.bgp_peers = AAZListType( + serialized_name="bgpPeers", + ) + cni_bgp_configuration.community_advertisements = AAZListType( + serialized_name="communityAdvertisements", + ) + cni_bgp_configuration.service_external_prefixes = AAZListType( + serialized_name="serviceExternalPrefixes", + ) + cni_bgp_configuration.service_load_balancer_prefixes = AAZListType( + serialized_name="serviceLoadBalancerPrefixes", + ) + + bgp_peers = cls._schema_on_200.value.Element.properties.cni_bgp_configuration.bgp_peers + bgp_peers.Element = AAZObjectType() + _ListHelper._build_schema_bgp_peer_read(bgp_peers.Element) + + community_advertisements = cls._schema_on_200.value.Element.properties.cni_bgp_configuration.community_advertisements + community_advertisements.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.cni_bgp_configuration.community_advertisements.Element + _element.communities = AAZListType( + flags={"required": True}, + ) + _element.subnet_prefix = AAZStrType( + serialized_name="subnetPrefix", + flags={"required": True}, + ) + + communities = cls._schema_on_200.value.Element.properties.cni_bgp_configuration.community_advertisements.Element.communities + communities.Element = AAZStrType() + + service_external_prefixes = cls._schema_on_200.value.Element.properties.cni_bgp_configuration.service_external_prefixes + service_external_prefixes.Element = AAZStrType() + + service_load_balancer_prefixes = cls._schema_on_200.value.Element.properties.cni_bgp_configuration.service_load_balancer_prefixes + service_load_balancer_prefixes.Element = AAZStrType() + + fabric_bgp_peers = cls._schema_on_200.value.Element.properties.fabric_bgp_peers + fabric_bgp_peers.Element = AAZObjectType() + _ListHelper._build_schema_bgp_peer_read(fabric_bgp_peers.Element) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200.value.Element.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + _schema_bgp_peer_read = None + + @classmethod + def _build_schema_bgp_peer_read(cls, _schema): + if cls._schema_bgp_peer_read is not None: + _schema.as_number = cls._schema_bgp_peer_read.as_number + _schema.peer_ip = cls._schema_bgp_peer_read.peer_ip + return + + cls._schema_bgp_peer_read = _schema_bgp_peer_read = AAZObjectType() + + bgp_peer_read = _schema_bgp_peer_read + bgp_peer_read.as_number = AAZIntType( + serialized_name="asNumber", + flags={"required": True}, + ) + bgp_peer_read.peer_ip = AAZStrType( + serialized_name="peerIp", + flags={"required": True}, + ) + + _schema.as_number = cls._schema_bgp_peer_read.as_number + _schema.peer_ip = cls._schema_bgp_peer_read.peer_ip + + +__all__ = ["List"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/_show.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/_show.py new file mode 100644 index 00000000000..a72f1a7f60d --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/_show.py @@ -0,0 +1,346 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud defaultcninetwork show", + is_experimental=True, +) +class Show(AAZCommand): + """Get properties of the provided default CNI network. + + :example: Get default CNI network + az networkcloud defaultcninetwork show --name "defaultCniNetworkName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/defaultcninetworks/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.default_cni_network_name = AAZStrArg( + options=["-n", "--name", "--default-cni-network-name"], + help="The name of the default CNI network.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.DefaultCniNetworksGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class DefaultCniNetworksGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/defaultCniNetworks/{defaultCniNetworkName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "defaultCniNetworkName", self.ctx.args.default_cni_network_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.cni_as_number = AAZIntType( + serialized_name="cniAsNumber", + flags={"read_only": True}, + ) + properties.cni_bgp_configuration = AAZObjectType( + serialized_name="cniBgpConfiguration", + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.fabric_bgp_peers = AAZListType( + serialized_name="fabricBgpPeers", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + flags={"read_only": True}, + ) + properties.ip_allocation_type = AAZStrType( + serialized_name="ipAllocationType", + ) + properties.ipv4_connected_prefix = AAZStrType( + serialized_name="ipv4ConnectedPrefix", + ) + properties.ipv6_connected_prefix = AAZStrType( + serialized_name="ipv6ConnectedPrefix", + ) + properties.l3_isolation_domain_id = AAZStrType( + serialized_name="l3IsolationDomainId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.vlan = AAZIntType( + flags={"required": True}, + ) + + cni_bgp_configuration = cls._schema_on_200.properties.cni_bgp_configuration + cni_bgp_configuration.bgp_peers = AAZListType( + serialized_name="bgpPeers", + ) + cni_bgp_configuration.community_advertisements = AAZListType( + serialized_name="communityAdvertisements", + ) + cni_bgp_configuration.service_external_prefixes = AAZListType( + serialized_name="serviceExternalPrefixes", + ) + cni_bgp_configuration.service_load_balancer_prefixes = AAZListType( + serialized_name="serviceLoadBalancerPrefixes", + ) + + bgp_peers = cls._schema_on_200.properties.cni_bgp_configuration.bgp_peers + bgp_peers.Element = AAZObjectType() + _ShowHelper._build_schema_bgp_peer_read(bgp_peers.Element) + + community_advertisements = cls._schema_on_200.properties.cni_bgp_configuration.community_advertisements + community_advertisements.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.cni_bgp_configuration.community_advertisements.Element + _element.communities = AAZListType( + flags={"required": True}, + ) + _element.subnet_prefix = AAZStrType( + serialized_name="subnetPrefix", + flags={"required": True}, + ) + + communities = cls._schema_on_200.properties.cni_bgp_configuration.community_advertisements.Element.communities + communities.Element = AAZStrType() + + service_external_prefixes = cls._schema_on_200.properties.cni_bgp_configuration.service_external_prefixes + service_external_prefixes.Element = AAZStrType() + + service_load_balancer_prefixes = cls._schema_on_200.properties.cni_bgp_configuration.service_load_balancer_prefixes + service_load_balancer_prefixes.Element = AAZStrType() + + fabric_bgp_peers = cls._schema_on_200.properties.fabric_bgp_peers + fabric_bgp_peers.Element = AAZObjectType() + _ShowHelper._build_schema_bgp_peer_read(fabric_bgp_peers.Element) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + _schema_bgp_peer_read = None + + @classmethod + def _build_schema_bgp_peer_read(cls, _schema): + if cls._schema_bgp_peer_read is not None: + _schema.as_number = cls._schema_bgp_peer_read.as_number + _schema.peer_ip = cls._schema_bgp_peer_read.peer_ip + return + + cls._schema_bgp_peer_read = _schema_bgp_peer_read = AAZObjectType() + + bgp_peer_read = _schema_bgp_peer_read + bgp_peer_read.as_number = AAZIntType( + serialized_name="asNumber", + flags={"required": True}, + ) + bgp_peer_read.peer_ip = AAZStrType( + serialized_name="peerIp", + flags={"required": True}, + ) + + _schema.as_number = cls._schema_bgp_peer_read.as_number + _schema.peer_ip = cls._schema_bgp_peer_read.peer_ip + + +__all__ = ["Show"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/_update.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/_update.py new file mode 100644 index 00000000000..aba1d4c4a4c --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/_update.py @@ -0,0 +1,376 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud defaultcninetwork update", + is_experimental=True, +) +class Update(AAZCommand): + """Update tags associated with the provided default CNI network. + + :example: Update tags for CNI network + az networkcloud defaultcninetwork update --tags key1="myvalue1" key2="myvalue2" --name "defaultCniNetworkName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/defaultcninetworks/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.default_cni_network_name = AAZStrArg( + options=["-n", "--name", "--default-cni-network-name"], + help="The name of the default CNI network.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "DefaultCniNetworkUpdateParameters" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="DefaultCniNetworkUpdateParameters", + help="The Azure resource tags that will replace the existing ones.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.DefaultCniNetworksUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class DefaultCniNetworksUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/defaultCniNetworks/{defaultCniNetworkName}", + **self.url_parameters + ) + + @property + def method(self): + return "PATCH" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "defaultCniNetworkName", self.ctx.args.default_cni_network_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"client_flatten": True}} + ) + _builder.set_prop("tags", AAZDictType, ".tags") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.cni_as_number = AAZIntType( + serialized_name="cniAsNumber", + flags={"read_only": True}, + ) + properties.cni_bgp_configuration = AAZObjectType( + serialized_name="cniBgpConfiguration", + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.fabric_bgp_peers = AAZListType( + serialized_name="fabricBgpPeers", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + flags={"read_only": True}, + ) + properties.ip_allocation_type = AAZStrType( + serialized_name="ipAllocationType", + ) + properties.ipv4_connected_prefix = AAZStrType( + serialized_name="ipv4ConnectedPrefix", + ) + properties.ipv6_connected_prefix = AAZStrType( + serialized_name="ipv6ConnectedPrefix", + ) + properties.l3_isolation_domain_id = AAZStrType( + serialized_name="l3IsolationDomainId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.vlan = AAZIntType( + flags={"required": True}, + ) + + cni_bgp_configuration = cls._schema_on_200.properties.cni_bgp_configuration + cni_bgp_configuration.bgp_peers = AAZListType( + serialized_name="bgpPeers", + ) + cni_bgp_configuration.community_advertisements = AAZListType( + serialized_name="communityAdvertisements", + ) + cni_bgp_configuration.service_external_prefixes = AAZListType( + serialized_name="serviceExternalPrefixes", + ) + cni_bgp_configuration.service_load_balancer_prefixes = AAZListType( + serialized_name="serviceLoadBalancerPrefixes", + ) + + bgp_peers = cls._schema_on_200.properties.cni_bgp_configuration.bgp_peers + bgp_peers.Element = AAZObjectType() + _UpdateHelper._build_schema_bgp_peer_read(bgp_peers.Element) + + community_advertisements = cls._schema_on_200.properties.cni_bgp_configuration.community_advertisements + community_advertisements.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.cni_bgp_configuration.community_advertisements.Element + _element.communities = AAZListType( + flags={"required": True}, + ) + _element.subnet_prefix = AAZStrType( + serialized_name="subnetPrefix", + flags={"required": True}, + ) + + communities = cls._schema_on_200.properties.cni_bgp_configuration.community_advertisements.Element.communities + communities.Element = AAZStrType() + + service_external_prefixes = cls._schema_on_200.properties.cni_bgp_configuration.service_external_prefixes + service_external_prefixes.Element = AAZStrType() + + service_load_balancer_prefixes = cls._schema_on_200.properties.cni_bgp_configuration.service_load_balancer_prefixes + service_load_balancer_prefixes.Element = AAZStrType() + + fabric_bgp_peers = cls._schema_on_200.properties.fabric_bgp_peers + fabric_bgp_peers.Element = AAZObjectType() + _UpdateHelper._build_schema_bgp_peer_read(fabric_bgp_peers.Element) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _UpdateHelper: + """Helper class for Update""" + + _schema_bgp_peer_read = None + + @classmethod + def _build_schema_bgp_peer_read(cls, _schema): + if cls._schema_bgp_peer_read is not None: + _schema.as_number = cls._schema_bgp_peer_read.as_number + _schema.peer_ip = cls._schema_bgp_peer_read.peer_ip + return + + cls._schema_bgp_peer_read = _schema_bgp_peer_read = AAZObjectType() + + bgp_peer_read = _schema_bgp_peer_read + bgp_peer_read.as_number = AAZIntType( + serialized_name="asNumber", + flags={"required": True}, + ) + bgp_peer_read.peer_ip = AAZStrType( + serialized_name="peerIp", + flags={"required": True}, + ) + + _schema.as_number = cls._schema_bgp_peer_read.as_number + _schema.peer_ip = cls._schema_bgp_peer_read.peer_ip + + +__all__ = ["Update"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/_wait.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/_wait.py new file mode 100644 index 00000000000..6e99d2b1335 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/defaultcninetwork/_wait.py @@ -0,0 +1,341 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud defaultcninetwork wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/defaultcninetworks/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.default_cni_network_name = AAZStrArg( + options=["-n", "--name", "--default-cni-network-name"], + help="The name of the default CNI network.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.DefaultCniNetworksGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) + return result + + class DefaultCniNetworksGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/defaultCniNetworks/{defaultCniNetworkName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "defaultCniNetworkName", self.ctx.args.default_cni_network_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.cni_as_number = AAZIntType( + serialized_name="cniAsNumber", + flags={"read_only": True}, + ) + properties.cni_bgp_configuration = AAZObjectType( + serialized_name="cniBgpConfiguration", + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.fabric_bgp_peers = AAZListType( + serialized_name="fabricBgpPeers", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + flags={"read_only": True}, + ) + properties.ip_allocation_type = AAZStrType( + serialized_name="ipAllocationType", + ) + properties.ipv4_connected_prefix = AAZStrType( + serialized_name="ipv4ConnectedPrefix", + ) + properties.ipv6_connected_prefix = AAZStrType( + serialized_name="ipv6ConnectedPrefix", + ) + properties.l3_isolation_domain_id = AAZStrType( + serialized_name="l3IsolationDomainId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.vlan = AAZIntType( + flags={"required": True}, + ) + + cni_bgp_configuration = cls._schema_on_200.properties.cni_bgp_configuration + cni_bgp_configuration.bgp_peers = AAZListType( + serialized_name="bgpPeers", + ) + cni_bgp_configuration.community_advertisements = AAZListType( + serialized_name="communityAdvertisements", + ) + cni_bgp_configuration.service_external_prefixes = AAZListType( + serialized_name="serviceExternalPrefixes", + ) + cni_bgp_configuration.service_load_balancer_prefixes = AAZListType( + serialized_name="serviceLoadBalancerPrefixes", + ) + + bgp_peers = cls._schema_on_200.properties.cni_bgp_configuration.bgp_peers + bgp_peers.Element = AAZObjectType() + _WaitHelper._build_schema_bgp_peer_read(bgp_peers.Element) + + community_advertisements = cls._schema_on_200.properties.cni_bgp_configuration.community_advertisements + community_advertisements.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.cni_bgp_configuration.community_advertisements.Element + _element.communities = AAZListType( + flags={"required": True}, + ) + _element.subnet_prefix = AAZStrType( + serialized_name="subnetPrefix", + flags={"required": True}, + ) + + communities = cls._schema_on_200.properties.cni_bgp_configuration.community_advertisements.Element.communities + communities.Element = AAZStrType() + + service_external_prefixes = cls._schema_on_200.properties.cni_bgp_configuration.service_external_prefixes + service_external_prefixes.Element = AAZStrType() + + service_load_balancer_prefixes = cls._schema_on_200.properties.cni_bgp_configuration.service_load_balancer_prefixes + service_load_balancer_prefixes.Element = AAZStrType() + + fabric_bgp_peers = cls._schema_on_200.properties.fabric_bgp_peers + fabric_bgp_peers.Element = AAZObjectType() + _WaitHelper._build_schema_bgp_peer_read(fabric_bgp_peers.Element) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + _schema_bgp_peer_read = None + + @classmethod + def _build_schema_bgp_peer_read(cls, _schema): + if cls._schema_bgp_peer_read is not None: + _schema.as_number = cls._schema_bgp_peer_read.as_number + _schema.peer_ip = cls._schema_bgp_peer_read.peer_ip + return + + cls._schema_bgp_peer_read = _schema_bgp_peer_read = AAZObjectType() + + bgp_peer_read = _schema_bgp_peer_read + bgp_peer_read.as_number = AAZIntType( + serialized_name="asNumber", + flags={"required": True}, + ) + bgp_peer_read.peer_ip = AAZStrType( + serialized_name="peerIp", + flags={"required": True}, + ) + + _schema.as_number = cls._schema_bgp_peer_read.as_number + _schema.peer_ip = cls._schema_bgp_peer_read.peer_ip + + +__all__ = ["Wait"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/hybridakscluster/__cmd_group.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/hybridakscluster/__cmd_group.py new file mode 100644 index 00000000000..ccbeea9f1f1 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/hybridakscluster/__cmd_group.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "networkcloud hybridakscluster", + is_experimental=True, +) +class __CMDGroup(AAZCommandGroup): + """Manage additional details of Hybrid AKS provisioned cluster + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/hybridakscluster/__init__.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/hybridakscluster/__init__.py new file mode 100644 index 00000000000..dde9234848c --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/hybridakscluster/__init__.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._list import * +from ._restart_node import * +from ._show import * +from ._update import * +from ._wait import * diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/hybridakscluster/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/hybridakscluster/_list.py new file mode 100644 index 00000000000..10a6d40da4e --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/hybridakscluster/_list.py @@ -0,0 +1,619 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud hybridakscluster list", + is_experimental=True, +) +class List(AAZCommand): + """List additional details related to Hybrid AKS provisioned clusters in the provided resource group or subscription. + + :example: List Hybrid AKS provisioned clusters data for resource group + az networkcloud hybridakscluster list --resource-group "resourceGroupName" + + :example: List Hybrid AKS provisioned clusters data for subscription + az networkcloud hybridakscluster list + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.networkcloud/hybridaksclusters", "2022-12-12-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/hybridaksclusters", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) + condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + if condition_0: + self.HybridAksClustersListByResourceGroup(ctx=self.ctx)() + if condition_1: + self.HybridAksClustersListBySubscription(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class HybridAksClustersListByResourceGroup(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/hybridAksClusters", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.value.Element.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.associated_network_ids = AAZListType( + serialized_name="associatedNetworkIds", + flags={"required": True}, + ) + properties.cloud_services_network_id = AAZStrType( + serialized_name="cloudServicesNetworkId", + flags={"read_only": True}, + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.control_plane_count = AAZIntType( + serialized_name="controlPlaneCount", + flags={"required": True}, + ) + properties.control_plane_nodes = AAZListType( + serialized_name="controlPlaneNodes", + flags={"read_only": True}, + ) + properties.default_cni_network_id = AAZStrType( + serialized_name="defaultCniNetworkId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hybrid_aks_provisioned_cluster_id = AAZStrType( + serialized_name="hybridAksProvisionedClusterId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.volumes = AAZListType( + flags={"read_only": True}, + ) + properties.worker_count = AAZIntType( + serialized_name="workerCount", + flags={"required": True}, + ) + properties.worker_nodes = AAZListType( + serialized_name="workerNodes", + flags={"read_only": True}, + ) + + associated_network_ids = cls._schema_on_200.value.Element.properties.associated_network_ids + associated_network_ids.Element = AAZStrType() + + control_plane_nodes = cls._schema_on_200.value.Element.properties.control_plane_nodes + control_plane_nodes.Element = AAZObjectType() + _ListHelper._build_schema_node_configuration_read(control_plane_nodes.Element) + + volumes = cls._schema_on_200.value.Element.properties.volumes + volumes.Element = AAZStrType() + + worker_nodes = cls._schema_on_200.value.Element.properties.worker_nodes + worker_nodes.Element = AAZObjectType() + _ListHelper._build_schema_node_configuration_read(worker_nodes.Element) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + class HybridAksClustersListBySubscription(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/hybridAksClusters", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.value.Element.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.associated_network_ids = AAZListType( + serialized_name="associatedNetworkIds", + flags={"required": True}, + ) + properties.cloud_services_network_id = AAZStrType( + serialized_name="cloudServicesNetworkId", + flags={"read_only": True}, + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.control_plane_count = AAZIntType( + serialized_name="controlPlaneCount", + flags={"required": True}, + ) + properties.control_plane_nodes = AAZListType( + serialized_name="controlPlaneNodes", + flags={"read_only": True}, + ) + properties.default_cni_network_id = AAZStrType( + serialized_name="defaultCniNetworkId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hybrid_aks_provisioned_cluster_id = AAZStrType( + serialized_name="hybridAksProvisionedClusterId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.volumes = AAZListType( + flags={"read_only": True}, + ) + properties.worker_count = AAZIntType( + serialized_name="workerCount", + flags={"required": True}, + ) + properties.worker_nodes = AAZListType( + serialized_name="workerNodes", + flags={"read_only": True}, + ) + + associated_network_ids = cls._schema_on_200.value.Element.properties.associated_network_ids + associated_network_ids.Element = AAZStrType() + + control_plane_nodes = cls._schema_on_200.value.Element.properties.control_plane_nodes + control_plane_nodes.Element = AAZObjectType() + _ListHelper._build_schema_node_configuration_read(control_plane_nodes.Element) + + volumes = cls._schema_on_200.value.Element.properties.volumes + volumes.Element = AAZStrType() + + worker_nodes = cls._schema_on_200.value.Element.properties.worker_nodes + worker_nodes.Element = AAZObjectType() + _ListHelper._build_schema_node_configuration_read(worker_nodes.Element) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + _schema_node_configuration_read = None + + @classmethod + def _build_schema_node_configuration_read(cls, _schema): + if cls._schema_node_configuration_read is not None: + _schema.agent_pool_id = cls._schema_node_configuration_read.agent_pool_id + _schema.agent_pool_name = cls._schema_node_configuration_read.agent_pool_name + _schema.cpu_cores = cls._schema_node_configuration_read.cpu_cores + _schema.disk_size_gb = cls._schema_node_configuration_read.disk_size_gb + _schema.memory_size_gb = cls._schema_node_configuration_read.memory_size_gb + _schema.node_pool_name = cls._schema_node_configuration_read.node_pool_name + _schema.nodes = cls._schema_node_configuration_read.nodes + _schema.vm_count = cls._schema_node_configuration_read.vm_count + _schema.vm_size = cls._schema_node_configuration_read.vm_size + return + + cls._schema_node_configuration_read = _schema_node_configuration_read = AAZObjectType() + + node_configuration_read = _schema_node_configuration_read + node_configuration_read.agent_pool_id = AAZStrType( + serialized_name="agentPoolId", + flags={"read_only": True}, + ) + node_configuration_read.agent_pool_name = AAZStrType( + serialized_name="agentPoolName", + flags={"read_only": True}, + ) + node_configuration_read.cpu_cores = AAZIntType( + serialized_name="cpuCores", + flags={"read_only": True}, + ) + node_configuration_read.disk_size_gb = AAZIntType( + serialized_name="diskSizeGB", + flags={"read_only": True}, + ) + node_configuration_read.memory_size_gb = AAZIntType( + serialized_name="memorySizeGB", + flags={"read_only": True}, + ) + node_configuration_read.node_pool_name = AAZStrType( + serialized_name="nodePoolName", + flags={"read_only": True}, + ) + node_configuration_read.nodes = AAZListType( + flags={"read_only": True}, + ) + node_configuration_read.vm_count = AAZIntType( + serialized_name="vmCount", + flags={"read_only": True}, + ) + node_configuration_read.vm_size = AAZStrType( + serialized_name="vmSize", + flags={"read_only": True}, + ) + + nodes = _schema_node_configuration_read.nodes + nodes.Element = AAZObjectType() + + _element = _schema_node_configuration_read.nodes.Element + _element.bare_metal_machine_id = AAZStrType( + serialized_name="bareMetalMachineId", + flags={"read_only": True}, + ) + _element.image_id = AAZStrType( + serialized_name="imageId", + flags={"read_only": True}, + ) + _element.network_attachments = AAZListType( + serialized_name="networkAttachments", + flags={"read_only": True}, + ) + _element.node_name = AAZStrType( + serialized_name="nodeName", + flags={"read_only": True}, + ) + _element.power_state = AAZStrType( + serialized_name="powerState", + flags={"read_only": True}, + ) + + network_attachments = _schema_node_configuration_read.nodes.Element.network_attachments + network_attachments.Element = AAZObjectType() + + _element = _schema_node_configuration_read.nodes.Element.network_attachments.Element + _element.attached_network_id = AAZStrType( + serialized_name="attachedNetworkId", + flags={"required": True}, + ) + _element.default_gateway = AAZStrType( + serialized_name="defaultGateway", + ) + _element.ip_allocation_method = AAZStrType( + serialized_name="ipAllocationMethod", + flags={"required": True}, + ) + _element.ipv4_address = AAZStrType( + serialized_name="ipv4Address", + ) + _element.ipv6_address = AAZStrType( + serialized_name="ipv6Address", + ) + _element.mac_address = AAZStrType( + serialized_name="macAddress", + flags={"read_only": True}, + ) + _element.network_attachment_name = AAZStrType( + serialized_name="networkAttachmentName", + ) + + _schema.agent_pool_id = cls._schema_node_configuration_read.agent_pool_id + _schema.agent_pool_name = cls._schema_node_configuration_read.agent_pool_name + _schema.cpu_cores = cls._schema_node_configuration_read.cpu_cores + _schema.disk_size_gb = cls._schema_node_configuration_read.disk_size_gb + _schema.memory_size_gb = cls._schema_node_configuration_read.memory_size_gb + _schema.node_pool_name = cls._schema_node_configuration_read.node_pool_name + _schema.nodes = cls._schema_node_configuration_read.nodes + _schema.vm_count = cls._schema_node_configuration_read.vm_count + _schema.vm_size = cls._schema_node_configuration_read.vm_size + + +__all__ = ["List"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/hybridakscluster/_restart_node.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/hybridakscluster/_restart_node.py new file mode 100644 index 00000000000..96e2b3e416c --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/hybridakscluster/_restart_node.py @@ -0,0 +1,325 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud hybridakscluster restart-node", + is_experimental=True, +) +class RestartNode(AAZCommand): + """Restart a targeted node of the Hybrid AKS provisioned cluster. + + :example: Restart a Hybrid AKS cluster node + az networkcloud hybridakscluster restart-node --name "hybridAksClusterName" --node-name "nodeName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/hybridaksclusters/{}/restartnode", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.hybrid_aks_cluster_name = AAZStrArg( + options=["-n", "--name", "--hybrid-aks-cluster-name"], + help="The name of the Hybrid AKS cluster.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,61}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "HybridAksClusterRestartNodeParameters" + + _args_schema = cls._args_schema + _args_schema.node_name = AAZStrArg( + options=["--node-name"], + arg_group="HybridAksClusterRestartNodeParameters", + help="The name of the node to restart.", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.HybridAksClustersRestartNode(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class HybridAksClustersRestartNode(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/hybridAksClusters/{hybridAksClusterName}/restartNode", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "hybridAksClusterName", self.ctx.args.hybrid_aks_cluster_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("nodeName", AAZStrType, ".node_name", typ_kwargs={"flags": {"required": True}}) + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _RestartNodeHelper._build_schema_operation_status_result_read(cls._schema_on_200) + + return cls._schema_on_200 + + def on_204(self, session): + pass + + +class _RestartNodeHelper: + """Helper class for RestartNode""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType() + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + _schema_operation_status_result_read = None + + @classmethod + def _build_schema_operation_status_result_read(cls, _schema): + if cls._schema_operation_status_result_read is not None: + _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.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 + return + + cls._schema_operation_status_result_read = _schema_operation_status_result_read = AAZObjectType() + + operation_status_result_read = _schema_operation_status_result_read + operation_status_result_read.end_time = AAZStrType( + serialized_name="endTime", + ) + 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.percent_complete = AAZFloatType( + serialized_name="percentComplete", + ) + operation_status_result_read.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"read_only": True}, + ) + operation_status_result_read.start_time = AAZStrType( + serialized_name="startTime", + ) + operation_status_result_read.status = AAZStrType( + flags={"required": True}, + ) + + operations = _schema_operation_status_result_read.operations + operations.Element = AAZObjectType() + cls._build_schema_operation_status_result_read(operations.Element) + + _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.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 + + +__all__ = ["RestartNode"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/hybridakscluster/_show.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/hybridakscluster/_show.py new file mode 100644 index 00000000000..98ab31db8dc --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/hybridakscluster/_show.py @@ -0,0 +1,409 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud hybridakscluster show", + is_experimental=True, +) +class Show(AAZCommand): + """Get the additional details related to the provided Hybrid AKS provisioned cluster. + + :example: Get Hybrid AKS provisioned cluster data + az networkcloud hybridakscluster show --name "hybridAksClusterName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/hybridaksclusters/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.hybrid_aks_cluster_name = AAZStrArg( + options=["-n", "--name", "--hybrid-aks-cluster-name"], + help="The name of the Hybrid AKS cluster.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,61}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.HybridAksClustersGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class HybridAksClustersGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/hybridAksClusters/{hybridAksClusterName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "hybridAksClusterName", self.ctx.args.hybrid_aks_cluster_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.associated_network_ids = AAZListType( + serialized_name="associatedNetworkIds", + flags={"required": True}, + ) + properties.cloud_services_network_id = AAZStrType( + serialized_name="cloudServicesNetworkId", + flags={"read_only": True}, + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.control_plane_count = AAZIntType( + serialized_name="controlPlaneCount", + flags={"required": True}, + ) + properties.control_plane_nodes = AAZListType( + serialized_name="controlPlaneNodes", + flags={"read_only": True}, + ) + properties.default_cni_network_id = AAZStrType( + serialized_name="defaultCniNetworkId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hybrid_aks_provisioned_cluster_id = AAZStrType( + serialized_name="hybridAksProvisionedClusterId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.volumes = AAZListType( + flags={"read_only": True}, + ) + properties.worker_count = AAZIntType( + serialized_name="workerCount", + flags={"required": True}, + ) + properties.worker_nodes = AAZListType( + serialized_name="workerNodes", + flags={"read_only": True}, + ) + + associated_network_ids = cls._schema_on_200.properties.associated_network_ids + associated_network_ids.Element = AAZStrType() + + control_plane_nodes = cls._schema_on_200.properties.control_plane_nodes + control_plane_nodes.Element = AAZObjectType() + _ShowHelper._build_schema_node_configuration_read(control_plane_nodes.Element) + + volumes = cls._schema_on_200.properties.volumes + volumes.Element = AAZStrType() + + worker_nodes = cls._schema_on_200.properties.worker_nodes + worker_nodes.Element = AAZObjectType() + _ShowHelper._build_schema_node_configuration_read(worker_nodes.Element) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + _schema_node_configuration_read = None + + @classmethod + def _build_schema_node_configuration_read(cls, _schema): + if cls._schema_node_configuration_read is not None: + _schema.agent_pool_id = cls._schema_node_configuration_read.agent_pool_id + _schema.agent_pool_name = cls._schema_node_configuration_read.agent_pool_name + _schema.cpu_cores = cls._schema_node_configuration_read.cpu_cores + _schema.disk_size_gb = cls._schema_node_configuration_read.disk_size_gb + _schema.memory_size_gb = cls._schema_node_configuration_read.memory_size_gb + _schema.node_pool_name = cls._schema_node_configuration_read.node_pool_name + _schema.nodes = cls._schema_node_configuration_read.nodes + _schema.vm_count = cls._schema_node_configuration_read.vm_count + _schema.vm_size = cls._schema_node_configuration_read.vm_size + return + + cls._schema_node_configuration_read = _schema_node_configuration_read = AAZObjectType() + + node_configuration_read = _schema_node_configuration_read + node_configuration_read.agent_pool_id = AAZStrType( + serialized_name="agentPoolId", + flags={"read_only": True}, + ) + node_configuration_read.agent_pool_name = AAZStrType( + serialized_name="agentPoolName", + flags={"read_only": True}, + ) + node_configuration_read.cpu_cores = AAZIntType( + serialized_name="cpuCores", + flags={"read_only": True}, + ) + node_configuration_read.disk_size_gb = AAZIntType( + serialized_name="diskSizeGB", + flags={"read_only": True}, + ) + node_configuration_read.memory_size_gb = AAZIntType( + serialized_name="memorySizeGB", + flags={"read_only": True}, + ) + node_configuration_read.node_pool_name = AAZStrType( + serialized_name="nodePoolName", + flags={"read_only": True}, + ) + node_configuration_read.nodes = AAZListType( + flags={"read_only": True}, + ) + node_configuration_read.vm_count = AAZIntType( + serialized_name="vmCount", + flags={"read_only": True}, + ) + node_configuration_read.vm_size = AAZStrType( + serialized_name="vmSize", + flags={"read_only": True}, + ) + + nodes = _schema_node_configuration_read.nodes + nodes.Element = AAZObjectType() + + _element = _schema_node_configuration_read.nodes.Element + _element.bare_metal_machine_id = AAZStrType( + serialized_name="bareMetalMachineId", + flags={"read_only": True}, + ) + _element.image_id = AAZStrType( + serialized_name="imageId", + flags={"read_only": True}, + ) + _element.network_attachments = AAZListType( + serialized_name="networkAttachments", + flags={"read_only": True}, + ) + _element.node_name = AAZStrType( + serialized_name="nodeName", + flags={"read_only": True}, + ) + _element.power_state = AAZStrType( + serialized_name="powerState", + flags={"read_only": True}, + ) + + network_attachments = _schema_node_configuration_read.nodes.Element.network_attachments + network_attachments.Element = AAZObjectType() + + _element = _schema_node_configuration_read.nodes.Element.network_attachments.Element + _element.attached_network_id = AAZStrType( + serialized_name="attachedNetworkId", + flags={"required": True}, + ) + _element.default_gateway = AAZStrType( + serialized_name="defaultGateway", + ) + _element.ip_allocation_method = AAZStrType( + serialized_name="ipAllocationMethod", + flags={"required": True}, + ) + _element.ipv4_address = AAZStrType( + serialized_name="ipv4Address", + ) + _element.ipv6_address = AAZStrType( + serialized_name="ipv6Address", + ) + _element.mac_address = AAZStrType( + serialized_name="macAddress", + flags={"read_only": True}, + ) + _element.network_attachment_name = AAZStrType( + serialized_name="networkAttachmentName", + ) + + _schema.agent_pool_id = cls._schema_node_configuration_read.agent_pool_id + _schema.agent_pool_name = cls._schema_node_configuration_read.agent_pool_name + _schema.cpu_cores = cls._schema_node_configuration_read.cpu_cores + _schema.disk_size_gb = cls._schema_node_configuration_read.disk_size_gb + _schema.memory_size_gb = cls._schema_node_configuration_read.memory_size_gb + _schema.node_pool_name = cls._schema_node_configuration_read.node_pool_name + _schema.nodes = cls._schema_node_configuration_read.nodes + _schema.vm_count = cls._schema_node_configuration_read.vm_count + _schema.vm_size = cls._schema_node_configuration_read.vm_size + + +__all__ = ["Show"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/hybridakscluster/_update.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/hybridakscluster/_update.py new file mode 100644 index 00000000000..ba277cd6a89 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/hybridakscluster/_update.py @@ -0,0 +1,439 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud hybridakscluster update", + is_experimental=True, +) +class Update(AAZCommand): + """Update tags associated with the additional details related to the Hybrid AKS provisioned cluster. + + :example: Update tags for Hybrid AKS provisioned cluster data + az networkcloud hybridakscluster update --name "hybridAksClusterName" --tags key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/hybridaksclusters/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.hybrid_aks_cluster_name = AAZStrArg( + options=["-n", "--name", "--hybrid-aks-cluster-name"], + help="The name of the Hybrid AKS cluster.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,61}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "HybridAksClusterUpdateParameters" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="HybridAksClusterUpdateParameters", + help="The Azure resource tags that will replace the existing ones.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.HybridAksClustersUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class HybridAksClustersUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/hybridAksClusters/{hybridAksClusterName}", + **self.url_parameters + ) + + @property + def method(self): + return "PATCH" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "hybridAksClusterName", self.ctx.args.hybrid_aks_cluster_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"client_flatten": True}} + ) + _builder.set_prop("tags", AAZDictType, ".tags") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.associated_network_ids = AAZListType( + serialized_name="associatedNetworkIds", + flags={"required": True}, + ) + properties.cloud_services_network_id = AAZStrType( + serialized_name="cloudServicesNetworkId", + flags={"read_only": True}, + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.control_plane_count = AAZIntType( + serialized_name="controlPlaneCount", + flags={"required": True}, + ) + properties.control_plane_nodes = AAZListType( + serialized_name="controlPlaneNodes", + flags={"read_only": True}, + ) + properties.default_cni_network_id = AAZStrType( + serialized_name="defaultCniNetworkId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hybrid_aks_provisioned_cluster_id = AAZStrType( + serialized_name="hybridAksProvisionedClusterId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.volumes = AAZListType( + flags={"read_only": True}, + ) + properties.worker_count = AAZIntType( + serialized_name="workerCount", + flags={"required": True}, + ) + properties.worker_nodes = AAZListType( + serialized_name="workerNodes", + flags={"read_only": True}, + ) + + associated_network_ids = cls._schema_on_200.properties.associated_network_ids + associated_network_ids.Element = AAZStrType() + + control_plane_nodes = cls._schema_on_200.properties.control_plane_nodes + control_plane_nodes.Element = AAZObjectType() + _UpdateHelper._build_schema_node_configuration_read(control_plane_nodes.Element) + + volumes = cls._schema_on_200.properties.volumes + volumes.Element = AAZStrType() + + worker_nodes = cls._schema_on_200.properties.worker_nodes + worker_nodes.Element = AAZObjectType() + _UpdateHelper._build_schema_node_configuration_read(worker_nodes.Element) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _UpdateHelper: + """Helper class for Update""" + + _schema_node_configuration_read = None + + @classmethod + def _build_schema_node_configuration_read(cls, _schema): + if cls._schema_node_configuration_read is not None: + _schema.agent_pool_id = cls._schema_node_configuration_read.agent_pool_id + _schema.agent_pool_name = cls._schema_node_configuration_read.agent_pool_name + _schema.cpu_cores = cls._schema_node_configuration_read.cpu_cores + _schema.disk_size_gb = cls._schema_node_configuration_read.disk_size_gb + _schema.memory_size_gb = cls._schema_node_configuration_read.memory_size_gb + _schema.node_pool_name = cls._schema_node_configuration_read.node_pool_name + _schema.nodes = cls._schema_node_configuration_read.nodes + _schema.vm_count = cls._schema_node_configuration_read.vm_count + _schema.vm_size = cls._schema_node_configuration_read.vm_size + return + + cls._schema_node_configuration_read = _schema_node_configuration_read = AAZObjectType() + + node_configuration_read = _schema_node_configuration_read + node_configuration_read.agent_pool_id = AAZStrType( + serialized_name="agentPoolId", + flags={"read_only": True}, + ) + node_configuration_read.agent_pool_name = AAZStrType( + serialized_name="agentPoolName", + flags={"read_only": True}, + ) + node_configuration_read.cpu_cores = AAZIntType( + serialized_name="cpuCores", + flags={"read_only": True}, + ) + node_configuration_read.disk_size_gb = AAZIntType( + serialized_name="diskSizeGB", + flags={"read_only": True}, + ) + node_configuration_read.memory_size_gb = AAZIntType( + serialized_name="memorySizeGB", + flags={"read_only": True}, + ) + node_configuration_read.node_pool_name = AAZStrType( + serialized_name="nodePoolName", + flags={"read_only": True}, + ) + node_configuration_read.nodes = AAZListType( + flags={"read_only": True}, + ) + node_configuration_read.vm_count = AAZIntType( + serialized_name="vmCount", + flags={"read_only": True}, + ) + node_configuration_read.vm_size = AAZStrType( + serialized_name="vmSize", + flags={"read_only": True}, + ) + + nodes = _schema_node_configuration_read.nodes + nodes.Element = AAZObjectType() + + _element = _schema_node_configuration_read.nodes.Element + _element.bare_metal_machine_id = AAZStrType( + serialized_name="bareMetalMachineId", + flags={"read_only": True}, + ) + _element.image_id = AAZStrType( + serialized_name="imageId", + flags={"read_only": True}, + ) + _element.network_attachments = AAZListType( + serialized_name="networkAttachments", + flags={"read_only": True}, + ) + _element.node_name = AAZStrType( + serialized_name="nodeName", + flags={"read_only": True}, + ) + _element.power_state = AAZStrType( + serialized_name="powerState", + flags={"read_only": True}, + ) + + network_attachments = _schema_node_configuration_read.nodes.Element.network_attachments + network_attachments.Element = AAZObjectType() + + _element = _schema_node_configuration_read.nodes.Element.network_attachments.Element + _element.attached_network_id = AAZStrType( + serialized_name="attachedNetworkId", + flags={"required": True}, + ) + _element.default_gateway = AAZStrType( + serialized_name="defaultGateway", + ) + _element.ip_allocation_method = AAZStrType( + serialized_name="ipAllocationMethod", + flags={"required": True}, + ) + _element.ipv4_address = AAZStrType( + serialized_name="ipv4Address", + ) + _element.ipv6_address = AAZStrType( + serialized_name="ipv6Address", + ) + _element.mac_address = AAZStrType( + serialized_name="macAddress", + flags={"read_only": True}, + ) + _element.network_attachment_name = AAZStrType( + serialized_name="networkAttachmentName", + ) + + _schema.agent_pool_id = cls._schema_node_configuration_read.agent_pool_id + _schema.agent_pool_name = cls._schema_node_configuration_read.agent_pool_name + _schema.cpu_cores = cls._schema_node_configuration_read.cpu_cores + _schema.disk_size_gb = cls._schema_node_configuration_read.disk_size_gb + _schema.memory_size_gb = cls._schema_node_configuration_read.memory_size_gb + _schema.node_pool_name = cls._schema_node_configuration_read.node_pool_name + _schema.nodes = cls._schema_node_configuration_read.nodes + _schema.vm_count = cls._schema_node_configuration_read.vm_count + _schema.vm_size = cls._schema_node_configuration_read.vm_size + + +__all__ = ["Update"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/hybridakscluster/_wait.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/hybridakscluster/_wait.py new file mode 100644 index 00000000000..605b38e8bec --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/hybridakscluster/_wait.py @@ -0,0 +1,404 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud hybridakscluster wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/hybridaksclusters/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.hybrid_aks_cluster_name = AAZStrArg( + options=["-n", "--name", "--hybrid-aks-cluster-name"], + help="The name of the Hybrid AKS cluster.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,61}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.HybridAksClustersGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) + return result + + class HybridAksClustersGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/hybridAksClusters/{hybridAksClusterName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "hybridAksClusterName", self.ctx.args.hybrid_aks_cluster_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.associated_network_ids = AAZListType( + serialized_name="associatedNetworkIds", + flags={"required": True}, + ) + properties.cloud_services_network_id = AAZStrType( + serialized_name="cloudServicesNetworkId", + flags={"read_only": True}, + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.control_plane_count = AAZIntType( + serialized_name="controlPlaneCount", + flags={"required": True}, + ) + properties.control_plane_nodes = AAZListType( + serialized_name="controlPlaneNodes", + flags={"read_only": True}, + ) + properties.default_cni_network_id = AAZStrType( + serialized_name="defaultCniNetworkId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hybrid_aks_provisioned_cluster_id = AAZStrType( + serialized_name="hybridAksProvisionedClusterId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.volumes = AAZListType( + flags={"read_only": True}, + ) + properties.worker_count = AAZIntType( + serialized_name="workerCount", + flags={"required": True}, + ) + properties.worker_nodes = AAZListType( + serialized_name="workerNodes", + flags={"read_only": True}, + ) + + associated_network_ids = cls._schema_on_200.properties.associated_network_ids + associated_network_ids.Element = AAZStrType() + + control_plane_nodes = cls._schema_on_200.properties.control_plane_nodes + control_plane_nodes.Element = AAZObjectType() + _WaitHelper._build_schema_node_configuration_read(control_plane_nodes.Element) + + volumes = cls._schema_on_200.properties.volumes + volumes.Element = AAZStrType() + + worker_nodes = cls._schema_on_200.properties.worker_nodes + worker_nodes.Element = AAZObjectType() + _WaitHelper._build_schema_node_configuration_read(worker_nodes.Element) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + _schema_node_configuration_read = None + + @classmethod + def _build_schema_node_configuration_read(cls, _schema): + if cls._schema_node_configuration_read is not None: + _schema.agent_pool_id = cls._schema_node_configuration_read.agent_pool_id + _schema.agent_pool_name = cls._schema_node_configuration_read.agent_pool_name + _schema.cpu_cores = cls._schema_node_configuration_read.cpu_cores + _schema.disk_size_gb = cls._schema_node_configuration_read.disk_size_gb + _schema.memory_size_gb = cls._schema_node_configuration_read.memory_size_gb + _schema.node_pool_name = cls._schema_node_configuration_read.node_pool_name + _schema.nodes = cls._schema_node_configuration_read.nodes + _schema.vm_count = cls._schema_node_configuration_read.vm_count + _schema.vm_size = cls._schema_node_configuration_read.vm_size + return + + cls._schema_node_configuration_read = _schema_node_configuration_read = AAZObjectType() + + node_configuration_read = _schema_node_configuration_read + node_configuration_read.agent_pool_id = AAZStrType( + serialized_name="agentPoolId", + flags={"read_only": True}, + ) + node_configuration_read.agent_pool_name = AAZStrType( + serialized_name="agentPoolName", + flags={"read_only": True}, + ) + node_configuration_read.cpu_cores = AAZIntType( + serialized_name="cpuCores", + flags={"read_only": True}, + ) + node_configuration_read.disk_size_gb = AAZIntType( + serialized_name="diskSizeGB", + flags={"read_only": True}, + ) + node_configuration_read.memory_size_gb = AAZIntType( + serialized_name="memorySizeGB", + flags={"read_only": True}, + ) + node_configuration_read.node_pool_name = AAZStrType( + serialized_name="nodePoolName", + flags={"read_only": True}, + ) + node_configuration_read.nodes = AAZListType( + flags={"read_only": True}, + ) + node_configuration_read.vm_count = AAZIntType( + serialized_name="vmCount", + flags={"read_only": True}, + ) + node_configuration_read.vm_size = AAZStrType( + serialized_name="vmSize", + flags={"read_only": True}, + ) + + nodes = _schema_node_configuration_read.nodes + nodes.Element = AAZObjectType() + + _element = _schema_node_configuration_read.nodes.Element + _element.bare_metal_machine_id = AAZStrType( + serialized_name="bareMetalMachineId", + flags={"read_only": True}, + ) + _element.image_id = AAZStrType( + serialized_name="imageId", + flags={"read_only": True}, + ) + _element.network_attachments = AAZListType( + serialized_name="networkAttachments", + flags={"read_only": True}, + ) + _element.node_name = AAZStrType( + serialized_name="nodeName", + flags={"read_only": True}, + ) + _element.power_state = AAZStrType( + serialized_name="powerState", + flags={"read_only": True}, + ) + + network_attachments = _schema_node_configuration_read.nodes.Element.network_attachments + network_attachments.Element = AAZObjectType() + + _element = _schema_node_configuration_read.nodes.Element.network_attachments.Element + _element.attached_network_id = AAZStrType( + serialized_name="attachedNetworkId", + flags={"required": True}, + ) + _element.default_gateway = AAZStrType( + serialized_name="defaultGateway", + ) + _element.ip_allocation_method = AAZStrType( + serialized_name="ipAllocationMethod", + flags={"required": True}, + ) + _element.ipv4_address = AAZStrType( + serialized_name="ipv4Address", + ) + _element.ipv6_address = AAZStrType( + serialized_name="ipv6Address", + ) + _element.mac_address = AAZStrType( + serialized_name="macAddress", + flags={"read_only": True}, + ) + _element.network_attachment_name = AAZStrType( + serialized_name="networkAttachmentName", + ) + + _schema.agent_pool_id = cls._schema_node_configuration_read.agent_pool_id + _schema.agent_pool_name = cls._schema_node_configuration_read.agent_pool_name + _schema.cpu_cores = cls._schema_node_configuration_read.cpu_cores + _schema.disk_size_gb = cls._schema_node_configuration_read.disk_size_gb + _schema.memory_size_gb = cls._schema_node_configuration_read.memory_size_gb + _schema.node_pool_name = cls._schema_node_configuration_read.node_pool_name + _schema.nodes = cls._schema_node_configuration_read.nodes + _schema.vm_count = cls._schema_node_configuration_read.vm_count + _schema.vm_size = cls._schema_node_configuration_read.vm_size + + +__all__ = ["Wait"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/__cmd_group.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/__cmd_group.py new file mode 100644 index 00000000000..33f157c3a69 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/__cmd_group.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "networkcloud l2network", + is_experimental=True, +) +class __CMDGroup(AAZCommandGroup): + """Manage layer 2 (l2) network + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/__init__.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/__init__.py new file mode 100644 index 00000000000..db73033039b --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/__init__.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._list import * +from ._show import * +from ._update import * +from ._wait import * diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/_create.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/_create.py new file mode 100644 index 00000000000..cd9aa1db946 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/_create.py @@ -0,0 +1,377 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud l2network create", + is_experimental=True, +) +class Create(AAZCommand): + """Create a new layer 2 (L2) network or update the properties of the existing network. + + :example: Create or update L2 network + az networkcloud l2network create --name "l2NetworkName" --extended-location name="/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterExtendedLocationName" type="CustomLocation" --location "location" --hybrid-aks-plugin-type "DPDK" --interface-name "eth0" --l2-isolation-domain-id "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/l2IsolationDomainName" --tags key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/l2networks/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.l2_network_name = AAZStrArg( + options=["-n", "--name", "--l2-network-name"], + help="The name of the L2 network.", + required=True, + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "L2NetworkParameters" + + _args_schema = cls._args_schema + _args_schema.extended_location = AAZObjectArg( + options=["--extended-location"], + arg_group="L2NetworkParameters", + help="The extended location of the cluster associated with the resource.", + required=True, + ) + _args_schema.location = AAZResourceLocationArg( + arg_group="L2NetworkParameters", + help="The geo-location where the resource lives", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="L2NetworkParameters", + help="Resource tags.", + ) + + extended_location = cls._args_schema.extended_location + extended_location.name = AAZStrArg( + options=["name"], + help="The resource ID of the extended location on which the resource will be created.", + required=True, + ) + extended_location.type = AAZStrArg( + options=["type"], + help="The extended location type, for example, CustomLocation.", + required=True, + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.hybrid_aks_plugin_type = AAZStrArg( + options=["--hybrid-aks-plugin-type"], + arg_group="Properties", + help="The network plugin type for Hybrid AKS.", + default="SRIOV", + enum={"DPDK": "DPDK", "OSDevice": "OSDevice", "SRIOV": "SRIOV"}, + ) + _args_schema.interface_name = AAZStrArg( + options=["--interface-name"], + arg_group="Properties", + help="The default interface name for this L2 network in the virtual machine. This name can be overridden by the name supplied in the network attachment configuration of that virtual machine.", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9@._-]*$", + max_length=12, + ), + ) + _args_schema.l2_isolation_domain_id = AAZStrArg( + options=["--l2-isolation-domain-id"], + arg_group="Properties", + help="The resource ID of the Network Fabric l2IsolationDomain.", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.L2NetworksCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class L2NetworksCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l2Networks/{l2NetworkName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "l2NetworkName", self.ctx.args.l2_network_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("extendedLocation", AAZObjectType, ".extended_location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True, "client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + extended_location = _builder.get(".extendedLocation") + if extended_location is not None: + extended_location.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}}) + extended_location.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("hybridAksPluginType", AAZStrType, ".hybrid_aks_plugin_type") + properties.set_prop("interfaceName", AAZStrType, ".interface_name") + properties.set_prop("l2IsolationDomainId", AAZStrType, ".l2_isolation_domain_id", typ_kwargs={"flags": {"required": True}}) + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + 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_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200_201.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.hybrid_aks_plugin_type = AAZStrType( + serialized_name="hybridAksPluginType", + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + ) + properties.l2_isolation_domain_id = AAZStrType( + serialized_name="l2IsolationDomainId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.virtual_machines_associated_ids = AAZListType( + serialized_name="virtualMachinesAssociatedIds", + flags={"read_only": True}, + ) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200_201.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + virtual_machines_associated_ids = cls._schema_on_200_201.properties.virtual_machines_associated_ids + virtual_machines_associated_ids.Element = AAZStrType() + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/_delete.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/_delete.py new file mode 100644 index 00000000000..a02511ac472 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/_delete.py @@ -0,0 +1,167 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud l2network delete", + is_experimental=True, + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete the provided layer 2 (L2) network. + + :example: Delete L2 network + az networkcloud l2network delete --name "l2NetworkName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/l2networks/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.l2_network_name = AAZStrArg( + options=["-n", "--name", "--l2-network-name"], + help="The name of the L2 network.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.L2NetworksDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class L2NetworksDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l2Networks/{l2NetworkName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "l2NetworkName", self.ctx.args.l2_network_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/_list.py new file mode 100644 index 00000000000..36472cfe809 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/_list.py @@ -0,0 +1,450 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud l2network list", + is_experimental=True, +) +class List(AAZCommand): + """List layer 2 (L2) networks in the provided resource group or subscription. + + :example: List L2 networks for subscription + az networkcloud l2network list + + :example: List L2 networks for resourcegroup + az networkcloud l2network list --resource-group "resourcegroupname" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.networkcloud/l2networks", "2022-12-12-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/l2networks", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) + condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + if condition_0: + self.L2NetworksListByResourceGroup(ctx=self.ctx)() + if condition_1: + self.L2NetworksListBySubscription(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class L2NetworksListByResourceGroup(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l2Networks", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.value.Element.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.hybrid_aks_plugin_type = AAZStrType( + serialized_name="hybridAksPluginType", + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + ) + properties.l2_isolation_domain_id = AAZStrType( + serialized_name="l2IsolationDomainId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.virtual_machines_associated_ids = AAZListType( + serialized_name="virtualMachinesAssociatedIds", + flags={"read_only": True}, + ) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200.value.Element.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + virtual_machines_associated_ids = cls._schema_on_200.value.Element.properties.virtual_machines_associated_ids + virtual_machines_associated_ids.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + class L2NetworksListBySubscription(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/l2Networks", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.value.Element.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.hybrid_aks_plugin_type = AAZStrType( + serialized_name="hybridAksPluginType", + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + ) + properties.l2_isolation_domain_id = AAZStrType( + serialized_name="l2IsolationDomainId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.virtual_machines_associated_ids = AAZListType( + serialized_name="virtualMachinesAssociatedIds", + flags={"read_only": True}, + ) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200.value.Element.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + virtual_machines_associated_ids = cls._schema_on_200.value.Element.properties.virtual_machines_associated_ids + virtual_machines_associated_ids.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/_show.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/_show.py new file mode 100644 index 00000000000..32f22b64a45 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/_show.py @@ -0,0 +1,265 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud l2network show", + is_experimental=True, +) +class Show(AAZCommand): + """Get properties of the provided layer 2 (L2) network. + + :example: Get L2 network + az networkcloud l2network show --name "l2NetworkName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/l2networks/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.l2_network_name = AAZStrArg( + options=["-n", "--name", "--l2-network-name"], + help="The name of the L2 network.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.L2NetworksGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class L2NetworksGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l2Networks/{l2NetworkName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "l2NetworkName", self.ctx.args.l2_network_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.hybrid_aks_plugin_type = AAZStrType( + serialized_name="hybridAksPluginType", + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + ) + properties.l2_isolation_domain_id = AAZStrType( + serialized_name="l2IsolationDomainId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.virtual_machines_associated_ids = AAZListType( + serialized_name="virtualMachinesAssociatedIds", + flags={"read_only": True}, + ) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + virtual_machines_associated_ids = cls._schema_on_200.properties.virtual_machines_associated_ids + virtual_machines_associated_ids.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/_update.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/_update.py new file mode 100644 index 00000000000..081ff8bb27e --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/_update.py @@ -0,0 +1,295 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud l2network update", + is_experimental=True, +) +class Update(AAZCommand): + """Update tags associated with the provided layer 2 (L2) network. + + :example: Update tags for L2 network + az networkcloud l2network update --name "l2NetworkName" --tags key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/l2networks/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.l2_network_name = AAZStrArg( + options=["-n", "--name", "--l2-network-name"], + help="The name of the L2 network.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "L2NetworkUpdateParameters" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="L2NetworkUpdateParameters", + help="The Azure resource tags that will replace the existing ones.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.L2NetworksUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class L2NetworksUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l2Networks/{l2NetworkName}", + **self.url_parameters + ) + + @property + def method(self): + return "PATCH" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "l2NetworkName", self.ctx.args.l2_network_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"client_flatten": True}} + ) + _builder.set_prop("tags", AAZDictType, ".tags") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.hybrid_aks_plugin_type = AAZStrType( + serialized_name="hybridAksPluginType", + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + ) + properties.l2_isolation_domain_id = AAZStrType( + serialized_name="l2IsolationDomainId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.virtual_machines_associated_ids = AAZListType( + serialized_name="virtualMachinesAssociatedIds", + flags={"read_only": True}, + ) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + virtual_machines_associated_ids = cls._schema_on_200.properties.virtual_machines_associated_ids + virtual_machines_associated_ids.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _UpdateHelper: + """Helper class for Update""" + + +__all__ = ["Update"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/_wait.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/_wait.py new file mode 100644 index 00000000000..b85a23c30c7 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l2network/_wait.py @@ -0,0 +1,260 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud l2network wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/l2networks/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.l2_network_name = AAZStrArg( + options=["-n", "--name", "--l2-network-name"], + help="The name of the L2 network.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.L2NetworksGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) + return result + + class L2NetworksGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l2Networks/{l2NetworkName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "l2NetworkName", self.ctx.args.l2_network_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.hybrid_aks_plugin_type = AAZStrType( + serialized_name="hybridAksPluginType", + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + ) + properties.l2_isolation_domain_id = AAZStrType( + serialized_name="l2IsolationDomainId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.virtual_machines_associated_ids = AAZListType( + serialized_name="virtualMachinesAssociatedIds", + flags={"read_only": True}, + ) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + virtual_machines_associated_ids = cls._schema_on_200.properties.virtual_machines_associated_ids + virtual_machines_associated_ids.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/__cmd_group.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/__cmd_group.py new file mode 100644 index 00000000000..813bfe1268d --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/__cmd_group.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "networkcloud l3network", + is_experimental=True, +) +class __CMDGroup(AAZCommandGroup): + """Manage layer 3 (l3) network + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/__init__.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/__init__.py new file mode 100644 index 00000000000..db73033039b --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/__init__.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._list import * +from ._show import * +from ._update import * +from ._wait import * diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/_create.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/_create.py new file mode 100644 index 00000000000..39ba6942a97 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/_create.py @@ -0,0 +1,427 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud l3network create", + is_experimental=True, +) +class Create(AAZCommand): + """Create a new layer 3 (L3) network or update the properties of the existing network. + + :example: Create or update L3 network + az networkcloud l3network create --name "l3NetworkName" --extended-location name="/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterExtendedLocationName" type="CustomLocation" --location "location" --hybrid-aks-ipam-enabled "True" --hybrid-aks-plugin-type "DPDK" --interface-name "eth0" --ip-allocation-type "DualStack" --ipv4-connected-prefix "198.51.100.0/24" --ipv6-connected-prefix "2001:db8::/64" --l3-isolation-domain-id "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/l3IsolationDomainName" --vlan 12 --tags key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/l3networks/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.l3_network_name = AAZStrArg( + options=["-n", "--name", "--l3-network-name"], + help="The name of the L3 network.", + required=True, + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "L3NetworkParameters" + + _args_schema = cls._args_schema + _args_schema.extended_location = AAZObjectArg( + options=["--extended-location"], + arg_group="L3NetworkParameters", + help="The extended location of the cluster associated with the resource.", + required=True, + ) + _args_schema.location = AAZResourceLocationArg( + arg_group="L3NetworkParameters", + help="The geo-location where the resource lives", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="L3NetworkParameters", + help="Resource tags.", + ) + + extended_location = cls._args_schema.extended_location + extended_location.name = AAZStrArg( + options=["name"], + help="The resource ID of the extended location on which the resource will be created.", + required=True, + ) + extended_location.type = AAZStrArg( + options=["type"], + help="The extended location type, for example, CustomLocation.", + required=True, + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.hybrid_aks_ipam_enabled = AAZStrArg( + options=["--hybrid-aks-ipam-enabled"], + arg_group="Properties", + help="The indicator of whether or not to disable IPAM allocation on the network attachment definition injected into the Hybrid AKS Cluster.", + default="True", + enum={"False": "False", "True": "True"}, + ) + _args_schema.hybrid_aks_plugin_type = AAZStrArg( + options=["--hybrid-aks-plugin-type"], + arg_group="Properties", + help="The network plugin type for Hybrid AKS.", + default="SRIOV", + enum={"DPDK": "DPDK", "OSDevice": "OSDevice", "SRIOV": "SRIOV"}, + ) + _args_schema.interface_name = AAZStrArg( + options=["--interface-name"], + arg_group="Properties", + help="The default interface name for this L3 network in the virtual machine. This name can be overridden by the name supplied in the network attachment configuration of that virtual machine.", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9@._-]*$", + max_length=12, + ), + ) + _args_schema.ip_allocation_type = AAZStrArg( + options=["--ip-allocation-type"], + arg_group="Properties", + help="The type of the IP address allocation, defaulted to \"DualStack\".", + default="DualStack", + enum={"DualStack": "DualStack", "IPV4": "IPV4", "IPV6": "IPV6"}, + ) + _args_schema.ipv4_connected_prefix = AAZStrArg( + options=["--ipv4-connected-prefix"], + arg_group="Properties", + help="The IPV4 prefix (CIDR) assigned to this L3 network. Required when the IP allocation type is IPV4 or DualStack.", + ) + _args_schema.ipv6_connected_prefix = AAZStrArg( + options=["--ipv6-connected-prefix"], + arg_group="Properties", + help="The IPV6 prefix (CIDR) assigned to this L3 network. Required when the IP allocation type is IPV6 or DualStack.", + ) + _args_schema.l3_isolation_domain_id = AAZStrArg( + options=["--l3-isolation-domain-id"], + arg_group="Properties", + help="The resource ID of the Network Fabric l3IsolationDomain.", + required=True, + ) + _args_schema.vlan = AAZIntArg( + options=["--vlan"], + arg_group="Properties", + help="The VLAN from the l3IsolationDomain that is used for this network.", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.L3NetworksCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class L3NetworksCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l3Networks/{l3NetworkName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "l3NetworkName", self.ctx.args.l3_network_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("extendedLocation", AAZObjectType, ".extended_location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True, "client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + extended_location = _builder.get(".extendedLocation") + if extended_location is not None: + extended_location.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}}) + extended_location.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("hybridAksIpamEnabled", AAZStrType, ".hybrid_aks_ipam_enabled") + properties.set_prop("hybridAksPluginType", AAZStrType, ".hybrid_aks_plugin_type") + properties.set_prop("interfaceName", AAZStrType, ".interface_name") + properties.set_prop("ipAllocationType", AAZStrType, ".ip_allocation_type") + properties.set_prop("ipv4ConnectedPrefix", AAZStrType, ".ipv4_connected_prefix") + properties.set_prop("ipv6ConnectedPrefix", AAZStrType, ".ipv6_connected_prefix") + properties.set_prop("l3IsolationDomainId", AAZStrType, ".l3_isolation_domain_id", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("vlan", AAZIntType, ".vlan", typ_kwargs={"flags": {"required": True}}) + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + 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_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200_201.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.hybrid_aks_ipam_enabled = AAZStrType( + serialized_name="hybridAksIpamEnabled", + ) + properties.hybrid_aks_plugin_type = AAZStrType( + serialized_name="hybridAksPluginType", + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + ) + properties.ip_allocation_type = AAZStrType( + serialized_name="ipAllocationType", + ) + properties.ipv4_connected_prefix = AAZStrType( + serialized_name="ipv4ConnectedPrefix", + ) + properties.ipv6_connected_prefix = AAZStrType( + serialized_name="ipv6ConnectedPrefix", + ) + properties.l3_isolation_domain_id = AAZStrType( + serialized_name="l3IsolationDomainId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.virtual_machines_associated_ids = AAZListType( + serialized_name="virtualMachinesAssociatedIds", + flags={"read_only": True}, + ) + properties.vlan = AAZIntType( + flags={"required": True}, + ) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200_201.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + virtual_machines_associated_ids = cls._schema_on_200_201.properties.virtual_machines_associated_ids + virtual_machines_associated_ids.Element = AAZStrType() + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/_delete.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/_delete.py new file mode 100644 index 00000000000..d1833e46a18 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/_delete.py @@ -0,0 +1,167 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud l3network delete", + is_experimental=True, + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete the provided layer 3 (L3) network. + + :example: Delete L3 network + az networkcloud l3network delete --name "l3NetworkName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/l3networks/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.l3_network_name = AAZStrArg( + options=["-n", "--name", "--l3-network-name"], + help="The name of the L3 network.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.L3NetworksDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class L3NetworksDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l3Networks/{l3NetworkName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "l3NetworkName", self.ctx.args.l3_network_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/_list.py new file mode 100644 index 00000000000..e52b323404c --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/_list.py @@ -0,0 +1,480 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud l3network list", + is_experimental=True, +) +class List(AAZCommand): + """List layer 3 (L3) networks in the provided resource group or subscription. + + :example: List L3 networks for subscription + az networkcloud l3network list + + :example: List L3networks for resource group + az networkcloud l3network list --resource-group "resourcegroupname" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.networkcloud/l3networks", "2022-12-12-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/l3networks", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) + condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + if condition_0: + self.L3NetworksListByResourceGroup(ctx=self.ctx)() + if condition_1: + self.L3NetworksListBySubscription(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class L3NetworksListByResourceGroup(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l3Networks", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.value.Element.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.hybrid_aks_ipam_enabled = AAZStrType( + serialized_name="hybridAksIpamEnabled", + ) + properties.hybrid_aks_plugin_type = AAZStrType( + serialized_name="hybridAksPluginType", + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + ) + properties.ip_allocation_type = AAZStrType( + serialized_name="ipAllocationType", + ) + properties.ipv4_connected_prefix = AAZStrType( + serialized_name="ipv4ConnectedPrefix", + ) + properties.ipv6_connected_prefix = AAZStrType( + serialized_name="ipv6ConnectedPrefix", + ) + properties.l3_isolation_domain_id = AAZStrType( + serialized_name="l3IsolationDomainId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.virtual_machines_associated_ids = AAZListType( + serialized_name="virtualMachinesAssociatedIds", + flags={"read_only": True}, + ) + properties.vlan = AAZIntType( + flags={"required": True}, + ) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200.value.Element.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + virtual_machines_associated_ids = cls._schema_on_200.value.Element.properties.virtual_machines_associated_ids + virtual_machines_associated_ids.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + class L3NetworksListBySubscription(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/l3Networks", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.value.Element.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.hybrid_aks_ipam_enabled = AAZStrType( + serialized_name="hybridAksIpamEnabled", + ) + properties.hybrid_aks_plugin_type = AAZStrType( + serialized_name="hybridAksPluginType", + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + ) + properties.ip_allocation_type = AAZStrType( + serialized_name="ipAllocationType", + ) + properties.ipv4_connected_prefix = AAZStrType( + serialized_name="ipv4ConnectedPrefix", + ) + properties.ipv6_connected_prefix = AAZStrType( + serialized_name="ipv6ConnectedPrefix", + ) + properties.l3_isolation_domain_id = AAZStrType( + serialized_name="l3IsolationDomainId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.virtual_machines_associated_ids = AAZListType( + serialized_name="virtualMachinesAssociatedIds", + flags={"read_only": True}, + ) + properties.vlan = AAZIntType( + flags={"required": True}, + ) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200.value.Element.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + virtual_machines_associated_ids = cls._schema_on_200.value.Element.properties.virtual_machines_associated_ids + virtual_machines_associated_ids.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/_show.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/_show.py new file mode 100644 index 00000000000..c0094836e83 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/_show.py @@ -0,0 +1,280 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud l3network show", + is_experimental=True, +) +class Show(AAZCommand): + """Get properties of the provided layer 3 (L3) network. + + :example: Get L3 network + az networkcloud l3network show --name "l2NetworkName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/l3networks/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.l3_network_name = AAZStrArg( + options=["-n", "--name", "--l3-network-name"], + help="The name of the L3 network.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.L3NetworksGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class L3NetworksGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l3Networks/{l3NetworkName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "l3NetworkName", self.ctx.args.l3_network_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.hybrid_aks_ipam_enabled = AAZStrType( + serialized_name="hybridAksIpamEnabled", + ) + properties.hybrid_aks_plugin_type = AAZStrType( + serialized_name="hybridAksPluginType", + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + ) + properties.ip_allocation_type = AAZStrType( + serialized_name="ipAllocationType", + ) + properties.ipv4_connected_prefix = AAZStrType( + serialized_name="ipv4ConnectedPrefix", + ) + properties.ipv6_connected_prefix = AAZStrType( + serialized_name="ipv6ConnectedPrefix", + ) + properties.l3_isolation_domain_id = AAZStrType( + serialized_name="l3IsolationDomainId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.virtual_machines_associated_ids = AAZListType( + serialized_name="virtualMachinesAssociatedIds", + flags={"read_only": True}, + ) + properties.vlan = AAZIntType( + flags={"required": True}, + ) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + virtual_machines_associated_ids = cls._schema_on_200.properties.virtual_machines_associated_ids + virtual_machines_associated_ids.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/_update.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/_update.py new file mode 100644 index 00000000000..68dd09732d2 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/_update.py @@ -0,0 +1,310 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud l3network update", + is_experimental=True, +) +class Update(AAZCommand): + """Update tags associated with the provided layer 3 (L3) network. + + :example: Update tags for L3 network + az networkcloud l3network update --name "l3NetworkName" --tags key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/l3networks/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.l3_network_name = AAZStrArg( + options=["-n", "--name", "--l3-network-name"], + help="The name of the L3 network.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "L3NetworkUpdateParameters" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="L3NetworkUpdateParameters", + help="The Azure resource tags that will replace the existing ones.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.L3NetworksUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class L3NetworksUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l3Networks/{l3NetworkName}", + **self.url_parameters + ) + + @property + def method(self): + return "PATCH" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "l3NetworkName", self.ctx.args.l3_network_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"client_flatten": True}} + ) + _builder.set_prop("tags", AAZDictType, ".tags") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.hybrid_aks_ipam_enabled = AAZStrType( + serialized_name="hybridAksIpamEnabled", + ) + properties.hybrid_aks_plugin_type = AAZStrType( + serialized_name="hybridAksPluginType", + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + ) + properties.ip_allocation_type = AAZStrType( + serialized_name="ipAllocationType", + ) + properties.ipv4_connected_prefix = AAZStrType( + serialized_name="ipv4ConnectedPrefix", + ) + properties.ipv6_connected_prefix = AAZStrType( + serialized_name="ipv6ConnectedPrefix", + ) + properties.l3_isolation_domain_id = AAZStrType( + serialized_name="l3IsolationDomainId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.virtual_machines_associated_ids = AAZListType( + serialized_name="virtualMachinesAssociatedIds", + flags={"read_only": True}, + ) + properties.vlan = AAZIntType( + flags={"required": True}, + ) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + virtual_machines_associated_ids = cls._schema_on_200.properties.virtual_machines_associated_ids + virtual_machines_associated_ids.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _UpdateHelper: + """Helper class for Update""" + + +__all__ = ["Update"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/_wait.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/_wait.py new file mode 100644 index 00000000000..e901e7842d3 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/l3network/_wait.py @@ -0,0 +1,275 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud l3network wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/l3networks/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.l3_network_name = AAZStrArg( + options=["-n", "--name", "--l3-network-name"], + help="The name of the L3 network.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.L3NetworksGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) + return result + + class L3NetworksGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/l3Networks/{l3NetworkName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "l3NetworkName", self.ctx.args.l3_network_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.hybrid_aks_ipam_enabled = AAZStrType( + serialized_name="hybridAksIpamEnabled", + ) + properties.hybrid_aks_plugin_type = AAZStrType( + serialized_name="hybridAksPluginType", + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + ) + properties.ip_allocation_type = AAZStrType( + serialized_name="ipAllocationType", + ) + properties.ipv4_connected_prefix = AAZStrType( + serialized_name="ipv4ConnectedPrefix", + ) + properties.ipv6_connected_prefix = AAZStrType( + serialized_name="ipv6ConnectedPrefix", + ) + properties.l3_isolation_domain_id = AAZStrType( + serialized_name="l3IsolationDomainId", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.virtual_machines_associated_ids = AAZListType( + serialized_name="virtualMachinesAssociatedIds", + flags={"read_only": True}, + ) + properties.vlan = AAZIntType( + flags={"required": True}, + ) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + virtual_machines_associated_ids = cls._schema_on_200.properties.virtual_machines_associated_ids + virtual_machines_associated_ids.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/rack/__cmd_group.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/rack/__cmd_group.py new file mode 100644 index 00000000000..532b047ed2f --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/rack/__cmd_group.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "networkcloud rack", + is_experimental=True, +) +class __CMDGroup(AAZCommandGroup): + """Manage rack + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/rack/__init__.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/rack/__init__.py new file mode 100644 index 00000000000..8287c45a4be --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/rack/__init__.py @@ -0,0 +1,15 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._list import * +from ._show import * +from ._update import * +from ._wait import * diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/rack/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/rack/_list.py new file mode 100644 index 00000000000..5c94d19e681 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/rack/_list.py @@ -0,0 +1,434 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud rack list", + is_experimental=True, +) +class List(AAZCommand): + """List racks in the provided resource group or subscription. + + :example: List racks for subscription + az networkcloud rack list + + :example: List racks for resource group + az networkcloud rack list --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.networkcloud/racks", "2022-12-12-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/racks", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) + condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + if condition_0: + self.RacksListByResourceGroup(ctx=self.ctx)() + if condition_1: + self.RacksListBySubscription(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class RacksListByResourceGroup(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/racks", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.value.Element.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.availability_zone = AAZStrType( + serialized_name="availabilityZone", + flags={"required": True}, + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.rack_location = AAZStrType( + serialized_name="rackLocation", + flags={"required": True}, + ) + properties.rack_serial_number = AAZStrType( + serialized_name="rackSerialNumber", + flags={"required": True}, + ) + properties.rack_sku_id = AAZStrType( + serialized_name="rackSkuId", + flags={"required": True}, + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + class RacksListBySubscription(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/racks", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.value.Element.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.availability_zone = AAZStrType( + serialized_name="availabilityZone", + flags={"required": True}, + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.rack_location = AAZStrType( + serialized_name="rackLocation", + flags={"required": True}, + ) + properties.rack_serial_number = AAZStrType( + serialized_name="rackSerialNumber", + flags={"required": True}, + ) + properties.rack_sku_id = AAZStrType( + serialized_name="rackSkuId", + flags={"required": True}, + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/rack/_show.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/rack/_show.py new file mode 100644 index 00000000000..a74b2c94b81 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/rack/_show.py @@ -0,0 +1,257 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud rack show", + is_experimental=True, +) +class Show(AAZCommand): + """Get properties of the provided rack. + + :example: Get rack + az networkcloud rack show --name "rackName" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/racks/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.rack_name = AAZStrArg( + options=["-n", "--name", "--rack-name"], + help="The name of the rack.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.RacksGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class RacksGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/racks/{rackName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "rackName", self.ctx.args.rack_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.availability_zone = AAZStrType( + serialized_name="availabilityZone", + flags={"required": True}, + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.rack_location = AAZStrType( + serialized_name="rackLocation", + flags={"required": True}, + ) + properties.rack_serial_number = AAZStrType( + serialized_name="rackSerialNumber", + flags={"required": True}, + ) + properties.rack_sku_id = AAZStrType( + serialized_name="rackSkuId", + flags={"required": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/rack/_update.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/rack/_update.py new file mode 100644 index 00000000000..d2c753d65e3 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/rack/_update.py @@ -0,0 +1,358 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud rack update", + is_experimental=True, +) +class Update(AAZCommand): + """Update properties of the provided rack, or update the tags associated with the rack. Properties and tag updates can be done independently. + + :example: Patch rack + az networkcloud rack update --name "rackName" --rack-location "Rack 2B" --rack-serial-number "RACK_SERIAL_NUMBER" --tags key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/racks/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.rack_name = AAZStrArg( + options=["-n", "--name", "--rack-name"], + help="The name of the rack.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.rack_location = AAZStrArg( + options=["--rack-location"], + arg_group="Properties", + help="The free-form description of the rack location. (e.g. “DTN Datacenter, Floor 3, Isle 9, Rack 2B”)", + fmt=AAZStrArgFormat( + max_length=256, + ), + ) + _args_schema.rack_serial_number = AAZStrArg( + options=["--rack-serial-number"], + arg_group="Properties", + help="The globally unique identifier for the rack.", + fmt=AAZStrArgFormat( + max_length=64, + min_length=1, + ), + ) + + # define Arg Group "RackUpdateParameters" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="RackUpdateParameters", + help="The Azure resource tags that will replace the existing ones.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.RacksUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class RacksUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/racks/{rackName}", + **self.url_parameters + ) + + @property + def method(self): + return "PATCH" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "rackName", self.ctx.args.rack_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("rackLocation", AAZStrType, ".rack_location") + properties.set_prop("rackSerialNumber", AAZStrType, ".rack_serial_number") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _UpdateHelper._build_schema_rack_read(cls._schema_on_200) + + return cls._schema_on_200 + + +class _UpdateHelper: + """Helper class for Update""" + + _schema_rack_read = None + + @classmethod + def _build_schema_rack_read(cls, _schema): + if cls._schema_rack_read is not None: + _schema.extended_location = cls._schema_rack_read.extended_location + _schema.id = cls._schema_rack_read.id + _schema.location = cls._schema_rack_read.location + _schema.name = cls._schema_rack_read.name + _schema.properties = cls._schema_rack_read.properties + _schema.system_data = cls._schema_rack_read.system_data + _schema.tags = cls._schema_rack_read.tags + _schema.type = cls._schema_rack_read.type + return + + cls._schema_rack_read = _schema_rack_read = AAZObjectType() + + rack_read = _schema_rack_read + rack_read.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + rack_read.id = AAZStrType( + flags={"read_only": True}, + ) + rack_read.location = AAZStrType( + flags={"required": True}, + ) + rack_read.name = AAZStrType( + flags={"read_only": True}, + ) + rack_read.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + rack_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + rack_read.tags = AAZDictType() + rack_read.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = _schema_rack_read.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = _schema_rack_read.properties + properties.availability_zone = AAZStrType( + serialized_name="availabilityZone", + flags={"required": True}, + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.rack_location = AAZStrType( + serialized_name="rackLocation", + flags={"required": True}, + ) + properties.rack_serial_number = AAZStrType( + serialized_name="rackSerialNumber", + flags={"required": True}, + ) + properties.rack_sku_id = AAZStrType( + serialized_name="rackSkuId", + flags={"required": True}, + ) + + system_data = _schema_rack_read.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = _schema_rack_read.tags + tags.Element = AAZStrType() + + _schema.extended_location = cls._schema_rack_read.extended_location + _schema.id = cls._schema_rack_read.id + _schema.location = cls._schema_rack_read.location + _schema.name = cls._schema_rack_read.name + _schema.properties = cls._schema_rack_read.properties + _schema.system_data = cls._schema_rack_read.system_data + _schema.tags = cls._schema_rack_read.tags + _schema.type = cls._schema_rack_read.type + + +__all__ = ["Update"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/rack/_wait.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/rack/_wait.py new file mode 100644 index 00000000000..47073ae16c9 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/rack/_wait.py @@ -0,0 +1,252 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud rack wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/racks/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.rack_name = AAZStrArg( + options=["-n", "--name", "--rack-name"], + help="The name of the rack.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.RacksGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) + return result + + class RacksGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/racks/{rackName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "rackName", self.ctx.args.rack_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.availability_zone = AAZStrType( + serialized_name="availabilityZone", + flags={"required": True}, + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.rack_location = AAZStrType( + serialized_name="rackLocation", + flags={"required": True}, + ) + properties.rack_serial_number = AAZStrType( + serialized_name="rackSerialNumber", + flags={"required": True}, + ) + properties.rack_sku_id = AAZStrType( + serialized_name="rackSkuId", + flags={"required": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/racksku/__cmd_group.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/racksku/__cmd_group.py new file mode 100644 index 00000000000..cad912cd8b3 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/racksku/__cmd_group.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "networkcloud racksku", + is_experimental=True, +) +class __CMDGroup(AAZCommandGroup): + """Manage rack SKU + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/racksku/__init__.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/racksku/__init__.py new file mode 100644 index 00000000000..2df85698253 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/racksku/__init__.py @@ -0,0 +1,13 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._list import * +from ._show import * diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/racksku/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/racksku/_list.py new file mode 100644 index 00000000000..ab81909f9bb --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/racksku/_list.py @@ -0,0 +1,366 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud racksku list", + is_experimental=True, +) +class List(AAZCommand): + """List rack SKUs in the provided subscription. + + :example: List rack SKUs for subscription + az networkcloud racksku list + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.networkcloud/rackskus", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.RackSkusListBySubscription(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class RackSkusListBySubscription(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/rackSkus", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.compute_machines = AAZListType( + serialized_name="computeMachines", + flags={"read_only": True}, + ) + properties.controller_machines = AAZListType( + serialized_name="controllerMachines", + flags={"read_only": True}, + ) + properties.description = AAZStrType( + flags={"read_only": True}, + ) + properties.max_cluster_slots = AAZIntType( + serialized_name="maxClusterSlots", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.rack_type = AAZStrType( + serialized_name="rackType", + flags={"read_only": True}, + ) + properties.storage_appliances = AAZListType( + serialized_name="storageAppliances", + flags={"read_only": True}, + ) + properties.supported_rack_sku_ids = AAZListType( + serialized_name="supportedRackSkuIds", + flags={"read_only": True}, + ) + + compute_machines = cls._schema_on_200.value.Element.properties.compute_machines + compute_machines.Element = AAZObjectType() + _ListHelper._build_schema_machine_sku_slot_read(compute_machines.Element) + + controller_machines = cls._schema_on_200.value.Element.properties.controller_machines + controller_machines.Element = AAZObjectType() + _ListHelper._build_schema_machine_sku_slot_read(controller_machines.Element) + + storage_appliances = cls._schema_on_200.value.Element.properties.storage_appliances + storage_appliances.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.storage_appliances.Element + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.rack_slot = AAZIntType( + serialized_name="rackSlot", + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties.storage_appliances.Element.properties + properties.capacity_gb = AAZIntType( + serialized_name="capacityGB", + flags={"read_only": True}, + ) + properties.model = AAZStrType( + flags={"read_only": True}, + ) + + supported_rack_sku_ids = cls._schema_on_200.value.Element.properties.supported_rack_sku_ids + supported_rack_sku_ids.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + _schema_machine_sku_slot_read = None + + @classmethod + def _build_schema_machine_sku_slot_read(cls, _schema): + if cls._schema_machine_sku_slot_read is not None: + _schema.properties = cls._schema_machine_sku_slot_read.properties + _schema.rack_slot = cls._schema_machine_sku_slot_read.rack_slot + return + + cls._schema_machine_sku_slot_read = _schema_machine_sku_slot_read = AAZObjectType() + + machine_sku_slot_read = _schema_machine_sku_slot_read + machine_sku_slot_read.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + machine_sku_slot_read.rack_slot = AAZIntType( + serialized_name="rackSlot", + flags={"read_only": True}, + ) + + properties = _schema_machine_sku_slot_read.properties + properties.bootstrap_protocol = AAZStrType( + serialized_name="bootstrapProtocol", + flags={"read_only": True}, + ) + properties.cpu_cores = AAZIntType( + serialized_name="cpuCores", + flags={"read_only": True}, + ) + properties.cpu_sockets = AAZIntType( + serialized_name="cpuSockets", + flags={"read_only": True}, + ) + properties.disks = AAZListType( + flags={"read_only": True}, + ) + properties.generation = AAZStrType( + flags={"read_only": True}, + ) + properties.hardware_version = AAZStrType( + serialized_name="hardwareVersion", + flags={"read_only": True}, + ) + properties.memory_capacity_gb = AAZIntType( + serialized_name="memoryCapacityGB", + flags={"read_only": True}, + ) + properties.model = AAZStrType( + flags={"read_only": True}, + ) + properties.network_interfaces = AAZListType( + serialized_name="networkInterfaces", + flags={"read_only": True}, + ) + properties.total_threads = AAZIntType( + serialized_name="totalThreads", + flags={"read_only": True}, + ) + properties.vendor = AAZStrType( + flags={"read_only": True}, + ) + + disks = _schema_machine_sku_slot_read.properties.disks + disks.Element = AAZObjectType() + + _element = _schema_machine_sku_slot_read.properties.disks.Element + _element.capacity_gb = AAZIntType( + serialized_name="capacityGB", + flags={"read_only": True}, + ) + _element.connection = AAZStrType( + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + network_interfaces = _schema_machine_sku_slot_read.properties.network_interfaces + network_interfaces.Element = AAZObjectType() + + _element = _schema_machine_sku_slot_read.properties.network_interfaces.Element + _element.address = AAZStrType( + flags={"read_only": True}, + ) + _element.device_connection_type = AAZStrType( + serialized_name="deviceConnectionType", + flags={"read_only": True}, + ) + _element.model = AAZStrType( + flags={"read_only": True}, + ) + _element.physical_slot = AAZIntType( + serialized_name="physicalSlot", + flags={"read_only": True}, + ) + _element.port_count = AAZIntType( + serialized_name="portCount", + flags={"read_only": True}, + ) + _element.port_speed = AAZIntType( + serialized_name="portSpeed", + flags={"read_only": True}, + ) + _element.vendor = AAZStrType( + flags={"read_only": True}, + ) + + _schema.properties = cls._schema_machine_sku_slot_read.properties + _schema.rack_slot = cls._schema_machine_sku_slot_read.rack_slot + + +__all__ = ["List"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/racksku/_show.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/racksku/_show.py new file mode 100644 index 00000000000..db486d527e4 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/racksku/_show.py @@ -0,0 +1,369 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud racksku show", + is_experimental=True, +) +class Show(AAZCommand): + """Get the properties of the provided rack SKU. + + :example: Get rack SKU resource + az networkcloud racksku show --name "rackSkuName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.networkcloud/rackskus/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.rack_sku_name = AAZStrArg( + options=["-n", "--name", "--rack-sku-name"], + help="The name of the rack SKU.", + required=True, + id_part="name", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.RackSkusGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class RackSkusGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/rackSkus/{rackSkuName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "rackSkuName", self.ctx.args.rack_sku_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.compute_machines = AAZListType( + serialized_name="computeMachines", + flags={"read_only": True}, + ) + properties.controller_machines = AAZListType( + serialized_name="controllerMachines", + flags={"read_only": True}, + ) + properties.description = AAZStrType( + flags={"read_only": True}, + ) + properties.max_cluster_slots = AAZIntType( + serialized_name="maxClusterSlots", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.rack_type = AAZStrType( + serialized_name="rackType", + flags={"read_only": True}, + ) + properties.storage_appliances = AAZListType( + serialized_name="storageAppliances", + flags={"read_only": True}, + ) + properties.supported_rack_sku_ids = AAZListType( + serialized_name="supportedRackSkuIds", + flags={"read_only": True}, + ) + + compute_machines = cls._schema_on_200.properties.compute_machines + compute_machines.Element = AAZObjectType() + _ShowHelper._build_schema_machine_sku_slot_read(compute_machines.Element) + + controller_machines = cls._schema_on_200.properties.controller_machines + controller_machines.Element = AAZObjectType() + _ShowHelper._build_schema_machine_sku_slot_read(controller_machines.Element) + + storage_appliances = cls._schema_on_200.properties.storage_appliances + storage_appliances.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.storage_appliances.Element + _element.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + _element.rack_slot = AAZIntType( + serialized_name="rackSlot", + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties.storage_appliances.Element.properties + properties.capacity_gb = AAZIntType( + serialized_name="capacityGB", + flags={"read_only": True}, + ) + properties.model = AAZStrType( + flags={"read_only": True}, + ) + + supported_rack_sku_ids = cls._schema_on_200.properties.supported_rack_sku_ids + supported_rack_sku_ids.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + _schema_machine_sku_slot_read = None + + @classmethod + def _build_schema_machine_sku_slot_read(cls, _schema): + if cls._schema_machine_sku_slot_read is not None: + _schema.properties = cls._schema_machine_sku_slot_read.properties + _schema.rack_slot = cls._schema_machine_sku_slot_read.rack_slot + return + + cls._schema_machine_sku_slot_read = _schema_machine_sku_slot_read = AAZObjectType() + + machine_sku_slot_read = _schema_machine_sku_slot_read + machine_sku_slot_read.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + machine_sku_slot_read.rack_slot = AAZIntType( + serialized_name="rackSlot", + flags={"read_only": True}, + ) + + properties = _schema_machine_sku_slot_read.properties + properties.bootstrap_protocol = AAZStrType( + serialized_name="bootstrapProtocol", + flags={"read_only": True}, + ) + properties.cpu_cores = AAZIntType( + serialized_name="cpuCores", + flags={"read_only": True}, + ) + properties.cpu_sockets = AAZIntType( + serialized_name="cpuSockets", + flags={"read_only": True}, + ) + properties.disks = AAZListType( + flags={"read_only": True}, + ) + properties.generation = AAZStrType( + flags={"read_only": True}, + ) + properties.hardware_version = AAZStrType( + serialized_name="hardwareVersion", + flags={"read_only": True}, + ) + properties.memory_capacity_gb = AAZIntType( + serialized_name="memoryCapacityGB", + flags={"read_only": True}, + ) + properties.model = AAZStrType( + flags={"read_only": True}, + ) + properties.network_interfaces = AAZListType( + serialized_name="networkInterfaces", + flags={"read_only": True}, + ) + properties.total_threads = AAZIntType( + serialized_name="totalThreads", + flags={"read_only": True}, + ) + properties.vendor = AAZStrType( + flags={"read_only": True}, + ) + + disks = _schema_machine_sku_slot_read.properties.disks + disks.Element = AAZObjectType() + + _element = _schema_machine_sku_slot_read.properties.disks.Element + _element.capacity_gb = AAZIntType( + serialized_name="capacityGB", + flags={"read_only": True}, + ) + _element.connection = AAZStrType( + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + network_interfaces = _schema_machine_sku_slot_read.properties.network_interfaces + network_interfaces.Element = AAZObjectType() + + _element = _schema_machine_sku_slot_read.properties.network_interfaces.Element + _element.address = AAZStrType( + flags={"read_only": True}, + ) + _element.device_connection_type = AAZStrType( + serialized_name="deviceConnectionType", + flags={"read_only": True}, + ) + _element.model = AAZStrType( + flags={"read_only": True}, + ) + _element.physical_slot = AAZIntType( + serialized_name="physicalSlot", + flags={"read_only": True}, + ) + _element.port_count = AAZIntType( + serialized_name="portCount", + flags={"read_only": True}, + ) + _element.port_speed = AAZIntType( + serialized_name="portSpeed", + flags={"read_only": True}, + ) + _element.vendor = AAZStrType( + flags={"read_only": True}, + ) + + _schema.properties = cls._schema_machine_sku_slot_read.properties + _schema.rack_slot = cls._schema_machine_sku_slot_read.rack_slot + + +__all__ = ["Show"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/__cmd_group.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/__cmd_group.py new file mode 100644 index 00000000000..344e532f814 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/__cmd_group.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "networkcloud storageappliance", + is_experimental=True, +) +class __CMDGroup(AAZCommandGroup): + """Manage storage appliance + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/__init__.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/__init__.py new file mode 100644 index 00000000000..73edf23e00d --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/__init__.py @@ -0,0 +1,18 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._disable_remote_vendor_management import * +from ._enable_remote_vendor_management import * +from ._list import * +from ._run_read_command import * +from ._show import * +from ._update import * +from ._wait import * diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_disable_remote_vendor_management.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_disable_remote_vendor_management.py new file mode 100644 index 00000000000..1e56aefdcb6 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_disable_remote_vendor_management.py @@ -0,0 +1,301 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud storageappliance disable-remote-vendor-management", + is_experimental=True, +) +class DisableRemoteVendorManagement(AAZCommand): + """Disable remote vendor management of the provided storage appliance. + + :example: Turn off remote vendor management for storage appliance + az networkcloud storageappliance disable-remote-vendor-management --resource-group "resourceGroupName" --storage-appliance-name "storageApplianceName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/storageappliances/{}/disableremotevendormanagement", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.storage_appliance_name = AAZStrArg( + options=["-n", "--name", "--storage-appliance-name"], + help="The name of the storage appliance.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.StorageAppliancesDisableRemoteVendorManagement(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class StorageAppliancesDisableRemoteVendorManagement(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances/{storageApplianceName}/disableRemoteVendorManagement", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "storageApplianceName", self.ctx.args.storage_appliance_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _DisableRemoteVendorManagementHelper._build_schema_operation_status_result_read(cls._schema_on_200) + + return cls._schema_on_200 + + def on_204(self, session): + pass + + +class _DisableRemoteVendorManagementHelper: + """Helper class for DisableRemoteVendorManagement""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType() + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + _schema_operation_status_result_read = None + + @classmethod + def _build_schema_operation_status_result_read(cls, _schema): + if cls._schema_operation_status_result_read is not None: + _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.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 + return + + cls._schema_operation_status_result_read = _schema_operation_status_result_read = AAZObjectType() + + operation_status_result_read = _schema_operation_status_result_read + operation_status_result_read.end_time = AAZStrType( + serialized_name="endTime", + ) + 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.percent_complete = AAZFloatType( + serialized_name="percentComplete", + ) + operation_status_result_read.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"read_only": True}, + ) + operation_status_result_read.start_time = AAZStrType( + serialized_name="startTime", + ) + operation_status_result_read.status = AAZStrType( + flags={"required": True}, + ) + + operations = _schema_operation_status_result_read.operations + operations.Element = AAZObjectType() + cls._build_schema_operation_status_result_read(operations.Element) + + _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.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 + + +__all__ = ["DisableRemoteVendorManagement"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_enable_remote_vendor_management.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_enable_remote_vendor_management.py new file mode 100644 index 00000000000..e333ea04f7e --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_enable_remote_vendor_management.py @@ -0,0 +1,331 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud storageappliance enable-remote-vendor-management", + is_experimental=True, +) +class EnableRemoteVendorManagement(AAZCommand): + """Enable remote vendor management of the provided storage appliance. + + :example: Turn on remote vendor management for storage appliance + az networkcloud storageappliance enable-remote-vendor-management --resource-group "resourceGroupName" --storage-appliance-name "storageApplianceName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/storageappliances/{}/enableremotevendormanagement", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.storage_appliance_name = AAZStrArg( + options=["-n", "--name", "--storage-appliance-name"], + help="The name of the storage appliance.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + + # define Arg Group "StorageApplianceEnableRemoteVendorManagementParameters" + + _args_schema = cls._args_schema + _args_schema.support_endpoints = AAZListArg( + options=["--support-endpoints"], + arg_group="StorageApplianceEnableRemoteVendorManagementParameters", + help="Field Deprecated. This field is not used and will be rejected if provided. The list of IPv4 subnets (in CIDR format), IPv6 subnets (in CIDR format), or hostnames that the storage appliance needs accessible in order to turn on the remote vendor management.", + ) + + support_endpoints = cls._args_schema.support_endpoints + support_endpoints.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.StorageAppliancesEnableRemoteVendorManagement(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class StorageAppliancesEnableRemoteVendorManagement(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances/{storageApplianceName}/enableRemoteVendorManagement", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "storageApplianceName", self.ctx.args.storage_appliance_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"client_flatten": True}} + ) + _builder.set_prop("supportEndpoints", AAZListType, ".support_endpoints") + + support_endpoints = _builder.get(".supportEndpoints") + if support_endpoints is not None: + support_endpoints.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _EnableRemoteVendorManagementHelper._build_schema_operation_status_result_read(cls._schema_on_200) + + return cls._schema_on_200 + + def on_204(self, session): + pass + + +class _EnableRemoteVendorManagementHelper: + """Helper class for EnableRemoteVendorManagement""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType() + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + _schema_operation_status_result_read = None + + @classmethod + def _build_schema_operation_status_result_read(cls, _schema): + if cls._schema_operation_status_result_read is not None: + _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.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 + return + + cls._schema_operation_status_result_read = _schema_operation_status_result_read = AAZObjectType() + + operation_status_result_read = _schema_operation_status_result_read + operation_status_result_read.end_time = AAZStrType( + serialized_name="endTime", + ) + 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.percent_complete = AAZFloatType( + serialized_name="percentComplete", + ) + operation_status_result_read.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"read_only": True}, + ) + operation_status_result_read.start_time = AAZStrType( + serialized_name="startTime", + ) + operation_status_result_read.status = AAZStrType( + flags={"required": True}, + ) + + operations = _schema_operation_status_result_read.operations + operations.Element = AAZObjectType() + cls._build_schema_operation_status_result_read(operations.Element) + + _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.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 + + +__all__ = ["EnableRemoteVendorManagement"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_list.py new file mode 100644 index 00000000000..6952e77d322 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_list.py @@ -0,0 +1,496 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud storageappliance list", + is_experimental=True, +) +class List(AAZCommand): + """List storage appliances in the provided resource group or subscription. + + :example: List storage appliances for subscription + az networkcloud storageappliance list + + :example: List storage appliances for resource group + az networkcloud storageappliance list --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.networkcloud/storageappliances", "2022-12-12-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/storageappliances", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) + condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + if condition_0: + self.StorageAppliancesListByResourceGroup(ctx=self.ctx)() + if condition_1: + self.StorageAppliancesListBySubscription(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class StorageAppliancesListByResourceGroup(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.value.Element.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.administrator_credentials = AAZObjectType( + serialized_name="administratorCredentials", + flags={"required": True}, + ) + properties.capacity = AAZIntType( + flags={"read_only": True}, + ) + properties.capacity_used = AAZIntType( + serialized_name="capacityUsed", + flags={"read_only": True}, + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.management_ipv4_address = AAZStrType( + serialized_name="managementIpv4Address", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.rack_id = AAZStrType( + serialized_name="rackId", + flags={"required": True}, + ) + properties.rack_slot = AAZIntType( + serialized_name="rackSlot", + flags={"required": True}, + ) + properties.remote_vendor_management_feature = AAZStrType( + serialized_name="remoteVendorManagementFeature", + flags={"read_only": True}, + ) + properties.remote_vendor_management_status = AAZStrType( + serialized_name="remoteVendorManagementStatus", + flags={"read_only": True}, + ) + properties.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"required": True}, + ) + properties.storage_appliance_sku_id = AAZStrType( + serialized_name="storageApplianceSkuId", + flags={"required": True}, + ) + + administrator_credentials = cls._schema_on_200.value.Element.properties.administrator_credentials + administrator_credentials.password = AAZStrType( + flags={"required": True, "secret": True}, + ) + administrator_credentials.username = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + class StorageAppliancesListBySubscription(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/storageAppliances", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.value.Element.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.administrator_credentials = AAZObjectType( + serialized_name="administratorCredentials", + flags={"required": True}, + ) + properties.capacity = AAZIntType( + flags={"read_only": True}, + ) + properties.capacity_used = AAZIntType( + serialized_name="capacityUsed", + flags={"read_only": True}, + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.management_ipv4_address = AAZStrType( + serialized_name="managementIpv4Address", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.rack_id = AAZStrType( + serialized_name="rackId", + flags={"required": True}, + ) + properties.rack_slot = AAZIntType( + serialized_name="rackSlot", + flags={"required": True}, + ) + properties.remote_vendor_management_feature = AAZStrType( + serialized_name="remoteVendorManagementFeature", + flags={"read_only": True}, + ) + properties.remote_vendor_management_status = AAZStrType( + serialized_name="remoteVendorManagementStatus", + flags={"read_only": True}, + ) + properties.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"required": True}, + ) + properties.storage_appliance_sku_id = AAZStrType( + serialized_name="storageApplianceSkuId", + flags={"required": True}, + ) + + administrator_credentials = cls._schema_on_200.value.Element.properties.administrator_credentials + administrator_credentials.password = AAZStrType( + flags={"required": True, "secret": True}, + ) + administrator_credentials.username = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_run_read_command.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_run_read_command.py new file mode 100644 index 00000000000..a4fbede8682 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_run_read_command.py @@ -0,0 +1,366 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud storageappliance run-read-command", + is_experimental=True, +) +class RunReadCommand(AAZCommand): + """Run and retrieve output from read only commands on the provided storage appliance. + + :example: Run and retrieve output from read only commands on storage appliance. + az networkcloud storageappliance run-read-command --resource-group "resourceGroupName" --name "storageApplianceName" --limit-time-seconds 60 --commands command="AlertList" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/storageappliances/{}/runreadcommands", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.storage_appliance_name = AAZStrArg( + options=["-n", "--name", "--storage-appliance-name"], + help="The name of the storage appliance.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + + # define Arg Group "StorageApplianceRunReadCommandsParameters" + + _args_schema = cls._args_schema + _args_schema.commands = AAZListArg( + options=["--commands"], + arg_group="StorageApplianceRunReadCommandsParameters", + help="The list of read-only commands to run.", + required=True, + ) + _args_schema.limit_time_seconds = AAZIntArg( + options=["--limit-time-seconds"], + arg_group="StorageApplianceRunReadCommandsParameters", + help="The maximum time the commands are allowed to run. If the execution time exceeds the maximum, the script will be stopped, any output produced until then will be captured, and the exit code matching a timeout will be returned (252).", + required=True, + fmt=AAZIntArgFormat( + maximum=14400, + minimum=60, + ), + ) + + commands = cls._args_schema.commands + commands.Element = AAZObjectArg() + + _element = cls._args_schema.commands.Element + _element.arguments = AAZListArg( + options=["arguments"], + help="The list of string arguments that will be passed to the script in order as separate arguments.", + ) + _element.command = AAZStrArg( + options=["command"], + help="The read-only command to execute against the storage appliance.", + required=True, + ) + + arguments = cls._args_schema.commands.Element.arguments + arguments.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.StorageAppliancesRunReadCommands(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class StorageAppliancesRunReadCommands(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances/{storageApplianceName}/runReadCommands", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "storageApplianceName", self.ctx.args.storage_appliance_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("commands", AAZListType, ".commands", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("limitTimeSeconds", AAZIntType, ".limit_time_seconds", typ_kwargs={"flags": {"required": True}}) + + commands = _builder.get(".commands") + if commands is not None: + commands.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".commands[]") + if _elements is not None: + _elements.set_prop("arguments", AAZListType, ".arguments") + _elements.set_prop("command", AAZStrType, ".command", typ_kwargs={"flags": {"required": True}}) + + arguments = _builder.get(".commands[].arguments") + if arguments is not None: + arguments.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _RunReadCommandHelper._build_schema_operation_status_result_read(cls._schema_on_200) + + return cls._schema_on_200 + + def on_204(self, session): + pass + + +class _RunReadCommandHelper: + """Helper class for RunReadCommand""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType() + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + _schema_operation_status_result_read = None + + @classmethod + def _build_schema_operation_status_result_read(cls, _schema): + if cls._schema_operation_status_result_read is not None: + _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.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 + return + + cls._schema_operation_status_result_read = _schema_operation_status_result_read = AAZObjectType() + + operation_status_result_read = _schema_operation_status_result_read + operation_status_result_read.end_time = AAZStrType( + serialized_name="endTime", + ) + 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.percent_complete = AAZFloatType( + serialized_name="percentComplete", + ) + operation_status_result_read.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"read_only": True}, + ) + operation_status_result_read.start_time = AAZStrType( + serialized_name="startTime", + ) + operation_status_result_read.status = AAZStrType( + flags={"required": True}, + ) + + operations = _schema_operation_status_result_read.operations + operations.Element = AAZObjectType() + cls._build_schema_operation_status_result_read(operations.Element) + + _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.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 + + +__all__ = ["RunReadCommand"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_show.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_show.py new file mode 100644 index 00000000000..c58881a2d60 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_show.py @@ -0,0 +1,288 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud storageappliance show", + is_experimental=True, +) +class Show(AAZCommand): + """Get properties of the provided storage appliance. + + :example: Get storage appliance + az networkcloud storageappliance show --resource-group "resourceGroupName" --storage-appliance-name "storageApplianceName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/storageappliances/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.storage_appliance_name = AAZStrArg( + options=["-n", "--name", "--storage-appliance-name"], + help="The name of the storage appliance.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.StorageAppliancesGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class StorageAppliancesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances/{storageApplianceName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "storageApplianceName", self.ctx.args.storage_appliance_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.administrator_credentials = AAZObjectType( + serialized_name="administratorCredentials", + flags={"required": True}, + ) + properties.capacity = AAZIntType( + flags={"read_only": True}, + ) + properties.capacity_used = AAZIntType( + serialized_name="capacityUsed", + flags={"read_only": True}, + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.management_ipv4_address = AAZStrType( + serialized_name="managementIpv4Address", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.rack_id = AAZStrType( + serialized_name="rackId", + flags={"required": True}, + ) + properties.rack_slot = AAZIntType( + serialized_name="rackSlot", + flags={"required": True}, + ) + properties.remote_vendor_management_feature = AAZStrType( + serialized_name="remoteVendorManagementFeature", + flags={"read_only": True}, + ) + properties.remote_vendor_management_status = AAZStrType( + serialized_name="remoteVendorManagementStatus", + flags={"read_only": True}, + ) + properties.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"required": True}, + ) + properties.storage_appliance_sku_id = AAZStrType( + serialized_name="storageApplianceSkuId", + flags={"required": True}, + ) + + administrator_credentials = cls._schema_on_200.properties.administrator_credentials + administrator_credentials.password = AAZStrType( + flags={"required": True, "secret": True}, + ) + administrator_credentials.username = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_update.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_update.py new file mode 100644 index 00000000000..edf7f84d09c --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_update.py @@ -0,0 +1,376 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud storageappliance update", + is_experimental=True, +) +class Update(AAZCommand): + """Update properties of the provided bare metal machine, or update tags associated with the bare metal machine. Properties and tag updates can be done independently. + + :example: Patch storage appliance + az networkcloud storageappliance update --resource-group "resourceGroupName" --storage-appliance-name "storageApplianceName" --serial-number "BM1219XXX" --tags key1="myvalue1" key2="myvalue2" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/storageappliances/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.storage_appliance_name = AAZStrArg( + options=["-n", "--name", "--storage-appliance-name"], + help="The name of the storage appliance.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.serial_number = AAZStrArg( + options=["--serial-number"], + arg_group="Properties", + help="The serial number for the storage appliance.", + ) + + # define Arg Group "StorageApplianceUpdateParameters" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="StorageApplianceUpdateParameters", + help="The Azure resource tags that will replace the existing ones.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.StorageAppliancesUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class StorageAppliancesUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances/{storageApplianceName}", + **self.url_parameters + ) + + @property + def method(self): + return "PATCH" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "storageApplianceName", self.ctx.args.storage_appliance_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("serialNumber", AAZStrType, ".serial_number") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _UpdateHelper._build_schema_storage_appliance_read(cls._schema_on_200) + + return cls._schema_on_200 + + +class _UpdateHelper: + """Helper class for Update""" + + _schema_storage_appliance_read = None + + @classmethod + def _build_schema_storage_appliance_read(cls, _schema): + if cls._schema_storage_appliance_read is not None: + _schema.extended_location = cls._schema_storage_appliance_read.extended_location + _schema.id = cls._schema_storage_appliance_read.id + _schema.location = cls._schema_storage_appliance_read.location + _schema.name = cls._schema_storage_appliance_read.name + _schema.properties = cls._schema_storage_appliance_read.properties + _schema.system_data = cls._schema_storage_appliance_read.system_data + _schema.tags = cls._schema_storage_appliance_read.tags + _schema.type = cls._schema_storage_appliance_read.type + return + + cls._schema_storage_appliance_read = _schema_storage_appliance_read = AAZObjectType() + + storage_appliance_read = _schema_storage_appliance_read + storage_appliance_read.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + storage_appliance_read.id = AAZStrType( + flags={"read_only": True}, + ) + storage_appliance_read.location = AAZStrType( + flags={"required": True}, + ) + storage_appliance_read.name = AAZStrType( + flags={"read_only": True}, + ) + storage_appliance_read.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + storage_appliance_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + storage_appliance_read.tags = AAZDictType() + storage_appliance_read.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = _schema_storage_appliance_read.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = _schema_storage_appliance_read.properties + properties.administrator_credentials = AAZObjectType( + serialized_name="administratorCredentials", + flags={"required": True}, + ) + properties.capacity = AAZIntType( + flags={"read_only": True}, + ) + properties.capacity_used = AAZIntType( + serialized_name="capacityUsed", + flags={"read_only": True}, + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.management_ipv4_address = AAZStrType( + serialized_name="managementIpv4Address", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.rack_id = AAZStrType( + serialized_name="rackId", + flags={"required": True}, + ) + properties.rack_slot = AAZIntType( + serialized_name="rackSlot", + flags={"required": True}, + ) + properties.remote_vendor_management_feature = AAZStrType( + serialized_name="remoteVendorManagementFeature", + flags={"read_only": True}, + ) + properties.remote_vendor_management_status = AAZStrType( + serialized_name="remoteVendorManagementStatus", + flags={"read_only": True}, + ) + properties.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"required": True}, + ) + properties.storage_appliance_sku_id = AAZStrType( + serialized_name="storageApplianceSkuId", + flags={"required": True}, + ) + + administrator_credentials = _schema_storage_appliance_read.properties.administrator_credentials + administrator_credentials.password = AAZStrType( + flags={"required": True, "secret": True}, + ) + administrator_credentials.username = AAZStrType( + flags={"required": True}, + ) + + system_data = _schema_storage_appliance_read.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = _schema_storage_appliance_read.tags + tags.Element = AAZStrType() + + _schema.extended_location = cls._schema_storage_appliance_read.extended_location + _schema.id = cls._schema_storage_appliance_read.id + _schema.location = cls._schema_storage_appliance_read.location + _schema.name = cls._schema_storage_appliance_read.name + _schema.properties = cls._schema_storage_appliance_read.properties + _schema.system_data = cls._schema_storage_appliance_read.system_data + _schema.tags = cls._schema_storage_appliance_read.tags + _schema.type = cls._schema_storage_appliance_read.type + + +__all__ = ["Update"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_wait.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_wait.py new file mode 100644 index 00000000000..7bcd1c3991f --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/storageappliance/_wait.py @@ -0,0 +1,283 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud storageappliance wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/storageappliances/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.storage_appliance_name = AAZStrArg( + options=["-n", "--name", "--storage-appliance-name"], + help="The name of the storage appliance.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.StorageAppliancesGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) + return result + + class StorageAppliancesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/storageAppliances/{storageApplianceName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "storageApplianceName", self.ctx.args.storage_appliance_name, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.administrator_credentials = AAZObjectType( + serialized_name="administratorCredentials", + flags={"required": True}, + ) + properties.capacity = AAZIntType( + flags={"read_only": True}, + ) + properties.capacity_used = AAZIntType( + serialized_name="capacityUsed", + flags={"read_only": True}, + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.management_ipv4_address = AAZStrType( + serialized_name="managementIpv4Address", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.rack_id = AAZStrType( + serialized_name="rackId", + flags={"required": True}, + ) + properties.rack_slot = AAZIntType( + serialized_name="rackSlot", + flags={"required": True}, + ) + properties.remote_vendor_management_feature = AAZStrType( + serialized_name="remoteVendorManagementFeature", + flags={"read_only": True}, + ) + properties.remote_vendor_management_status = AAZStrType( + serialized_name="remoteVendorManagementStatus", + flags={"read_only": True}, + ) + properties.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"required": True}, + ) + properties.storage_appliance_sku_id = AAZStrType( + serialized_name="storageApplianceSkuId", + flags={"required": True}, + ) + + administrator_credentials = cls._schema_on_200.properties.administrator_credentials + administrator_credentials.password = AAZStrType( + flags={"required": True, "secret": True}, + ) + administrator_credentials.username = AAZStrType( + flags={"required": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/__cmd_group.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/__cmd_group.py new file mode 100644 index 00000000000..4e2f5d3e066 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/__cmd_group.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "networkcloud trunkednetwork", + is_experimental=True, +) +class __CMDGroup(AAZCommandGroup): + """Manage trunked network + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/__init__.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/__init__.py new file mode 100644 index 00000000000..db73033039b --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/__init__.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._list import * +from ._show import * +from ._update import * +from ._wait import * diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/_create.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/_create.py new file mode 100644 index 00000000000..e697f49ae44 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/_create.py @@ -0,0 +1,407 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud trunkednetwork create", + is_experimental=True, +) +class Create(AAZCommand): + """Create a new trunked network or update the properties of the existing trunked network. + + :example: Create or update trunked network + az networkcloud trunkednetwork create --resource-group "resourceGroupName" --name "trunkedNetworkName" --extended-location name="/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterExtendedLocationName" type="CustomLocation" --location "location" --hybrid-aks-plugin-type "DPDK" --interface-name "eth0" --isolation-domain-ids "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/l2IsolationDomainName" "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/l3IsolationDomainName" --vlans 12 14 --tags key1="myvalue1" key2="myvalue2" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/trunkednetworks/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.trunked_network_name = AAZStrArg( + options=["-n", "--name", "--trunked-network-name"], + help="The name of the trunked network.", + required=True, + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.hybrid_aks_plugin_type = AAZStrArg( + options=["--hybrid-aks-plugin-type"], + arg_group="Properties", + help="The network plugin type for Hybrid AKS.", + default="SRIOV", + enum={"DPDK": "DPDK", "OSDevice": "OSDevice", "SRIOV": "SRIOV"}, + ) + _args_schema.interface_name = AAZStrArg( + options=["--interface-name"], + arg_group="Properties", + help="The default interface name for this trunked network in the virtual machine. This name can be overridden by the name supplied in the network attachment configuration of that virtual machine.", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9@._-]*$", + max_length=12, + ), + ) + _args_schema.isolation_domain_ids = AAZListArg( + options=["--isolation-domain-ids"], + arg_group="Properties", + help="The list of resource IDs representing the Network Fabric isolation domains. It can be any combination of l2IsolationDomain and l3IsolationDomain resources.", + required=True, + ) + _args_schema.vlans = AAZListArg( + options=["--vlans"], + arg_group="Properties", + help="The list of vlans that are selected from the isolation domains for trunking.", + required=True, + ) + + isolation_domain_ids = cls._args_schema.isolation_domain_ids + isolation_domain_ids.Element = AAZStrArg() + + vlans = cls._args_schema.vlans + vlans.Element = AAZIntArg() + + # define Arg Group "TrunkedNetworkParameters" + + _args_schema = cls._args_schema + _args_schema.extended_location = AAZObjectArg( + options=["--extended-location"], + arg_group="TrunkedNetworkParameters", + help="The extended location of the cluster associated with the resource.", + required=True, + ) + _args_schema.location = AAZResourceLocationArg( + arg_group="TrunkedNetworkParameters", + help="The geo-location where the resource lives", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="TrunkedNetworkParameters", + help="Resource tags.", + ) + + extended_location = cls._args_schema.extended_location + extended_location.name = AAZStrArg( + options=["name"], + help="The resource ID of the extended location on which the resource will be created.", + required=True, + ) + extended_location.type = AAZStrArg( + options=["type"], + help="The extended location type, for example, CustomLocation.", + required=True, + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.TrunkedNetworksCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class TrunkedNetworksCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/trunkedNetworks/{trunkedNetworkName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "trunkedNetworkName", self.ctx.args.trunked_network_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("extendedLocation", AAZObjectType, ".extended_location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True, "client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + extended_location = _builder.get(".extendedLocation") + if extended_location is not None: + extended_location.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}}) + extended_location.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("hybridAksPluginType", AAZStrType, ".hybrid_aks_plugin_type") + properties.set_prop("interfaceName", AAZStrType, ".interface_name") + properties.set_prop("isolationDomainIds", AAZListType, ".isolation_domain_ids", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("vlans", AAZListType, ".vlans", typ_kwargs={"flags": {"required": True}}) + + isolation_domain_ids = _builder.get(".properties.isolationDomainIds") + if isolation_domain_ids is not None: + isolation_domain_ids.set_elements(AAZStrType, ".") + + vlans = _builder.get(".properties.vlans") + if vlans is not None: + vlans.set_elements(AAZIntType, ".") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + 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_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200_201.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.hybrid_aks_plugin_type = AAZStrType( + serialized_name="hybridAksPluginType", + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + ) + properties.isolation_domain_ids = AAZListType( + serialized_name="isolationDomainIds", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.virtual_machines_associated_ids = AAZListType( + serialized_name="virtualMachinesAssociatedIds", + flags={"read_only": True}, + ) + properties.vlans = AAZListType( + flags={"required": True}, + ) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200_201.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + isolation_domain_ids = cls._schema_on_200_201.properties.isolation_domain_ids + isolation_domain_ids.Element = AAZStrType() + + virtual_machines_associated_ids = cls._schema_on_200_201.properties.virtual_machines_associated_ids + virtual_machines_associated_ids.Element = AAZStrType() + + vlans = cls._schema_on_200_201.properties.vlans + vlans.Element = AAZIntType() + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/_delete.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/_delete.py new file mode 100644 index 00000000000..115d23b3a86 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/_delete.py @@ -0,0 +1,167 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud trunkednetwork delete", + is_experimental=True, + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete the provided trunked network. + + :example: Delete trunked network + az networkcloud trunkednetwork delete --resource-group "resourceGroupName" --name "trunkedNetworkName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/trunkednetworks/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.trunked_network_name = AAZStrArg( + options=["-n", "--name", "--trunked-network-name"], + help="The name of the trunked network.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.TrunkedNetworksDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class TrunkedNetworksDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/trunkedNetworks/{trunkedNetworkName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "trunkedNetworkName", self.ctx.args.trunked_network_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/_list.py new file mode 100644 index 00000000000..5bb479fac4b --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/_list.py @@ -0,0 +1,468 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud trunkednetwork list", + is_experimental=True, +) +class List(AAZCommand): + """List trunked networks in the provided resource group or subscription. + + :example: List trunked networks for subscription + az networkcloud trunkednetwork list + + :example: List trunked networks for resource group + az networkcloud trunkednetwork list --resource-group "resourceGroupName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.networkcloud/trunkednetworks", "2022-12-12-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/trunkednetworks", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) + condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + if condition_0: + self.TrunkedNetworksListByResourceGroup(ctx=self.ctx)() + if condition_1: + self.TrunkedNetworksListBySubscription(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class TrunkedNetworksListByResourceGroup(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/trunkedNetworks", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.value.Element.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.hybrid_aks_plugin_type = AAZStrType( + serialized_name="hybridAksPluginType", + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + ) + properties.isolation_domain_ids = AAZListType( + serialized_name="isolationDomainIds", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.virtual_machines_associated_ids = AAZListType( + serialized_name="virtualMachinesAssociatedIds", + flags={"read_only": True}, + ) + properties.vlans = AAZListType( + flags={"required": True}, + ) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200.value.Element.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + isolation_domain_ids = cls._schema_on_200.value.Element.properties.isolation_domain_ids + isolation_domain_ids.Element = AAZStrType() + + virtual_machines_associated_ids = cls._schema_on_200.value.Element.properties.virtual_machines_associated_ids + virtual_machines_associated_ids.Element = AAZStrType() + + vlans = cls._schema_on_200.value.Element.properties.vlans + vlans.Element = AAZIntType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + class TrunkedNetworksListBySubscription(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/trunkedNetworks", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.value.Element.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.hybrid_aks_plugin_type = AAZStrType( + serialized_name="hybridAksPluginType", + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + ) + properties.isolation_domain_ids = AAZListType( + serialized_name="isolationDomainIds", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.virtual_machines_associated_ids = AAZListType( + serialized_name="virtualMachinesAssociatedIds", + flags={"read_only": True}, + ) + properties.vlans = AAZListType( + flags={"required": True}, + ) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200.value.Element.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + isolation_domain_ids = cls._schema_on_200.value.Element.properties.isolation_domain_ids + isolation_domain_ids.Element = AAZStrType() + + virtual_machines_associated_ids = cls._schema_on_200.value.Element.properties.virtual_machines_associated_ids + virtual_machines_associated_ids.Element = AAZStrType() + + vlans = cls._schema_on_200.value.Element.properties.vlans + vlans.Element = AAZIntType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/_show.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/_show.py new file mode 100644 index 00000000000..e87f547bbab --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/_show.py @@ -0,0 +1,274 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud trunkednetwork show", + is_experimental=True, +) +class Show(AAZCommand): + """Get properties of the provided trunked network. + + :example: Get trunked network + az networkcloud trunkednetwork show --resource-group "resourceGroupName" --name "trunkedNetworkName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/trunkednetworks/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.trunked_network_name = AAZStrArg( + options=["-n", "--name", "--trunked-network-name"], + help="The name of the trunked network.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.TrunkedNetworksGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class TrunkedNetworksGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/trunkedNetworks/{trunkedNetworkName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "trunkedNetworkName", self.ctx.args.trunked_network_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.hybrid_aks_plugin_type = AAZStrType( + serialized_name="hybridAksPluginType", + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + ) + properties.isolation_domain_ids = AAZListType( + serialized_name="isolationDomainIds", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.virtual_machines_associated_ids = AAZListType( + serialized_name="virtualMachinesAssociatedIds", + flags={"read_only": True}, + ) + properties.vlans = AAZListType( + flags={"required": True}, + ) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + isolation_domain_ids = cls._schema_on_200.properties.isolation_domain_ids + isolation_domain_ids.Element = AAZStrType() + + virtual_machines_associated_ids = cls._schema_on_200.properties.virtual_machines_associated_ids + virtual_machines_associated_ids.Element = AAZStrType() + + vlans = cls._schema_on_200.properties.vlans + vlans.Element = AAZIntType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/_update.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/_update.py new file mode 100644 index 00000000000..2be5e148df8 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/_update.py @@ -0,0 +1,304 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud trunkednetwork update", + is_experimental=True, +) +class Update(AAZCommand): + """Update tags associated with the provided trunked network. + + :example: Update tags for trunked network + az networkcloud trunkednetwork update --resource-group "resourceGroupName" --name "trunkedNetworkName" --tags key1="myvalue1" key2="myvalue2" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/trunkednetworks/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.trunked_network_name = AAZStrArg( + options=["-n", "--name", "--trunked-network-name"], + help="The name of the trunked network.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + + # define Arg Group "TrunkedNetworkUpdateParameters" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="TrunkedNetworkUpdateParameters", + help="The Azure resource tags that will replace the existing ones.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.TrunkedNetworksUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class TrunkedNetworksUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/trunkedNetworks/{trunkedNetworkName}", + **self.url_parameters + ) + + @property + def method(self): + return "PATCH" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "trunkedNetworkName", self.ctx.args.trunked_network_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"client_flatten": True}} + ) + _builder.set_prop("tags", AAZDictType, ".tags") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.hybrid_aks_plugin_type = AAZStrType( + serialized_name="hybridAksPluginType", + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + ) + properties.isolation_domain_ids = AAZListType( + serialized_name="isolationDomainIds", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.virtual_machines_associated_ids = AAZListType( + serialized_name="virtualMachinesAssociatedIds", + flags={"read_only": True}, + ) + properties.vlans = AAZListType( + flags={"required": True}, + ) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + isolation_domain_ids = cls._schema_on_200.properties.isolation_domain_ids + isolation_domain_ids.Element = AAZStrType() + + virtual_machines_associated_ids = cls._schema_on_200.properties.virtual_machines_associated_ids + virtual_machines_associated_ids.Element = AAZStrType() + + vlans = cls._schema_on_200.properties.vlans + vlans.Element = AAZIntType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _UpdateHelper: + """Helper class for Update""" + + +__all__ = ["Update"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/_wait.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/_wait.py new file mode 100644 index 00000000000..0c44dee1e93 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/trunkednetwork/_wait.py @@ -0,0 +1,269 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud trunkednetwork wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/trunkednetworks/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.trunked_network_name = AAZStrArg( + options=["-n", "--name", "--trunked-network-name"], + help="The name of the trunked network.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.TrunkedNetworksGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) + return result + + class TrunkedNetworksGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/trunkedNetworks/{trunkedNetworkName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "trunkedNetworkName", self.ctx.args.trunked_network_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.hybrid_aks_clusters_associated_ids = AAZListType( + serialized_name="hybridAksClustersAssociatedIds", + flags={"read_only": True}, + ) + properties.hybrid_aks_plugin_type = AAZStrType( + serialized_name="hybridAksPluginType", + ) + properties.interface_name = AAZStrType( + serialized_name="interfaceName", + ) + properties.isolation_domain_ids = AAZListType( + serialized_name="isolationDomainIds", + flags={"required": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.virtual_machines_associated_ids = AAZListType( + serialized_name="virtualMachinesAssociatedIds", + flags={"read_only": True}, + ) + properties.vlans = AAZListType( + flags={"required": True}, + ) + + hybrid_aks_clusters_associated_ids = cls._schema_on_200.properties.hybrid_aks_clusters_associated_ids + hybrid_aks_clusters_associated_ids.Element = AAZStrType() + + isolation_domain_ids = cls._schema_on_200.properties.isolation_domain_ids + isolation_domain_ids.Element = AAZStrType() + + virtual_machines_associated_ids = cls._schema_on_200.properties.virtual_machines_associated_ids + virtual_machines_associated_ids.Element = AAZStrType() + + vlans = cls._schema_on_200.properties.vlans + vlans.Element = AAZIntType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/__cmd_group.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/__cmd_group.py new file mode 100644 index 00000000000..eb036b1b396 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/__cmd_group.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "networkcloud virtualmachine", + is_experimental=True, +) +class __CMDGroup(AAZCommandGroup): + """Manage virtual machine + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/__init__.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/__init__.py new file mode 100644 index 00000000000..9688b9fb1c1 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/__init__.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._attach_volume import * +from ._create import * +from ._delete import * +from ._detach_volume import * +from ._list import * +from ._power_off import * +from ._reimage import * +from ._restart import * +from ._show import * +from ._start import * +from ._update import * +from ._wait import * diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_attach_volume.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_attach_volume.py new file mode 100644 index 00000000000..93b5cb77bf3 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_attach_volume.py @@ -0,0 +1,325 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud virtualmachine attach-volume", + is_experimental=True, +) +class AttachVolume(AAZCommand): + """Attach volume to the provided virtual machine. + + :example: Attach volume to virtual machine + az networkcloud virtualmachine attach-volume --resource-group "resourceGroupName" --volume-id "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/volumes/volumeName" --name "virtualMachineName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/virtualmachines/{}/attachvolume", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.virtual_machine_name = AAZStrArg( + options=["-n", "--name", "--virtual-machine-name"], + help="The name of the virtual machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + + # define Arg Group "VirtualMachineAttachVolumeParameters" + + _args_schema = cls._args_schema + _args_schema.volume_id = AAZStrArg( + options=["--volume-id"], + arg_group="VirtualMachineAttachVolumeParameters", + help="The resource ID of the volume.", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.VirtualMachinesAttachVolume(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class VirtualMachinesAttachVolume(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/attachVolume", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "virtualMachineName", self.ctx.args.virtual_machine_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("volumeId", AAZStrType, ".volume_id", typ_kwargs={"flags": {"required": True}}) + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _AttachVolumeHelper._build_schema_operation_status_result_read(cls._schema_on_200) + + return cls._schema_on_200 + + def on_204(self, session): + pass + + +class _AttachVolumeHelper: + """Helper class for AttachVolume""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType() + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + _schema_operation_status_result_read = None + + @classmethod + def _build_schema_operation_status_result_read(cls, _schema): + if cls._schema_operation_status_result_read is not None: + _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.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 + return + + cls._schema_operation_status_result_read = _schema_operation_status_result_read = AAZObjectType() + + operation_status_result_read = _schema_operation_status_result_read + operation_status_result_read.end_time = AAZStrType( + serialized_name="endTime", + ) + 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.percent_complete = AAZFloatType( + serialized_name="percentComplete", + ) + operation_status_result_read.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"read_only": True}, + ) + operation_status_result_read.start_time = AAZStrType( + serialized_name="startTime", + ) + operation_status_result_read.status = AAZStrType( + flags={"required": True}, + ) + + operations = _schema_operation_status_result_read.operations + operations.Element = AAZObjectType() + cls._build_schema_operation_status_result_read(operations.Element) + + _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.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 + + +__all__ = ["AttachVolume"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_create.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_create.py new file mode 100644 index 00000000000..7e5a8a1d4e3 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_create.py @@ -0,0 +1,861 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud virtualmachine create", + is_experimental=True, +) +class Create(AAZCommand): + """Create a new virtual machine or update the properties of the existing virtual machine. + + :example: Create virtual machine + az networkcloud virtualmachine create --resource-group "resourceGroupName" --name "virtualMachineName" --extended-location name="/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterExtendedLocationName" type="CustomLocation" --location "location" --admin-username "admin" --boot-method "UEFI" --cloud-services-network-attachment attached-network-id="/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/CloudServicesNetworks/cloudServicesNetworkName" --cpu-cores 2 --isolate-emulator-thread "True" --memory-size 8 --network-attachments '[{"attachedNetworkId":"/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/l3Networks/l3NetworkName","defaultGateway":"True","ipAllocationMethod":"Dynamic","ipv4Address":"198.51.100.1","ipv6Address":"2001:0db8:0000:0000:0000:0000:0000:0000","networkAttachmentName":"networkAttachmentName"}]' --network-data "bmV0d29ya0RhdGVTYW1wbGU=" --placement-hints '[{"hintType":"Affinity","resourceId":"/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/racks/rackName", "schedulingExecution":"Hard", "scope":""}]' --ssh-key-values "ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeRqiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXISTRnIDpcf5qytjs1Xo+yYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOKpzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm" --storage-profile disk-size=120 create-option="Ephemeral" delete-option="Delete" --tags key1="myvalues1" --tags key2="myvalues2" --user-data "dXNlckRhdGVTYW1wbGU=" --virtio-interface "Modern" --vm-image "myacr.azurecr.io/ubuntu-pw:20.04" --vm-image-repository-credentials password="{password}" registry-url="myacr.azurecr.io" username="username" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/virtualmachines/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.virtual_machine_name = AAZStrArg( + options=["-n", "--name", "--virtual-machine-name"], + help="The name of the virtual machine.", + required=True, + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.admin_username = AAZStrArg( + options=["--admin-username"], + arg_group="Properties", + help="The name of the administrator to which the ssh public keys will be added into the authorized keys.", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-z_][a-z0-9_]{0,31}$", + max_length=32, + min_length=1, + ), + ) + _args_schema.boot_method = AAZStrArg( + options=["--boot-method"], + arg_group="Properties", + help="Selects the boot method for the virtual machine.", + default="UEFI", + enum={"BIOS": "BIOS", "UEFI": "UEFI"}, + ) + _args_schema.cloud_services_network_attachment = AAZObjectArg( + options=["--csn", "--cloud-services-network-attachment"], + arg_group="Properties", + help="The cloud service network that provides platform-level services for the virtual machine.", + required=True, + ) + _args_schema.cpu_cores = AAZIntArg( + options=["--cpu-cores"], + arg_group="Properties", + help="The number of CPU cores in the virtual machine.", + required=True, + fmt=AAZIntArgFormat( + minimum=2, + ), + ) + _args_schema.isolate_emulator_thread = AAZStrArg( + options=["--isolate-emulator-thread"], + arg_group="Properties", + help="Field Deprecated, the value will be ignored if provided. The indicator of whether one of the specified CPU cores is isolated to run the emulator thread for this virtual machine.", + default="True", + enum={"False": "False", "True": "True"}, + ) + _args_schema.memory_size_gb = AAZIntArg( + options=["--memory-size", "--memory-size-gb"], + arg_group="Properties", + help="The memory size of the virtual machine in GB.", + required=True, + fmt=AAZIntArgFormat( + minimum=1, + ), + ) + _args_schema.network_attachments = AAZListArg( + options=["--na", "--network-attachments"], + arg_group="Properties", + help="The list of network attachments to the virtual machine.", + ) + _args_schema.network_data = AAZStrArg( + options=["--nd", "--network-data"], + arg_group="Properties", + help="The Base64 encoded cloud-init network data.", + ) + _args_schema.placement_hints = AAZListArg( + options=["--ph", "--placement-hints"], + arg_group="Properties", + help="The scheduling hints for the virtual machine.", + ) + _args_schema.ssh_public_keys = AAZListArg( + options=["--ssh-public-keys"], + arg_group="Properties", + help="The list of ssh public keys. Each key will be added to the virtual machine using the cloud-init ssh_authorized_keys mechanism for the adminUsername.", + ) + _args_schema.storage_profile = AAZObjectArg( + options=["--storage-profile"], + arg_group="Properties", + help="The storage profile that specifies size and other parameters about the disks related to the virtual machine.", + required=True, + ) + _args_schema.user_data = AAZStrArg( + options=["--ud", "--user-data"], + arg_group="Properties", + help="The Base64 encoded cloud-init user data.", + ) + _args_schema.virtio_interface = AAZStrArg( + options=["--vi", "--virtio-interface"], + arg_group="Properties", + help="Field Deprecated, use virtualizationModel instead. The type of the virtio interface.", + default="Modern", + enum={"Modern": "Modern", "Transitional": "Transitional"}, + ) + _args_schema.vm_device_model = AAZStrArg( + options=["--vm-device-model"], + arg_group="Properties", + help="The type of the device model to use.", + default="T2", + enum={"T1": "T1", "T2": "T2"}, + ) + _args_schema.vm_image = AAZStrArg( + options=["--vm-image"], + arg_group="Properties", + help="The virtual machine image that is currently provisioned to the OS disk, using the full url and tag notation used to pull the image.", + required=True, + ) + _args_schema.vm_image_repository_credentials = AAZObjectArg( + options=["--vmi-creds", "--vm-image-repository-credentials"], + arg_group="Properties", + help="The credentials used to login to the image repository that has access to the specified image.", + ) + + cloud_services_network_attachment = cls._args_schema.cloud_services_network_attachment + cloud_services_network_attachment.attached_network_id = AAZStrArg( + options=["attached-network-id"], + help="The resource ID of the associated network attached to the virtual machine. It can be one of cloudServicesNetwork, l3Network, l2Network or trunkedNetwork resources.", + required=True, + ) + cloud_services_network_attachment.default_gateway = AAZStrArg( + options=["default-gateway"], + help="The indicator of whether this is the default gateway. Only one of the attached networks (including the CloudServicesNetwork attachment) for a single machine may be specified as True.", + enum={"False": "False", "True": "True"}, + ) + cloud_services_network_attachment.ip_allocation_method = AAZStrArg( + options=["ip-allocation-method"], + help="The IP allocation mechanism for the virtual machine. Dynamic and Static are only valid for l3Network which may also specify Disabled. Otherwise, Disabled is the only permitted value.", + required=True, + enum={"Disabled": "Disabled", "Dynamic": "Dynamic", "Static": "Static"}, + ) + cloud_services_network_attachment.ipv4_address = AAZStrArg( + options=["ipv4-address"], + help="The IPv4 address of the virtual machine. This field is used only if the attached network has IPAllocationType of IPV4 or DualStack. If IPAllocationMethod is: Static - this field must contain a user specified IPv4 address from within the subnet specified in the attached network. Dynamic - this field is read-only, but will be populated with an address from within the subnet specified in the attached network. Disabled - this field will be empty.", + ) + cloud_services_network_attachment.ipv6_address = AAZStrArg( + options=["ipv6-address"], + help="The IPv6 address of the virtual machine. This field is used only if the attached network has IPAllocationType of IPV6 or DualStack. If IPAllocationMethod is: Static - this field must contain an IPv6 address range from within the range specified in the attached network. Dynamic - this field is read-only, but will be populated with an range from within the subnet specified in the attached network. Disabled - this field will be empty.", + ) + cloud_services_network_attachment.network_attachment_name = AAZStrArg( + options=["network-attachment-name"], + help="The associated network's interface name. If specified, the network attachment name has a maximum length of 15 characters and must be unique to this virtual machine. If the user doesn’t specify this value, the default interface name of the network resource will be used. For a CloudServicesNetwork resource, this name will be ignored.", + fmt=AAZStrArgFormat( + max_length=15, + ), + ) + + network_attachments = cls._args_schema.network_attachments + network_attachments.Element = AAZObjectArg() + + _element = cls._args_schema.network_attachments.Element + _element.attached_network_id = AAZStrArg( + options=["attached-network-id"], + help="The resource ID of the associated network attached to the virtual machine. It can be one of cloudServicesNetwork, l3Network, l2Network or trunkedNetwork resources.", + required=True, + ) + _element.default_gateway = AAZStrArg( + options=["default-gateway"], + help="The indicator of whether this is the default gateway. Only one of the attached networks (including the CloudServicesNetwork attachment) for a single machine may be specified as True.", + enum={"False": "False", "True": "True"}, + ) + _element.ip_allocation_method = AAZStrArg( + options=["ip-allocation-method"], + help="The IP allocation mechanism for the virtual machine. Dynamic and Static are only valid for l3Network which may also specify Disabled. Otherwise, Disabled is the only permitted value.", + required=True, + enum={"Disabled": "Disabled", "Dynamic": "Dynamic", "Static": "Static"}, + ) + _element.ipv4_address = AAZStrArg( + options=["ipv4-address"], + help="The IPv4 address of the virtual machine. This field is used only if the attached network has IPAllocationType of IPV4 or DualStack. If IPAllocationMethod is: Static - this field must contain a user specified IPv4 address from within the subnet specified in the attached network. Dynamic - this field is read-only, but will be populated with an address from within the subnet specified in the attached network. Disabled - this field will be empty.", + ) + _element.ipv6_address = AAZStrArg( + options=["ipv6-address"], + help="The IPv6 address of the virtual machine. This field is used only if the attached network has IPAllocationType of IPV6 or DualStack. If IPAllocationMethod is: Static - this field must contain an IPv6 address range from within the range specified in the attached network. Dynamic - this field is read-only, but will be populated with an range from within the subnet specified in the attached network. Disabled - this field will be empty.", + ) + _element.network_attachment_name = AAZStrArg( + options=["network-attachment-name"], + help="The associated network's interface name. If specified, the network attachment name has a maximum length of 15 characters and must be unique to this virtual machine. If the user doesn’t specify this value, the default interface name of the network resource will be used. For a CloudServicesNetwork resource, this name will be ignored.", + fmt=AAZStrArgFormat( + max_length=15, + ), + ) + + placement_hints = cls._args_schema.placement_hints + placement_hints.Element = AAZObjectArg() + + _element = cls._args_schema.placement_hints.Element + _element.hint_type = AAZStrArg( + options=["hint-type"], + help="The specification of whether this hint supports affinity or anti-affinity with the referenced resources.", + required=True, + enum={"Affinity": "Affinity", "AntiAffinity": "AntiAffinity"}, + ) + _element.resource_id = AAZStrArg( + options=["resource-id"], + help="The resource ID of the target object that the placement hints will be checked against, e.g., the bare metal node to host the virtual machine.", + required=True, + fmt=AAZStrArgFormat( + min_length=1, + ), + ) + _element.scheduling_execution = AAZStrArg( + options=["scheduling-execution"], + help="The indicator of whether the hint is a hard or soft requirement during scheduling.", + required=True, + enum={"Hard": "Hard", "Soft": "Soft"}, + ) + _element.scope = AAZStrArg( + options=["scope"], + help="The scope for the virtual machine affinity or anti-affinity placement hint. It should always be \"Machine\" in the case of node affinity.", + required=True, + enum={"Machine": "Machine", "Rack": "Rack"}, + ) + + ssh_public_keys = cls._args_schema.ssh_public_keys + ssh_public_keys.Element = AAZObjectArg() + + _element = cls._args_schema.ssh_public_keys.Element + _element.key_data = AAZStrArg( + options=["key-data"], + help="The public ssh key of the user.", + required=True, + fmt=AAZStrArgFormat( + min_length=1, + ), + ) + + storage_profile = cls._args_schema.storage_profile + storage_profile.create_option = AAZStrArg( + options=["create-option"], + help="The strategy for creating the OS disk.", + default="Ephemeral", + enum={"Ephemeral": "Ephemeral"}, + ) + storage_profile.delete_option = AAZStrArg( + options=["delete-option"], + help="The strategy for deleting the OS disk.", + default="Delete", + enum={"Delete": "Delete"}, + ) + storage_profile.disk_size_gb = AAZIntArg( + options=["disk-size", "disk-size-gb"], + help="The size of the disk in gigabytes. Required if the createOption is Ephemeral.", + required=True, + ) + storage_profile.volume_attachments = AAZListArg( + options=["volume-attachments"], + help="The resource IDs of volumes that are requested to be attached to the virtual machine.", + ) + + volume_attachments = cls._args_schema.storage_profile.volume_attachments + volume_attachments.Element = AAZStrArg() + + vm_image_repository_credentials = cls._args_schema.vm_image_repository_credentials + vm_image_repository_credentials.password = AAZStrArg( + options=["password"], + help="The password or token used to access an image in the target repository.", + required=True, + fmt=AAZStrArgFormat( + min_length=1, + ), + ) + vm_image_repository_credentials.registry_url = AAZStrArg( + options=["registry-url"], + help="The URL of the authentication server used to validate the repository credentials.", + required=True, + ) + vm_image_repository_credentials.username = AAZStrArg( + options=["username"], + help="The username used to access an image in the target repository.", + required=True, + fmt=AAZStrArgFormat( + min_length=1, + ), + ) + + # define Arg Group "VirtualMachineParameters" + + _args_schema = cls._args_schema + _args_schema.extended_location = AAZObjectArg( + options=["--extended-location"], + arg_group="VirtualMachineParameters", + help="The extended location of the cluster associated with the resource.", + required=True, + ) + _args_schema.location = AAZResourceLocationArg( + arg_group="VirtualMachineParameters", + help="The geo-location where the resource lives", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="VirtualMachineParameters", + help="Resource tags.", + ) + + extended_location = cls._args_schema.extended_location + extended_location.name = AAZStrArg( + options=["name"], + help="The resource ID of the extended location on which the resource will be created.", + required=True, + ) + extended_location.type = AAZStrArg( + options=["type"], + help="The extended location type, for example, CustomLocation.", + required=True, + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.VirtualMachinesCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class VirtualMachinesCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "virtualMachineName", self.ctx.args.virtual_machine_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("extendedLocation", AAZObjectType, ".extended_location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True, "client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + extended_location = _builder.get(".extendedLocation") + if extended_location is not None: + extended_location.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}}) + extended_location.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("adminUsername", AAZStrType, ".admin_username", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("bootMethod", AAZStrType, ".boot_method") + properties.set_prop("cloudServicesNetworkAttachment", AAZObjectType, ".cloud_services_network_attachment", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("cpuCores", AAZIntType, ".cpu_cores", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("isolateEmulatorThread", AAZStrType, ".isolate_emulator_thread") + properties.set_prop("memorySizeGB", AAZIntType, ".memory_size_gb", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("networkAttachments", AAZListType, ".network_attachments") + properties.set_prop("networkData", AAZStrType, ".network_data") + properties.set_prop("placementHints", AAZListType, ".placement_hints") + properties.set_prop("sshPublicKeys", AAZListType, ".ssh_public_keys") + properties.set_prop("storageProfile", AAZObjectType, ".storage_profile", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("userData", AAZStrType, ".user_data") + properties.set_prop("virtioInterface", AAZStrType, ".virtio_interface") + properties.set_prop("vmDeviceModel", AAZStrType, ".vm_device_model") + properties.set_prop("vmImage", AAZStrType, ".vm_image", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("vmImageRepositoryCredentials", AAZObjectType, ".vm_image_repository_credentials") + + cloud_services_network_attachment = _builder.get(".properties.cloudServicesNetworkAttachment") + if cloud_services_network_attachment is not None: + cloud_services_network_attachment.set_prop("attachedNetworkId", AAZStrType, ".attached_network_id", typ_kwargs={"flags": {"required": True}}) + cloud_services_network_attachment.set_prop("defaultGateway", AAZStrType, ".default_gateway") + cloud_services_network_attachment.set_prop("ipAllocationMethod", AAZStrType, ".ip_allocation_method", typ_kwargs={"flags": {"required": True}}) + cloud_services_network_attachment.set_prop("ipv4Address", AAZStrType, ".ipv4_address") + cloud_services_network_attachment.set_prop("ipv6Address", AAZStrType, ".ipv6_address") + cloud_services_network_attachment.set_prop("networkAttachmentName", AAZStrType, ".network_attachment_name") + + network_attachments = _builder.get(".properties.networkAttachments") + if network_attachments is not None: + network_attachments.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.networkAttachments[]") + if _elements is not None: + _elements.set_prop("attachedNetworkId", AAZStrType, ".attached_network_id", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("defaultGateway", AAZStrType, ".default_gateway") + _elements.set_prop("ipAllocationMethod", AAZStrType, ".ip_allocation_method", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("ipv4Address", AAZStrType, ".ipv4_address") + _elements.set_prop("ipv6Address", AAZStrType, ".ipv6_address") + _elements.set_prop("networkAttachmentName", AAZStrType, ".network_attachment_name") + + placement_hints = _builder.get(".properties.placementHints") + if placement_hints is not None: + placement_hints.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.placementHints[]") + if _elements is not None: + _elements.set_prop("hintType", AAZStrType, ".hint_type", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("resourceId", AAZStrType, ".resource_id", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("schedulingExecution", AAZStrType, ".scheduling_execution", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("scope", AAZStrType, ".scope", typ_kwargs={"flags": {"required": True}}) + + ssh_public_keys = _builder.get(".properties.sshPublicKeys") + if ssh_public_keys is not None: + ssh_public_keys.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.sshPublicKeys[]") + if _elements is not None: + _elements.set_prop("keyData", AAZStrType, ".key_data", typ_kwargs={"flags": {"required": True}}) + + storage_profile = _builder.get(".properties.storageProfile") + if storage_profile is not None: + storage_profile.set_prop("osDisk", AAZObjectType, ".", typ_kwargs={"flags": {"required": True}}) + storage_profile.set_prop("volumeAttachments", AAZListType, ".volume_attachments") + + os_disk = _builder.get(".properties.storageProfile.osDisk") + if os_disk is not None: + os_disk.set_prop("createOption", AAZStrType, ".create_option") + os_disk.set_prop("deleteOption", AAZStrType, ".delete_option") + os_disk.set_prop("diskSizeGB", AAZIntType, ".disk_size_gb", typ_kwargs={"flags": {"required": True}}) + + volume_attachments = _builder.get(".properties.storageProfile.volumeAttachments") + if volume_attachments is not None: + volume_attachments.set_elements(AAZStrType, ".") + + vm_image_repository_credentials = _builder.get(".properties.vmImageRepositoryCredentials") + if vm_image_repository_credentials is not None: + vm_image_repository_credentials.set_prop("password", AAZStrType, ".password", typ_kwargs={"flags": {"required": True, "secret": True}}) + vm_image_repository_credentials.set_prop("registryUrl", AAZStrType, ".registry_url", typ_kwargs={"flags": {"required": True}}) + vm_image_repository_credentials.set_prop("username", AAZStrType, ".username", typ_kwargs={"flags": {"required": True}}) + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + 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_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200_201.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.admin_username = AAZStrType( + serialized_name="adminUsername", + flags={"required": True}, + ) + properties.bare_metal_machine_id = AAZStrType( + serialized_name="bareMetalMachineId", + flags={"read_only": True}, + ) + properties.boot_method = AAZStrType( + serialized_name="bootMethod", + ) + properties.cloud_services_network_attachment = AAZObjectType( + serialized_name="cloudServicesNetworkAttachment", + flags={"required": True}, + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.cpu_cores = AAZIntType( + serialized_name="cpuCores", + flags={"required": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.isolate_emulator_thread = AAZStrType( + serialized_name="isolateEmulatorThread", + ) + properties.memory_size_gb = AAZIntType( + serialized_name="memorySizeGB", + flags={"required": True}, + ) + properties.network_attachments = AAZListType( + serialized_name="networkAttachments", + ) + properties.network_data = AAZStrType( + serialized_name="networkData", + ) + properties.placement_hints = AAZListType( + serialized_name="placementHints", + ) + properties.power_state = AAZStrType( + serialized_name="powerState", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.ssh_public_keys = AAZListType( + serialized_name="sshPublicKeys", + ) + properties.storage_profile = AAZObjectType( + serialized_name="storageProfile", + flags={"required": True}, + ) + properties.user_data = AAZStrType( + serialized_name="userData", + ) + properties.virtio_interface = AAZStrType( + serialized_name="virtioInterface", + ) + properties.vm_device_model = AAZStrType( + serialized_name="vmDeviceModel", + ) + properties.vm_image = AAZStrType( + serialized_name="vmImage", + flags={"required": True}, + ) + properties.vm_image_repository_credentials = AAZObjectType( + serialized_name="vmImageRepositoryCredentials", + ) + properties.volumes = AAZListType( + flags={"read_only": True}, + ) + + cloud_services_network_attachment = cls._schema_on_200_201.properties.cloud_services_network_attachment + cloud_services_network_attachment.attached_network_id = AAZStrType( + serialized_name="attachedNetworkId", + flags={"required": True}, + ) + cloud_services_network_attachment.default_gateway = AAZStrType( + serialized_name="defaultGateway", + ) + cloud_services_network_attachment.ip_allocation_method = AAZStrType( + serialized_name="ipAllocationMethod", + flags={"required": True}, + ) + cloud_services_network_attachment.ipv4_address = AAZStrType( + serialized_name="ipv4Address", + ) + cloud_services_network_attachment.ipv6_address = AAZStrType( + serialized_name="ipv6Address", + ) + cloud_services_network_attachment.mac_address = AAZStrType( + serialized_name="macAddress", + flags={"read_only": True}, + ) + cloud_services_network_attachment.network_attachment_name = AAZStrType( + serialized_name="networkAttachmentName", + ) + + network_attachments = cls._schema_on_200_201.properties.network_attachments + network_attachments.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.network_attachments.Element + _element.attached_network_id = AAZStrType( + serialized_name="attachedNetworkId", + flags={"required": True}, + ) + _element.default_gateway = AAZStrType( + serialized_name="defaultGateway", + ) + _element.ip_allocation_method = AAZStrType( + serialized_name="ipAllocationMethod", + flags={"required": True}, + ) + _element.ipv4_address = AAZStrType( + serialized_name="ipv4Address", + ) + _element.ipv6_address = AAZStrType( + serialized_name="ipv6Address", + ) + _element.mac_address = AAZStrType( + serialized_name="macAddress", + flags={"read_only": True}, + ) + _element.network_attachment_name = AAZStrType( + serialized_name="networkAttachmentName", + ) + + placement_hints = cls._schema_on_200_201.properties.placement_hints + placement_hints.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.placement_hints.Element + _element.hint_type = AAZStrType( + serialized_name="hintType", + flags={"required": True}, + ) + _element.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"required": True}, + ) + _element.scheduling_execution = AAZStrType( + serialized_name="schedulingExecution", + flags={"required": True}, + ) + _element.scope = AAZStrType( + flags={"required": True}, + ) + + ssh_public_keys = cls._schema_on_200_201.properties.ssh_public_keys + ssh_public_keys.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.ssh_public_keys.Element + _element.key_data = AAZStrType( + serialized_name="keyData", + flags={"required": True}, + ) + + storage_profile = cls._schema_on_200_201.properties.storage_profile + storage_profile.os_disk = AAZObjectType( + serialized_name="osDisk", + flags={"required": True}, + ) + storage_profile.volume_attachments = AAZListType( + serialized_name="volumeAttachments", + ) + + os_disk = cls._schema_on_200_201.properties.storage_profile.os_disk + os_disk.create_option = AAZStrType( + serialized_name="createOption", + ) + os_disk.delete_option = AAZStrType( + serialized_name="deleteOption", + ) + os_disk.disk_size_gb = AAZIntType( + serialized_name="diskSizeGB", + flags={"required": True}, + ) + + volume_attachments = cls._schema_on_200_201.properties.storage_profile.volume_attachments + volume_attachments.Element = AAZStrType() + + vm_image_repository_credentials = cls._schema_on_200_201.properties.vm_image_repository_credentials + vm_image_repository_credentials.password = AAZStrType( + flags={"required": True, "secret": True}, + ) + vm_image_repository_credentials.registry_url = AAZStrType( + serialized_name="registryUrl", + flags={"required": True}, + ) + vm_image_repository_credentials.username = AAZStrType( + flags={"required": True}, + ) + + volumes = cls._schema_on_200_201.properties.volumes + volumes.Element = AAZStrType() + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_delete.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_delete.py new file mode 100644 index 00000000000..9f4118a828e --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_delete.py @@ -0,0 +1,167 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud virtualmachine delete", + is_experimental=True, + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete the provided virtual machine. + + :example: Delete virtual machine + az networkcloud virtualmachine delete --resource-group "resourceGroupName" --name "virtualMachineName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/virtualmachines/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.virtual_machine_name = AAZStrArg( + options=["-n", "--name", "--virtual-machine-name"], + help="The name of the virtual machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.VirtualMachinesDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class VirtualMachinesDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "virtualMachineName", self.ctx.args.virtual_machine_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_detach_volume.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_detach_volume.py new file mode 100644 index 00000000000..95be736b97e --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_detach_volume.py @@ -0,0 +1,325 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud virtualmachine detach-volume", + is_experimental=True, +) +class DetachVolume(AAZCommand): + """Detach volume from the provided virtual machine. + + :example: Detach volume from virtual machine + az networkcloud virtualmachine detach-volume --resource-group "resourceGroupName" --volume-id "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/volumes/volumeName" --name "virtualMachineName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/virtualmachines/{}/detachvolume", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.virtual_machine_name = AAZStrArg( + options=["-n", "--name", "--virtual-machine-name"], + help="The name of the virtual machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + + # define Arg Group "VirtualMachineDetachVolumeParameters" + + _args_schema = cls._args_schema + _args_schema.volume_id = AAZStrArg( + options=["--volume-id"], + arg_group="VirtualMachineDetachVolumeParameters", + help="The resource ID of the volume.", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.VirtualMachinesDetachVolume(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class VirtualMachinesDetachVolume(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/detachVolume", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "virtualMachineName", self.ctx.args.virtual_machine_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("volumeId", AAZStrType, ".volume_id", typ_kwargs={"flags": {"required": True}}) + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _DetachVolumeHelper._build_schema_operation_status_result_read(cls._schema_on_200) + + return cls._schema_on_200 + + def on_204(self, session): + pass + + +class _DetachVolumeHelper: + """Helper class for DetachVolume""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType() + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + _schema_operation_status_result_read = None + + @classmethod + def _build_schema_operation_status_result_read(cls, _schema): + if cls._schema_operation_status_result_read is not None: + _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.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 + return + + cls._schema_operation_status_result_read = _schema_operation_status_result_read = AAZObjectType() + + operation_status_result_read = _schema_operation_status_result_read + operation_status_result_read.end_time = AAZStrType( + serialized_name="endTime", + ) + 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.percent_complete = AAZFloatType( + serialized_name="percentComplete", + ) + operation_status_result_read.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"read_only": True}, + ) + operation_status_result_read.start_time = AAZStrType( + serialized_name="startTime", + ) + operation_status_result_read.status = AAZStrType( + flags={"required": True}, + ) + + operations = _schema_operation_status_result_read.operations + operations.Element = AAZObjectType() + cls._build_schema_operation_status_result_read(operations.Element) + + _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.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 + + +__all__ = ["DetachVolume"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_list.py new file mode 100644 index 00000000000..a1986e3dbd7 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_list.py @@ -0,0 +1,778 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud virtualmachine list", + is_experimental=True, +) +class List(AAZCommand): + """List virtual machines in the provided resource group or subscription. + + :example: List virtual machines for resource group + az networkcloud virtualmachine list --resource-group "resourceGroupName" + + :example: List virtual machines for subscription + az networkcloud virtualmachine list + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.networkcloud/virtualmachines", "2022-12-12-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/virtualmachines", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) + condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + if condition_0: + self.VirtualMachinesListByResourceGroup(ctx=self.ctx)() + if condition_1: + self.VirtualMachinesListBySubscription(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class VirtualMachinesListByResourceGroup(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.value.Element.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.admin_username = AAZStrType( + serialized_name="adminUsername", + flags={"required": True}, + ) + properties.bare_metal_machine_id = AAZStrType( + serialized_name="bareMetalMachineId", + flags={"read_only": True}, + ) + properties.boot_method = AAZStrType( + serialized_name="bootMethod", + ) + properties.cloud_services_network_attachment = AAZObjectType( + serialized_name="cloudServicesNetworkAttachment", + flags={"required": True}, + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.cpu_cores = AAZIntType( + serialized_name="cpuCores", + flags={"required": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.isolate_emulator_thread = AAZStrType( + serialized_name="isolateEmulatorThread", + ) + properties.memory_size_gb = AAZIntType( + serialized_name="memorySizeGB", + flags={"required": True}, + ) + properties.network_attachments = AAZListType( + serialized_name="networkAttachments", + ) + properties.network_data = AAZStrType( + serialized_name="networkData", + ) + properties.placement_hints = AAZListType( + serialized_name="placementHints", + ) + properties.power_state = AAZStrType( + serialized_name="powerState", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.ssh_public_keys = AAZListType( + serialized_name="sshPublicKeys", + ) + properties.storage_profile = AAZObjectType( + serialized_name="storageProfile", + flags={"required": True}, + ) + properties.user_data = AAZStrType( + serialized_name="userData", + ) + properties.virtio_interface = AAZStrType( + serialized_name="virtioInterface", + ) + properties.vm_device_model = AAZStrType( + serialized_name="vmDeviceModel", + ) + properties.vm_image = AAZStrType( + serialized_name="vmImage", + flags={"required": True}, + ) + properties.vm_image_repository_credentials = AAZObjectType( + serialized_name="vmImageRepositoryCredentials", + ) + properties.volumes = AAZListType( + flags={"read_only": True}, + ) + + cloud_services_network_attachment = cls._schema_on_200.value.Element.properties.cloud_services_network_attachment + cloud_services_network_attachment.attached_network_id = AAZStrType( + serialized_name="attachedNetworkId", + flags={"required": True}, + ) + cloud_services_network_attachment.default_gateway = AAZStrType( + serialized_name="defaultGateway", + ) + cloud_services_network_attachment.ip_allocation_method = AAZStrType( + serialized_name="ipAllocationMethod", + flags={"required": True}, + ) + cloud_services_network_attachment.ipv4_address = AAZStrType( + serialized_name="ipv4Address", + ) + cloud_services_network_attachment.ipv6_address = AAZStrType( + serialized_name="ipv6Address", + ) + cloud_services_network_attachment.mac_address = AAZStrType( + serialized_name="macAddress", + flags={"read_only": True}, + ) + cloud_services_network_attachment.network_attachment_name = AAZStrType( + serialized_name="networkAttachmentName", + ) + + network_attachments = cls._schema_on_200.value.Element.properties.network_attachments + network_attachments.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.network_attachments.Element + _element.attached_network_id = AAZStrType( + serialized_name="attachedNetworkId", + flags={"required": True}, + ) + _element.default_gateway = AAZStrType( + serialized_name="defaultGateway", + ) + _element.ip_allocation_method = AAZStrType( + serialized_name="ipAllocationMethod", + flags={"required": True}, + ) + _element.ipv4_address = AAZStrType( + serialized_name="ipv4Address", + ) + _element.ipv6_address = AAZStrType( + serialized_name="ipv6Address", + ) + _element.mac_address = AAZStrType( + serialized_name="macAddress", + flags={"read_only": True}, + ) + _element.network_attachment_name = AAZStrType( + serialized_name="networkAttachmentName", + ) + + placement_hints = cls._schema_on_200.value.Element.properties.placement_hints + placement_hints.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.placement_hints.Element + _element.hint_type = AAZStrType( + serialized_name="hintType", + flags={"required": True}, + ) + _element.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"required": True}, + ) + _element.scheduling_execution = AAZStrType( + serialized_name="schedulingExecution", + flags={"required": True}, + ) + _element.scope = AAZStrType( + flags={"required": True}, + ) + + ssh_public_keys = cls._schema_on_200.value.Element.properties.ssh_public_keys + ssh_public_keys.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.ssh_public_keys.Element + _element.key_data = AAZStrType( + serialized_name="keyData", + flags={"required": True}, + ) + + storage_profile = cls._schema_on_200.value.Element.properties.storage_profile + storage_profile.os_disk = AAZObjectType( + serialized_name="osDisk", + flags={"required": True}, + ) + storage_profile.volume_attachments = AAZListType( + serialized_name="volumeAttachments", + ) + + os_disk = cls._schema_on_200.value.Element.properties.storage_profile.os_disk + os_disk.create_option = AAZStrType( + serialized_name="createOption", + ) + os_disk.delete_option = AAZStrType( + serialized_name="deleteOption", + ) + os_disk.disk_size_gb = AAZIntType( + serialized_name="diskSizeGB", + flags={"required": True}, + ) + + volume_attachments = cls._schema_on_200.value.Element.properties.storage_profile.volume_attachments + volume_attachments.Element = AAZStrType() + + vm_image_repository_credentials = cls._schema_on_200.value.Element.properties.vm_image_repository_credentials + vm_image_repository_credentials.password = AAZStrType( + flags={"required": True, "secret": True}, + ) + vm_image_repository_credentials.registry_url = AAZStrType( + serialized_name="registryUrl", + flags={"required": True}, + ) + vm_image_repository_credentials.username = AAZStrType( + flags={"required": True}, + ) + + volumes = cls._schema_on_200.value.Element.properties.volumes + volumes.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + class VirtualMachinesListBySubscription(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/virtualMachines", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.value.Element.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.admin_username = AAZStrType( + serialized_name="adminUsername", + flags={"required": True}, + ) + properties.bare_metal_machine_id = AAZStrType( + serialized_name="bareMetalMachineId", + flags={"read_only": True}, + ) + properties.boot_method = AAZStrType( + serialized_name="bootMethod", + ) + properties.cloud_services_network_attachment = AAZObjectType( + serialized_name="cloudServicesNetworkAttachment", + flags={"required": True}, + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.cpu_cores = AAZIntType( + serialized_name="cpuCores", + flags={"required": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.isolate_emulator_thread = AAZStrType( + serialized_name="isolateEmulatorThread", + ) + properties.memory_size_gb = AAZIntType( + serialized_name="memorySizeGB", + flags={"required": True}, + ) + properties.network_attachments = AAZListType( + serialized_name="networkAttachments", + ) + properties.network_data = AAZStrType( + serialized_name="networkData", + ) + properties.placement_hints = AAZListType( + serialized_name="placementHints", + ) + properties.power_state = AAZStrType( + serialized_name="powerState", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.ssh_public_keys = AAZListType( + serialized_name="sshPublicKeys", + ) + properties.storage_profile = AAZObjectType( + serialized_name="storageProfile", + flags={"required": True}, + ) + properties.user_data = AAZStrType( + serialized_name="userData", + ) + properties.virtio_interface = AAZStrType( + serialized_name="virtioInterface", + ) + properties.vm_device_model = AAZStrType( + serialized_name="vmDeviceModel", + ) + properties.vm_image = AAZStrType( + serialized_name="vmImage", + flags={"required": True}, + ) + properties.vm_image_repository_credentials = AAZObjectType( + serialized_name="vmImageRepositoryCredentials", + ) + properties.volumes = AAZListType( + flags={"read_only": True}, + ) + + cloud_services_network_attachment = cls._schema_on_200.value.Element.properties.cloud_services_network_attachment + cloud_services_network_attachment.attached_network_id = AAZStrType( + serialized_name="attachedNetworkId", + flags={"required": True}, + ) + cloud_services_network_attachment.default_gateway = AAZStrType( + serialized_name="defaultGateway", + ) + cloud_services_network_attachment.ip_allocation_method = AAZStrType( + serialized_name="ipAllocationMethod", + flags={"required": True}, + ) + cloud_services_network_attachment.ipv4_address = AAZStrType( + serialized_name="ipv4Address", + ) + cloud_services_network_attachment.ipv6_address = AAZStrType( + serialized_name="ipv6Address", + ) + cloud_services_network_attachment.mac_address = AAZStrType( + serialized_name="macAddress", + flags={"read_only": True}, + ) + cloud_services_network_attachment.network_attachment_name = AAZStrType( + serialized_name="networkAttachmentName", + ) + + network_attachments = cls._schema_on_200.value.Element.properties.network_attachments + network_attachments.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.network_attachments.Element + _element.attached_network_id = AAZStrType( + serialized_name="attachedNetworkId", + flags={"required": True}, + ) + _element.default_gateway = AAZStrType( + serialized_name="defaultGateway", + ) + _element.ip_allocation_method = AAZStrType( + serialized_name="ipAllocationMethod", + flags={"required": True}, + ) + _element.ipv4_address = AAZStrType( + serialized_name="ipv4Address", + ) + _element.ipv6_address = AAZStrType( + serialized_name="ipv6Address", + ) + _element.mac_address = AAZStrType( + serialized_name="macAddress", + flags={"read_only": True}, + ) + _element.network_attachment_name = AAZStrType( + serialized_name="networkAttachmentName", + ) + + placement_hints = cls._schema_on_200.value.Element.properties.placement_hints + placement_hints.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.placement_hints.Element + _element.hint_type = AAZStrType( + serialized_name="hintType", + flags={"required": True}, + ) + _element.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"required": True}, + ) + _element.scheduling_execution = AAZStrType( + serialized_name="schedulingExecution", + flags={"required": True}, + ) + _element.scope = AAZStrType( + flags={"required": True}, + ) + + ssh_public_keys = cls._schema_on_200.value.Element.properties.ssh_public_keys + ssh_public_keys.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.ssh_public_keys.Element + _element.key_data = AAZStrType( + serialized_name="keyData", + flags={"required": True}, + ) + + storage_profile = cls._schema_on_200.value.Element.properties.storage_profile + storage_profile.os_disk = AAZObjectType( + serialized_name="osDisk", + flags={"required": True}, + ) + storage_profile.volume_attachments = AAZListType( + serialized_name="volumeAttachments", + ) + + os_disk = cls._schema_on_200.value.Element.properties.storage_profile.os_disk + os_disk.create_option = AAZStrType( + serialized_name="createOption", + ) + os_disk.delete_option = AAZStrType( + serialized_name="deleteOption", + ) + os_disk.disk_size_gb = AAZIntType( + serialized_name="diskSizeGB", + flags={"required": True}, + ) + + volume_attachments = cls._schema_on_200.value.Element.properties.storage_profile.volume_attachments + volume_attachments.Element = AAZStrType() + + vm_image_repository_credentials = cls._schema_on_200.value.Element.properties.vm_image_repository_credentials + vm_image_repository_credentials.password = AAZStrType( + flags={"required": True, "secret": True}, + ) + vm_image_repository_credentials.registry_url = AAZStrType( + serialized_name="registryUrl", + flags={"required": True}, + ) + vm_image_repository_credentials.username = AAZStrType( + flags={"required": True}, + ) + + volumes = cls._schema_on_200.value.Element.properties.volumes + volumes.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_power_off.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_power_off.py new file mode 100644 index 00000000000..7e52a6e399f --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_power_off.py @@ -0,0 +1,326 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud virtualmachine power-off", + is_experimental=True, +) +class PowerOff(AAZCommand): + """Power off the provided virtual machine. + + :example: Power off virtual machine + az networkcloud virtualmachine power-off --resource-group "resourceGroupName" --name "virtualMachineName" --skip-shutdown "True" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/virtualmachines/{}/poweroff", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.virtual_machine_name = AAZStrArg( + options=["-n", "--name", "--virtual-machine-name"], + help="The name of the virtual machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + + # define Arg Group "VirtualMachinePowerOffParameters" + + _args_schema = cls._args_schema + _args_schema.skip_shutdown = AAZStrArg( + options=["--skip-shutdown"], + arg_group="VirtualMachinePowerOffParameters", + help="The indicator of whether to skip the graceful OS shutdown and power off the virtual machine immediately.", + default="False", + enum={"False": "False", "True": "True"}, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.VirtualMachinesPowerOff(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class VirtualMachinesPowerOff(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/powerOff", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "virtualMachineName", self.ctx.args.virtual_machine_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"client_flatten": True}} + ) + _builder.set_prop("skipShutdown", AAZStrType, ".skip_shutdown") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _PowerOffHelper._build_schema_operation_status_result_read(cls._schema_on_200) + + return cls._schema_on_200 + + def on_204(self, session): + pass + + +class _PowerOffHelper: + """Helper class for PowerOff""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType() + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + _schema_operation_status_result_read = None + + @classmethod + def _build_schema_operation_status_result_read(cls, _schema): + if cls._schema_operation_status_result_read is not None: + _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.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 + return + + cls._schema_operation_status_result_read = _schema_operation_status_result_read = AAZObjectType() + + operation_status_result_read = _schema_operation_status_result_read + operation_status_result_read.end_time = AAZStrType( + serialized_name="endTime", + ) + 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.percent_complete = AAZFloatType( + serialized_name="percentComplete", + ) + operation_status_result_read.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"read_only": True}, + ) + operation_status_result_read.start_time = AAZStrType( + serialized_name="startTime", + ) + operation_status_result_read.status = AAZStrType( + flags={"required": True}, + ) + + operations = _schema_operation_status_result_read.operations + operations.Element = AAZObjectType() + cls._build_schema_operation_status_result_read(operations.Element) + + _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.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 + + +__all__ = ["PowerOff"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_reimage.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_reimage.py new file mode 100644 index 00000000000..ce7a3f2579f --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_reimage.py @@ -0,0 +1,301 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud virtualmachine reimage", + is_experimental=True, +) +class Reimage(AAZCommand): + """Reimage the provided virtual machine. + + :example: Reimage virtual machine + az networkcloud virtualmachine reimage --resource-group "resourceGroupName" --name "virtualMachineName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/virtualmachines/{}/reimage", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.virtual_machine_name = AAZStrArg( + options=["-n", "--name", "--virtual-machine-name"], + help="The name of the virtual machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.VirtualMachinesReimage(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class VirtualMachinesReimage(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/reimage", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "virtualMachineName", self.ctx.args.virtual_machine_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _ReimageHelper._build_schema_operation_status_result_read(cls._schema_on_200) + + return cls._schema_on_200 + + def on_204(self, session): + pass + + +class _ReimageHelper: + """Helper class for Reimage""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType() + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + _schema_operation_status_result_read = None + + @classmethod + def _build_schema_operation_status_result_read(cls, _schema): + if cls._schema_operation_status_result_read is not None: + _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.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 + return + + cls._schema_operation_status_result_read = _schema_operation_status_result_read = AAZObjectType() + + operation_status_result_read = _schema_operation_status_result_read + operation_status_result_read.end_time = AAZStrType( + serialized_name="endTime", + ) + 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.percent_complete = AAZFloatType( + serialized_name="percentComplete", + ) + operation_status_result_read.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"read_only": True}, + ) + operation_status_result_read.start_time = AAZStrType( + serialized_name="startTime", + ) + operation_status_result_read.status = AAZStrType( + flags={"required": True}, + ) + + operations = _schema_operation_status_result_read.operations + operations.Element = AAZObjectType() + cls._build_schema_operation_status_result_read(operations.Element) + + _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.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 + + +__all__ = ["Reimage"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_restart.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_restart.py new file mode 100644 index 00000000000..e0ae3ce0567 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_restart.py @@ -0,0 +1,301 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud virtualmachine restart", + is_experimental=True, +) +class Restart(AAZCommand): + """Restart the provided virtual machine. + + :example: Restart virtual machine + az networkcloud virtualmachine restart --resource-group "resourceGroupName" --name "virtualMachineName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/virtualmachines/{}/restart", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.virtual_machine_name = AAZStrArg( + options=["-n", "--name", "--virtual-machine-name"], + help="The name of the virtual machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.VirtualMachinesRestart(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class VirtualMachinesRestart(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/restart", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "virtualMachineName", self.ctx.args.virtual_machine_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _RestartHelper._build_schema_operation_status_result_read(cls._schema_on_200) + + return cls._schema_on_200 + + def on_204(self, session): + pass + + +class _RestartHelper: + """Helper class for Restart""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType() + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + _schema_operation_status_result_read = None + + @classmethod + def _build_schema_operation_status_result_read(cls, _schema): + if cls._schema_operation_status_result_read is not None: + _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.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 + return + + cls._schema_operation_status_result_read = _schema_operation_status_result_read = AAZObjectType() + + operation_status_result_read = _schema_operation_status_result_read + operation_status_result_read.end_time = AAZStrType( + serialized_name="endTime", + ) + 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.percent_complete = AAZFloatType( + serialized_name="percentComplete", + ) + operation_status_result_read.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"read_only": True}, + ) + operation_status_result_read.start_time = AAZStrType( + serialized_name="startTime", + ) + operation_status_result_read.status = AAZStrType( + flags={"required": True}, + ) + + operations = _schema_operation_status_result_read.operations + operations.Element = AAZObjectType() + cls._build_schema_operation_status_result_read(operations.Element) + + _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.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 + + +__all__ = ["Restart"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_show.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_show.py new file mode 100644 index 00000000000..34e49596aeb --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_show.py @@ -0,0 +1,429 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud virtualmachine show", + is_experimental=True, +) +class Show(AAZCommand): + """Get properties of the provided virtual machine. + + :example: Get virtual machine + az networkcloud virtualmachine show --resource-group "resourceGroupName" --name "virtualMachineName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/virtualmachines/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.virtual_machine_name = AAZStrArg( + options=["-n", "--name", "--virtual-machine-name"], + help="The name of the virtual machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.VirtualMachinesGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class VirtualMachinesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "virtualMachineName", self.ctx.args.virtual_machine_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.admin_username = AAZStrType( + serialized_name="adminUsername", + flags={"required": True}, + ) + properties.bare_metal_machine_id = AAZStrType( + serialized_name="bareMetalMachineId", + flags={"read_only": True}, + ) + properties.boot_method = AAZStrType( + serialized_name="bootMethod", + ) + properties.cloud_services_network_attachment = AAZObjectType( + serialized_name="cloudServicesNetworkAttachment", + flags={"required": True}, + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.cpu_cores = AAZIntType( + serialized_name="cpuCores", + flags={"required": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.isolate_emulator_thread = AAZStrType( + serialized_name="isolateEmulatorThread", + ) + properties.memory_size_gb = AAZIntType( + serialized_name="memorySizeGB", + flags={"required": True}, + ) + properties.network_attachments = AAZListType( + serialized_name="networkAttachments", + ) + properties.network_data = AAZStrType( + serialized_name="networkData", + ) + properties.placement_hints = AAZListType( + serialized_name="placementHints", + ) + properties.power_state = AAZStrType( + serialized_name="powerState", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.ssh_public_keys = AAZListType( + serialized_name="sshPublicKeys", + ) + properties.storage_profile = AAZObjectType( + serialized_name="storageProfile", + flags={"required": True}, + ) + properties.user_data = AAZStrType( + serialized_name="userData", + ) + properties.virtio_interface = AAZStrType( + serialized_name="virtioInterface", + ) + properties.vm_device_model = AAZStrType( + serialized_name="vmDeviceModel", + ) + properties.vm_image = AAZStrType( + serialized_name="vmImage", + flags={"required": True}, + ) + properties.vm_image_repository_credentials = AAZObjectType( + serialized_name="vmImageRepositoryCredentials", + ) + properties.volumes = AAZListType( + flags={"read_only": True}, + ) + + cloud_services_network_attachment = cls._schema_on_200.properties.cloud_services_network_attachment + cloud_services_network_attachment.attached_network_id = AAZStrType( + serialized_name="attachedNetworkId", + flags={"required": True}, + ) + cloud_services_network_attachment.default_gateway = AAZStrType( + serialized_name="defaultGateway", + ) + cloud_services_network_attachment.ip_allocation_method = AAZStrType( + serialized_name="ipAllocationMethod", + flags={"required": True}, + ) + cloud_services_network_attachment.ipv4_address = AAZStrType( + serialized_name="ipv4Address", + ) + cloud_services_network_attachment.ipv6_address = AAZStrType( + serialized_name="ipv6Address", + ) + cloud_services_network_attachment.mac_address = AAZStrType( + serialized_name="macAddress", + flags={"read_only": True}, + ) + cloud_services_network_attachment.network_attachment_name = AAZStrType( + serialized_name="networkAttachmentName", + ) + + network_attachments = cls._schema_on_200.properties.network_attachments + network_attachments.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.network_attachments.Element + _element.attached_network_id = AAZStrType( + serialized_name="attachedNetworkId", + flags={"required": True}, + ) + _element.default_gateway = AAZStrType( + serialized_name="defaultGateway", + ) + _element.ip_allocation_method = AAZStrType( + serialized_name="ipAllocationMethod", + flags={"required": True}, + ) + _element.ipv4_address = AAZStrType( + serialized_name="ipv4Address", + ) + _element.ipv6_address = AAZStrType( + serialized_name="ipv6Address", + ) + _element.mac_address = AAZStrType( + serialized_name="macAddress", + flags={"read_only": True}, + ) + _element.network_attachment_name = AAZStrType( + serialized_name="networkAttachmentName", + ) + + placement_hints = cls._schema_on_200.properties.placement_hints + placement_hints.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.placement_hints.Element + _element.hint_type = AAZStrType( + serialized_name="hintType", + flags={"required": True}, + ) + _element.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"required": True}, + ) + _element.scheduling_execution = AAZStrType( + serialized_name="schedulingExecution", + flags={"required": True}, + ) + _element.scope = AAZStrType( + flags={"required": True}, + ) + + ssh_public_keys = cls._schema_on_200.properties.ssh_public_keys + ssh_public_keys.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.ssh_public_keys.Element + _element.key_data = AAZStrType( + serialized_name="keyData", + flags={"required": True}, + ) + + storage_profile = cls._schema_on_200.properties.storage_profile + storage_profile.os_disk = AAZObjectType( + serialized_name="osDisk", + flags={"required": True}, + ) + storage_profile.volume_attachments = AAZListType( + serialized_name="volumeAttachments", + ) + + os_disk = cls._schema_on_200.properties.storage_profile.os_disk + os_disk.create_option = AAZStrType( + serialized_name="createOption", + ) + os_disk.delete_option = AAZStrType( + serialized_name="deleteOption", + ) + os_disk.disk_size_gb = AAZIntType( + serialized_name="diskSizeGB", + flags={"required": True}, + ) + + volume_attachments = cls._schema_on_200.properties.storage_profile.volume_attachments + volume_attachments.Element = AAZStrType() + + vm_image_repository_credentials = cls._schema_on_200.properties.vm_image_repository_credentials + vm_image_repository_credentials.password = AAZStrType( + flags={"required": True, "secret": True}, + ) + vm_image_repository_credentials.registry_url = AAZStrType( + serialized_name="registryUrl", + flags={"required": True}, + ) + vm_image_repository_credentials.username = AAZStrType( + flags={"required": True}, + ) + + volumes = cls._schema_on_200.properties.volumes + volumes.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_start.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_start.py new file mode 100644 index 00000000000..5f2cfffdb6b --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_start.py @@ -0,0 +1,301 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud virtualmachine start", + is_experimental=True, +) +class Start(AAZCommand): + """Start the provided virtual machine. + + :example: Start virtual machine + az networkcloud virtualmachine start --resource-group "resourceGroupName" --name "virtualMachineName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/virtualmachines/{}/start", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.virtual_machine_name = AAZStrArg( + options=["-n", "--name", "--virtual-machine-name"], + help="The name of the virtual machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.VirtualMachinesStart(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class VirtualMachinesStart(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/start", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "virtualMachineName", self.ctx.args.virtual_machine_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _StartHelper._build_schema_operation_status_result_read(cls._schema_on_200) + + return cls._schema_on_200 + + def on_204(self, session): + pass + + +class _StartHelper: + """Helper class for Start""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType() + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + _schema_operation_status_result_read = None + + @classmethod + def _build_schema_operation_status_result_read(cls, _schema): + if cls._schema_operation_status_result_read is not None: + _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.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 + return + + cls._schema_operation_status_result_read = _schema_operation_status_result_read = AAZObjectType() + + operation_status_result_read = _schema_operation_status_result_read + operation_status_result_read.end_time = AAZStrType( + serialized_name="endTime", + ) + 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.percent_complete = AAZFloatType( + serialized_name="percentComplete", + ) + operation_status_result_read.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"read_only": True}, + ) + operation_status_result_read.start_time = AAZStrType( + serialized_name="startTime", + ) + operation_status_result_read.status = AAZStrType( + flags={"required": True}, + ) + + operations = _schema_operation_status_result_read.operations + operations.Element = AAZObjectType() + cls._build_schema_operation_status_result_read(operations.Element) + + _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.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 + + +__all__ = ["Start"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_update.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_update.py new file mode 100644 index 00000000000..f38eb4a4a87 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_update.py @@ -0,0 +1,546 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud virtualmachine update", + is_experimental=True, +) +class Update(AAZCommand): + """Update the properties of the provided virtual machine, or update the tags associated with the virtual machine. Properties and tag updates can be done independently. + + :example: Patch virtual machine + az networkcloud virtualmachine update --resource-group "resourceGroupName" --name "virtualMachineName" --vm-image-repository-credentials password="password" registry-url="myacr.azurecr.io" username="myuser" --tags key1="myvalue1" key2="myvalue2" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/virtualmachines/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.virtual_machine_name = AAZStrArg( + options=["-n", "--name", "--virtual-machine-name"], + help="The name of the virtual machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.vm_image_repository_credentials = AAZObjectArg( + options=["--vmi-creds", "--vm-image-repository-credentials"], + arg_group="Properties", + help="The credentials used to login to the image repository that has access to the specified image.", + ) + + vm_image_repository_credentials = cls._args_schema.vm_image_repository_credentials + vm_image_repository_credentials.password = AAZStrArg( + options=["password"], + help="The password or token used to access an image in the target repository.", + required=True, + fmt=AAZStrArgFormat( + min_length=1, + ), + ) + vm_image_repository_credentials.registry_url = AAZStrArg( + options=["registry-url"], + help="The URL of the authentication server used to validate the repository credentials.", + required=True, + ) + vm_image_repository_credentials.username = AAZStrArg( + options=["username"], + help="The username used to access an image in the target repository.", + required=True, + fmt=AAZStrArgFormat( + min_length=1, + ), + ) + + # define Arg Group "VirtualMachineUpdateParameters" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="VirtualMachineUpdateParameters", + help="The Azure resource tags that will replace the existing ones.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.VirtualMachinesUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class VirtualMachinesUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}", + **self.url_parameters + ) + + @property + def method(self): + return "PATCH" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "virtualMachineName", self.ctx.args.virtual_machine_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("vmImageRepositoryCredentials", AAZObjectType, ".vm_image_repository_credentials") + + vm_image_repository_credentials = _builder.get(".properties.vmImageRepositoryCredentials") + if vm_image_repository_credentials is not None: + vm_image_repository_credentials.set_prop("password", AAZStrType, ".password", typ_kwargs={"flags": {"required": True, "secret": True}}) + vm_image_repository_credentials.set_prop("registryUrl", AAZStrType, ".registry_url", typ_kwargs={"flags": {"required": True}}) + vm_image_repository_credentials.set_prop("username", AAZStrType, ".username", typ_kwargs={"flags": {"required": True}}) + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _UpdateHelper._build_schema_virtual_machine_read(cls._schema_on_200) + + return cls._schema_on_200 + + +class _UpdateHelper: + """Helper class for Update""" + + _schema_virtual_machine_read = None + + @classmethod + def _build_schema_virtual_machine_read(cls, _schema): + if cls._schema_virtual_machine_read is not None: + _schema.extended_location = cls._schema_virtual_machine_read.extended_location + _schema.id = cls._schema_virtual_machine_read.id + _schema.location = cls._schema_virtual_machine_read.location + _schema.name = cls._schema_virtual_machine_read.name + _schema.properties = cls._schema_virtual_machine_read.properties + _schema.system_data = cls._schema_virtual_machine_read.system_data + _schema.tags = cls._schema_virtual_machine_read.tags + _schema.type = cls._schema_virtual_machine_read.type + return + + cls._schema_virtual_machine_read = _schema_virtual_machine_read = AAZObjectType() + + virtual_machine_read = _schema_virtual_machine_read + virtual_machine_read.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + virtual_machine_read.id = AAZStrType( + flags={"read_only": True}, + ) + virtual_machine_read.location = AAZStrType( + flags={"required": True}, + ) + virtual_machine_read.name = AAZStrType( + flags={"read_only": True}, + ) + virtual_machine_read.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + virtual_machine_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + virtual_machine_read.tags = AAZDictType() + virtual_machine_read.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = _schema_virtual_machine_read.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = _schema_virtual_machine_read.properties + properties.admin_username = AAZStrType( + serialized_name="adminUsername", + flags={"required": True}, + ) + properties.bare_metal_machine_id = AAZStrType( + serialized_name="bareMetalMachineId", + flags={"read_only": True}, + ) + properties.boot_method = AAZStrType( + serialized_name="bootMethod", + ) + properties.cloud_services_network_attachment = AAZObjectType( + serialized_name="cloudServicesNetworkAttachment", + flags={"required": True}, + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.cpu_cores = AAZIntType( + serialized_name="cpuCores", + flags={"required": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.isolate_emulator_thread = AAZStrType( + serialized_name="isolateEmulatorThread", + ) + properties.memory_size_gb = AAZIntType( + serialized_name="memorySizeGB", + flags={"required": True}, + ) + properties.network_attachments = AAZListType( + serialized_name="networkAttachments", + ) + properties.network_data = AAZStrType( + serialized_name="networkData", + ) + properties.placement_hints = AAZListType( + serialized_name="placementHints", + ) + properties.power_state = AAZStrType( + serialized_name="powerState", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.ssh_public_keys = AAZListType( + serialized_name="sshPublicKeys", + ) + properties.storage_profile = AAZObjectType( + serialized_name="storageProfile", + flags={"required": True}, + ) + properties.user_data = AAZStrType( + serialized_name="userData", + ) + properties.virtio_interface = AAZStrType( + serialized_name="virtioInterface", + ) + properties.vm_device_model = AAZStrType( + serialized_name="vmDeviceModel", + ) + properties.vm_image = AAZStrType( + serialized_name="vmImage", + flags={"required": True}, + ) + properties.vm_image_repository_credentials = AAZObjectType( + serialized_name="vmImageRepositoryCredentials", + ) + properties.volumes = AAZListType( + flags={"read_only": True}, + ) + + cloud_services_network_attachment = _schema_virtual_machine_read.properties.cloud_services_network_attachment + cloud_services_network_attachment.attached_network_id = AAZStrType( + serialized_name="attachedNetworkId", + flags={"required": True}, + ) + cloud_services_network_attachment.default_gateway = AAZStrType( + serialized_name="defaultGateway", + ) + cloud_services_network_attachment.ip_allocation_method = AAZStrType( + serialized_name="ipAllocationMethod", + flags={"required": True}, + ) + cloud_services_network_attachment.ipv4_address = AAZStrType( + serialized_name="ipv4Address", + ) + cloud_services_network_attachment.ipv6_address = AAZStrType( + serialized_name="ipv6Address", + ) + cloud_services_network_attachment.mac_address = AAZStrType( + serialized_name="macAddress", + flags={"read_only": True}, + ) + cloud_services_network_attachment.network_attachment_name = AAZStrType( + serialized_name="networkAttachmentName", + ) + + network_attachments = _schema_virtual_machine_read.properties.network_attachments + network_attachments.Element = AAZObjectType() + + _element = _schema_virtual_machine_read.properties.network_attachments.Element + _element.attached_network_id = AAZStrType( + serialized_name="attachedNetworkId", + flags={"required": True}, + ) + _element.default_gateway = AAZStrType( + serialized_name="defaultGateway", + ) + _element.ip_allocation_method = AAZStrType( + serialized_name="ipAllocationMethod", + flags={"required": True}, + ) + _element.ipv4_address = AAZStrType( + serialized_name="ipv4Address", + ) + _element.ipv6_address = AAZStrType( + serialized_name="ipv6Address", + ) + _element.mac_address = AAZStrType( + serialized_name="macAddress", + flags={"read_only": True}, + ) + _element.network_attachment_name = AAZStrType( + serialized_name="networkAttachmentName", + ) + + placement_hints = _schema_virtual_machine_read.properties.placement_hints + placement_hints.Element = AAZObjectType() + + _element = _schema_virtual_machine_read.properties.placement_hints.Element + _element.hint_type = AAZStrType( + serialized_name="hintType", + flags={"required": True}, + ) + _element.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"required": True}, + ) + _element.scheduling_execution = AAZStrType( + serialized_name="schedulingExecution", + flags={"required": True}, + ) + _element.scope = AAZStrType( + flags={"required": True}, + ) + + ssh_public_keys = _schema_virtual_machine_read.properties.ssh_public_keys + ssh_public_keys.Element = AAZObjectType() + + _element = _schema_virtual_machine_read.properties.ssh_public_keys.Element + _element.key_data = AAZStrType( + serialized_name="keyData", + flags={"required": True}, + ) + + storage_profile = _schema_virtual_machine_read.properties.storage_profile + storage_profile.os_disk = AAZObjectType( + serialized_name="osDisk", + flags={"required": True}, + ) + storage_profile.volume_attachments = AAZListType( + serialized_name="volumeAttachments", + ) + + os_disk = _schema_virtual_machine_read.properties.storage_profile.os_disk + os_disk.create_option = AAZStrType( + serialized_name="createOption", + ) + os_disk.delete_option = AAZStrType( + serialized_name="deleteOption", + ) + os_disk.disk_size_gb = AAZIntType( + serialized_name="diskSizeGB", + flags={"required": True}, + ) + + volume_attachments = _schema_virtual_machine_read.properties.storage_profile.volume_attachments + volume_attachments.Element = AAZStrType() + + vm_image_repository_credentials = _schema_virtual_machine_read.properties.vm_image_repository_credentials + vm_image_repository_credentials.password = AAZStrType( + flags={"required": True, "secret": True}, + ) + vm_image_repository_credentials.registry_url = AAZStrType( + serialized_name="registryUrl", + flags={"required": True}, + ) + vm_image_repository_credentials.username = AAZStrType( + flags={"required": True}, + ) + + volumes = _schema_virtual_machine_read.properties.volumes + volumes.Element = AAZStrType() + + system_data = _schema_virtual_machine_read.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = _schema_virtual_machine_read.tags + tags.Element = AAZStrType() + + _schema.extended_location = cls._schema_virtual_machine_read.extended_location + _schema.id = cls._schema_virtual_machine_read.id + _schema.location = cls._schema_virtual_machine_read.location + _schema.name = cls._schema_virtual_machine_read.name + _schema.properties = cls._schema_virtual_machine_read.properties + _schema.system_data = cls._schema_virtual_machine_read.system_data + _schema.tags = cls._schema_virtual_machine_read.tags + _schema.type = cls._schema_virtual_machine_read.type + + +__all__ = ["Update"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_wait.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_wait.py new file mode 100644 index 00000000000..416db8d37ae --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/_wait.py @@ -0,0 +1,424 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud virtualmachine wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/virtualmachines/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.virtual_machine_name = AAZStrArg( + options=["-n", "--name", "--virtual-machine-name"], + help="The name of the virtual machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.VirtualMachinesGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) + return result + + class VirtualMachinesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "virtualMachineName", self.ctx.args.virtual_machine_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.admin_username = AAZStrType( + serialized_name="adminUsername", + flags={"required": True}, + ) + properties.bare_metal_machine_id = AAZStrType( + serialized_name="bareMetalMachineId", + flags={"read_only": True}, + ) + properties.boot_method = AAZStrType( + serialized_name="bootMethod", + ) + properties.cloud_services_network_attachment = AAZObjectType( + serialized_name="cloudServicesNetworkAttachment", + flags={"required": True}, + ) + properties.cluster_id = AAZStrType( + serialized_name="clusterId", + flags={"read_only": True}, + ) + properties.cpu_cores = AAZIntType( + serialized_name="cpuCores", + flags={"required": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.isolate_emulator_thread = AAZStrType( + serialized_name="isolateEmulatorThread", + ) + properties.memory_size_gb = AAZIntType( + serialized_name="memorySizeGB", + flags={"required": True}, + ) + properties.network_attachments = AAZListType( + serialized_name="networkAttachments", + ) + properties.network_data = AAZStrType( + serialized_name="networkData", + ) + properties.placement_hints = AAZListType( + serialized_name="placementHints", + ) + properties.power_state = AAZStrType( + serialized_name="powerState", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.ssh_public_keys = AAZListType( + serialized_name="sshPublicKeys", + ) + properties.storage_profile = AAZObjectType( + serialized_name="storageProfile", + flags={"required": True}, + ) + properties.user_data = AAZStrType( + serialized_name="userData", + ) + properties.virtio_interface = AAZStrType( + serialized_name="virtioInterface", + ) + properties.vm_device_model = AAZStrType( + serialized_name="vmDeviceModel", + ) + properties.vm_image = AAZStrType( + serialized_name="vmImage", + flags={"required": True}, + ) + properties.vm_image_repository_credentials = AAZObjectType( + serialized_name="vmImageRepositoryCredentials", + ) + properties.volumes = AAZListType( + flags={"read_only": True}, + ) + + cloud_services_network_attachment = cls._schema_on_200.properties.cloud_services_network_attachment + cloud_services_network_attachment.attached_network_id = AAZStrType( + serialized_name="attachedNetworkId", + flags={"required": True}, + ) + cloud_services_network_attachment.default_gateway = AAZStrType( + serialized_name="defaultGateway", + ) + cloud_services_network_attachment.ip_allocation_method = AAZStrType( + serialized_name="ipAllocationMethod", + flags={"required": True}, + ) + cloud_services_network_attachment.ipv4_address = AAZStrType( + serialized_name="ipv4Address", + ) + cloud_services_network_attachment.ipv6_address = AAZStrType( + serialized_name="ipv6Address", + ) + cloud_services_network_attachment.mac_address = AAZStrType( + serialized_name="macAddress", + flags={"read_only": True}, + ) + cloud_services_network_attachment.network_attachment_name = AAZStrType( + serialized_name="networkAttachmentName", + ) + + network_attachments = cls._schema_on_200.properties.network_attachments + network_attachments.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.network_attachments.Element + _element.attached_network_id = AAZStrType( + serialized_name="attachedNetworkId", + flags={"required": True}, + ) + _element.default_gateway = AAZStrType( + serialized_name="defaultGateway", + ) + _element.ip_allocation_method = AAZStrType( + serialized_name="ipAllocationMethod", + flags={"required": True}, + ) + _element.ipv4_address = AAZStrType( + serialized_name="ipv4Address", + ) + _element.ipv6_address = AAZStrType( + serialized_name="ipv6Address", + ) + _element.mac_address = AAZStrType( + serialized_name="macAddress", + flags={"read_only": True}, + ) + _element.network_attachment_name = AAZStrType( + serialized_name="networkAttachmentName", + ) + + placement_hints = cls._schema_on_200.properties.placement_hints + placement_hints.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.placement_hints.Element + _element.hint_type = AAZStrType( + serialized_name="hintType", + flags={"required": True}, + ) + _element.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"required": True}, + ) + _element.scheduling_execution = AAZStrType( + serialized_name="schedulingExecution", + flags={"required": True}, + ) + _element.scope = AAZStrType( + flags={"required": True}, + ) + + ssh_public_keys = cls._schema_on_200.properties.ssh_public_keys + ssh_public_keys.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.ssh_public_keys.Element + _element.key_data = AAZStrType( + serialized_name="keyData", + flags={"required": True}, + ) + + storage_profile = cls._schema_on_200.properties.storage_profile + storage_profile.os_disk = AAZObjectType( + serialized_name="osDisk", + flags={"required": True}, + ) + storage_profile.volume_attachments = AAZListType( + serialized_name="volumeAttachments", + ) + + os_disk = cls._schema_on_200.properties.storage_profile.os_disk + os_disk.create_option = AAZStrType( + serialized_name="createOption", + ) + os_disk.delete_option = AAZStrType( + serialized_name="deleteOption", + ) + os_disk.disk_size_gb = AAZIntType( + serialized_name="diskSizeGB", + flags={"required": True}, + ) + + volume_attachments = cls._schema_on_200.properties.storage_profile.volume_attachments + volume_attachments.Element = AAZStrType() + + vm_image_repository_credentials = cls._schema_on_200.properties.vm_image_repository_credentials + vm_image_repository_credentials.password = AAZStrType( + flags={"required": True, "secret": True}, + ) + vm_image_repository_credentials.registry_url = AAZStrType( + serialized_name="registryUrl", + flags={"required": True}, + ) + vm_image_repository_credentials.username = AAZStrType( + flags={"required": True}, + ) + + volumes = cls._schema_on_200.properties.volumes + volumes.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/__cmd_group.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/__cmd_group.py new file mode 100644 index 00000000000..30043ef82fe --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/__cmd_group.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "networkcloud virtualmachine console", + is_experimental=True, +) +class __CMDGroup(AAZCommandGroup): + """Manage virtual machine's console + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/__init__.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/__init__.py new file mode 100644 index 00000000000..db73033039b --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/__init__.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._list import * +from ._show import * +from ._update import * +from ._wait import * diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/_create.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/_create.py new file mode 100644 index 00000000000..033e573e2bd --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/_create.py @@ -0,0 +1,398 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud virtualmachine console create", + is_experimental=True, +) +class Create(AAZCommand): + """Create a new virtual machine console or update the properties of the existing virtual machine console. + + A single console is allowed for each virtual machine and is always named 'default'. + + :example: Create or update virtual machine console + az networkcloud virtualmachine console create --extended-location name="/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterManagerExtendedLocationName" type="CustomLocation" --location "location" --enabled "True" --expiration "2024-06-01T01:27:03.008Z" --ssh-public-key key-data="ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeRqiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXISTRnIDpcf5qytjs1Xo+yYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOKpzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm" --tags key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" --virtual-machine-name "virtualMachineName" + + :example: Create or update virtual machine console with SSH key file + az networkcloud virtualmachine console create --extended-location name="/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterManagerExtendedLocationName" type="CustomLocation" --location "location" --enabled "True" --expiration "2024-06-01T01:27:03.008Z" --ssh-public-key key-data=~/.ssh/id_rsa.pub --tags key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" --virtual-machine-name "virtualMachineName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/virtualmachines/{}/consoles/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.console_name = AAZStrArg( + options=["-n", "--name", "--console-name"], + help="The name of the virtual machine console.", + required=True, + fmt=AAZStrArgFormat( + pattern="^default$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.virtual_machine_name = AAZStrArg( + options=["--virtual-machine-name"], + help="The name of the virtual machine.", + required=True, + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + + # define Arg Group "ConsoleParameters" + + _args_schema = cls._args_schema + _args_schema.extended_location = AAZObjectArg( + options=["--extended-location"], + arg_group="ConsoleParameters", + help="The extended location of the cluster manager associated with the cluster this virtual machine is created on.", + required=True, + ) + _args_schema.location = AAZResourceLocationArg( + arg_group="ConsoleParameters", + help="The geo-location where the resource lives", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="ConsoleParameters", + help="Resource tags.", + ) + + extended_location = cls._args_schema.extended_location + extended_location.name = AAZStrArg( + options=["name"], + help="The resource ID of the extended location on which the resource will be created.", + required=True, + ) + extended_location.type = AAZStrArg( + options=["type"], + help="The extended location type, for example, CustomLocation.", + required=True, + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.enabled = AAZStrArg( + options=["--enabled"], + arg_group="Properties", + help="The indicator of whether the console access is enabled.", + required=True, + enum={"False": "False", "True": "True"}, + ) + _args_schema.expiration = AAZDateTimeArg( + options=["--expiration"], + arg_group="Properties", + help="The date and time after which the key will be disallowed access.", + ) + _args_schema.ssh_public_key = AAZObjectArg( + options=["--ssh-public-key"], + arg_group="Properties", + help="The SSH public key that will be provisioned for user access. The user is expected to have the corresponding SSH private key for logging in.", + required=True, + ) + + ssh_public_key = cls._args_schema.ssh_public_key + ssh_public_key.key_data = AAZStrArg( + options=["key-data"], + help="The public ssh key of the user.", + required=True, + fmt=AAZStrArgFormat( + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.ConsolesCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ConsolesCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/consoles/{consoleName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "consoleName", self.ctx.args.console_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "virtualMachineName", self.ctx.args.virtual_machine_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("extendedLocation", AAZObjectType, ".extended_location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True, "client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + extended_location = _builder.get(".extendedLocation") + if extended_location is not None: + extended_location.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}}) + extended_location.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("enabled", AAZStrType, ".enabled", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("expiration", AAZStrType, ".expiration") + properties.set_prop("sshPublicKey", AAZObjectType, ".ssh_public_key", typ_kwargs={"flags": {"required": True}}) + + ssh_public_key = _builder.get(".properties.sshPublicKey") + if ssh_public_key is not None: + ssh_public_key.set_prop("keyData", AAZStrType, ".key_data", typ_kwargs={"flags": {"required": True}}) + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + 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_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200_201.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.enabled = AAZStrType( + flags={"required": True}, + ) + properties.expiration = AAZStrType() + properties.private_link_service_id = AAZStrType( + serialized_name="privateLinkServiceId", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.ssh_public_key = AAZObjectType( + serialized_name="sshPublicKey", + flags={"required": True}, + ) + properties.virtual_machine_access_id = AAZStrType( + serialized_name="virtualMachineAccessId", + flags={"read_only": True}, + ) + + ssh_public_key = cls._schema_on_200_201.properties.ssh_public_key + ssh_public_key.key_data = AAZStrType( + serialized_name="keyData", + flags={"required": True}, + ) + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/_delete.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/_delete.py new file mode 100644 index 00000000000..ff48114f3b8 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/_delete.py @@ -0,0 +1,180 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud virtualmachine console delete", + is_experimental=True, + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete the provided virtual machine console. + + :example: Delete virtual machine console + az networkcloud virtualmachine console delete --resource-group "resourceGroupName" --virtual-machine-name "virtualMachineName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/virtualmachines/{}/consoles/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.console_name = AAZStrArg( + options=["-n", "--name", "--console-name"], + help="The name of the virtual machine console.", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^default$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.virtual_machine_name = AAZStrArg( + options=["--virtual-machine-name"], + help="The name of the virtual machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.ConsolesDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class ConsolesDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/consoles/{consoleName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "consoleName", self.ctx.args.console_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "virtualMachineName", self.ctx.args.virtual_machine_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/_list.py new file mode 100644 index 00000000000..8e6e996f66a --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/_list.py @@ -0,0 +1,267 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud virtualmachine console list", + is_experimental=True, +) +class List(AAZCommand): + """List consoles of the virtual machine. + + :example: List consoles of the virtual machine + az networkcloud virtualmachine console list --resource-group "resourceGroupName" --virtual-machine-name "virtualMachineName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/virtualmachines/{}/consoles", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.virtual_machine_name = AAZStrArg( + options=["--virtual-machine-name"], + help="The name of the virtual machine.", + required=True, + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ConsolesListByResourceGroup(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class ConsolesListByResourceGroup(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/consoles", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "virtualMachineName", self.ctx.args.virtual_machine_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.value.Element.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.enabled = AAZStrType( + flags={"required": True}, + ) + properties.expiration = AAZStrType() + properties.private_link_service_id = AAZStrType( + serialized_name="privateLinkServiceId", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.ssh_public_key = AAZObjectType( + serialized_name="sshPublicKey", + flags={"required": True}, + ) + properties.virtual_machine_access_id = AAZStrType( + serialized_name="virtualMachineAccessId", + flags={"read_only": True}, + ) + + ssh_public_key = cls._schema_on_200.value.Element.properties.ssh_public_key + ssh_public_key.key_data = AAZStrType( + serialized_name="keyData", + flags={"required": True}, + ) + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/_show.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/_show.py new file mode 100644 index 00000000000..ed007e75ba1 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/_show.py @@ -0,0 +1,272 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud virtualmachine console show", + is_experimental=True, +) +class Show(AAZCommand): + """Get properties of the provided virtual machine console. + + :example: Get virtual machine console + az networkcloud virtualmachine console show --resource-group "resourceGroupName" --virtual-machine-name "virtualMachineName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/virtualmachines/{}/consoles/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.console_name = AAZStrArg( + options=["-n", "--name", "--console-name"], + help="The name of the virtual machine console.", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^default$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.virtual_machine_name = AAZStrArg( + options=["--virtual-machine-name"], + help="The name of the virtual machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ConsolesGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ConsolesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/consoles/{consoleName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "consoleName", self.ctx.args.console_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "virtualMachineName", self.ctx.args.virtual_machine_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.enabled = AAZStrType( + flags={"required": True}, + ) + properties.expiration = AAZStrType() + properties.private_link_service_id = AAZStrType( + serialized_name="privateLinkServiceId", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.ssh_public_key = AAZObjectType( + serialized_name="sshPublicKey", + flags={"required": True}, + ) + properties.virtual_machine_access_id = AAZStrType( + serialized_name="virtualMachineAccessId", + flags={"read_only": True}, + ) + + ssh_public_key = cls._schema_on_200.properties.ssh_public_key + ssh_public_key.key_data = AAZStrType( + serialized_name="keyData", + flags={"required": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/_update.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/_update.py new file mode 100644 index 00000000000..332d5e85623 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/_update.py @@ -0,0 +1,390 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud virtualmachine console update", + is_experimental=True, +) +class Update(AAZCommand): + """Update the properties of the provided virtual machine console, or update the tags associated with the virtual machine console. Properties and tag updates can be done independently. + + :example: Patch virtual machine console + az networkcloud virtualmachine console update --enabled "True" --expiration "2022-06-01T01:27:03.008Z" --ssh-public-key key-data="ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeRqiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXISTRnIDpcf5qytjs1Xo+yYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOKpzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm" --tags key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" --virtual-machine-name "virtualMachineName" + + :example: Patch virtual machine console with SSH key file + az networkcloud virtualmachine console update --enabled "True" --expiration "2022-06-01T01:27:03.008Z" --ssh-public-key key-data=~/.ssh/id_rsa.pub --tags key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" --virtual-machine-name "virtualMachineName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/virtualmachines/{}/consoles/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.console_name = AAZStrArg( + options=["-n", "--name", "--console-name"], + help="The name of the virtual machine console.", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^default$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.virtual_machine_name = AAZStrArg( + options=["--virtual-machine-name"], + help="The name of the virtual machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + + # define Arg Group "ConsoleUpdateParameters" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="ConsoleUpdateParameters", + help="The Azure resource tags that will replace the existing ones.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.enabled = AAZStrArg( + options=["--enabled"], + arg_group="Properties", + help="The credentials used to login to the image repository that has access to the specified image.", + enum={"False": "False", "True": "True"}, + ) + _args_schema.expiration = AAZDateTimeArg( + options=["--expiration"], + arg_group="Properties", + help="The date and time after which the key will be disallowed access.", + ) + _args_schema.ssh_public_key = AAZObjectArg( + options=["--ssh-public-key"], + arg_group="Properties", + help="The SSH public key that will be provisioned for user access. The user is expected to have the corresponding SSH private key for logging in.", + ) + + ssh_public_key = cls._args_schema.ssh_public_key + ssh_public_key.key_data = AAZStrArg( + options=["key-data"], + help="The public ssh key of the user.", + required=True, + fmt=AAZStrArgFormat( + min_length=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.ConsolesUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class ConsolesUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/consoles/{consoleName}", + **self.url_parameters + ) + + @property + def method(self): + return "PATCH" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "consoleName", self.ctx.args.console_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "virtualMachineName", self.ctx.args.virtual_machine_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("enabled", AAZStrType, ".enabled") + properties.set_prop("expiration", AAZStrType, ".expiration") + properties.set_prop("sshPublicKey", AAZObjectType, ".ssh_public_key") + + ssh_public_key = _builder.get(".properties.sshPublicKey") + if ssh_public_key is not None: + ssh_public_key.set_prop("keyData", AAZStrType, ".key_data", typ_kwargs={"flags": {"required": True}}) + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + _UpdateHelper._build_schema_console_read(cls._schema_on_200) + + return cls._schema_on_200 + + +class _UpdateHelper: + """Helper class for Update""" + + _schema_console_read = None + + @classmethod + def _build_schema_console_read(cls, _schema): + if cls._schema_console_read is not None: + _schema.extended_location = cls._schema_console_read.extended_location + _schema.id = cls._schema_console_read.id + _schema.location = cls._schema_console_read.location + _schema.name = cls._schema_console_read.name + _schema.properties = cls._schema_console_read.properties + _schema.system_data = cls._schema_console_read.system_data + _schema.tags = cls._schema_console_read.tags + _schema.type = cls._schema_console_read.type + return + + cls._schema_console_read = _schema_console_read = AAZObjectType() + + console_read = _schema_console_read + console_read.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + console_read.id = AAZStrType( + flags={"read_only": True}, + ) + console_read.location = AAZStrType( + flags={"required": True}, + ) + console_read.name = AAZStrType( + flags={"read_only": True}, + ) + console_read.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + console_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + console_read.tags = AAZDictType() + console_read.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = _schema_console_read.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = _schema_console_read.properties + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.enabled = AAZStrType( + flags={"required": True}, + ) + properties.expiration = AAZStrType() + properties.private_link_service_id = AAZStrType( + serialized_name="privateLinkServiceId", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.ssh_public_key = AAZObjectType( + serialized_name="sshPublicKey", + flags={"required": True}, + ) + properties.virtual_machine_access_id = AAZStrType( + serialized_name="virtualMachineAccessId", + flags={"read_only": True}, + ) + + ssh_public_key = _schema_console_read.properties.ssh_public_key + ssh_public_key.key_data = AAZStrType( + serialized_name="keyData", + flags={"required": True}, + ) + + system_data = _schema_console_read.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = _schema_console_read.tags + tags.Element = AAZStrType() + + _schema.extended_location = cls._schema_console_read.extended_location + _schema.id = cls._schema_console_read.id + _schema.location = cls._schema_console_read.location + _schema.name = cls._schema_console_read.name + _schema.properties = cls._schema_console_read.properties + _schema.system_data = cls._schema_console_read.system_data + _schema.tags = cls._schema_console_read.tags + _schema.type = cls._schema_console_read.type + + +__all__ = ["Update"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/_wait.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/_wait.py new file mode 100644 index 00000000000..704ee3ee2f3 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/_wait.py @@ -0,0 +1,267 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud virtualmachine console wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/virtualmachines/{}/consoles/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.console_name = AAZStrArg( + options=["-n", "--name", "--console-name"], + help="The name of the virtual machine console.", + required=True, + id_part="child_name_1", + fmt=AAZStrArgFormat( + pattern="^default$", + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.virtual_machine_name = AAZStrArg( + options=["--virtual-machine-name"], + help="The name of the virtual machine.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,62}[a-zA-Z0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.ConsolesGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) + return result + + class ConsolesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/virtualMachines/{virtualMachineName}/consoles/{consoleName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "consoleName", self.ctx.args.console_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "virtualMachineName", self.ctx.args.virtual_machine_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.enabled = AAZStrType( + flags={"required": True}, + ) + properties.expiration = AAZStrType() + properties.private_link_service_id = AAZStrType( + serialized_name="privateLinkServiceId", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.ssh_public_key = AAZObjectType( + serialized_name="sshPublicKey", + flags={"required": True}, + ) + properties.virtual_machine_access_id = AAZStrType( + serialized_name="virtualMachineAccessId", + flags={"read_only": True}, + ) + + ssh_public_key = cls._schema_on_200.properties.ssh_public_key + ssh_public_key.key_data = AAZStrType( + serialized_name="keyData", + flags={"required": True}, + ) + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/__cmd_group.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/__cmd_group.py new file mode 100644 index 00000000000..e500714c4fa --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/__cmd_group.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "networkcloud volume", + is_experimental=True, +) +class __CMDGroup(AAZCommandGroup): + """Manage volume + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/__init__.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/__init__.py new file mode 100644 index 00000000000..db73033039b --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/__init__.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._list import * +from ._show import * +from ._update import * +from ._wait import * diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/_create.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/_create.py new file mode 100644 index 00000000000..16b8249fe54 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/_create.py @@ -0,0 +1,349 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud volume create", + is_experimental=True, +) +class Create(AAZCommand): + """Create a new volume or update the properties of the existing one. + + :example: Create or update volume + az networkcloud volume create --resource-group "resourceGroupName" --name "volumeName" --extended-location name="/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterExtendedLocationName" type="CustomLocation" --location "location" --size 10000 --tags key1="myvalue1" key2="myvalue2" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/volumes/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.volume_name = AAZStrArg( + options=["-n", "--name", "--volume-name"], + help="The name of the volume.", + required=True, + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,28}[a-zA-Z0-9])$", + ), + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.size_mib = AAZIntArg( + options=["--size", "--size-mib"], + arg_group="Properties", + help="The size of the allocation for this volume in Mebibytes.", + required=True, + fmt=AAZIntArgFormat( + minimum=1, + ), + ) + + # define Arg Group "VolumeParameters" + + _args_schema = cls._args_schema + _args_schema.extended_location = AAZObjectArg( + options=["--extended-location"], + arg_group="VolumeParameters", + help="The extended location of the cluster associated with the resource.", + required=True, + ) + _args_schema.location = AAZResourceLocationArg( + arg_group="VolumeParameters", + help="The geo-location where the resource lives", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="VolumeParameters", + help="Resource tags.", + ) + + extended_location = cls._args_schema.extended_location + extended_location.name = AAZStrArg( + options=["name"], + help="The resource ID of the extended location on which the resource will be created.", + required=True, + ) + extended_location.type = AAZStrArg( + options=["type"], + help="The extended location type, for example, CustomLocation.", + required=True, + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.VolumesCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class VolumesCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/volumes/{volumeName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "volumeName", self.ctx.args.volume_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("extendedLocation", AAZObjectType, ".extended_location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True, "client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + extended_location = _builder.get(".extendedLocation") + if extended_location is not None: + extended_location.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}}) + extended_location.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("sizeMiB", AAZIntType, ".size_mib", typ_kwargs={"flags": {"required": True}}) + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + 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_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200_201.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.attached_to = AAZListType( + serialized_name="attachedTo", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"read_only": True}, + ) + properties.size_mi_b = AAZIntType( + serialized_name="sizeMiB", + flags={"required": True}, + ) + + attached_to = cls._schema_on_200_201.properties.attached_to + attached_to.Element = AAZStrType() + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/_delete.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/_delete.py new file mode 100644 index 00000000000..bb269c4b576 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/_delete.py @@ -0,0 +1,167 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud volume delete", + is_experimental=True, + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete the provided volume. + + :example: Delete volume + az networkcloud volume delete --resource-group "resourceGroupName" --name "volumeName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/volumes/{}", "2022-12-12-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.volume_name = AAZStrArg( + options=["-n", "--name", "--volume-name"], + help="The name of the volume.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,28}[a-zA-Z0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.VolumesDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class VolumesDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/volumes/{volumeName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "volumeName", self.ctx.args.volume_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/_list.py new file mode 100644 index 00000000000..163caa9a153 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/_list.py @@ -0,0 +1,424 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud volume list", + is_experimental=True, +) +class List(AAZCommand): + """List volumes in the provided resource group or subscription. + + :example: List volumes for resource group + az networkcloud volume list --resource-group "resourceGroupName" + + :example: List volumes for subscription + az networkcloud volume list + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.networkcloud/volumes", "2022-12-12-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/volumes", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + condition_0 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id) + condition_1 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True + if condition_0: + self.VolumesListByResourceGroup(ctx=self.ctx)() + if condition_1: + self.VolumesListBySubscription(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class VolumesListByResourceGroup(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/volumes", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.value.Element.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.attached_to = AAZListType( + serialized_name="attachedTo", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"read_only": True}, + ) + properties.size_mi_b = AAZIntType( + serialized_name="sizeMiB", + flags={"required": True}, + ) + + attached_to = cls._schema_on_200.value.Element.properties.attached_to + attached_to.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + class VolumesListBySubscription(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/providers/Microsoft.NetworkCloud/volumes", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.value.Element.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.attached_to = AAZListType( + serialized_name="attachedTo", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"read_only": True}, + ) + properties.size_mi_b = AAZIntType( + serialized_name="sizeMiB", + flags={"required": True}, + ) + + attached_to = cls._schema_on_200.value.Element.properties.attached_to + attached_to.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/_show.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/_show.py new file mode 100644 index 00000000000..183ad3f045f --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/_show.py @@ -0,0 +1,252 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud volume show", + is_experimental=True, +) +class Show(AAZCommand): + """Get properties of the provided volume. + + :example: Get volume + az networkcloud volume show --resource-group "resourceGroupName" --name "volumeName" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/volumes/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.volume_name = AAZStrArg( + options=["-n", "--name", "--volume-name"], + help="The name of the volume.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,28}[a-zA-Z0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.VolumesGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class VolumesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/volumes/{volumeName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "volumeName", self.ctx.args.volume_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.attached_to = AAZListType( + serialized_name="attachedTo", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"read_only": True}, + ) + properties.size_mi_b = AAZIntType( + serialized_name="sizeMiB", + flags={"required": True}, + ) + + attached_to = cls._schema_on_200.properties.attached_to + attached_to.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/_update.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/_update.py new file mode 100644 index 00000000000..422603cd79b --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/_update.py @@ -0,0 +1,282 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud volume update", + is_experimental=True, +) +class Update(AAZCommand): + """Update tags associated with the provided volume. + + :example: Update tags for volume + az networkcloud volume update --resource-group "resourceGroupName" --name "volumeName" --tags key1="myvalue1" key2="myvalue2" + """ + + _aaz_info = { + "version": "2022-12-12-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/volumes/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.volume_name = AAZStrArg( + options=["-n", "--name", "--volume-name"], + help="The name of the volume.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,28}[a-zA-Z0-9])$", + ), + ) + + # define Arg Group "VolumeUpdateParameters" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="VolumeUpdateParameters", + help="The Azure resource tags that will replace the existing ones.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.VolumesUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class VolumesUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/volumes/{volumeName}", + **self.url_parameters + ) + + @property + def method(self): + return "PATCH" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "volumeName", self.ctx.args.volume_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"client_flatten": True}} + ) + _builder.set_prop("tags", AAZDictType, ".tags") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.attached_to = AAZListType( + serialized_name="attachedTo", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"read_only": True}, + ) + properties.size_mi_b = AAZIntType( + serialized_name="sizeMiB", + flags={"required": True}, + ) + + attached_to = cls._schema_on_200.properties.attached_to + attached_to.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _UpdateHelper: + """Helper class for Update""" + + +__all__ = ["Update"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/_wait.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/_wait.py new file mode 100644 index 00000000000..c43a1819c13 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/volume/_wait.py @@ -0,0 +1,247 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "networkcloud volume wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/volumes/{}", "2022-12-12-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.volume_name = AAZStrArg( + options=["-n", "--name", "--volume-name"], + help="The name of the volume.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^([a-zA-Z0-9][a-zA-Z0-9]{0,28}[a-zA-Z0-9])$", + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.VolumesGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=False) + return result + + class VolumesGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/volumes/{volumeName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + **self.serialize_url_param( + "volumeName", self.ctx.args.volume_name, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2022-12-12-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = 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() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.attached_to = AAZListType( + serialized_name="attachedTo", + flags={"read_only": True}, + ) + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.serial_number = AAZStrType( + serialized_name="serialNumber", + flags={"read_only": True}, + ) + properties.size_mi_b = AAZIntType( + serialized_name="sizeMiB", + flags={"required": True}, + ) + + attached_to = cls._schema_on_200.properties.attached_to + attached_to.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/networkcloud/azext_networkcloud/aaz/operations/__init__.py b/src/networkcloud/azext_networkcloud/aaz/operations/__init__.py new file mode 100644 index 00000000000..34913fb394d --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/operations/__init__.py @@ -0,0 +1,4 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- diff --git a/src/networkcloud/azext_networkcloud/aaz/operations/baremetalmachine/__init__.py b/src/networkcloud/azext_networkcloud/aaz/operations/baremetalmachine/__init__.py new file mode 100644 index 00000000000..34913fb394d --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/operations/baremetalmachine/__init__.py @@ -0,0 +1,4 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- diff --git a/src/networkcloud/azext_networkcloud/aaz/operations/baremetalmachine/_run_command.py b/src/networkcloud/azext_networkcloud/aaz/operations/baremetalmachine/_run_command.py new file mode 100644 index 00000000000..627165fe9d7 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/operations/baremetalmachine/_run_command.py @@ -0,0 +1,84 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# -------------------------------------------------------------------------------------------- +# pylint: disable=unused-wildcard-import,anomalous-backslash-in-string,wildcard-import +# pylint: disable=protected-access,duplicate-code +# flake8: noqa + +""" +This custom code inherits the auto-generated code for BMM run command and adds: + - retrieval of custom properties returned on the success using CustomActionProperties class. +""" + +from pathlib import Path + +from azure.cli.core.aaz import * +from azure.cli.core.azclierror import FileOperationError + +from ...latest.networkcloud.baremetalmachine import RunCommand as _RunCommand +from ..custom_properties import CustomActionProperties + + +class RunCommand(_RunCommand): + '''Custom class for baremetalmachine run command ''' + _args_schema = None + + # NOTE: There is currently an aaz bug that prevents these operations from being completed + # in the correct place, post_operations(). This is a temporary workaround until + # the next AAZ release. + def _output(self, *args, **kwargs): + return CustomActionProperties._output(self, args, kwargs) + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.output = AAZStrArg( + options=["--output-directory"], + arg_group="BareMetalMachineRunCommandParameters", + help="The output directory where the script execution results will be" + + "downloaded to from storage blob. Accepts relative or qualified directory path.", + required=False, + fmt=AAZStrArgFormat( + pattern="^(.+)([^\/]*)$" + ) + ) + + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.BareMetalMachinesRunCommand(ctx=self.ctx)() + self.post_operations() + + def pre_operations(self): + args = self.ctx.args + output_directory = args.output + if has_value(args.output): + try: + Path(f"{output_directory}").mkdir( + parents=True, exist_ok=True) + except OSError as ex: + raise FileOperationError(ex) from ex + return super().pre_operations() + + class BareMetalMachinesRunCommand(_RunCommand.BareMetalMachinesRunCommand): + ''' Custom class for baremetal machine run command''' + @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() + CustomActionProperties._build_schema_operation_status_result_read( + cls._schema_on_200) + + return cls._schema_on_200 + + def on_204(self, session): + pass diff --git a/src/networkcloud/azext_networkcloud/aaz/operations/baremetalmachine/_run_data_extract.py b/src/networkcloud/azext_networkcloud/aaz/operations/baremetalmachine/_run_data_extract.py new file mode 100644 index 00000000000..35243502d80 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/operations/baremetalmachine/_run_data_extract.py @@ -0,0 +1,89 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# -------------------------------------------------------------------------------------------- +# pylint: disable=wildcard-import,unused-wildcard-import,protected-access,duplicate-code +# pylint: disable=anomalous-backslash-in-string +# flake8: noqa + +""" +This code inherits the auto-generated code for BMM run data extracts command, and adds retrieval +of custom properties. It also processes the output directory if given and downloads +the results of the command. +""" + + +from pathlib import Path + +from azure.cli.core.aaz import * +from azure.cli.core.azclierror import FileOperationError + +from ...latest.networkcloud.baremetalmachine import \ + RunDataExtract as _RunDataExtract +from ..custom_properties import CustomActionProperties + + +class RunDataExtract(_RunDataExtract): + '''Custom class for baremetalmachine run data extract command ''' + + _args_schema = None + + # NOTE: There is currently an aaz bug that prevents these operations from being completed + # in the correct place, post_operations(). + # This is a temporary workaround until the next AAZ release. + def _output(self, *args, **kwargs): + return CustomActionProperties._output(self, args, kwargs) + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.output = AAZStrArg( + options=["--output-directory"], + arg_group="BareMetalMachineRunDataExtractsParameters", + help="The output directory where the script execution results will " + + "be downloaded to from storage blob. Accepts relative or qualified directory path.", + required=False, + fmt=AAZStrArgFormat( + pattern="^(.+)([^\/]*)$" + ) + ) + + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.BareMetalMachinesRunDataExtract(ctx=self.ctx)() + self.post_operations() + + def pre_operations(self): + args = self.ctx.args + output_directory = args.output + if has_value(args.output): + try: + Path(f"{output_directory}").mkdir( + parents=True, exist_ok=True) + except OSError as ex: + raise FileOperationError(ex) from ex + return super().pre_operations() + + class BareMetalMachinesRunDataExtract(_RunDataExtract.BareMetalMachinesRunDataExtracts): + '''Custom class for baremetalmachine run data extract command ''' + + @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() + CustomActionProperties._build_schema_operation_status_result_read( + cls._schema_on_200) + + return cls._schema_on_200 + + def on_204(self, session): + pass diff --git a/src/networkcloud/azext_networkcloud/aaz/operations/baremetalmachine/_run_read_command.py b/src/networkcloud/azext_networkcloud/aaz/operations/baremetalmachine/_run_read_command.py new file mode 100644 index 00000000000..7d8a8b0f181 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/operations/baremetalmachine/_run_read_command.py @@ -0,0 +1,88 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# -------------------------------------------------------------------------------------------- +# pylint: disable=unused-wildcard-import,anomalous-backslash-in-string,wildcard-import +# pylint: disable=protected-access,duplicate-code +# flake8: noqa + +""" + This code inherits the auto-generated code for BMM run read command, and adds retrieval of + custom properties. It also processes the output directory if given and downloads the results + of the command. +""" + +from pathlib import Path + +from azure.cli.core.aaz import * +from azure.cli.core.azclierror import FileOperationError + +from ...latest.networkcloud.baremetalmachine import \ + RunReadCommand as _RunReadCommand +from ..custom_properties import CustomActionProperties + + +class RunReadCommand(_RunReadCommand): + '''Custom class for baremetalmachine run read command ''' + + _args_schema = None + + # NOTE: There is currently an aaz bug that prevents these operations from being completed in + # the correct place, post_operations(). This is a temporary workaround until + # the next AAZ release. + def _output(self, *args, **kwargs): + return CustomActionProperties._output(self, args, kwargs) + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.output = AAZStrArg( + options=["--output-directory"], + arg_group="BareMetalMachineRunReadCommandsParameters", + help="The output directory where the script execution results will be" + + " downloaded to from storage blob. Accepts relative or qualified directory path.", + required=False, + fmt=AAZStrArgFormat( + pattern="^(.+)([^\/]*)$" + ) + ) + + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.BareMetalMachineRunReadCommand(ctx=self.ctx)() + self.post_operations() + + def pre_operations(self): + args = self.ctx.args + output_directory = args.output + if has_value(args.output): + try: + Path(f"{output_directory}").mkdir( + parents=True, exist_ok=True) + except OSError as ex: + raise FileOperationError(ex) from ex + return super().pre_operations() + + class BareMetalMachineRunReadCommand(_RunReadCommand.BareMetalMachinesRunReadCommands): + '''Custom class for baremetalmachine run read command ''' + + @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() + CustomActionProperties._build_schema_operation_status_result_read( + cls._schema_on_200) + + return cls._schema_on_200 + + def on_204(self, session): + pass diff --git a/src/networkcloud/azext_networkcloud/aaz/operations/cluster/__init__.py b/src/networkcloud/azext_networkcloud/aaz/operations/cluster/__init__.py new file mode 100644 index 00000000000..34913fb394d --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/operations/cluster/__init__.py @@ -0,0 +1,4 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- diff --git a/src/networkcloud/azext_networkcloud/aaz/operations/cluster/metricsconfiguration/__init__.py b/src/networkcloud/azext_networkcloud/aaz/operations/cluster/metricsconfiguration/__init__.py new file mode 100644 index 00000000000..34913fb394d --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/operations/cluster/metricsconfiguration/__init__.py @@ -0,0 +1,4 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- diff --git a/src/networkcloud/azext_networkcloud/aaz/operations/cluster/metricsconfiguration/_create.py b/src/networkcloud/azext_networkcloud/aaz/operations/cluster/metricsconfiguration/_create.py new file mode 100644 index 00000000000..97af3a406c7 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/operations/cluster/metricsconfiguration/_create.py @@ -0,0 +1,33 @@ + +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +# pylint: disable= protected-access, too-few-public-methods +# pylint: disable=duplicate-code +# flake8: noqa + +""" +This custom code inherits from generate cluster metrics configuration +functions. It is integrated into the generated code via: + cli-ext/v20221212preview/ext/src/networkcloud/azext_networkcloud/commands.py +""" + +from azext_networkcloud.aaz.latest.networkcloud.cluster.metricsconfiguration._create import \ + Create +from azure.cli.core.aaz import register_callback + +from .common import ClusterMetricsConfiguration + + +class ClusterMetricsConfigurationCreate(Create): + ''' Custom class for create operation of cluster's metrics configuration ''' + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + return ClusterMetricsConfiguration._build_arguments_schema(args_schema) + + @register_callback + def pre_operations(self): + return ClusterMetricsConfiguration.pre_operations(self.ctx.args) diff --git a/src/networkcloud/azext_networkcloud/aaz/operations/cluster/metricsconfiguration/_delete.py b/src/networkcloud/azext_networkcloud/aaz/operations/cluster/metricsconfiguration/_delete.py new file mode 100644 index 00000000000..1bf5a0bd9a1 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/operations/cluster/metricsconfiguration/_delete.py @@ -0,0 +1,34 @@ + +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=protected-access, too-few-public-methods +# pylint: disable=duplicate-code +# flake8: noqa + +""" +This custom code inherits from generate cluster metrics configuration +functions. It is integrated into the generated code via: + cli-ext/v20221212preview/ext/src/networkcloud/azext_networkcloud/commands.py +""" + +from azext_networkcloud.aaz.latest.networkcloud.cluster.metricsconfiguration._delete import \ + Delete +from azure.cli.core.aaz import register_callback + +from .common import ClusterMetricsConfiguration + + +class ClusterMetricsConfigurationDelete(Delete): + ''' Custom class for delete operation of cluster's metrics configuration ''' + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + return ClusterMetricsConfiguration._build_arguments_schema(args_schema) + + @register_callback + def pre_operations(self): + return ClusterMetricsConfiguration.pre_operations(self.ctx.args) diff --git a/src/networkcloud/azext_networkcloud/aaz/operations/cluster/metricsconfiguration/_show.py b/src/networkcloud/azext_networkcloud/aaz/operations/cluster/metricsconfiguration/_show.py new file mode 100644 index 00000000000..bbad80b8f88 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/operations/cluster/metricsconfiguration/_show.py @@ -0,0 +1,35 @@ + +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: disable=line-too-long, protected-access, too-few-public-methods +# pylint: disable=duplicate-code +# flake8: noqa + +""" +This custom code inherits from generate cluster metrics configuration functions. It is integrated into the generated code via: + cli-ext/v20221212preview/ext/src/networkcloud/azext_networkcloud/commands.py +""" + +from azext_networkcloud.aaz.latest.networkcloud.cluster.metricsconfiguration._show import \ + Show +from azure.cli.core.aaz import register_callback + +from .common import ClusterMetricsConfiguration + +# This custom code inherits from generate cluster metrics configuration functions. It is integrated into the generated code via: +# cli-ext/v20221212preview/ext/src/networkcloud/azext_networkcloud/commands.py + + +class ClusterMetricsConfigurationShow(Show): + ''' Custom class for show operation of cluster's metrics configuration ''' + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + return ClusterMetricsConfiguration._build_arguments_schema(args_schema) + + @register_callback + def pre_operations(self): + return ClusterMetricsConfiguration.pre_operations(self.ctx.args) diff --git a/src/networkcloud/azext_networkcloud/aaz/operations/cluster/metricsconfiguration/_update.py b/src/networkcloud/azext_networkcloud/aaz/operations/cluster/metricsconfiguration/_update.py new file mode 100644 index 00000000000..13ac3fbd806 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/operations/cluster/metricsconfiguration/_update.py @@ -0,0 +1,32 @@ + +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: disable=protected-access, too-few-public-methods +# pylint: disable=duplicate-code +# flake8: noqa + +""" +This custom code inherits from generate cluster metrics configuration functions. +It is integrated into the generated code via: +cli-ext/v20221212preview/ext/src/networkcloud/azext_networkcloud/commands.py +""" +from azext_networkcloud.aaz.latest.networkcloud.cluster.metricsconfiguration._update import \ + Update +from azure.cli.core.aaz import register_callback + +from .common import ClusterMetricsConfiguration + + +class ClusterMetricsConfigurationUpdate(Update): + ''' Custom class for update operation of cluster's metrics configuration ''' + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + return ClusterMetricsConfiguration._build_arguments_schema(args_schema) + + @register_callback + def pre_operations(self): + return ClusterMetricsConfiguration.pre_operations(self.ctx.args) diff --git a/src/networkcloud/azext_networkcloud/aaz/operations/cluster/metricsconfiguration/common.py b/src/networkcloud/azext_networkcloud/aaz/operations/cluster/metricsconfiguration/common.py new file mode 100644 index 00000000000..84f7f5e8710 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/operations/cluster/metricsconfiguration/common.py @@ -0,0 +1,31 @@ + +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: disable=protected-access, too-few-public-methods +# pylint: disable=duplicate-code +# flake8: noqa + +""" +This custom code deregisters the 'metrics_configuration_name' argument and sets +the default value to "default". +""" + + +class ClusterMetricsConfiguration: + ''' Common custom class cluster's metrics configuration CRUD operations''' + + @classmethod + def _build_arguments_schema(cls, args_schema): + # deregister the Cluster metrics configuration name argument which users + # should not interact with + args_schema.metrics_configuration_name._registered = False + args_schema.metrics_configuration_name._required = False + return args_schema + + @classmethod + def pre_operations(cls, args): + ''' "default" is the default name for the metrics configuration name ''' + args.metrics_configuration_name = "default" + return args diff --git a/src/networkcloud/azext_networkcloud/aaz/operations/custom_properties.py b/src/networkcloud/azext_networkcloud/aaz/operations/custom_properties.py new file mode 100644 index 00000000000..c04129cd276 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/operations/custom_properties.py @@ -0,0 +1,198 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Custom code that is added in addition to auto-generated by aaz-dev code. +# -------------------------------------------------------------------------------------------- +# pylint: disable=too-many-lines,no-member,inconsistent-return-statements +# pylint: disable=too-many-statements,too-few-public-methods,unused-wildcard-import,wildcard-import +# flake8: noqa + +""" +Helper class for all POST commands that return extra properties back to the customer +""" + +import tarfile +import urllib + +from azure.cli.core.aaz import * +from knack.log import get_logger + +logger = get_logger(__name__) + + +class CustomActionProperties: + """Helper class for all POST commands that return extra properties back to the customer""" + + _schema_error_detail_read = None + _schema_properties_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType() + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + @classmethod + def _build_schema_properties_read(cls, _schema): + if cls._schema_properties_read is not None: + _schema.exitCode = cls._schema_properties_read.exitCode + _schema.outputHead = cls._schema_properties_read.outputHead + _schema.resultUrl = cls._schema_properties_read.resultUrl + return + + cls._schema_properties_read = _schema_properties_read = AAZObjectType() + + properties_read = _schema_properties_read + properties_read.exitCode = AAZStrType( + flags={"read_only": True}, + ) + properties_read.outputHead = AAZStrType( + flags={"read_only": True}, + ) + properties_read.resultUrl = AAZStrType( + flags={"read_only": True}, + ) + + _schema.exitCode = cls._schema_properties_read.exitCode + _schema.outputHead = cls._schema_properties_read.outputHead + _schema.resultUrl = cls._schema_properties_read.resultUrl + + _schema_operation_status_result_read = None + + @classmethod + def _build_schema_operation_status_result_read(cls, _schema): + if cls._schema_operation_status_result_read is not None: + _schema.end_time = cls._schema_operation_status_result_read.end_time + _schema.error = cls._schema_operation_status_result_read.error + _schema.properties = cls._schema_operation_status_result_read.properties + _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.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 + return + + cls._schema_operation_status_result_read = _schema_operation_status_result_read \ + = AAZObjectType() + + operation_status_result_read = _schema_operation_status_result_read + operation_status_result_read.end_time = AAZStrType( + serialized_name="endTime", + ) + operation_status_result_read.error = AAZObjectType() + cls._build_schema_error_detail_read(operation_status_result_read.error) + + operation_status_result_read.properties = AAZObjectType() + cls._build_schema_properties_read( + operation_status_result_read.properties) + + operation_status_result_read.id = AAZStrType() + operation_status_result_read.name = AAZStrType() + operation_status_result_read.operations = AAZListType() + operation_status_result_read.percent_complete = AAZFloatType( + serialized_name="percentComplete", + ) + operation_status_result_read.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"read_only": True}, + ) + operation_status_result_read.start_time = AAZStrType( + serialized_name="startTime", + ) + operation_status_result_read.status = AAZStrType( + flags={"required": True}, + ) + + operations = _schema_operation_status_result_read.operations + operations.Element = AAZObjectType() + cls._build_schema_operation_status_result_read(operations.Element) + + _schema.end_time = cls._schema_operation_status_result_read.end_time + _schema.error = cls._schema_operation_status_result_read.error + _schema.properties = cls._schema_operation_status_result_read.properties + _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.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 + + # Custom handling of response will print out the output head and the result URL + # it will also save files into output directory if provided + def _output(self, *args, **kwargs): + args = self.ctx.args + properties = self.ctx.vars.instance.properties + + # Print the output head to the console + if has_value(properties.outputHead): + print(properties.outputHead.to_serialized_data()) + print("\n================================") + + # Print out the result URL + if has_value(properties.resultUrl): + result_url = properties.resultUrl.to_serialized_data() + print( + "Script execution result can be found in storage account:\n" + result_url + "\n") + else: + # continue returning the API response back + return super()._output(self, args, kwargs) + + # extract result to the provided directory + if has_value(args.output): + output_directory = args.output.to_serialized_data() + + try: + with urllib.request.urlopen(result_url) as result: + with tarfile.open(fileobj=result, mode="r:gz") as tar: + tar.extractall(path=output_directory) + print( + "Extracted results are available in directory: " + output_directory) + except Exception as excep: + raise RuntimeError( + f"failed to retrieve output, error {excep}") from excep diff --git a/src/networkcloud/azext_networkcloud/aaz/operations/storageappliance/__init__.py b/src/networkcloud/azext_networkcloud/aaz/operations/storageappliance/__init__.py new file mode 100644 index 00000000000..34913fb394d --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/operations/storageappliance/__init__.py @@ -0,0 +1,4 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- diff --git a/src/networkcloud/azext_networkcloud/aaz/operations/storageappliance/_run_read_command.py b/src/networkcloud/azext_networkcloud/aaz/operations/storageappliance/_run_read_command.py new file mode 100644 index 00000000000..5cc1c5dfc4e --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/operations/storageappliance/_run_read_command.py @@ -0,0 +1,89 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# -------------------------------------------------------------------------------------------- +# pylint: disable=protected-access,wildcard-import,unused-wildcard-import,anomalous-backslash-in-string +# pylint: disable=R0801 +# flake8: noqa + +""" +Storage appliance commands themselves are not implemented yet. +This code inherits the auto-generated code for storage appliance run read command, +and adds retrieval of custom properties. +It also processes the output directory if given and downloads the results of the command. +""" + +from pathlib import Path + +from azure.cli.core.aaz import * +from azure.cli.core.azclierror import FileOperationError + +from ...latest.networkcloud.storageappliance import \ + RunReadCommand as _RunReadCommand +from ..custom_properties import CustomActionProperties + + +class RunReadCommand(_RunReadCommand): + '''Custom class for Storage appliance run command ''' + + _args_schema = None + + # NOTE: There is currently an aaz bug that prevents these operations from being + # completed in the correct place, post_operations(). This is a temporary workaround + # until the next AAZ release. + def _output(self, *args, **kwargs): + return CustomActionProperties._output(self, args, kwargs) + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.output = AAZStrArg( + options=["--output-directory"], + arg_group="StorageApplianceRunReadCommandsParameters", + help="The output directory where the script execution results will " + + "be downloaded to from storage blob. Accepts relative or qualified directory path.", + required=False, + fmt=AAZStrArgFormat( + pattern="^(.+)([^\/]*)$" + ) + ) + + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.StorageApplianceRunReadCommands(ctx=self.ctx)() + self.post_operations() + + def pre_operations(self): + args = self.ctx.args + output_directory = args.output + if has_value(args.output): + try: + Path(f"{output_directory}").mkdir( + parents=True, exist_ok=True) + except OSError as ex: + raise FileOperationError(ex) from ex + return super().pre_operations() + + class StorageApplianceRunReadCommands(_RunReadCommand.StorageAppliancesRunReadCommands): + '''Custom class for Storage appliance run command ''' + + @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() + CustomActionProperties._build_schema_operation_status_result_read( + cls._schema_on_200) + + return cls._schema_on_200 + + def on_204(self, session): + pass diff --git a/src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/__init__.py b/src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/__init__.py new file mode 100644 index 00000000000..34913fb394d --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/__init__.py @@ -0,0 +1,4 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- diff --git a/src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/_create.py b/src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/_create.py new file mode 100644 index 00000000000..21a47b65410 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/_create.py @@ -0,0 +1,147 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: disable=wildcard-import,unused-wildcard-import,too-many-nested-blocks +# pylint: disable=protected-access, too-few-public-methods,line-too-long +# flake8: noqa + +""" +Provides VirtualMachineCreate customization +""" + +import os + +from azure.cli.core import keys +from azure.cli.core.aaz import * +from knack.util import CLIError + +from ...latest.networkcloud.virtualmachine import \ + Create as _VirtualMachineCreate + + +class VirtualMachineCreate(_VirtualMachineCreate): + ''' + This custom code inherits from generate virtual machine functions. It is + integrated into the generated code via: + cli-ext/v20221212preview/ext/src/networkcloud/azext_networkcloud/commands.py + ''' + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + + # Build VM Authentication args + args_schema.generate_ssh_keys = AAZBoolArg( + options=["--generate-ssh-keys"], + arg_group="Authentication", + help="Generate SSH public and private key files if missing. The keys will " + + "be stored under '~/.ssh'." + ) + + args_schema.ssh_dest_key_path = AAZListArg( + options=["--ssh-dest-key-path"], + arg_group="Authentication", + help="The list of space-separated paths to ssh public keys. A file path can be " + + "provided or a directory. If a directory is provided will attempt to load all the " + + "public keys (.pub) found." + ) + args_schema.ssh_dest_key_path.Element = AAZStrArg() + + args_schema.ssh_key_values = AAZListArg( + options=["--ssh-key-values"], + arg_group="Authentication", + help="The list of space-separated SSH public keys." + ) + args_schema.ssh_key_values.Element = AAZStrArg() + + # deregister the VM cli arguments which users should not interact with + args_schema.ssh_public_keys._registered = False + args_schema.cloud_services_network_attachment.ip_allocation_method._required = False + args_schema.cloud_services_network_attachment.ip_allocation_method._registered = False + + return args_schema + + @register_callback + def pre_operations(self): + args = self.ctx.args + + # Dynamic is the default allocation method for the cloud services network attachment + args.cloud_services_network_attachment.ip_allocation_method = "Dynamic" + + ssh_keys = [] + if bool(args.generate_ssh_keys): + ssh_keys += generate_ssh_keys() + if list(args.ssh_dest_key_path): + ssh_keys += get_ssh_keys_from_path(list(args.ssh_dest_key_path)) + if list(args.ssh_key_values): + ssh_keys += add_ssh_key_action(list(args.ssh_key_values)) + if len(ssh_keys) == 0: + print('No keys are selected for insertion into the vm. The image will need to have keys or credentials setup in order to access.') + args.ssh_public_keys = ssh_keys + + return args + + +def generate_ssh_keys(): + ''' generates ssh keys in user .ssh folder ''' + + key_name = "id_rsa" + private_key_path = os.path.join(os.path.expanduser('~'), '.ssh', key_name) + public_key_path = os.path.join( + os.path.expanduser('~'), '.ssh', f"{key_name}.pub") + print(f"Attempted to find or generate SSH key files {key_name} and {key_name}.pub under ~/.ssh to allow SSH access " + "to the vm. If using machines without permanent storage, back up your keys to a safe location.") + return [{'keyData': keys.generate_ssh_keys(private_key_path, public_key_path)}] + + +def get_ssh_keys_from_path(values): + ''' get ssh keys from the provided path ''' + + key_list = [] + for path in values: + # Casting is necessary to get away from the custom type AAZSimpleType wrapping the string we want + path = str(path) + if os.path.isdir(path): + content = "" + for key in os.listdir(path): + if key.endswith(".pub"): + with open(os.path.join(path, key,), 'r', encoding="utf-8") as k: + content = k.read() + try: + if keys.is_valid_ssh_rsa_public_key(content): + key_list.append({'keyData': content}) + except Exception as exception: + raise CLIError( + f'Unsupported Key {key} is provided.\nContent:\n{content}.') from exception + if len(key_list) == 0: + raise CLIError( + f'No public keys found in the path: {path}') + elif os.path.isfile(path): + with open(path, 'r', encoding="utf-8") as k: + content = k.read() + try: + if keys.is_valid_ssh_rsa_public_key(content): + key_list.append({'keyData': content}) + except Exception as excep: + raise CLIError( + f'Unsupported Key {path} is provided.\nContent:\n{content}') from excep + else: + raise CLIError(f'An invalid directory or key was provided: {path}') + return key_list + + +def add_ssh_key_action(values): + '''validate and add ssh key to the list ''' + + key_data = [] + for key in values: + # Casting is necessary to get away from the custom type AAZSimpleType wrapping the string we want + key = str(key) + try: + if keys.is_valid_ssh_rsa_public_key(key): + key_data.append({'keyData': key}) + except Exception as excep: + raise CLIError( + f'Unsupported Key is provided.\nContent:\n{key}') from excep + return key_data diff --git a/src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/console/__init__.py b/src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/console/__init__.py new file mode 100644 index 00000000000..34913fb394d --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/console/__init__.py @@ -0,0 +1,4 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- diff --git a/src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/console/_create.py b/src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/console/_create.py new file mode 100644 index 00000000000..735477b3b2a --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/console/_create.py @@ -0,0 +1,35 @@ + +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# flake8: noqa + +# pylint: disable=unused-wildcard-import,wildcard-import +# pylint: disable=protected-access, too-few-public-methods + + +""" +Provides VirtualMachine Console create customization + +""" +from azext_networkcloud.aaz.latest.networkcloud.virtualmachine.console._create import \ + Create +from azure.cli.core.aaz import * + +from .common import VirtualMachineConsole + + +class VirtualMachineConsoleCreate(Create): + ''' This custom code inherits from generate virtual machine functions. It is + integrated into the generated code via: + - cli-ext/v20221212preview/ext/src/networkcloud/azext_networkcloud/commands.py + ''' + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + return VirtualMachineConsole._build_arguments_schema(args_schema) + + @register_callback + def pre_operations(self): + return VirtualMachineConsole.pre_operations(self.ctx.args) diff --git a/src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/console/_delete.py b/src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/console/_delete.py new file mode 100644 index 00000000000..0ca8e4fd6cb --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/console/_delete.py @@ -0,0 +1,37 @@ + +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=unused-wildcard-import,wildcard-import +# pylint: disable=protected-access, too-few-public-methods +# flake8: noqa + +""" +Provides VirtualMachine Console delete customization + +""" + +from azext_networkcloud.aaz.latest.networkcloud.virtualmachine.console._delete import \ + Delete +from azure.cli.core.aaz import * + +from .common import VirtualMachineConsole + + +class VirtualMachineConsoleDelete(Delete): + ''' + This custom code inherits from generate virtual machine console functions. + It is integrated into the generated code via: + cli-ext/v20221212preview/ext/src/networkcloud/azext_networkcloud/commands.py + ''' + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + + return VirtualMachineConsole._build_arguments_schema(args_schema) + + @register_callback + def pre_operations(self): + return VirtualMachineConsole.pre_operations(self.ctx.args) diff --git a/src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/console/_show.py b/src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/console/_show.py new file mode 100644 index 00000000000..3822b92ad80 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/console/_show.py @@ -0,0 +1,34 @@ + +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=unused-wildcard-import,wildcard-import +# pylint: disable=protected-access, too-few-public-methods +# flake8: noqa + +""" +Provides VirtualMachine Console show customization +""" +from azext_networkcloud.aaz.latest.networkcloud.virtualmachine.console._show import \ + Show +from azure.cli.core.aaz import * + +from .common import VirtualMachineConsole + + +class VirtualMachineConsoleShow(Show): + ''' + This custom code inherits from generate virtual machine console functions. + It is integrated into the generated code via: + cli-ext/v20221212preview/ext/src/networkcloud/azext_networkcloud/commands.py + ''' + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + return VirtualMachineConsole._build_arguments_schema(args_schema) + + @register_callback + def pre_operations(self): + return VirtualMachineConsole.pre_operations(self.ctx.args) diff --git a/src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/console/_update.py b/src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/console/_update.py new file mode 100644 index 00000000000..bb5d5375b54 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/console/_update.py @@ -0,0 +1,35 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +# pylint: disable=protected-access +# pylint: disable=unused-wildcard-import,wildcard-import +# pylint: disable=line-too-long, protected-access, too-few-public-methods +# pylint: disable=R0801 +# flake8: noqa + +""" +Provides VirtualMachine Console update customization + +""" +from azext_networkcloud.aaz.latest.networkcloud.virtualmachine.console._update import \ + Update +from azure.cli.core.aaz import * + +from .common import VirtualMachineConsole + + +class VirtualMachineConsoleUpdate(Update): + ''' + # This custom code inherits from generate virtual machine functions. It is integrated into the generated code via: + # cli-ext/v20221212preview/ext/src/networkcloud/azext_networkcloud/commands.py + ''' + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + return VirtualMachineConsole._build_arguments_schema(args_schema) + + @register_callback + def pre_operations(self): + return VirtualMachineConsole.pre_operations(self.ctx.args) diff --git a/src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/console/common.py b/src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/console/common.py new file mode 100644 index 00000000000..8fd487ef74e --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/operations/virtualmachine/console/common.py @@ -0,0 +1,28 @@ + +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- +# pylint: disable=protected-access, too-few-public-methods +# flake8: noqa + +""" +This custom code deregisters the 'console_name' argument of console +and sets the default value to "default". +""" + + +class VirtualMachineConsole: + ''' Common class for VirtualMachineConsole CRUD operations ''' + @classmethod + def _build_arguments_schema(cls, args_schema): + # deregister the VM console name argument which users should not interact with + args_schema.console_name._registered = False + args_schema.console_name._required = False + return args_schema + + @classmethod + def pre_operations(cls, args): + ''' "default" is the default name for the console''' + args.console_name = "default" + return args diff --git a/src/networkcloud/azext_networkcloud/azext_metadata.json b/src/networkcloud/azext_networkcloud/azext_metadata.json new file mode 100644 index 00000000000..66237e37669 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/azext_metadata.json @@ -0,0 +1,5 @@ +{ + "azext.isExperimental": true, + "azext.isPreview": true, + "azext.minCliCoreVersion": "2.45.0" +} \ No newline at end of file diff --git a/src/networkcloud/azext_networkcloud/commands.py b/src/networkcloud/azext_networkcloud/commands.py new file mode 100644 index 00000000000..58094500504 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/commands.py @@ -0,0 +1,79 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code originally generated by aaz-dev-tools and facilitates integration of custom code +# -------------------------------------------------------------------------------------------- +# pylint: disable=too-many-lines,import-outside-toplevel +# pylint: disable=too-many-statements + +''' Load Command model table importing custom commands''' + + +def load_command_table(self, _): # pylint: disable=unused-argument + ''' Custom code imported in this function is loaded via: + cli-ext/v20221212preview/ext/src/networkcloud/azext_networkcloud/__init__.py + ''' + # baremetalmachine + from .aaz.operations.baremetalmachine._run_command import RunCommand + self.command_table["networkcloud baremetalmachine run-command"] = RunCommand( + loader=self) + from .aaz.operations.baremetalmachine._run_read_command import \ + RunReadCommand + self.command_table["networkcloud baremetalmachine run-read-command"] = RunReadCommand( + loader=self) + from .aaz.operations.baremetalmachine._run_data_extract import \ + RunDataExtract + self.command_table["networkcloud baremetalmachine run-data-extract"] = RunDataExtract( + loader=self) + + from .aaz.operations.storageappliance._run_read_command import \ + RunReadCommand as RunReadStorage + self.command_table["networkcloud storageappliance run-read-command"] = RunReadStorage( + loader=self) + + # cluster + from .aaz.operations.cluster.metricsconfiguration._create import \ + ClusterMetricsConfigurationCreate + self.command_table["networkcloud cluster metricsconfiguration create"] = \ + ClusterMetricsConfigurationCreate(loader=self) + + from .aaz.operations.cluster.metricsconfiguration._update import \ + ClusterMetricsConfigurationUpdate + self.command_table["networkcloud cluster metricsconfiguration update"] = \ + ClusterMetricsConfigurationUpdate(loader=self) + + from .aaz.operations.cluster.metricsconfiguration._delete import \ + ClusterMetricsConfigurationDelete + self.command_table["networkcloud cluster metricsconfiguration delete"] = \ + ClusterMetricsConfigurationDelete(loader=self) + + from .aaz.operations.cluster.metricsconfiguration._show import \ + ClusterMetricsConfigurationShow + self.command_table["networkcloud cluster metricsconfiguration show"] = \ + ClusterMetricsConfigurationShow(loader=self) + + # virtualmachine + from .aaz.operations.virtualmachine._create import VirtualMachineCreate + self.command_table["networkcloud virtualmachine create"] = VirtualMachineCreate( + loader=self) + + from .aaz.operations.virtualmachine.console._create import \ + VirtualMachineConsoleCreate + self.command_table["networkcloud virtualmachine console create"] = VirtualMachineConsoleCreate( + loader=self) + + from .aaz.operations.virtualmachine.console._update import \ + VirtualMachineConsoleUpdate + self.command_table["networkcloud virtualmachine console update"] = VirtualMachineConsoleUpdate( + loader=self) + + from .aaz.operations.virtualmachine.console._show import \ + VirtualMachineConsoleShow + self.command_table["networkcloud virtualmachine console show"] = VirtualMachineConsoleShow( + loader=self) + + from .aaz.operations.virtualmachine.console._delete import \ + VirtualMachineConsoleDelete + self.command_table["networkcloud virtualmachine console delete"] = VirtualMachineConsoleDelete( + loader=self) diff --git a/src/networkcloud/azext_networkcloud/custom.py b/src/networkcloud/azext_networkcloud/custom.py new file mode 100644 index 00000000000..86df1e48ef5 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/custom.py @@ -0,0 +1,14 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + +from knack.log import get_logger + + +logger = get_logger(__name__) diff --git a/src/networkcloud/azext_networkcloud/tests/__init__.py b/src/networkcloud/azext_networkcloud/tests/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/tests/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- diff --git a/src/networkcloud/azext_networkcloud/tests/latest/__init__.py b/src/networkcloud/azext_networkcloud/tests/latest/__init__.py new file mode 100644 index 00000000000..5757aea3175 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/tests/latest/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- diff --git a/src/networkcloud/azext_networkcloud/tests/latest/config.ini b/src/networkcloud/azext_networkcloud/tests/latest/config.ini new file mode 100644 index 00000000000..5b094ed77b3 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/tests/latest/config.ini @@ -0,0 +1,21 @@ +# The config contains sections ["resourcename"] specific to each API resource +# Add the parameters relevant to each resource in the corresponding section + +[L3_NETWORK] +location = 'eastus' +type="CustomLocation" +tags='tag1="tag1"' +tagsUpdate='tag1="tag1",tagUpdate=NewTag' +extended_location='/subscriptions/a3eeb848-665a-4dbf-80a4-eb460930fb23/resourcegroups/simulator-hostedresources-106b4111/providers/microsoft.extendedlocation/customlocations/simulator-cstm-loc' +vlan=1001 +ipv4prefix="10.1.100.0/24" +ipv6prefix="fd01:1::0/64" +ip_allocation_type="DualStack" +hybrid_aks_ipam_enabled="True" +hybrid_aks_plugin_type="DPDK" +interface_name="eth0" +l3_isolation_domain_id="/subscriptions/fabricsubs/resourceGroups/fabric-rg/providers/Microsoft.NetworkFabric/L3IsolationDomains/l3isolationdomain1" + +[L2_NETWORK] +location = 'eastus' +type="CustomLocation" diff --git a/src/networkcloud/azext_networkcloud/tests/latest/config.py b/src/networkcloud/azext_networkcloud/tests/latest/config.py new file mode 100644 index 00000000000..4f4c4bf65a0 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/tests/latest/config.py @@ -0,0 +1,41 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# -------------------------------------------------------------------------------------------- +# pylint: disable=too-few-public-methods + +""" Network cloud resource specific configuration""" + +import configparser +from os import path + + +class LoadConfig: + ''' Loads the resource specific configuration for network cloud resources from config.ini. + This configuration is loaded at the first instance and stored in the _config_instance + Global parameter CONFIG can be used by calling classes to use the configuration values + ''' + config = None + + def __init__(self): + self._config_instance = None # Initial value + filename = path.dirname(__file__) + "/config.ini" + self.config = self.readconfig(filename) + + def readconfig(self, filename): + ''' Load resource config from configuration file''' + if self._config_instance: + return self._config_instance + self._config_instance = configparser.ConfigParser() + self._config_instance.read(filename) + return self._config_instance + + +def get_config(): + ''' Load the config and return the class instance''' + load_cnfig = LoadConfig() + return load_cnfig.config + + +CONFIG = get_config() diff --git a/src/networkcloud/azext_networkcloud/tests/latest/recordings/test_l3network_scenario1.yaml b/src/networkcloud/azext_networkcloud/tests/latest/recordings/test_l3network_scenario1.yaml new file mode 100644 index 00000000000..ced33e60b7b --- /dev/null +++ b/src/networkcloud/azext_networkcloud/tests/latest/recordings/test_l3network_scenario1.yaml @@ -0,0 +1,584 @@ +interactions: +- request: + body: '{"extendedLocation": {"name": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/simulator-hostedresources-106b4111/providers/microsoft.extendedlocation/customlocations/simulator-cstm-loc", + "type": "CustomLocation"}, "location": "eastus", "properties": {"hybridAksIpamEnabled": + "True", "hybridAksPluginType": "DPDK", "interfaceName": "eth0", "ipAllocationType": + "DualStack", "ipv4ConnectedPrefix": "10.1.100.0/24", "ipv6ConnectedPrefix": + "fd01:1::0/64", "l3IsolationDomainId": "/subscriptions/fabricsubs/resourceGroups/fabric-rg/providers/Microsoft.NetworkFabric/L3IsolationDomains/l3isolationdomain1", + "vlan": 1001}, "tags": {"tag1": "\"tag1\""}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - networkcloud l3network create + Connection: + - keep-alive + Content-Length: + - '664' + Content-Type: + - application/json + ParameterSetName: + - --name --extended-location --location --hybrid-aks-ipam-enabled --hybrid-aks-plugin-type + --interface-name --ip-allocation-type --ipv4-connected-prefix --ipv6-connected-prefix + --l3-isolation-domain-id --vlan --tags --resource-group + User-Agent: + - AZURECLI/2.48.1 (AAZ) azsdk-python-core/1.26.4 Python/3.8.10 (Linux-5.15.0-1036-azure-x86_64-with-glibc2.29) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000002/providers/Microsoft.NetworkCloud/l3Networks/cli-test-l3-000001?api-version=2022-12-12-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000002/providers/Microsoft.NetworkCloud/l3Networks/cli-test-l3-000001","name":"cli-test-l3-000001","type":"microsoft.networkcloud/l3networks","location":"eastus","extendedLocation":{"name":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/simulator-hostedresources-106b4111/providers/microsoft.extendedlocation/customlocations/simulator-cstm-loc","type":"CustomLocation"},"tags":{"tag1":"\"tag1\""},"systemData":{"createdBy":"priyashet@microsoft.com","createdByType":"User","createdAt":"2023-04-28T21:15:27.1788968Z","lastModifiedBy":"priyashet@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2023-04-28T21:15:27.1788968Z"},"properties":{"provisioningState":"Accepted","hybridAksIpamEnabled":"True","hybridAksPluginType":"DPDK","interfaceName":"eth0","ipAllocationType":"DualStack","ipv4ConnectedPrefix":"10.1.100.0/24","ipv6ConnectedPrefix":"fd01:1::0/64","l3IsolationDomainId":"/subscriptions/fabricsubs/resourceGroups/fabric-rg/providers/Microsoft.NetworkFabric/L3IsolationDomains/l3isolationdomain1","vlan":1001}}' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.NetworkCloud/locations/EASTUS/operationStatuses/dbf9a2f7-c5e4-4ebe-81ba-e622396fa0d6*9826E77B9951D96594780323A475A2CCEB3C534A04A1FF32AD82A431FECCF73A?api-version=2022-12-12-preview + cache-control: + - no-cache + content-length: + - '1129' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 28 Apr 2023 21:15:28 GMT + etag: + - '"55046836-0000-0100-0000-644c376f0000"' + expires: + - '-1' + mise-correlation-id: + - fcb1e211-03f0-4f6b-a231-1a63fc938cec + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 201 + message: Created +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - networkcloud l3network create + Connection: + - keep-alive + ParameterSetName: + - --name --extended-location --location --hybrid-aks-ipam-enabled --hybrid-aks-plugin-type + --interface-name --ip-allocation-type --ipv4-connected-prefix --ipv6-connected-prefix + --l3-isolation-domain-id --vlan --tags --resource-group + User-Agent: + - AZURECLI/2.48.1 (AAZ) azsdk-python-core/1.26.4 Python/3.8.10 (Linux-5.15.0-1036-azure-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.NetworkCloud/locations/EASTUS/operationStatuses/dbf9a2f7-c5e4-4ebe-81ba-e622396fa0d6*9826E77B9951D96594780323A475A2CCEB3C534A04A1FF32AD82A431FECCF73A?api-version=2022-12-12-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.NetworkCloud/locations/EASTUS/operationStatuses/dbf9a2f7-c5e4-4ebe-81ba-e622396fa0d6*9826E77B9951D96594780323A475A2CCEB3C534A04A1FF32AD82A431FECCF73A","name":"dbf9a2f7-c5e4-4ebe-81ba-e622396fa0d6*9826E77B9951D96594780323A475A2CCEB3C534A04A1FF32AD82A431FECCF73A","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000002/providers/Microsoft.NetworkCloud/l3Networks/cli-test-l3-000001","status":"Accepted","startTime":"2023-04-28T21:15:27.2671358Z"}' + headers: + cache-control: + - no-cache + content-length: + - '563' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 28 Apr 2023 21:15:28 GMT + etag: + - '"6c00c352-0000-0100-0000-644c376f0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - networkcloud l3network create + Connection: + - keep-alive + ParameterSetName: + - --name --extended-location --location --hybrid-aks-ipam-enabled --hybrid-aks-plugin-type + --interface-name --ip-allocation-type --ipv4-connected-prefix --ipv6-connected-prefix + --l3-isolation-domain-id --vlan --tags --resource-group + User-Agent: + - AZURECLI/2.48.1 (AAZ) azsdk-python-core/1.26.4 Python/3.8.10 (Linux-5.15.0-1036-azure-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.NetworkCloud/locations/EASTUS/operationStatuses/dbf9a2f7-c5e4-4ebe-81ba-e622396fa0d6*9826E77B9951D96594780323A475A2CCEB3C534A04A1FF32AD82A431FECCF73A?api-version=2022-12-12-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.NetworkCloud/locations/EASTUS/operationStatuses/dbf9a2f7-c5e4-4ebe-81ba-e622396fa0d6*9826E77B9951D96594780323A475A2CCEB3C534A04A1FF32AD82A431FECCF73A","name":"dbf9a2f7-c5e4-4ebe-81ba-e622396fa0d6*9826E77B9951D96594780323A475A2CCEB3C534A04A1FF32AD82A431FECCF73A","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000002/providers/Microsoft.NetworkCloud/l3Networks/cli-test-l3-000001","status":"Succeeded","startTime":"2023-04-28T21:15:27.2671358Z","endTime":"2023-04-28T21:15:36.3977498Z","error":{},"properties":null}' + headers: + cache-control: + - no-cache + content-length: + - '634' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 28 Apr 2023 21:15:58 GMT + etag: + - '"6c00945a-0000-0100-0000-644c37780000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - networkcloud l3network create + Connection: + - keep-alive + ParameterSetName: + - --name --extended-location --location --hybrid-aks-ipam-enabled --hybrid-aks-plugin-type + --interface-name --ip-allocation-type --ipv4-connected-prefix --ipv6-connected-prefix + --l3-isolation-domain-id --vlan --tags --resource-group + User-Agent: + - AZURECLI/2.48.1 (AAZ) azsdk-python-core/1.26.4 Python/3.8.10 (Linux-5.15.0-1036-azure-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000002/providers/Microsoft.NetworkCloud/l3Networks/cli-test-l3-000001?api-version=2022-12-12-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000002/providers/Microsoft.NetworkCloud/l3Networks/cli-test-l3-000001","name":"cli-test-l3-000001","type":"microsoft.networkcloud/l3networks","location":"eastus","extendedLocation":{"name":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/simulator-hostedresources-106b4111/providers/microsoft.extendedlocation/customlocations/simulator-cstm-loc","type":"CustomLocation"},"tags":{"tag1":"\"tag1\""},"systemData":{"createdBy":"priyashet@microsoft.com","createdByType":"User","createdAt":"2023-04-28T21:15:27.1788968Z","lastModifiedBy":"319f651f-7ddb-4fc6-9857-7aef9250bd05","lastModifiedByType":"Application","lastModifiedAt":"2023-04-28T21:15:37.4933065Z"},"properties":{"provisioningState":"Succeeded","hybridAksIpamEnabled":"True","hybridAksPluginType":"DPDK","interfaceName":"eth0","ipAllocationType":"DualStack","ipv4ConnectedPrefix":"10.1.100.0/24","ipv6ConnectedPrefix":"fd01:1::0/64","l3IsolationDomainId":"/subscriptions/fabricsubs/resourceGroups/fabric-rg/providers/Microsoft.NetworkFabric/L3IsolationDomains/l3isolationdomain1","vlan":1001,"clusterId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mbashtovaya-sim2-rg/providers/Microsoft.NetworkCloud/clusters/simulator","hybridAksClustersAssociatedIds":[],"virtualMachinesAssociatedIds":[],"detailedStatus":"Available","detailedStatusMessage":"all + resource creation succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '1460' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 28 Apr 2023 21:15:58 GMT + etag: + - '"5504e836-0000-0100-0000-644c37790000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: '{"tags": {"tag1": "\"tag1\",tagUpdate=NewTag"}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - networkcloud l3network update + Connection: + - keep-alive + Content-Length: + - '47' + Content-Type: + - application/json + ParameterSetName: + - --name --tags --resource-group + User-Agent: + - AZURECLI/2.48.1 (AAZ) azsdk-python-core/1.26.4 Python/3.8.10 (Linux-5.15.0-1036-azure-x86_64-with-glibc2.29) + method: PATCH + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000002/providers/Microsoft.NetworkCloud/l3Networks/cli-test-l3-000001?api-version=2022-12-12-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000002/providers/Microsoft.NetworkCloud/l3Networks/cli-test-l3-000001","name":"cli-test-l3-000001","type":"microsoft.networkcloud/l3networks","location":"eastus","extendedLocation":{"name":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/simulator-hostedresources-106b4111/providers/microsoft.extendedlocation/customlocations/simulator-cstm-loc","type":"CustomLocation"},"tags":{"tag1":"\"tag1\",tagUpdate=NewTag"},"systemData":{"createdBy":"priyashet@microsoft.com","createdByType":"User","createdAt":"2023-04-28T21:15:27.1788968Z","lastModifiedBy":"priyashet@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2023-04-28T21:15:59.6919164Z"},"properties":{"provisioningState":"Succeeded","hybridAksIpamEnabled":"True","hybridAksPluginType":"DPDK","interfaceName":"eth0","ipAllocationType":"DualStack","ipv4ConnectedPrefix":"10.1.100.0/24","ipv6ConnectedPrefix":"fd01:1::0/64","l3IsolationDomainId":"/subscriptions/fabricsubs/resourceGroups/fabric-rg/providers/Microsoft.NetworkFabric/L3IsolationDomains/l3isolationdomain1","vlan":1001,"clusterId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mbashtovaya-sim2-rg/providers/Microsoft.NetworkCloud/clusters/simulator","hybridAksClustersAssociatedIds":[],"virtualMachinesAssociatedIds":[],"detailedStatus":"Available","detailedStatusMessage":"all + resource creation succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '1457' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 28 Apr 2023 21:15:59 GMT + etag: + - '"5504a138-0000-0100-0000-644c378f0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - networkcloud l3network show + Connection: + - keep-alive + ParameterSetName: + - --name --resource-group + User-Agent: + - AZURECLI/2.48.1 (AAZ) azsdk-python-core/1.26.4 Python/3.8.10 (Linux-5.15.0-1036-azure-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000002/providers/Microsoft.NetworkCloud/l3Networks/cli-test-l3-000001?api-version=2022-12-12-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000002/providers/Microsoft.NetworkCloud/l3Networks/cli-test-l3-000001","name":"cli-test-l3-000001","type":"microsoft.networkcloud/l3networks","location":"eastus","extendedLocation":{"name":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/simulator-hostedresources-106b4111/providers/microsoft.extendedlocation/customlocations/simulator-cstm-loc","type":"CustomLocation"},"tags":{"tag1":"\"tag1\",tagUpdate=NewTag"},"systemData":{"createdBy":"priyashet@microsoft.com","createdByType":"User","createdAt":"2023-04-28T21:15:27.1788968Z","lastModifiedBy":"priyashet@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2023-04-28T21:15:59.6919164Z"},"properties":{"provisioningState":"Succeeded","hybridAksIpamEnabled":"True","hybridAksPluginType":"DPDK","interfaceName":"eth0","ipAllocationType":"DualStack","ipv4ConnectedPrefix":"10.1.100.0/24","ipv6ConnectedPrefix":"fd01:1::0/64","l3IsolationDomainId":"/subscriptions/fabricsubs/resourceGroups/fabric-rg/providers/Microsoft.NetworkFabric/L3IsolationDomains/l3isolationdomain1","vlan":1001,"clusterId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mbashtovaya-sim2-rg/providers/Microsoft.NetworkCloud/clusters/simulator","hybridAksClustersAssociatedIds":[],"virtualMachinesAssociatedIds":[],"detailedStatus":"Available","detailedStatusMessage":"all + resource creation succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '1457' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 28 Apr 2023 21:16:00 GMT + etag: + - '"5504a138-0000-0100-0000-644c378f0000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - networkcloud l3network list + Connection: + - keep-alive + User-Agent: + - AZURECLI/2.48.1 (AAZ) azsdk-python-core/1.26.4 Python/3.8.10 (Linux-5.15.0-1036-azure-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.NetworkCloud/l3Networks?api-version=2022-12-12-preview + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/syzehra-sim-1/providers/Microsoft.NetworkCloud/l3Networks/l3networksy1","name":"l3networksy1","type":"microsoft.networkcloud/l3networks","location":"eastus","extendedLocation":{"name":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/simulator-hostedresources-4deb0127/providers/microsoft.extendedlocation/customlocations/simulator-cstm-loc","type":"CustomLocation"},"tags":{"ManagedBy":"nc-labs","LabEnvironment":"simulator","ResourceType":"l3Network"},"systemData":{"createdBy":"syzehra@microsoft.com","createdByType":"User","createdAt":"2023-03-13T16:09:59.889044Z","lastModifiedBy":"syzehra@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2023-03-13T16:20:31.2913632Z"},"properties":{"provisioningState":"Failed","interfaceName":"vlan-1004","l3IsolationDomainId":"/subscriptions/fabricsubs/resourceGroups/fabric-rg/providers/Microsoft.NetworkFabric/L3IsolationDomains/l3isolationdomain2","ipAllocationType":"DualStack","ipv4ConnectedPrefix":"10.20.101.0/24","ipv6ConnectedPrefix":"fda0:d59c:da0a:b20::/64","vlan":1004,"hybridAksPluginType":"DPDK","hybridAksIpamEnabled":"True"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/syzehra-sim-1/providers/Microsoft.NetworkCloud/l3Networks/l3Networkk51","name":"l3Networkk51","type":"microsoft.networkcloud/l3networks","location":"eastus","extendedLocation":{"name":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/m15-47e8287f7f4f-hostedresources-40dc54a4/providers/microsoft.extendedlocation/customlocations/m15-47e8287f7f4f-cstm-loc","type":"CustomLocation"},"tags":{"key1":"myvalue1","key2":"myvalue2"},"systemData":{"createdBy":"syzehra@microsoft.com","createdByType":"User","createdAt":"2023-03-13T17:41:34.2729506Z","lastModifiedBy":"syzehra@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2023-03-13T17:43:50.9523433Z"},"properties":{"provisioningState":"Failed","hybridAksIpamEnabled":"True","hybridAksPluginType":"DPDK","ipAllocationType":"DualStack","ipv4ConnectedPrefix":"10.1.154.1","ipv6ConnectedPrefix":"fda0:d59c:da0b:9a::/64","l3IsolationDomainId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/m15-cluster/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/m15-l3domain-1","vlan":567}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.NetworkCloud/l3Networks/l3network-535","name":"l3network-535","type":"microsoft.networkcloud/l3networks","location":"eastus","extendedLocation":{"name":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/j18-a2308c7d5495-hostedresources-12cf30c0/providers/microsoft.extendedlocation/customlocations/j18-a2308c7d5495-cstm-loc","type":"CustomLocation"},"tags":{"ResourceType":"l3network","ManagedBy":"nc-labs","LabEnvironment":"j18","ResourceTest":"deployment"},"systemData":{"createdBy":"de975306-d24e-4dec-9d3b-ef05c66f0075","createdByType":"Application","createdAt":"2023-04-19T12:35:43.1426847Z","lastModifiedBy":"319f651f-7ddb-4fc6-9857-7aef9250bd05","lastModifiedByType":"Application","lastModifiedAt":"2023-04-27T19:22:39.1298377Z"},"properties":{"provisioningState":"Succeeded","interfaceName":"vlan-535","l3IsolationDomainId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/j18-l3domain-2","ipAllocationType":"IPV4","ipv4ConnectedPrefix":"10.6.100.0/24","vlan":535,"hybridAksPluginType":"DPDK","hybridAksIpamEnabled":"False","clusterId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.NetworkCloud/clusters/j18-a2308c7d5495","hybridAksClustersAssociatedIds":[],"virtualMachinesAssociatedIds":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/jnath-rg/providers/Microsoft.NetworkCloud/virtualMachines/jnvsrx0421v4e","/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/jnath-rg/providers/Microsoft.NetworkCloud/virtualMachines/jnvsrx0421v4e2","/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.NetworkCloud/virtualMachines/pipelinevmvXTZCSKoKhSwg","/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/jnath-rg/providers/Microsoft.NetworkCloud/virtualMachines/jnvsrx0421v4"],"detailedStatus":"Available","detailedStatusMessage":"all + resource creation succeeded"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.NetworkCloud/l3Networks/l3network-530","name":"l3network-530","type":"microsoft.networkcloud/l3networks","location":"eastus","extendedLocation":{"name":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/j18-a2308c7d5495-hostedresources-12cf30c0/providers/microsoft.extendedlocation/customlocations/j18-a2308c7d5495-cstm-loc","type":"CustomLocation"},"tags":{"ResourceType":"l3network","ManagedBy":"nc-labs","LabEnvironment":"j18","ResourceTest":"deployment"},"systemData":{"createdBy":"de975306-d24e-4dec-9d3b-ef05c66f0075","createdByType":"Application","createdAt":"2023-04-19T12:35:42.8106539Z","lastModifiedBy":"319f651f-7ddb-4fc6-9857-7aef9250bd05","lastModifiedByType":"Application","lastModifiedAt":"2023-04-28T14:42:31.3026292Z"},"properties":{"provisioningState":"Succeeded","interfaceName":"vlan-530","l3IsolationDomainId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/j18-l3domain-2","ipAllocationType":"IPV4","ipv4ConnectedPrefix":"10.6.90.0/24","vlan":530,"hybridAksPluginType":"DPDK","hybridAksIpamEnabled":"False","clusterId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.NetworkCloud/clusters/j18-a2308c7d5495","hybridAksClustersAssociatedIds":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.HybridContainerService/provisionedClusters/pipelinehaks-vXTZCSKoKhSwg","/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.HybridContainerService/provisionedClusters/mattjtest-haks2","/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.HybridContainerService/provisionedClusters/mattjtest-haks3"],"virtualMachinesAssociatedIds":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.NetworkCloud/virtualmachines/jnvsrxubuntuvm1","/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.NetworkCloud/virtualmachines/jnubuntuvm8","/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/jnath-rg/providers/Microsoft.NetworkCloud/virtualMachines/jnvsrx0421v4","/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/jnath-rg/providers/Microsoft.NetworkCloud/virtualMachines/jntestubuntu22","/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/jnath-rg/providers/Microsoft.NetworkCloud/virtualMachines/jnubuntu7","/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.NetworkCloud/virtualmachines/jnvsrxubuntuvm","/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.NetworkCloud/virtualmachines/jnvsrxubuntuvm2","/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/jnath-rg/providers/Microsoft.NetworkCloud/virtualMachines/jnvsrx0421v4e","/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/jnath-rg/providers/Microsoft.NetworkCloud/virtualMachines/jnvsrx0421v4e2","/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.NetworkCloud/virtualmachines/jnubuntuvm","/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/jnath-rg/providers/Microsoft.NetworkCloud/virtualMachines/jntestubuntu1","/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.NetworkCloud/virtualmachines/jnubuntuvm1"],"detailedStatus":"Available","detailedStatusMessage":"all + resource creation succeeded"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.NetworkCloud/l3Networks/mattj-l3n-527","name":"mattj-l3n-527","type":"microsoft.networkcloud/l3networks","location":"eastus","extendedLocation":{"name":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/j18-a2308c7d5495-hostedresources-12cf30c0/providers/microsoft.extendedlocation/customlocations/j18-a2308c7d5495-cstm-loc","type":"CustomLocation"},"systemData":{"createdBy":"mjeanneret@microsoft.com","createdByType":"User","createdAt":"2023-04-19T20:18:13.154574Z","lastModifiedBy":"319f651f-7ddb-4fc6-9857-7aef9250bd05","lastModifiedByType":"Application","lastModifiedAt":"2023-04-27T19:24:05.7089752Z"},"properties":{"provisioningState":"Succeeded","hybridAksIpamEnabled":"False","hybridAksPluginType":"SRIOV","interfaceName":"vlan-527","ipAllocationType":"IPV4","ipv4ConnectedPrefix":"10.6.84.0/24","l3IsolationDomainId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/j18-l3domain-1","vlan":527,"clusterId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.NetworkCloud/clusters/j18-a2308c7d5495","hybridAksClustersAssociatedIds":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.HybridContainerService/provisionedClusters/mattjtest-haks2","/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.HybridContainerService/provisionedClusters/mattjtest-haks3"],"virtualMachinesAssociatedIds":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.NetworkCloud/virtualMachines/mattjtestvm1"],"detailedStatus":"Available","detailedStatusMessage":"all + resource creation succeeded"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.NetworkCloud/l3Networks/l3network-503","name":"l3network-503","type":"microsoft.networkcloud/l3networks","location":"eastus","extendedLocation":{"name":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/j18-a2308c7d5495-hostedresources-12cf30c0/providers/microsoft.extendedlocation/customlocations/j18-a2308c7d5495-cstm-loc","type":"CustomLocation"},"tags":{"ManagedBy":"nc-labs","LabEnvironment":"j18","ResourceType":"l3Network"},"systemData":{"createdBy":"arijitbose@microsoft.com","createdByType":"User","createdAt":"2023-04-25T19:48:58.4061463Z","lastModifiedBy":"319f651f-7ddb-4fc6-9857-7aef9250bd05","lastModifiedByType":"Application","lastModifiedAt":"2023-04-27T19:23:06.3542441Z"},"properties":{"provisioningState":"Succeeded","interfaceName":"vlan-503","l3IsolationDomainId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/j18-l3domain-1","ipAllocationType":"IPV4","ipv4ConnectedPrefix":"10.6.36.0/24","ipv6ConnectedPrefix":"fda0:d59c:da0a:624::/64","vlan":503,"hybridAksPluginType":"SRIOV","hybridAksIpamEnabled":"True","clusterId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.NetworkCloud/clusters/j18-a2308c7d5495","hybridAksClustersAssociatedIds":[],"virtualMachinesAssociatedIds":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.NetworkCloud/virtualmachines/arijitbisevm"],"detailedStatus":"Available","detailedStatusMessage":"all + resource creation succeeded"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nc-resource-testing-m15-822a3c/providers/Microsoft.NetworkCloud/l3Networks/l3network-506","name":"l3network-506","type":"microsoft.networkcloud/l3networks","location":"eastus","extendedLocation":{"name":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/m15-b22f44ae5d50-hostedresources-2496d74b/providers/microsoft.extendedlocation/customlocations/m15-b22f44ae5d50-cstm-loc","type":"CustomLocation"},"tags":{"CleanupFrequency":"Daily","ManagedBy":"nc-resource-testing","Purpose":"QA"},"systemData":{"createdBy":"v-chsullivan@microsoft.com","createdByType":"User","createdAt":"2023-04-28T16:41:01.98212Z","lastModifiedBy":"319f651f-7ddb-4fc6-9857-7aef9250bd05","lastModifiedByType":"Application","lastModifiedAt":"2023-04-28T16:41:16.5379863Z"},"properties":{"provisioningState":"Succeeded","hybridAksPluginType":"OSDevice","ipAllocationType":"DualStack","ipv4ConnectedPrefix":"10.0.42.0/24","ipv6ConnectedPrefix":"fda0:d59c:da0a:2a::/64","l3IsolationDomainId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/m15-cluster/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/m15-l3domain-1","vlan":506,"interfaceName":"l3netw-59c16","hybridAksIpamEnabled":"True","clusterId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/m15-cluster/providers/Microsoft.NetworkCloud/clusters/m15-b22f44ae5d50","hybridAksClustersAssociatedIds":[],"virtualMachinesAssociatedIds":[],"detailedStatus":"Available","detailedStatusMessage":"all + resource creation succeeded"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nc-resource-testing-m15-822a3c/providers/Microsoft.NetworkCloud/l3Networks/l3network-507","name":"l3network-507","type":"microsoft.networkcloud/l3networks","location":"eastus","extendedLocation":{"name":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/m15-b22f44ae5d50-hostedresources-2496d74b/providers/microsoft.extendedlocation/customlocations/m15-b22f44ae5d50-cstm-loc","type":"CustomLocation"},"tags":{"CleanupFrequency":"Daily","ManagedBy":"nc-resource-testing","Purpose":"QA"},"systemData":{"createdBy":"v-chsullivan@microsoft.com","createdByType":"User","createdAt":"2023-04-28T16:41:35.092335Z","lastModifiedBy":"319f651f-7ddb-4fc6-9857-7aef9250bd05","lastModifiedByType":"Application","lastModifiedAt":"2023-04-28T16:43:02.3849055Z"},"properties":{"provisioningState":"Succeeded","hybridAksPluginType":"OSDevice","ipAllocationType":"DualStack","ipv4ConnectedPrefix":"10.0.44.0/24","ipv6ConnectedPrefix":"fda0:d59c:da0a:2c::/64","l3IsolationDomainId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/m15-cluster/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/m15-l3domain-1","vlan":507,"interfaceName":"l3netw-6b1b1","hybridAksIpamEnabled":"True","clusterId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/m15-cluster/providers/Microsoft.NetworkCloud/clusters/m15-b22f44ae5d50","hybridAksClustersAssociatedIds":[],"virtualMachinesAssociatedIds":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nc-resource-testing-m15-822a3c/providers/Microsoft.NetworkCloud/virtualMachines/resourcetestvmeb385util"],"detailedStatus":"Available","detailedStatusMessage":"all + resource creation succeeded"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/oded-IRT1/providers/Microsoft.NetworkCloud/l3Networks/l3network-502","name":"l3network-502","type":"microsoft.networkcloud/l3networks","location":"eastus","extendedLocation":{"name":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/j18-a2308c7d5495-hostedresources-12cf30c0/providers/microsoft.extendedlocation/customlocations/j18-a2308c7d5495-cstm-loc","type":"CustomLocation"},"tags":{"CleanupFrequency":"Daily","ManagedBy":"nc-resource-testing","Purpose":"QA"},"systemData":{"createdBy":"odedlesage@microsoft.com","createdByType":"User","createdAt":"2023-04-28T18:40:15.448095Z","lastModifiedBy":"319f651f-7ddb-4fc6-9857-7aef9250bd05","lastModifiedByType":"Application","lastModifiedAt":"2023-04-28T19:27:04.1307619Z"},"properties":{"provisioningState":"Failed","hybridAksPluginType":"OSDevice","ipAllocationType":"DualStack","ipv4ConnectedPrefix":"10.6.34.0/24","ipv6ConnectedPrefix":"fda0:d59c:da0a:622::/64","l3IsolationDomainId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/j18-l3domain-1","vlan":502,"interfaceName":"l3netw-4dac1","hybridAksIpamEnabled":"True","clusterId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.NetworkCloud/clusters/j18-a2308c7d5495","hybridAksClustersAssociatedIds":[],"virtualMachinesAssociatedIds":[],"detailedStatus":"Available","detailedStatusMessage":"all + resource creation succeeded"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/oded-IRT1/providers/Microsoft.NetworkCloud/l3Networks/l3network-504","name":"l3network-504","type":"microsoft.networkcloud/l3networks","location":"eastus","extendedLocation":{"name":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/j18-a2308c7d5495-hostedresources-12cf30c0/providers/microsoft.extendedlocation/customlocations/j18-a2308c7d5495-cstm-loc","type":"CustomLocation"},"tags":{"CleanupFrequency":"Daily","ManagedBy":"nc-resource-testing","Purpose":"QA"},"systemData":{"createdBy":"odedlesage@microsoft.com","createdByType":"User","createdAt":"2023-04-28T18:40:48.5733331Z","lastModifiedBy":"319f651f-7ddb-4fc6-9857-7aef9250bd05","lastModifiedByType":"Application","lastModifiedAt":"2023-04-28T19:27:05.5553739Z"},"properties":{"provisioningState":"Failed","hybridAksPluginType":"OSDevice","ipAllocationType":"DualStack","ipv4ConnectedPrefix":"10.6.38.0/24","ipv6ConnectedPrefix":"fda0:d59c:da0a:626::/64","l3IsolationDomainId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/j18-l3domain-1","vlan":504,"hybridAksIpamEnabled":"True","hybridAksClustersAssociatedIds":[],"virtualMachinesAssociatedIds":[],"detailedStatus":"Available","detailedStatusMessage":"all + resource creation succeeded","interfaceName":"l3netw-6f945","clusterId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.NetworkCloud/clusters/j18-a2308c7d5495"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/oded-IRT1/providers/Microsoft.NetworkCloud/l3Networks/l3network-505","name":"l3network-505","type":"microsoft.networkcloud/l3networks","location":"eastus","extendedLocation":{"name":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/j18-a2308c7d5495-hostedresources-12cf30c0/providers/microsoft.extendedlocation/customlocations/j18-a2308c7d5495-cstm-loc","type":"CustomLocation"},"tags":{"CleanupFrequency":"Daily","ManagedBy":"nc-resource-testing","Purpose":"QA"},"systemData":{"createdBy":"odedlesage@microsoft.com","createdByType":"User","createdAt":"2023-04-28T19:51:30.1596594Z","lastModifiedBy":"319f651f-7ddb-4fc6-9857-7aef9250bd05","lastModifiedByType":"Application","lastModifiedAt":"2023-04-28T19:55:04.8438769Z"},"properties":{"provisioningState":"Succeeded","hybridAksPluginType":"OSDevice","ipAllocationType":"DualStack","ipv4ConnectedPrefix":"10.6.40.0/24","ipv6ConnectedPrefix":"fda0:d59c:da0a:628::/64","l3IsolationDomainId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/j18-l3domain-1","vlan":505,"interfaceName":"l3netw-993cf","hybridAksIpamEnabled":"True","clusterId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.NetworkCloud/clusters/j18-a2308c7d5495","hybridAksClustersAssociatedIds":[],"virtualMachinesAssociatedIds":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/oded-IRT1/providers/Microsoft.NetworkCloud/virtualMachines/resourcetestvmd6d27"],"detailedStatus":"Available","detailedStatusMessage":"all + resource creation succeeded"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/oded-IRT1/providers/Microsoft.NetworkCloud/l3Networks/l3network-506","name":"l3network-506","type":"microsoft.networkcloud/l3networks","location":"eastus","extendedLocation":{"name":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/j18-a2308c7d5495-hostedresources-12cf30c0/providers/microsoft.extendedlocation/customlocations/j18-a2308c7d5495-cstm-loc","type":"CustomLocation"},"tags":{"CleanupFrequency":"Daily","ManagedBy":"nc-resource-testing","Purpose":"QA"},"systemData":{"createdBy":"odedlesage@microsoft.com","createdByType":"User","createdAt":"2023-04-28T19:52:02.8013618Z","lastModifiedBy":"319f651f-7ddb-4fc6-9857-7aef9250bd05","lastModifiedByType":"Application","lastModifiedAt":"2023-04-28T19:53:27.9221783Z"},"properties":{"provisioningState":"Succeeded","hybridAksPluginType":"OSDevice","ipAllocationType":"DualStack","ipv4ConnectedPrefix":"10.6.42.0/24","ipv6ConnectedPrefix":"fda0:d59c:da0a:62a::/64","l3IsolationDomainId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/j18-l3domain-1","vlan":506,"interfaceName":"l3netw-9367c","hybridAksIpamEnabled":"True","hybridAksClustersAssociatedIds":[],"virtualMachinesAssociatedIds":["/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/oded-IRT1/providers/Microsoft.NetworkCloud/virtualMachines/resourcetestvmd6d27util"],"detailedStatus":"Available","detailedStatusMessage":"all + resource creation succeeded","clusterId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/j18-cluster/providers/Microsoft.NetworkCloud/clusters/j18-a2308c7d5495"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000002/providers/Microsoft.NetworkCloud/l3Networks/cli-test-l3-000001","name":"cli-test-l3-000001","type":"microsoft.networkcloud/l3networks","location":"eastus","extendedLocation":{"name":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/simulator-hostedresources-106b4111/providers/microsoft.extendedlocation/customlocations/simulator-cstm-loc","type":"CustomLocation"},"tags":{"tag1":"\"tag1\",tagUpdate=NewTag"},"systemData":{"createdBy":"priyashet@microsoft.com","createdByType":"User","createdAt":"2023-04-28T21:15:27.1788968Z","lastModifiedBy":"priyashet@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2023-04-28T21:15:59.6919164Z"},"properties":{"provisioningState":"Succeeded","hybridAksIpamEnabled":"True","hybridAksPluginType":"DPDK","interfaceName":"eth0","ipAllocationType":"DualStack","ipv4ConnectedPrefix":"10.1.100.0/24","ipv6ConnectedPrefix":"fd01:1::0/64","l3IsolationDomainId":"/subscriptions/fabricsubs/resourceGroups/fabric-rg/providers/Microsoft.NetworkFabric/L3IsolationDomains/l3isolationdomain1","vlan":1001,"clusterId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mbashtovaya-sim2-rg/providers/Microsoft.NetworkCloud/clusters/simulator","hybridAksClustersAssociatedIds":[],"virtualMachinesAssociatedIds":[],"detailedStatus":"Available","detailedStatusMessage":"all + resource creation succeeded"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rajeshwari-preflight/providers/Microsoft.NetworkCloud/l3Networks/rg2l3test5network","name":"rg2l3test5network","type":"microsoft.networkcloud/l3networks","location":"eastus2euap","extendedLocation":{"name":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/simulator-hostedresources-427177bf/providers/microsoft.extendedlocation/customlocations/simulator-cstm-loc","type":"CustomLocation"},"tags":{},"systemData":{"createdBy":"rajeshwarig@microsoft.com","createdByType":"User","createdAt":"2023-04-21T16:29:18.7249247Z","lastModifiedBy":"rajeshwarig@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2023-04-21T16:29:18.7249247Z"},"properties":{"provisioningState":"Failed","interfaceName":"vlan-55","l3IsolationDomainId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rajeshwari-preflight/providers/Microsoft.NetworkFabric/IsolationDomains/rprelight-l3domain-55","ipAllocationType":"IPV4","ipv4ConnectedPrefix":"10.121.5.0/24","vlan":55,"hybridAksPluginType":"HostDevice","hybridAksIpamEnabled":"False"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rajeshwari-preflight/providers/Microsoft.NetworkCloud/l3Networks/rg2l3test6network","name":"rg2l3test6network","type":"microsoft.networkcloud/l3networks","location":"eastus2euap","extendedLocation":{"name":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/simulator-hostedresources-427177bf/providers/microsoft.extendedlocation/customlocations/simulator-cstm-loc","type":"CustomLocation"},"tags":{},"systemData":{"createdBy":"rajeshwarig@microsoft.com","createdByType":"User","createdAt":"2023-04-21T16:45:52.7312663Z","lastModifiedBy":"rajeshwarig@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2023-04-21T16:45:52.7312663Z"},"properties":{"provisioningState":"Failed","interfaceName":"vlan-55","l3IsolationDomainId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rajeshwari-preflight/providers/Microsoft.NetworkFabric/IsolationDomains/isodomain-55","ipAllocationType":"IPV4","ipv4ConnectedPrefix":"10.121.5.0/24","vlan":55,"hybridAksPluginType":"HostDevice","hybridAksIpamEnabled":"False"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '25465' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 28 Apr 2023 21:16:01 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-original-request-ids: + - 5aea763c-fcaa-4d69-b18e-918fbab8c8ec + - ead650aa-6be9-4360-8c95-82bb737611e8 + - 4a7f6593-2f2d-463f-a8f6-f90601a40da1 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - networkcloud l3network list + Connection: + - keep-alive + ParameterSetName: + - --resource-group + User-Agent: + - AZURECLI/2.48.1 (AAZ) azsdk-python-core/1.26.4 Python/3.8.10 (Linux-5.15.0-1036-azure-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000002/providers/Microsoft.NetworkCloud/l3Networks?api-version=2022-12-12-preview + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000002/providers/Microsoft.NetworkCloud/l3Networks/cli-test-l3-000001","name":"cli-test-l3-000001","type":"microsoft.networkcloud/l3networks","location":"eastus","extendedLocation":{"name":"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/simulator-hostedresources-106b4111/providers/microsoft.extendedlocation/customlocations/simulator-cstm-loc","type":"CustomLocation"},"tags":{"tag1":"\"tag1\",tagUpdate=NewTag"},"systemData":{"createdBy":"priyashet@microsoft.com","createdByType":"User","createdAt":"2023-04-28T21:15:27.1788968Z","lastModifiedBy":"priyashet@microsoft.com","lastModifiedByType":"User","lastModifiedAt":"2023-04-28T21:15:59.6919164Z"},"properties":{"provisioningState":"Succeeded","hybridAksIpamEnabled":"True","hybridAksPluginType":"DPDK","interfaceName":"eth0","ipAllocationType":"DualStack","ipv4ConnectedPrefix":"10.1.100.0/24","ipv6ConnectedPrefix":"fd01:1::0/64","l3IsolationDomainId":"/subscriptions/fabricsubs/resourceGroups/fabric-rg/providers/Microsoft.NetworkFabric/L3IsolationDomains/l3isolationdomain1","vlan":1001,"clusterId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mbashtovaya-sim2-rg/providers/Microsoft.NetworkCloud/clusters/simulator","hybridAksClustersAssociatedIds":[],"virtualMachinesAssociatedIds":[],"detailedStatus":"Available","detailedStatusMessage":"all + resource creation succeeded"}}]}' + headers: + cache-control: + - no-cache + content-length: + - '1469' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 28 Apr 2023 21:16:02 GMT + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + vary: + - Accept-Encoding + x-content-type-options: + - nosniff + x-ms-original-request-ids: + - 6ad1d8db-cbda-4b6d-ac30-a25bf5cc0134 + - e4f7aae1-4b2c-48d2-8e35-40a0ee660775 + - d8a6905b-81ed-4988-8aad-cc6a3e4b2226 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - networkcloud l3network delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - --name --resource-group -y + User-Agent: + - AZURECLI/2.48.1 (AAZ) azsdk-python-core/1.26.4 Python/3.8.10 (Linux-5.15.0-1036-azure-x86_64-with-glibc2.29) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000002/providers/Microsoft.NetworkCloud/l3Networks/cli-test-l3-000001?api-version=2022-12-12-preview + response: + body: + string: 'null' + headers: + azure-asyncoperation: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.NetworkCloud/locations/EASTUS/operationStatuses/69c0297c-1f84-4951-a1c5-6bd92d3ed3b0*9826E77B9951D96594780323A475A2CCEB3C534A04A1FF32AD82A431FECCF73A?api-version=2022-12-12-preview + cache-control: + - no-cache + content-length: + - '4' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 28 Apr 2023 21:16:04 GMT + etag: + - '"55044c39-0000-0100-0000-644c37940000"' + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.NetworkCloud/locations/EASTUS/operationStatuses/69c0297c-1f84-4951-a1c5-6bd92d3ed3b0*9826E77B9951D96594780323A475A2CCEB3C534A04A1FF32AD82A431FECCF73A?api-version=2022-12-12-preview + mise-correlation-id: + - 2d85a9f5-646e-4090-b0fc-7d4eb441ee46 + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-providerhub-traffic: + - 'True' + x-ms-ratelimit-remaining-subscription-deletes: + - '14998' + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - networkcloud l3network delete + Connection: + - keep-alive + ParameterSetName: + - --name --resource-group -y + User-Agent: + - AZURECLI/2.48.1 (AAZ) azsdk-python-core/1.26.4 Python/3.8.10 (Linux-5.15.0-1036-azure-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.NetworkCloud/locations/EASTUS/operationStatuses/69c0297c-1f84-4951-a1c5-6bd92d3ed3b0*9826E77B9951D96594780323A475A2CCEB3C534A04A1FF32AD82A431FECCF73A?api-version=2022-12-12-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.NetworkCloud/locations/EASTUS/operationStatuses/69c0297c-1f84-4951-a1c5-6bd92d3ed3b0*9826E77B9951D96594780323A475A2CCEB3C534A04A1FF32AD82A431FECCF73A","name":"69c0297c-1f84-4951-a1c5-6bd92d3ed3b0*9826E77B9951D96594780323A475A2CCEB3C534A04A1FF32AD82A431FECCF73A","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000002/providers/Microsoft.NetworkCloud/l3Networks/cli-test-l3-000001","status":"Deleting","startTime":"2023-04-28T21:16:04.4301796Z"}' + headers: + cache-control: + - no-cache + content-length: + - '563' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 28 Apr 2023 21:16:04 GMT + etag: + - '"6c00aa72-0000-0100-0000-644c37940000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - networkcloud l3network delete + Connection: + - keep-alive + ParameterSetName: + - --name --resource-group -y + User-Agent: + - AZURECLI/2.48.1 (AAZ) azsdk-python-core/1.26.4 Python/3.8.10 (Linux-5.15.0-1036-azure-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.NetworkCloud/locations/EASTUS/operationStatuses/69c0297c-1f84-4951-a1c5-6bd92d3ed3b0*9826E77B9951D96594780323A475A2CCEB3C534A04A1FF32AD82A431FECCF73A?api-version=2022-12-12-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.NetworkCloud/locations/EASTUS/operationStatuses/69c0297c-1f84-4951-a1c5-6bd92d3ed3b0*9826E77B9951D96594780323A475A2CCEB3C534A04A1FF32AD82A431FECCF73A","name":"69c0297c-1f84-4951-a1c5-6bd92d3ed3b0*9826E77B9951D96594780323A475A2CCEB3C534A04A1FF32AD82A431FECCF73A","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000002/providers/Microsoft.NetworkCloud/l3Networks/cli-test-l3-000001","status":"Succeeded","startTime":"2023-04-28T21:16:04.4301796Z","endTime":"2023-04-28T21:16:16.3070005Z","properties":null}' + headers: + cache-control: + - no-cache + content-length: + - '623' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 28 Apr 2023 21:16:34 GMT + etag: + - '"6c00337d-0000-0100-0000-644c37a00000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - networkcloud l3network delete + Connection: + - keep-alive + ParameterSetName: + - --name --resource-group -y + User-Agent: + - AZURECLI/2.48.1 (AAZ) azsdk-python-core/1.26.4 Python/3.8.10 (Linux-5.15.0-1036-azure-x86_64-with-glibc2.29) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.NetworkCloud/locations/EASTUS/operationStatuses/69c0297c-1f84-4951-a1c5-6bd92d3ed3b0*9826E77B9951D96594780323A475A2CCEB3C534A04A1FF32AD82A431FECCF73A?api-version=2022-12-12-preview + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.NetworkCloud/locations/EASTUS/operationStatuses/69c0297c-1f84-4951-a1c5-6bd92d3ed3b0*9826E77B9951D96594780323A475A2CCEB3C534A04A1FF32AD82A431FECCF73A","name":"69c0297c-1f84-4951-a1c5-6bd92d3ed3b0*9826E77B9951D96594780323A475A2CCEB3C534A04A1FF32AD82A431FECCF73A","resourceId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000002/providers/Microsoft.NetworkCloud/l3Networks/cli-test-l3-000001","status":"Succeeded","startTime":"2023-04-28T21:16:04.4301796Z","endTime":"2023-04-28T21:16:16.3070005Z","properties":null}' + headers: + cache-control: + - no-cache + content-length: + - '623' + content-type: + - application/json; charset=utf-8 + date: + - Fri, 28 Apr 2023 21:16:34 GMT + etag: + - '"6c00337d-0000-0100-0000-644c37a00000"' + expires: + - '-1' + pragma: + - no-cache + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + status: + code: 200 + message: OK +version: 1 diff --git a/src/networkcloud/azext_networkcloud/tests/latest/test_l3network.py b/src/networkcloud/azext_networkcloud/tests/latest/test_l3network.py new file mode 100644 index 00000000000..e23a9cb2213 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/tests/latest/test_l3network.py @@ -0,0 +1,120 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# -------------------------------------------------------------------------------------------- +# pylint: disable=too-few-public-methods,unnecessary-pass,unused-argument +# flake8: noqa + + +""" +L3Network tests scenarios +""" + +from azure.cli.testsdk import ScenarioTest, ResourceGroupPreparer +from .config import CONFIG + + +def setup_scenario1(test): + ''' Env setup_scenario1 ''' + + +def cleanup_scenario1(test): + '''Env cleanup_scenario1 ''' + + +def call_scenario1(test): + ''' # Testcase: scenario1''' + setup_scenario1(test) + step_create(test, checks=[ + test.check('name', '{name}'), + test.check('provisioningState', 'Succeeded') + ]) + step_update(test, checks=[ + test.check('tags', '{tagsUpdate}'), + test.check('provisioningState', 'Succeeded') + ]) + step_show(test, checks=[]) + step_list_subscription(test, checks=[]) + step_list_resource_group(test, checks=[]) + step_delete(test, checks=[]) + cleanup_scenario1(test) + + +def step_create(test, checks=None): + '''l3network create operation''' + if checks is None: + checks = [] + test.cmd('az networkcloud l3network create --name {name} --extended-location ' + 'name={extendedLocation} type="CustomLocation" --location {location} ' + '--hybrid-aks-ipam-enabled {hybridAksIpamEnabled} ' + '--hybrid-aks-plugin-type {hybridAksPluginType} ' + ' --interface-name "eth0" --ip-allocation-type {ipAllocationType}' + ' --ipv4-connected-prefix {ipv4prefix} --ipv6-connected-prefix {ipv6prefix} ' + '--l3-isolation-domain-id {l3_isolation_domain_id} --vlan {vlan} --tags ' + ' {tags} --resource-group {rg}', checks=checks) + + +def step_show(test, checks=None): + '''l3network show operation''' + if checks is None: + checks = [] + test.cmd( + 'az networkcloud l3network show --name {name} --resource-group {rg}') + + +def step_delete(test, checks=None): + '''l3network delete operation''' + if checks is None: + checks = [] + test.cmd( + 'az networkcloud l3network delete --name {name} --resource-group {rg} -y') + + +def step_list_resource_group(test, checks=None): + '''l3network list by resource group operation''' + if checks is None: + checks = [] + test.cmd('az networkcloud l3network list --resource-group {rg}') + + +def step_list_subscription(test, checks=None): + '''l3network list by subscription operation''' + if checks is None: + checks = [] + test.cmd('az networkcloud l3network list') + + +def step_update(test, checks=None): + '''l3network update operation''' + if checks is None: + checks = [] + test.cmd( + 'az networkcloud l3network update --name {name} --tags {tagsUpdate} --resource-group {rg}') + + +class L3NetworkScenarioTest1(ScenarioTest): + ''' L3NetworkScenario test''' + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.kwargs.update({ + 'name': self.create_random_name(prefix="cli-test-l3-", length=24), + 'location': CONFIG.get('L3_NETWORK', 'location'), + 'extendedLocation': CONFIG.get('L3_NETWORK', 'extended_location'), + 'tags': CONFIG.get('L3_NETWORK', 'tags'), + 'tagsUpdate': CONFIG.get('L3_NETWORK', 'tagsUpdate'), + "type": CONFIG.get('L3_NETWORK', 'type'), + 'vlan': CONFIG.get('L3_NETWORK', 'vlan'), + "ipAllocationType": CONFIG.get('L3_NETWORK', 'ip_allocation_type'), + "hybridAksPluginType": CONFIG.get('L3_NETWORK', 'hybrid_aks_plugin_type'), + "hybridAksIpamEnabled": CONFIG.get('L3_NETWORK', 'hybrid_aks_ipam_enabled'), + "ipv4prefix": CONFIG.get('L3_NETWORK', 'ipv4prefix'), + "ipv6prefix": CONFIG.get('L3_NETWORK', 'ipv6prefix'), + "l3_isolation_domain_id": CONFIG.get('L3_NETWORK', 'l3_isolation_domain_id'), + }) + + @ResourceGroupPreparer(name_prefix='clitest_rg'[:7], key='rg', parameter_name='rg') + def test_l3network_scenario1(self): + ''' test scenario for L3network CRUD operations''' + call_scenario1(self) diff --git a/src/networkcloud/azext_networkcloud/tests/latest/test_networkcloud.py b/src/networkcloud/azext_networkcloud/tests/latest/test_networkcloud.py new file mode 100644 index 00000000000..5d723b0117f --- /dev/null +++ b/src/networkcloud/azext_networkcloud/tests/latest/test_networkcloud.py @@ -0,0 +1,11 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + + +class NetworkcloudScenario(): + ''' TODO:add tests here''' + pass diff --git a/src/networkcloud/report.md b/src/networkcloud/report.md new file mode 100644 index 00000000000..ae337936a7e --- /dev/null +++ b/src/networkcloud/report.md @@ -0,0 +1,2131 @@ +# Azure CLI Module Creation Report + +## EXTENSION +|CLI Extension|Command Groups| +|---------|------------| +|az networkcloud|[groups](#CommandGroups) + +## GROUPS +### Command groups in `az networkcloud` extension +|CLI Command Group|Group Swagger name|Commands| +|---------|------------|--------| +|az networkcloud baremetalmachine|BareMetalMachines|[commands](#CommandsInBareMetalMachines)| +|az networkcloud baremetalmachinekeyset|BareMetalMachineKeySets|[commands](#CommandsInBareMetalMachineKeySets)| +|az networkcloud bmckeyset|BmcKeySets|[commands](#CommandsInBmcKeySets)| +|az networkcloud cloudservicesnetwork|CloudServicesNetworks|[commands](#CommandsInCloudServicesNetworks)| +|az networkcloud cluster|Clusters|[commands](#CommandsInClusters)| +|az networkcloud clustermanager|ClusterManagers|[commands](#CommandsInClusterManagers)| +|az networkcloud console|Consoles|[commands](#CommandsInConsoles)| +|az networkcloud defaultcninetwork|DefaultCniNetworks|[commands](#CommandsInDefaultCniNetworks)| +|az networkcloud hybridakscluster|HybridAksClusters|[commands](#CommandsInHybridAksClusters)| +|az networkcloud l2network|L2Networks|[commands](#CommandsInL2Networks)| +|az networkcloud l3network|L3Networks|[commands](#CommandsInL3Networks)| +|az networkcloud metricsconfiguration|MetricsConfigurations|[commands](#CommandsInMetricsConfigurations)| +|az networkcloud rack|Racks|[commands](#CommandsInRacks)| +|az networkcloud racksku|RackSkus|[commands](#CommandsInRackSkus)| +|az networkcloud storageappliance|StorageAppliances|[commands](#CommandsInStorageAppliances)| +|az networkcloud trunkednetwork|TrunkedNetworks|[commands](#CommandsInTrunkedNetworks)| +|az networkcloud virtualmachine|VirtualMachines|[commands](#CommandsInVirtualMachines)| +|az networkcloud volume|Volumes|[commands](#CommandsInVolumes)| + +## COMMANDS +### Commands in `az networkcloud baremetalmachine` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az networkcloud baremetalmachine list](#BareMetalMachinesListByResourceGroup)|ListByResourceGroup|[Parameters](#ParametersBareMetalMachinesListByResourceGroup)|[Example](#ExamplesBareMetalMachinesListByResourceGroup)| +|[az networkcloud baremetalmachine list](#BareMetalMachinesListBySubscription)|ListBySubscription|[Parameters](#ParametersBareMetalMachinesListBySubscription)|[Example](#ExamplesBareMetalMachinesListBySubscription)| +|[az networkcloud baremetalmachine show](#BareMetalMachinesGet)|Get|[Parameters](#ParametersBareMetalMachinesGet)|[Example](#ExamplesBareMetalMachinesGet)| +|[az networkcloud baremetalmachine create](#BareMetalMachinesCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersBareMetalMachinesCreateOrUpdate#Create)|[Example](#ExamplesBareMetalMachinesCreateOrUpdate#Create)| +|[az networkcloud baremetalmachine update](#BareMetalMachinesUpdate)|Update|[Parameters](#ParametersBareMetalMachinesUpdate)|[Example](#ExamplesBareMetalMachinesUpdate)| +|[az networkcloud baremetalmachine delete](#BareMetalMachinesDelete)|Delete|[Parameters](#ParametersBareMetalMachinesDelete)|[Example](#ExamplesBareMetalMachinesDelete)| +|[az networkcloud baremetalmachine cordon](#BareMetalMachinesCordon)|Cordon|[Parameters](#ParametersBareMetalMachinesCordon)|[Example](#ExamplesBareMetalMachinesCordon)| +|[az networkcloud baremetalmachine power-off](#BareMetalMachinesPowerOff)|PowerOff|[Parameters](#ParametersBareMetalMachinesPowerOff)|[Example](#ExamplesBareMetalMachinesPowerOff)| +|[az networkcloud baremetalmachine reimage](#BareMetalMachinesReimage)|Reimage|[Parameters](#ParametersBareMetalMachinesReimage)|[Example](#ExamplesBareMetalMachinesReimage)| +|[az networkcloud baremetalmachine replace](#BareMetalMachinesReplace)|Replace|[Parameters](#ParametersBareMetalMachinesReplace)|[Example](#ExamplesBareMetalMachinesReplace)| +|[az networkcloud baremetalmachine restart](#BareMetalMachinesRestart)|Restart|[Parameters](#ParametersBareMetalMachinesRestart)|[Example](#ExamplesBareMetalMachinesRestart)| +|[az networkcloud baremetalmachine run-command](#BareMetalMachinesRunCommand)|RunCommand|[Parameters](#ParametersBareMetalMachinesRunCommand)|[Example](#ExamplesBareMetalMachinesRunCommand)| +|[az networkcloud baremetalmachine run-data-extract](#BareMetalMachinesRunDataExtracts)|RunDataExtracts|[Parameters](#ParametersBareMetalMachinesRunDataExtracts)|[Example](#ExamplesBareMetalMachinesRunDataExtracts)| +|[az networkcloud baremetalmachine run-read-command](#BareMetalMachinesRunReadCommands)|RunReadCommands|[Parameters](#ParametersBareMetalMachinesRunReadCommands)|[Example](#ExamplesBareMetalMachinesRunReadCommands)| +|[az networkcloud baremetalmachine start](#BareMetalMachinesStart)|Start|[Parameters](#ParametersBareMetalMachinesStart)|[Example](#ExamplesBareMetalMachinesStart)| +|[az networkcloud baremetalmachine uncordon](#BareMetalMachinesUncordon)|Uncordon|[Parameters](#ParametersBareMetalMachinesUncordon)|[Example](#ExamplesBareMetalMachinesUncordon)| +|[az networkcloud baremetalmachine validate-hardware](#BareMetalMachinesValidateHardware)|ValidateHardware|[Parameters](#ParametersBareMetalMachinesValidateHardware)|[Example](#ExamplesBareMetalMachinesValidateHardware)| + +### Commands in `az networkcloud baremetalmachinekeyset` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az networkcloud baremetalmachinekeyset list](#BareMetalMachineKeySetsListByResourceGroup)|ListByResourceGroup|[Parameters](#ParametersBareMetalMachineKeySetsListByResourceGroup)|[Example](#ExamplesBareMetalMachineKeySetsListByResourceGroup)| +|[az networkcloud baremetalmachinekeyset show](#BareMetalMachineKeySetsGet)|Get|[Parameters](#ParametersBareMetalMachineKeySetsGet)|[Example](#ExamplesBareMetalMachineKeySetsGet)| +|[az networkcloud baremetalmachinekeyset create](#BareMetalMachineKeySetsCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersBareMetalMachineKeySetsCreateOrUpdate#Create)|[Example](#ExamplesBareMetalMachineKeySetsCreateOrUpdate#Create)| +|[az networkcloud baremetalmachinekeyset update](#BareMetalMachineKeySetsUpdate)|Update|[Parameters](#ParametersBareMetalMachineKeySetsUpdate)|[Example](#ExamplesBareMetalMachineKeySetsUpdate)| +|[az networkcloud baremetalmachinekeyset delete](#BareMetalMachineKeySetsDelete)|Delete|[Parameters](#ParametersBareMetalMachineKeySetsDelete)|[Example](#ExamplesBareMetalMachineKeySetsDelete)| + +### Commands in `az networkcloud bmckeyset` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az networkcloud bmckeyset list](#BmcKeySetsListByResourceGroup)|ListByResourceGroup|[Parameters](#ParametersBmcKeySetsListByResourceGroup)|[Example](#ExamplesBmcKeySetsListByResourceGroup)| +|[az networkcloud bmckeyset show](#BmcKeySetsGet)|Get|[Parameters](#ParametersBmcKeySetsGet)|[Example](#ExamplesBmcKeySetsGet)| +|[az networkcloud bmckeyset create](#BmcKeySetsCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersBmcKeySetsCreateOrUpdate#Create)|[Example](#ExamplesBmcKeySetsCreateOrUpdate#Create)| +|[az networkcloud bmckeyset update](#BmcKeySetsUpdate)|Update|[Parameters](#ParametersBmcKeySetsUpdate)|[Example](#ExamplesBmcKeySetsUpdate)| +|[az networkcloud bmckeyset delete](#BmcKeySetsDelete)|Delete|[Parameters](#ParametersBmcKeySetsDelete)|[Example](#ExamplesBmcKeySetsDelete)| + +### Commands in `az networkcloud cloudservicesnetwork` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az networkcloud cloudservicesnetwork list](#CloudServicesNetworksListByResourceGroup)|ListByResourceGroup|[Parameters](#ParametersCloudServicesNetworksListByResourceGroup)|[Example](#ExamplesCloudServicesNetworksListByResourceGroup)| +|[az networkcloud cloudservicesnetwork list](#CloudServicesNetworksListBySubscription)|ListBySubscription|[Parameters](#ParametersCloudServicesNetworksListBySubscription)|[Example](#ExamplesCloudServicesNetworksListBySubscription)| +|[az networkcloud cloudservicesnetwork show](#CloudServicesNetworksGet)|Get|[Parameters](#ParametersCloudServicesNetworksGet)|[Example](#ExamplesCloudServicesNetworksGet)| +|[az networkcloud cloudservicesnetwork create](#CloudServicesNetworksCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersCloudServicesNetworksCreateOrUpdate#Create)|[Example](#ExamplesCloudServicesNetworksCreateOrUpdate#Create)| +|[az networkcloud cloudservicesnetwork update](#CloudServicesNetworksUpdate)|Update|[Parameters](#ParametersCloudServicesNetworksUpdate)|[Example](#ExamplesCloudServicesNetworksUpdate)| +|[az networkcloud cloudservicesnetwork delete](#CloudServicesNetworksDelete)|Delete|[Parameters](#ParametersCloudServicesNetworksDelete)|[Example](#ExamplesCloudServicesNetworksDelete)| + +### Commands in `az networkcloud cluster` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az networkcloud cluster list](#ClustersListByResourceGroup)|ListByResourceGroup|[Parameters](#ParametersClustersListByResourceGroup)|[Example](#ExamplesClustersListByResourceGroup)| +|[az networkcloud cluster list](#ClustersListBySubscription)|ListBySubscription|[Parameters](#ParametersClustersListBySubscription)|[Example](#ExamplesClustersListBySubscription)| +|[az networkcloud cluster show](#ClustersGet)|Get|[Parameters](#ParametersClustersGet)|[Example](#ExamplesClustersGet)| +|[az networkcloud cluster create](#ClustersCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersClustersCreateOrUpdate#Create)|[Example](#ExamplesClustersCreateOrUpdate#Create)| +|[az networkcloud cluster update](#ClustersUpdate)|Update|[Parameters](#ParametersClustersUpdate)|[Example](#ExamplesClustersUpdate)| +|[az networkcloud cluster delete](#ClustersDelete)|Delete|[Parameters](#ParametersClustersDelete)|[Example](#ExamplesClustersDelete)| +|[az networkcloud cluster deploy](#ClustersDeploy)|Deploy|[Parameters](#ParametersClustersDeploy)|[Example](#ExamplesClustersDeploy)| +|[az networkcloud cluster update-version](#ClustersUpdateVersion)|UpdateVersion|[Parameters](#ParametersClustersUpdateVersion)|[Example](#ExamplesClustersUpdateVersion)| + +### Commands in `az networkcloud clustermanager` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az networkcloud clustermanager list](#ClusterManagersListByResourceGroup)|ListByResourceGroup|[Parameters](#ParametersClusterManagersListByResourceGroup)|[Example](#ExamplesClusterManagersListByResourceGroup)| +|[az networkcloud clustermanager list](#ClusterManagersListBySubscription)|ListBySubscription|[Parameters](#ParametersClusterManagersListBySubscription)|[Example](#ExamplesClusterManagersListBySubscription)| +|[az networkcloud clustermanager show](#ClusterManagersGet)|Get|[Parameters](#ParametersClusterManagersGet)|[Example](#ExamplesClusterManagersGet)| +|[az networkcloud clustermanager create](#ClusterManagersCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersClusterManagersCreateOrUpdate#Create)|[Example](#ExamplesClusterManagersCreateOrUpdate#Create)| +|[az networkcloud clustermanager update](#ClusterManagersUpdate)|Update|[Parameters](#ParametersClusterManagersUpdate)|[Example](#ExamplesClusterManagersUpdate)| +|[az networkcloud clustermanager delete](#ClusterManagersDelete)|Delete|[Parameters](#ParametersClusterManagersDelete)|[Example](#ExamplesClusterManagersDelete)| + +### Commands in `az networkcloud console` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az networkcloud console list](#ConsolesListByResourceGroup)|ListByResourceGroup|[Parameters](#ParametersConsolesListByResourceGroup)|[Example](#ExamplesConsolesListByResourceGroup)| +|[az networkcloud console show](#ConsolesGet)|Get|[Parameters](#ParametersConsolesGet)|[Example](#ExamplesConsolesGet)| +|[az networkcloud console create](#ConsolesCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersConsolesCreateOrUpdate#Create)|[Example](#ExamplesConsolesCreateOrUpdate#Create)| +|[az networkcloud console update](#ConsolesUpdate)|Update|[Parameters](#ParametersConsolesUpdate)|[Example](#ExamplesConsolesUpdate)| +|[az networkcloud console delete](#ConsolesDelete)|Delete|[Parameters](#ParametersConsolesDelete)|[Example](#ExamplesConsolesDelete)| + +### Commands in `az networkcloud defaultcninetwork` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az networkcloud defaultcninetwork list](#DefaultCniNetworksListByResourceGroup)|ListByResourceGroup|[Parameters](#ParametersDefaultCniNetworksListByResourceGroup)|[Example](#ExamplesDefaultCniNetworksListByResourceGroup)| +|[az networkcloud defaultcninetwork list](#DefaultCniNetworksListBySubscription)|ListBySubscription|[Parameters](#ParametersDefaultCniNetworksListBySubscription)|[Example](#ExamplesDefaultCniNetworksListBySubscription)| +|[az networkcloud defaultcninetwork show](#DefaultCniNetworksGet)|Get|[Parameters](#ParametersDefaultCniNetworksGet)|[Example](#ExamplesDefaultCniNetworksGet)| +|[az networkcloud defaultcninetwork create](#DefaultCniNetworksCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersDefaultCniNetworksCreateOrUpdate#Create)|[Example](#ExamplesDefaultCniNetworksCreateOrUpdate#Create)| +|[az networkcloud defaultcninetwork update](#DefaultCniNetworksUpdate)|Update|[Parameters](#ParametersDefaultCniNetworksUpdate)|[Example](#ExamplesDefaultCniNetworksUpdate)| +|[az networkcloud defaultcninetwork delete](#DefaultCniNetworksDelete)|Delete|[Parameters](#ParametersDefaultCniNetworksDelete)|[Example](#ExamplesDefaultCniNetworksDelete)| + +### Commands in `az networkcloud hybridakscluster` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az networkcloud hybridakscluster list](#HybridAksClustersListByResourceGroup)|ListByResourceGroup|[Parameters](#ParametersHybridAksClustersListByResourceGroup)|[Example](#ExamplesHybridAksClustersListByResourceGroup)| +|[az networkcloud hybridakscluster list](#HybridAksClustersListBySubscription)|ListBySubscription|[Parameters](#ParametersHybridAksClustersListBySubscription)|[Example](#ExamplesHybridAksClustersListBySubscription)| +|[az networkcloud hybridakscluster show](#HybridAksClustersGet)|Get|[Parameters](#ParametersHybridAksClustersGet)|[Example](#ExamplesHybridAksClustersGet)| +|[az networkcloud hybridakscluster create](#HybridAksClustersCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersHybridAksClustersCreateOrUpdate#Create)|[Example](#ExamplesHybridAksClustersCreateOrUpdate#Create)| +|[az networkcloud hybridakscluster update](#HybridAksClustersUpdate)|Update|[Parameters](#ParametersHybridAksClustersUpdate)|[Example](#ExamplesHybridAksClustersUpdate)| +|[az networkcloud hybridakscluster delete](#HybridAksClustersDelete)|Delete|[Parameters](#ParametersHybridAksClustersDelete)|[Example](#ExamplesHybridAksClustersDelete)| +|[az networkcloud hybridakscluster restart-node](#HybridAksClustersRestartNode)|RestartNode|[Parameters](#ParametersHybridAksClustersRestartNode)|[Example](#ExamplesHybridAksClustersRestartNode)| + +### Commands in `az networkcloud l2network` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az networkcloud l2network list](#L2NetworksListByResourceGroup)|ListByResourceGroup|[Parameters](#ParametersL2NetworksListByResourceGroup)|[Example](#ExamplesL2NetworksListByResourceGroup)| +|[az networkcloud l2network list](#L2NetworksListBySubscription)|ListBySubscription|[Parameters](#ParametersL2NetworksListBySubscription)|[Example](#ExamplesL2NetworksListBySubscription)| +|[az networkcloud l2network show](#L2NetworksGet)|Get|[Parameters](#ParametersL2NetworksGet)|[Example](#ExamplesL2NetworksGet)| +|[az networkcloud l2network create](#L2NetworksCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersL2NetworksCreateOrUpdate#Create)|[Example](#ExamplesL2NetworksCreateOrUpdate#Create)| +|[az networkcloud l2network update](#L2NetworksUpdate)|Update|[Parameters](#ParametersL2NetworksUpdate)|[Example](#ExamplesL2NetworksUpdate)| +|[az networkcloud l2network delete](#L2NetworksDelete)|Delete|[Parameters](#ParametersL2NetworksDelete)|[Example](#ExamplesL2NetworksDelete)| + +### Commands in `az networkcloud l3network` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az networkcloud l3network list](#L3NetworksListByResourceGroup)|ListByResourceGroup|[Parameters](#ParametersL3NetworksListByResourceGroup)|[Example](#ExamplesL3NetworksListByResourceGroup)| +|[az networkcloud l3network list](#L3NetworksListBySubscription)|ListBySubscription|[Parameters](#ParametersL3NetworksListBySubscription)|[Example](#ExamplesL3NetworksListBySubscription)| +|[az networkcloud l3network show](#L3NetworksGet)|Get|[Parameters](#ParametersL3NetworksGet)|[Example](#ExamplesL3NetworksGet)| +|[az networkcloud l3network create](#L3NetworksCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersL3NetworksCreateOrUpdate#Create)|[Example](#ExamplesL3NetworksCreateOrUpdate#Create)| +|[az networkcloud l3network update](#L3NetworksUpdate)|Update|[Parameters](#ParametersL3NetworksUpdate)|[Example](#ExamplesL3NetworksUpdate)| +|[az networkcloud l3network delete](#L3NetworksDelete)|Delete|[Parameters](#ParametersL3NetworksDelete)|[Example](#ExamplesL3NetworksDelete)| + +### Commands in `az networkcloud metricsconfiguration` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az networkcloud metricsconfiguration list](#MetricsConfigurationsListByResourceGroup)|ListByResourceGroup|[Parameters](#ParametersMetricsConfigurationsListByResourceGroup)|[Example](#ExamplesMetricsConfigurationsListByResourceGroup)| +|[az networkcloud metricsconfiguration show](#MetricsConfigurationsGet)|Get|[Parameters](#ParametersMetricsConfigurationsGet)|[Example](#ExamplesMetricsConfigurationsGet)| +|[az networkcloud metricsconfiguration create](#MetricsConfigurationsCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersMetricsConfigurationsCreateOrUpdate#Create)|[Example](#ExamplesMetricsConfigurationsCreateOrUpdate#Create)| +|[az networkcloud metricsconfiguration update](#MetricsConfigurationsUpdate)|Update|[Parameters](#ParametersMetricsConfigurationsUpdate)|[Example](#ExamplesMetricsConfigurationsUpdate)| +|[az networkcloud metricsconfiguration delete](#MetricsConfigurationsDelete)|Delete|[Parameters](#ParametersMetricsConfigurationsDelete)|[Example](#ExamplesMetricsConfigurationsDelete)| + +### Commands in `az networkcloud rack` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az networkcloud rack list](#RacksListByResourceGroup)|ListByResourceGroup|[Parameters](#ParametersRacksListByResourceGroup)|[Example](#ExamplesRacksListByResourceGroup)| +|[az networkcloud rack list](#RacksListBySubscription)|ListBySubscription|[Parameters](#ParametersRacksListBySubscription)|[Example](#ExamplesRacksListBySubscription)| +|[az networkcloud rack show](#RacksGet)|Get|[Parameters](#ParametersRacksGet)|[Example](#ExamplesRacksGet)| +|[az networkcloud rack create](#RacksCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersRacksCreateOrUpdate#Create)|[Example](#ExamplesRacksCreateOrUpdate#Create)| +|[az networkcloud rack update](#RacksUpdate)|Update|[Parameters](#ParametersRacksUpdate)|[Example](#ExamplesRacksUpdate)| +|[az networkcloud rack delete](#RacksDelete)|Delete|[Parameters](#ParametersRacksDelete)|[Example](#ExamplesRacksDelete)| + +### Commands in `az networkcloud racksku` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az networkcloud racksku list](#RackSkusListBySubscription)|ListBySubscription|[Parameters](#ParametersRackSkusListBySubscription)|[Example](#ExamplesRackSkusListBySubscription)| +|[az networkcloud racksku show](#RackSkusGet)|Get|[Parameters](#ParametersRackSkusGet)|[Example](#ExamplesRackSkusGet)| + +### Commands in `az networkcloud storageappliance` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az networkcloud storageappliance list](#StorageAppliancesListByResourceGroup)|ListByResourceGroup|[Parameters](#ParametersStorageAppliancesListByResourceGroup)|[Example](#ExamplesStorageAppliancesListByResourceGroup)| +|[az networkcloud storageappliance list](#StorageAppliancesListBySubscription)|ListBySubscription|[Parameters](#ParametersStorageAppliancesListBySubscription)|[Example](#ExamplesStorageAppliancesListBySubscription)| +|[az networkcloud storageappliance show](#StorageAppliancesGet)|Get|[Parameters](#ParametersStorageAppliancesGet)|[Example](#ExamplesStorageAppliancesGet)| +|[az networkcloud storageappliance create](#StorageAppliancesCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersStorageAppliancesCreateOrUpdate#Create)|[Example](#ExamplesStorageAppliancesCreateOrUpdate#Create)| +|[az networkcloud storageappliance update](#StorageAppliancesUpdate)|Update|[Parameters](#ParametersStorageAppliancesUpdate)|[Example](#ExamplesStorageAppliancesUpdate)| +|[az networkcloud storageappliance delete](#StorageAppliancesDelete)|Delete|[Parameters](#ParametersStorageAppliancesDelete)|[Example](#ExamplesStorageAppliancesDelete)| +|[az networkcloud storageappliance disable-remote-vendor-management](#StorageAppliancesDisableRemoteVendorManagement)|DisableRemoteVendorManagement|[Parameters](#ParametersStorageAppliancesDisableRemoteVendorManagement)|[Example](#ExamplesStorageAppliancesDisableRemoteVendorManagement)| +|[az networkcloud storageappliance enable-remote-vendor-management](#StorageAppliancesEnableRemoteVendorManagement)|EnableRemoteVendorManagement|[Parameters](#ParametersStorageAppliancesEnableRemoteVendorManagement)|[Example](#ExamplesStorageAppliancesEnableRemoteVendorManagement)| +|[az networkcloud storageappliance run-read-command](#StorageAppliancesRunReadCommands)|RunReadCommands|[Parameters](#ParametersStorageAppliancesRunReadCommands)|[Example](#ExamplesStorageAppliancesRunReadCommands)| +|[az networkcloud storageappliance validate-hardware](#StorageAppliancesValidateHardware)|ValidateHardware|[Parameters](#ParametersStorageAppliancesValidateHardware)|[Example](#ExamplesStorageAppliancesValidateHardware)| + +### Commands in `az networkcloud trunkednetwork` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az networkcloud trunkednetwork list](#TrunkedNetworksListByResourceGroup)|ListByResourceGroup|[Parameters](#ParametersTrunkedNetworksListByResourceGroup)|[Example](#ExamplesTrunkedNetworksListByResourceGroup)| +|[az networkcloud trunkednetwork list](#TrunkedNetworksListBySubscription)|ListBySubscription|[Parameters](#ParametersTrunkedNetworksListBySubscription)|[Example](#ExamplesTrunkedNetworksListBySubscription)| +|[az networkcloud trunkednetwork show](#TrunkedNetworksGet)|Get|[Parameters](#ParametersTrunkedNetworksGet)|[Example](#ExamplesTrunkedNetworksGet)| +|[az networkcloud trunkednetwork create](#TrunkedNetworksCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersTrunkedNetworksCreateOrUpdate#Create)|[Example](#ExamplesTrunkedNetworksCreateOrUpdate#Create)| +|[az networkcloud trunkednetwork update](#TrunkedNetworksUpdate)|Update|[Parameters](#ParametersTrunkedNetworksUpdate)|[Example](#ExamplesTrunkedNetworksUpdate)| +|[az networkcloud trunkednetwork delete](#TrunkedNetworksDelete)|Delete|[Parameters](#ParametersTrunkedNetworksDelete)|[Example](#ExamplesTrunkedNetworksDelete)| + +### Commands in `az networkcloud virtualmachine` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az networkcloud virtualmachine list](#VirtualMachinesListByResourceGroup)|ListByResourceGroup|[Parameters](#ParametersVirtualMachinesListByResourceGroup)|[Example](#ExamplesVirtualMachinesListByResourceGroup)| +|[az networkcloud virtualmachine list](#VirtualMachinesListBySubscription)|ListBySubscription|[Parameters](#ParametersVirtualMachinesListBySubscription)|[Example](#ExamplesVirtualMachinesListBySubscription)| +|[az networkcloud virtualmachine show](#VirtualMachinesGet)|Get|[Parameters](#ParametersVirtualMachinesGet)|[Example](#ExamplesVirtualMachinesGet)| +|[az networkcloud virtualmachine create](#VirtualMachinesCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersVirtualMachinesCreateOrUpdate#Create)|[Example](#ExamplesVirtualMachinesCreateOrUpdate#Create)| +|[az networkcloud virtualmachine update](#VirtualMachinesUpdate)|Update|[Parameters](#ParametersVirtualMachinesUpdate)|[Example](#ExamplesVirtualMachinesUpdate)| +|[az networkcloud virtualmachine delete](#VirtualMachinesDelete)|Delete|[Parameters](#ParametersVirtualMachinesDelete)|[Example](#ExamplesVirtualMachinesDelete)| +|[az networkcloud virtualmachine attach-volume](#VirtualMachinesAttachVolume)|AttachVolume|[Parameters](#ParametersVirtualMachinesAttachVolume)|[Example](#ExamplesVirtualMachinesAttachVolume)| +|[az networkcloud virtualmachine detach-volume](#VirtualMachinesDetachVolume)|DetachVolume|[Parameters](#ParametersVirtualMachinesDetachVolume)|[Example](#ExamplesVirtualMachinesDetachVolume)| +|[az networkcloud virtualmachine power-off](#VirtualMachinesPowerOff)|PowerOff|[Parameters](#ParametersVirtualMachinesPowerOff)|[Example](#ExamplesVirtualMachinesPowerOff)| +|[az networkcloud virtualmachine reimage](#VirtualMachinesReimage)|Reimage|[Parameters](#ParametersVirtualMachinesReimage)|[Example](#ExamplesVirtualMachinesReimage)| +|[az networkcloud virtualmachine restart](#VirtualMachinesRestart)|Restart|[Parameters](#ParametersVirtualMachinesRestart)|[Example](#ExamplesVirtualMachinesRestart)| +|[az networkcloud virtualmachine start](#VirtualMachinesStart)|Start|[Parameters](#ParametersVirtualMachinesStart)|[Example](#ExamplesVirtualMachinesStart)| + +### Commands in `az networkcloud volume` group +|CLI Command|Operation Swagger name|Parameters|Examples| +|---------|------------|--------|-----------| +|[az networkcloud volume list](#VolumesListByResourceGroup)|ListByResourceGroup|[Parameters](#ParametersVolumesListByResourceGroup)|[Example](#ExamplesVolumesListByResourceGroup)| +|[az networkcloud volume list](#VolumesListBySubscription)|ListBySubscription|[Parameters](#ParametersVolumesListBySubscription)|[Example](#ExamplesVolumesListBySubscription)| +|[az networkcloud volume show](#VolumesGet)|Get|[Parameters](#ParametersVolumesGet)|[Example](#ExamplesVolumesGet)| +|[az networkcloud volume create](#VolumesCreateOrUpdate#Create)|CreateOrUpdate#Create|[Parameters](#ParametersVolumesCreateOrUpdate#Create)|[Example](#ExamplesVolumesCreateOrUpdate#Create)| +|[az networkcloud volume update](#VolumesUpdate)|Update|[Parameters](#ParametersVolumesUpdate)|[Example](#ExamplesVolumesUpdate)| +|[az networkcloud volume delete](#VolumesDelete)|Delete|[Parameters](#ParametersVolumesDelete)|[Example](#ExamplesVolumesDelete)| + + +## COMMAND DETAILS +### group `az networkcloud baremetalmachine` +#### Command `az networkcloud baremetalmachine list` + +##### Example +``` +az networkcloud baremetalmachine list --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| + +#### Command `az networkcloud baremetalmachine list` + +##### Example +``` +az networkcloud baremetalmachine list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| + +#### Command `az networkcloud baremetalmachine show` + +##### Example +``` +az networkcloud baremetalmachine show --name "bareMetalMachineName" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--bare-metal-machine-name**|string|The name of the bare metal machine.|bare_metal_machine_name|bareMetalMachineName| + +#### Command `az networkcloud baremetalmachine create` + +##### Example +``` +az networkcloud baremetalmachine create --name "bareMetalMachineName" --extended-location \ +name="/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocatio\ +ns/clusterExtendedLocationName" type="CustomLocation" --location "location" --bmc-connection-string \ +"bmcconnectionstring" --bmc-credentials password="{password}" username="bmcuser" --bmc-mac-address "00:00:4f:00:57:00" \ +--boot-mac-address "00:00:4e:00:58:af" --machine-details "User-provided machine details." --machine-name "r01c001" \ +--machine-sku-id "684E-3B16-399E" --rack-id "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/M\ +icrosoft.NetworkCloud/racks/rackName" --rack-slot 1 --serial-number "BM1219XXX" --tags key1="myvalue1" key2="myvalue2" \ +--resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--bare-metal-machine-name**|string|The name of the bare metal machine.|bare_metal_machine_name|bareMetalMachineName| +|**--location**|string|The geo-location where the resource lives|location|location| +|**--extended-location**|object|The extended location of the cluster associated with the resource.|extended_location|extendedLocation| +|**--bmc-connection-string**|string|The connection string for the baseboard management controller including IP address and protocol.|bmc_connection_string|bmcConnectionString| +|**--bmc-credentials**|object|The credentials of the baseboard management controller on this bare metal machine.|bmc_credentials|bmcCredentials| +|**--bmc-mac-address**|string|The MAC address of the BMC device.|bmc_mac_address|bmcMacAddress| +|**--boot-mac-address**|string|The MAC address of a NIC connected to the PXE network.|boot_mac_address|bootMacAddress| +|**--machine-details**|string|The custom details provided by the customer.|machine_details|machineDetails| +|**--machine-name**|string|The OS-level hostname assigned to this machine.|machine_name|machineName| +|**--machine-sku-id**|string|The unique internal identifier of the bare metal machine SKU.|machine_sku_id|machineSkuId| +|**--rack-id**|string|The resource ID of the rack where this bare metal machine resides.|rack_id|rackId| +|**--rack-slot**|integer|The rack slot in which this bare metal machine is located, ordered from the bottom up i.e. the lowest slot is 1.|rack_slot|rackSlot| +|**--serial-number**|string|The serial number of the bare metal machine.|serial_number|serialNumber| +|**--tags**|dictionary|Resource tags.|tags|tags| + +#### Command `az networkcloud baremetalmachine update` + +##### Example +``` +az networkcloud baremetalmachine update --name "bareMetalMachineName" --machine-details "machinedetails" --tags \ +key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--bare-metal-machine-name**|string|The name of the bare metal machine.|bare_metal_machine_name|bareMetalMachineName| +|**--tags**|dictionary|The Azure resource tags that will replace the existing ones.|tags|tags| +|**--machine-details**|string|The details provided by the customer during the creation of rack manifests that allows for custom data to be associated with this machine.|machine_details|machineDetails| + +#### Command `az networkcloud baremetalmachine delete` + +##### Example +``` +az networkcloud baremetalmachine delete --name "bareMetalMachineName" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--bare-metal-machine-name**|string|The name of the bare metal machine.|bare_metal_machine_name|bareMetalMachineName| + +#### Command `az networkcloud baremetalmachine cordon` + +##### Example +``` +az networkcloud baremetalmachine cordon --evacuate "True" --name "bareMetalMachineName" --resource-group \ +"resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--bare-metal-machine-name**|string|The name of the bare metal machine.|bare_metal_machine_name|bareMetalMachineName| +|**--evacuate**|choice|The indicator of whether to evacuate the node workload when the bare metal machine is cordoned.|evacuate|evacuate| + +#### Command `az networkcloud baremetalmachine power-off` + +##### Example +``` +az networkcloud baremetalmachine power-off --name "bareMetalMachineName" --skip-shutdown "True" --resource-group \ +"resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--bare-metal-machine-name**|string|The name of the bare metal machine.|bare_metal_machine_name|bareMetalMachineName| +|**--skip-shutdown**|choice|The indicator of whether to skip the graceful OS shutdown and power off the bare metal machine immediately.|skip_shutdown|skipShutdown| + +#### Command `az networkcloud baremetalmachine reimage` + +##### Example +``` +az networkcloud baremetalmachine reimage --name "bareMetalMachineName" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--bare-metal-machine-name**|string|The name of the bare metal machine.|bare_metal_machine_name|bareMetalMachineName| + +#### Command `az networkcloud baremetalmachine replace` + +##### Example +``` +az networkcloud baremetalmachine replace --name "bareMetalMachineName" --bmc-credentials password="{password}" \ +username="bmcuser" --bmc-mac-address "00:00:4f:00:57:ad" --boot-mac-address "00:00:4e:00:58:af" --machine-name "name" \ +--serial-number "BM1219XXX" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--bare-metal-machine-name**|string|The name of the bare metal machine.|bare_metal_machine_name|bareMetalMachineName| +|**--bmc-credentials**|object|The credentials of the baseboard management controller on this bare metal machine.|bmc_credentials|bmcCredentials| +|**--bmc-mac-address**|string|The MAC address of the BMC device.|bmc_mac_address|bmcMacAddress| +|**--boot-mac-address**|string|The MAC address of a NIC connected to the PXE network.|boot_mac_address|bootMacAddress| +|**--machine-name**|string|The OS-level hostname assigned to this machine.|machine_name|machineName| +|**--serial-number**|string|The serial number of the bare metal machine.|serial_number|serialNumber| + +#### Command `az networkcloud baremetalmachine restart` + +##### Example +``` +az networkcloud baremetalmachine restart --name "bareMetalMachineName" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--bare-metal-machine-name**|string|The name of the bare metal machine.|bare_metal_machine_name|bareMetalMachineName| + +#### Command `az networkcloud baremetalmachine run-command` + +##### Example +``` +az networkcloud baremetalmachine run-command --name "bareMetalMachineName" --arguments "--argument1" "argument2" \ +--limit-time-seconds 60 --script "cHdkCg==" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--bare-metal-machine-name**|string|The name of the bare metal machine.|bare_metal_machine_name|bareMetalMachineName| +|**--limit-time-seconds**|integer|The maximum time the script is allowed to run. If the execution time exceeds the maximum, the script will be stopped, any output produced until then will be captured, and the exit code matching a timeout will be returned (252).|limit_time_seconds|limitTimeSeconds| +|**--script**|string|The base64 encoded script to execute on the bare metal machine.|script|script| +|**--arguments**|array|The list of string arguments that will be passed to the script in order as separate arguments.|arguments|arguments| + +#### Command `az networkcloud baremetalmachine run-data-extract` + +##### Example +``` +az networkcloud baremetalmachine run-data-extract --name "bareMetalMachineName" --limit-time-seconds 60 --commands \ +command="networkInfo" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--bare-metal-machine-name**|string|The name of the bare metal machine.|bare_metal_machine_name|bareMetalMachineName| +|**--commands**|array|The list of curated data extraction commands to be executed directly against the target machine.|commands|commands| +|**--limit-time-seconds**|integer|The maximum time the commands are allowed to run. If the execution time exceeds the maximum, the script will be stopped, any output produced until then will be captured, and the exit code matching a timeout will be returned (252).|limit_time_seconds|limitTimeSeconds| + +#### Command `az networkcloud baremetalmachine run-read-command` + +##### Example +``` +az networkcloud baremetalmachine run-read-command --name "bareMetalMachineName" --limit-time-seconds 60 --commands \ +arguments="pods" arguments="-A" command="kubectl get" --commands arguments="192.168.0.99" arguments="-c" arguments="3" \ +command="ping" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--bare-metal-machine-name**|string|The name of the bare metal machine.|bare_metal_machine_name|bareMetalMachineName| +|**--commands**|array|The list of read-only commands to be executed directly against the target machine.|commands|commands| +|**--limit-time-seconds**|integer|The maximum time the commands are allowed to run. If the execution time exceeds the maximum, the script will be stopped, any output produced until then will be captured, and the exit code matching a timeout will be returned (252).|limit_time_seconds|limitTimeSeconds| + +#### Command `az networkcloud baremetalmachine start` + +##### Example +``` +az networkcloud baremetalmachine start --name "bareMetalMachineName" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--bare-metal-machine-name**|string|The name of the bare metal machine.|bare_metal_machine_name|bareMetalMachineName| + +#### Command `az networkcloud baremetalmachine uncordon` + +##### Example +``` +az networkcloud baremetalmachine uncordon --name "bareMetalMachineName" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--bare-metal-machine-name**|string|The name of the bare metal machine.|bare_metal_machine_name|bareMetalMachineName| + +#### Command `az networkcloud baremetalmachine validate-hardware` + +##### Example +``` +az networkcloud baremetalmachine validate-hardware --name "bareMetalMachineName" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--bare-metal-machine-name**|string|The name of the bare metal machine.|bare_metal_machine_name|bareMetalMachineName| + +### group `az networkcloud baremetalmachinekeyset` +#### Command `az networkcloud baremetalmachinekeyset list` + +##### Example +``` +az networkcloud baremetalmachinekeyset list --cluster-name "clusterName" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the cluster.|cluster_name|clusterName| + +#### Command `az networkcloud baremetalmachinekeyset show` + +##### Example +``` +az networkcloud baremetalmachinekeyset show --name "bareMetalMachineKeySetName" --cluster-name "clusterName" \ +--resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the cluster.|cluster_name|clusterName| +|**--bare-metal-machine-key-set-name**|string|The name of the bare metal machine key set.|bare_metal_machine_key_set_name|bareMetalMachineKeySetName| + +#### Command `az networkcloud baremetalmachinekeyset create` + +##### Example +``` +az networkcloud baremetalmachinekeyset create --name "bareMetalMachineKeySetName" --extended-location \ +name="/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocatio\ +ns/clusterExtendedLocationName" type="CustomLocation" --location "location" --azure-group-id \ +"f110271b-XXXX-4163-9b99-214d91660f0e" --expiration "2022-12-31T23:59:59.008Z" --jump-hosts-allowed "192.0.2.1" \ +"192.0.2.5" --os-group-name "standardAccessGroup" --privilege-level "Standard" --user-list description="Needs access \ +for troubleshooting as a part of the support team" azure-user-name="userABC" key-data="ssh-rsa \ +AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeRqiFu1lawN\ +blZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXISTRnIDpcf5qytjs1Xo+yYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOKpzXnblrv9\ +d3q4c2tWmm/SyFqthaqd0= admin@vm" --user-list description="Needs access for troubleshooting as a part of the support \ +team" azure-user-name="userXYZ" key-data="ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEk\ +mnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeRqiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXISTRnIDpcf5qytjs\ +1Xo+yYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOKpzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm" --tags key1="myvalue1" \ +key2="myvalue2" --cluster-name "clusterName" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the cluster.|cluster_name|clusterName| +|**--bare-metal-machine-key-set-name**|string|The name of the bare metal machine key set.|bare_metal_machine_key_set_name|bareMetalMachineKeySetName| +|**--location**|string|The geo-location where the resource lives|location|location| +|**--extended-location**|object|The extended location of the cluster associated with the resource.|extended_location|extendedLocation| +|**--azure-group-id**|string|The object ID of Azure Active Directory group that all users in the list must be in for access to be granted. Users that are not in the group will not have access.|azure_group_id|azureGroupId| +|**--expiration**|date-time|The date and time after which the users in this key set will be removed from the bare metal machines.|expiration|expiration| +|**--jump-hosts-allowed**|array|The list of IP addresses of jump hosts with management network access from which a login will be allowed for the users.|jump_hosts_allowed|jumpHostsAllowed| +|**--privilege-level**|choice|The access level allowed for the users in this key set.|privilege_level|privilegeLevel| +|**--user-list**|array|The unique list of permitted users.|user_list|userList| +|**--tags**|dictionary|Resource tags.|tags|tags| +|**--os-group-name**|string|The name of the group that users will be assigned to on the operating system of the machines.|os_group_name|osGroupName| + +#### Command `az networkcloud baremetalmachinekeyset update` + +##### Example +``` +az networkcloud baremetalmachinekeyset update --name "bareMetalMachineKeySetName" --expiration \ +"2022-12-31T23:59:59.008Z" --jump-hosts-allowed "192.0.2.1" "192.0.2.5" --user-list description="Needs access for \ +troubleshooting as a part of the support team" azure-user-name="userABC" key-data="ssh-rsa \ +AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeRqiFu1lawN\ +blZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXISTRnIDpcf5qytjs1Xo+yYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOKpzXnblrv9\ +d3q4c2tWmm/SyFqthaqd0= admin@vm" --user-list description="Needs access for troubleshooting as a part of the support \ +team" azure-user-name="userXYZ" key-data="ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEk\ +mnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeRqiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXISTRnIDpcf5qytjs\ +1Xo+yYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOKpzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm" --tags key1="myvalue1" \ +key2="myvalue2" --cluster-name "clusterName" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the cluster.|cluster_name|clusterName| +|**--bare-metal-machine-key-set-name**|string|The name of the bare metal machine key set.|bare_metal_machine_key_set_name|bareMetalMachineKeySetName| +|**--tags**|dictionary|The Azure resource tags that will replace the existing ones.|tags|tags| +|**--expiration**|date-time|The date and time after which the users in this key set will be removed from the bare metal machines.|expiration|expiration| +|**--jump-hosts-allowed**|array|The list of IP addresses of jump hosts with management network access from which a login will be allowed for the users.|jump_hosts_allowed|jumpHostsAllowed| +|**--user-list**|array|The unique list of permitted users.|user_list|userList| + +#### Command `az networkcloud baremetalmachinekeyset delete` + +##### Example +``` +az networkcloud baremetalmachinekeyset delete --name "bareMetalMachineKeySetName" --cluster-name "clusterName" \ +--resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the cluster.|cluster_name|clusterName| +|**--bare-metal-machine-key-set-name**|string|The name of the bare metal machine key set.|bare_metal_machine_key_set_name|bareMetalMachineKeySetName| + +### group `az networkcloud bmckeyset` +#### Command `az networkcloud bmckeyset list` + +##### Example +``` +az networkcloud bmckeyset list --cluster-name "clusterName" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the cluster.|cluster_name|clusterName| + +#### Command `az networkcloud bmckeyset show` + +##### Example +``` +az networkcloud bmckeyset show --name "bmcKeySetName" --cluster-name "clusterName" --resource-group \ +"resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the cluster.|cluster_name|clusterName| +|**--bmc-key-set-name**|string|The name of the baseboard management controller key set.|bmc_key_set_name|bmcKeySetName| + +#### Command `az networkcloud bmckeyset create` + +##### Example +``` +az networkcloud bmckeyset create --name "bmcKeySetName" --extended-location name="/subscriptions/subscriptionId/resourc\ +eGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterExtendedLocationName" \ +type="CustomLocation" --location "location" --azure-group-id "f110271b-XXXX-4163-9b99-214d91660f0e" --expiration \ +"2022-12-31T23:59:59.008Z" --privilege-level "Administrator" --user-list description="Needs access for troubleshooting \ +as a part of the support team" azure-user-name="userABC" key-data="ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTII\ +B4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeRqiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUm\ +ug0daSsSXISTRnIDpcf5qytjs1Xo+yYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOKpzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm" \ +--user-list description="Needs access for troubleshooting as a part of the support team" azure-user-name="userXYZ" \ +key-data="ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8U\ +YWOd0IXeRqiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXISTRnIDpcf5qytjs1Xo+yYyJMvzLL59mhAyb3p/cD+Y3/s3W\ +hAx+l0XOKpzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm" --tags key1="myvalue1" key2="myvalue2" --cluster-name "clusterName" \ +--resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the cluster.|cluster_name|clusterName| +|**--bmc-key-set-name**|string|The name of the baseboard management controller key set.|bmc_key_set_name|bmcKeySetName| +|**--location**|string|The geo-location where the resource lives|location|location| +|**--extended-location**|object|The extended location of the cluster associated with the resource.|extended_location|extendedLocation| +|**--azure-group-id**|string|The object ID of Azure Active Directory group that all users in the list must be in for access to be granted. Users that are not in the group will not have access.|azure_group_id|azureGroupId| +|**--expiration**|date-time|The date and time after which the users in this key set will be removed from the baseboard management controllers.|expiration|expiration| +|**--privilege-level**|choice|The access level allowed for the users in this key set.|privilege_level|privilegeLevel| +|**--user-list**|array|The unique list of permitted users.|user_list|userList| +|**--tags**|dictionary|Resource tags.|tags|tags| + +#### Command `az networkcloud bmckeyset update` + +##### Example +``` +az networkcloud bmckeyset update --name "bmcKeySetName" --expiration "2022-12-31T23:59:59.008Z" --user-list \ +description="Needs access for troubleshooting as a part of the support team" azure-user-name="userABC" \ +key-data="ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8U\ +YWOd0IXeRqiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXISTRnIDpcf5qytjs1Xo+yYyJMvzLL59mhAyb3p/cD+Y3/s3W\ +hAx+l0XOKpzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm" --user-list description="Needs access for troubleshooting as a part \ +of the support team" azure-user-name="userXYZ" key-data="ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQU\ +ZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeRqiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXI\ +STRnIDpcf5qytjs1Xo+yYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOKpzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm" --tags \ +key1="myvalue1" key2="myvalue2" --cluster-name "clusterName" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the cluster.|cluster_name|clusterName| +|**--bmc-key-set-name**|string|The name of the baseboard management controller key set.|bmc_key_set_name|bmcKeySetName| +|**--tags**|dictionary|The Azure resource tags that will replace the existing ones.|tags|tags| +|**--expiration**|date-time|The date and time after which the users in this key set will be removed from the baseboard management controllers.|expiration|expiration| +|**--user-list**|array|The unique list of permitted users.|user_list|userList| + +#### Command `az networkcloud bmckeyset delete` + +##### Example +``` +az networkcloud bmckeyset delete --name "bmcKeySetName" --cluster-name "clusterName" --resource-group \ +"resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the cluster.|cluster_name|clusterName| +|**--bmc-key-set-name**|string|The name of the baseboard management controller key set.|bmc_key_set_name|bmcKeySetName| + +### group `az networkcloud cloudservicesnetwork` +#### Command `az networkcloud cloudservicesnetwork list` + +##### Example +``` +az networkcloud cloudservicesnetwork list --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| + +#### Command `az networkcloud cloudservicesnetwork list` + +##### Example +``` +az networkcloud cloudservicesnetwork list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| + +#### Command `az networkcloud cloudservicesnetwork show` + +##### Example +``` +az networkcloud cloudservicesnetwork show --name "cloudServicesNetworkName" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cloud-services-network-name**|string|The name of the cloud services network.|cloud_services_network_name|cloudServicesNetworkName| + +#### Command `az networkcloud cloudservicesnetwork create` + +##### Example +``` +az networkcloud cloudservicesnetwork create --name "cloudServicesNetworkName" --extended-location \ +name="/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocatio\ +ns/clusterExtendedLocationName" type="CustomLocation" --location "location" --additional-egress-endpoints \ +"[{\\"category\\":\\"azure-resource-management\\",\\"endpoints\\":[{\\"domainName\\":\\"https://storageaccountex.blob.c\ +ore.windows.net\\",\\"port\\":443}]}]" --enable-default-egress-endpoints "False" --tags key1="myvalue1" \ +key2="myvalue2" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cloud-services-network-name**|string|The name of the cloud services network.|cloud_services_network_name|cloudServicesNetworkName| +|**--location**|string|The geo-location where the resource lives|location|location| +|**--extended-location**|object|The extended location of the cluster associated with the resource.|extended_location|extendedLocation| +|**--tags**|dictionary|Resource tags.|tags|tags| +|**--additional-egress-endpoints**|array|The list of egress endpoints. This allows for connection from a Hybrid AKS cluster to the specified endpoint.|additional_egress_endpoints|additionalEgressEndpoints| +|**--enable-default-egress-endpoints**|choice|The indicator of whether the platform default endpoints are allowed for the egress traffic.|enable_default_egress_endpoints|enableDefaultEgressEndpoints| + +#### Command `az networkcloud cloudservicesnetwork update` + +##### Example +``` +az networkcloud cloudservicesnetwork update --name "cloudServicesNetworkName" --additional-egress-endpoints \ +"[{\\"category\\":\\"azure-resource-management\\",\\"endpoints\\":[{\\"domainName\\":\\"https://storageaccountex.blob.c\ +ore.windows.net\\",\\"port\\":443}]}]" --enable-default-egress-endpoints "False" --tags key1="myvalue1" \ +key2="myvalue2" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cloud-services-network-name**|string|The name of the cloud services network.|cloud_services_network_name|cloudServicesNetworkName| +|**--tags**|dictionary|The Azure resource tags that will replace the existing ones.|tags|tags| +|**--additional-egress-endpoints**|array|The list of egress endpoints. This allows for connection from a Hybrid AKS cluster to the specified endpoint.|additional_egress_endpoints|additionalEgressEndpoints| +|**--enable-default-egress-endpoints**|choice|The indicator of whether the platform default endpoints are allowed for the egress traffic.|enable_default_egress_endpoints|enableDefaultEgressEndpoints| + +#### Command `az networkcloud cloudservicesnetwork delete` + +##### Example +``` +az networkcloud cloudservicesnetwork delete --name "cloudServicesNetworkName" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cloud-services-network-name**|string|The name of the cloud services network.|cloud_services_network_name|cloudServicesNetworkName| + +### group `az networkcloud cluster` +#### Command `az networkcloud cluster list` + +##### Example +``` +az networkcloud cluster list --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| + +#### Command `az networkcloud cluster list` + +##### Example +``` +az networkcloud cluster list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| + +#### Command `az networkcloud cluster show` + +##### Example +``` +az networkcloud cluster show --name "clusterName" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the cluster.|cluster_name|clusterName| + +#### Command `az networkcloud cluster create` + +##### Example +``` +az networkcloud cluster create --name "clusterName" --extended-location name="/subscriptions/subscriptionId/resourceGro\ +ups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterManagerExtendedLocationName" \ +type="CustomLocation" --location "location" --bare-metal-machine-configuration-data "[{\\"bmcCredentials\\":{\\"passwor\ +d\\":\\"{password}\\",\\"username\\":\\"username\\"},\\"bmcMacAddress\\":\\"AA:BB:CC:DD:EE:FF\\",\\"bootMacAddress\\":\ +\\"00:BB:CC:DD:EE:FF\\",\\"machineDetails\\":\\"extraDetails\\",\\"machineName\\":\\"bmmName1\\",\\"rackSlot\\":1,\\"se\ +rialNumber\\":\\"BM1219XXX\\"},{\\"bmcCredentials\\":{\\"password\\":\\"{password}\\",\\"username\\":\\"username\\"},\\\ +"bmcMacAddress\\":\\"AA:BB:CC:DD:EE:00\\",\\"bootMacAddress\\":\\"00:BB:CC:DD:EE:00\\",\\"machineDetails\\":\\"extraDet\ +ails\\",\\"machineName\\":\\"bmmName2\\",\\"rackSlot\\":2,\\"serialNumber\\":\\"BM1219YYY\\"}]" --network-rack-id \ +"/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/networkRacks/n\ +etworkRackName" --rack-location "Foo Datacenter, Floor 3, Aisle 9, Rack 2" --rack-serial-number "AA1234" --rack-sku-id \ +"/subscriptions/subscriptionId/providers/Microsoft.NetworkCloud/rackSkus/rackSkuName" --storage-appliance-configuration\ +-data "[{\\"adminCredentials\\":{\\"password\\":\\"{password}\\",\\"username\\":\\"username\\"},\\"rackSlot\\":1,\\"ser\ +ialNumber\\":\\"BM1219XXX\\",\\"storageApplianceName\\":\\"vmName\\"}]" --analytics-workspace-id \ +"/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/microsoft.operationalInsights/workspaces/logA\ +nalyticsWorkspaceName" --cluster-location "Foo Street, 3rd Floor, row 9" --cluster-service-principal \ +application-id="12345678-1234-1234-1234-123456789012" password="{password}" principal-id="00000008-0004-0004-0004-00000\ +0000012" tenant-id="80000000-4000-4000-4000-120000000000" --cluster-type "SingleRack" --cluster-version "1.0.0" \ +--compute-deployment-threshold type="PercentSuccess" grouping="PerCluster" value=90 --compute-rack-definitions \ +"[{\\"bareMetalMachineConfigurationData\\":[{\\"bmcCredentials\\":{\\"password\\":\\"{password}\\",\\"username\\":\\"us\ +ername\\"},\\"bmcMacAddress\\":\\"AA:BB:CC:DD:EE:FF\\",\\"bootMacAddress\\":\\"00:BB:CC:DD:EE:FF\\",\\"machineDetails\\\ +":\\"extraDetails\\",\\"machineName\\":\\"bmmName1\\",\\"rackSlot\\":1,\\"serialNumber\\":\\"BM1219XXX\\"},{\\"bmcCrede\ +ntials\\":{\\"password\\":\\"{password}\\",\\"username\\":\\"username\\"},\\"bmcMacAddress\\":\\"AA:BB:CC:DD:EE:00\\",\ +\\"bootMacAddress\\":\\"00:BB:CC:DD:EE:00\\",\\"machineDetails\\":\\"extraDetails\\",\\"machineName\\":\\"bmmName2\\",\ +\\"rackSlot\\":2,\\"serialNumber\\":\\"BM1219YYY\\"}],\\"networkRackId\\":\\"/subscriptions/subscriptionId/resourceGrou\ +ps/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/networkRacks/networkRackName\\",\\"rackLocation\\":\\"Foo\ + Datacenter, Floor 3, Aisle 9, Rack 2\\",\\"rackSerialNumber\\":\\"AA1234\\",\\"rackSkuId\\":\\"/subscriptions/subscrip\ +tionId/providers/Microsoft.NetworkCloud/rackSkus/rackSkuName\\",\\"storageApplianceConfigurationData\\":[{\\"adminCrede\ +ntials\\":{\\"password\\":\\"{password}\\",\\"username\\":\\"username\\"},\\"rackSlot\\":1,\\"serialNumber\\":\\"BM1219\ +XXX\\",\\"storageApplianceName\\":\\"vmName\\"}]}]" --managed-resource-group-configuration name="my-managed-rg" \ +location="East US" --network-fabric-id "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Micros\ +oft.ManagedNetworkFabric/networkFabrics/fabricName" --tags key1="myvalue1" key2="myvalue2" --resource-group \ +"resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the cluster.|cluster_name|clusterName| +|**--location**|string|The geo-location where the resource lives|location|location| +|**--extended-location**|object|The extended location of the cluster manager associated with the cluster.|extended_location|extendedLocation| +|**--analytics-workspace-id**|string|The resource ID of the Log Analytics Workspace that will be used for storing relevant logs.|analytics_workspace_id|analyticsWorkspaceId| +|**--cluster-type**|choice|The type of rack configuration for the cluster.|cluster_type|clusterType| +|**--cluster-version**|string|The current runtime version of the cluster.|cluster_version|clusterVersion| +|**--network-fabric-id**|string|The resource ID of the Network Fabric associated with the cluster.|network_fabric_id|networkFabricId| +|**--network-rack-id**|string|The resource ID of the network rack that matches this rack definition.|network_rack_id|networkRackId| +|**--rack-serial-number**|string|The unique identifier for the rack within Network Cloud cluster. An alternate unique alphanumeric value other than a serial number may be provided if desired.|rack_serial_number|rackSerialNumber| +|**--rack-sku-id**|string|The resource ID of the sku for the rack being added.|rack_sku_id|rackSkuId| +|**--tags**|dictionary|Resource tags.|tags|tags| +|**--cluster-location**|string|The customer-provided location information to identify where the cluster resides.|cluster_location|clusterLocation| +|**--cluster-service-principal**|object|The service principal to be used by the cluster during Arc Appliance installation.|cluster_service_principal|clusterServicePrincipal| +|**--compute-deployment-threshold**|object|The validation threshold indicating the allowable failures of compute machines during environment validation and deployment.|compute_deployment_threshold|computeDeploymentThreshold| +|**--compute-rack-definitions**|array|The list of rack definitions for the compute racks in a multi-rack cluster, or an empty list in a single-rack cluster.|compute_rack_definitions|computeRackDefinitions| +|**--managed-resource-group-configuration**|object|The configuration of the managed resource group associated with the resource.|managed_resource_group_configuration|managedResourceGroupConfiguration| +|**--availability-zone**|string|The zone name used for this rack when created.|availability_zone|availabilityZone| +|**--bare-metal-machine-configuration-data**|array|The unordered list of bare metal machine configuration.|bare_metal_machine_configuration_data|bareMetalMachineConfigurationData| +|**--rack-location**|string|The free-form description of the rack's location.|rack_location|rackLocation| +|**--storage-appliance-configuration-data**|array|The list of storage appliance configuration data for this rack.|storage_appliance_configuration_data|storageApplianceConfigurationData| + +#### Command `az networkcloud cluster update` + +##### Example +``` +az networkcloud cluster update --name "clusterName" --bare-metal-machine-configuration-data \ +"[{\\"bmcCredentials\\":{\\"password\\":\\"{password}\\",\\"username\\":\\"username\\"},\\"bmcMacAddress\\":\\"AA:BB:CC\ +:DD:EE:FF\\",\\"bootMacAddress\\":\\"00:BB:CC:DD:EE:FF\\",\\"machineDetails\\":\\"extraDetails\\",\\"machineName\\":\\"\ +bmmName1\\",\\"rackSlot\\":1,\\"serialNumber\\":\\"BM1219XXX\\"},{\\"bmcCredentials\\":{\\"password\\":\\"{password}\\"\ +,\\"username\\":\\"username\\"},\\"bmcMacAddress\\":\\"AA:BB:CC:DD:EE:00\\",\\"bootMacAddress\\":\\"00:BB:CC:DD:EE:00\\\ +",\\"machineDetails\\":\\"extraDetails\\",\\"machineName\\":\\"bmmName2\\",\\"rackSlot\\":2,\\"serialNumber\\":\\"BM121\ +9YYY\\"}]" --network-rack-id "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.Manage\ +dNetworkFabric/networkRacks/networkRackName" --rack-location "Foo Datacenter, Floor 3, Aisle 9, Rack 2" \ +--rack-serial-number "newSerialNumber" --rack-sku-id "/subscriptions/subscriptionId/providers/Microsoft.NetworkCloud/ra\ +ckSkus/rackSkuName" --storage-appliance-configuration-data "[{\\"adminCredentials\\":{\\"password\\":\\"{password}\\",\ +\\"username\\":\\"username\\"},\\"rackSlot\\":1,\\"serialNumber\\":\\"BM1219XXX\\",\\"storageApplianceName\\":\\"vmName\ +\\"}]" --compute-deployment-threshold type="PercentSuccess" grouping="PerCluster" value=90 --tags key1="myvalue1" \ +key2="myvalue2" --resource-group "resourceGroupName" +az networkcloud cluster update --name "clusterName" --cluster-location "Foo Street, 3rd Floor, row 9" --tags \ +key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the cluster.|cluster_name|clusterName| +|**--tags**|dictionary|The Azure resource tags that will replace the existing ones.|tags|tags| +|**--cluster-location**|string|The customer-provided location information to identify where the cluster resides.|cluster_location|clusterLocation| +|**--cluster-service-principal**|object|The service principal to be used by the cluster during Arc Appliance installation.|cluster_service_principal|clusterServicePrincipal| +|**--compute-deployment-threshold**|object|The validation threshold indicating the allowable failures of compute machines during environment validation and deployment.|compute_deployment_threshold|computeDeploymentThreshold| +|**--compute-rack-definitions**|array|The list of rack definitions for the compute racks in a multi-rack cluster, or an empty list in a single-rack cluster.|compute_rack_definitions|computeRackDefinitions| +|**--availability-zone**|string|The zone name used for this rack when created.|availability_zone|availabilityZone| +|**--bare-metal-machine-configuration-data**|array|The unordered list of bare metal machine configuration.|bare_metal_machine_configuration_data|bareMetalMachineConfigurationData| +|**--network-rack-id**|string|The resource ID of the network rack that matches this rack definition.|network_rack_id|networkRackId| +|**--rack-location**|string|The free-form description of the rack's location.|rack_location|rackLocation| +|**--rack-serial-number**|string|The unique identifier for the rack within Network Cloud cluster. An alternate unique alphanumeric value other than a serial number may be provided if desired.|rack_serial_number|rackSerialNumber| +|**--rack-sku-id**|string|The resource ID of the sku for the rack being added.|rack_sku_id|rackSkuId| +|**--storage-appliance-configuration-data**|array|The list of storage appliance configuration data for this rack.|storage_appliance_configuration_data|storageApplianceConfigurationData| + +#### Command `az networkcloud cluster delete` + +##### Example +``` +az networkcloud cluster delete --name "clusterName" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the cluster.|cluster_name|clusterName| + +#### Command `az networkcloud cluster deploy` + +##### Example +``` +az networkcloud cluster deploy --name "clusterName" --resource-group "resourceGroupName" +az networkcloud cluster deploy --skip-validations-for-machines "bmmName1" --name "clusterName" --resource-group \ +"resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the cluster.|cluster_name|clusterName| +|**--skip-validations-for-machines**|array|The names of bare metal machines in the cluster that should be skipped during environment validation.|skip_validations_for_machines|skipValidationsForMachines| + +#### Command `az networkcloud cluster update-version` + +##### Example +``` +az networkcloud cluster update-version --name "clusterName" --target-cluster-version "2.0" --resource-group \ +"resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the cluster.|cluster_name|clusterName| +|**--target-cluster-version**|string|The version to be applied to the cluster during update.|target_cluster_version|targetClusterVersion| + +### group `az networkcloud clustermanager` +#### Command `az networkcloud clustermanager list` + +##### Example +``` +az networkcloud clustermanager list --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| + +#### Command `az networkcloud clustermanager list` + +##### Example +``` +az networkcloud clustermanager list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| + +#### Command `az networkcloud clustermanager show` + +##### Example +``` +az networkcloud clustermanager show --name "clusterManagerName" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-manager-name**|string|The name of the cluster manager.|cluster_manager_name|clusterManagerName| + +#### Command `az networkcloud clustermanager create` + +##### Example +``` +az networkcloud clustermanager create --name "clusterManagerName" --location "location" --analytics-workspace-id \ +"/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/microsoft.operationalInsights/workspaces/logA\ +nalyticsWorkspaceName" --fabric-controller-id "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers\ +/Microsoft.ManagedNetworkFabric/networkFabricControllers/fabricControllerName" --managed-resource-group-configuration \ +name="my-managed-rg" location="East US" --tags key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-manager-name**|string|The name of the cluster manager.|cluster_manager_name|clusterManagerName| +|**--location**|string|The geo-location where the resource lives|location|location| +|**--fabric-controller-id**|string|The resource ID of the fabric controller that has one to one mapping with the cluster manager.|fabric_controller_id|fabricControllerId| +|**--tags**|dictionary|Resource tags.|tags|tags| +|**--analytics-workspace-id**|string|The resource ID of the Log Analytics workspace that is used for the logs collection.|analytics_workspace_id|analyticsWorkspaceId| +|**--availability-zones**|array|Field deprecated, this value will no longer influence the cluster manager allocation process and will be removed in a future version. The Azure availability zones within the region that will be used to support the cluster manager resource.|availability_zones|availabilityZones| +|**--managed-resource-group-configuration**|object|The configuration of the managed resource group associated with the resource.|managed_resource_group_configuration|managedResourceGroupConfiguration| +|**--vm-size**|string|Field deprecated, this value will no longer influence the cluster manager allocation process and will be removed in a future version. The size of the Azure virtual machines to use for hosting the cluster manager resource.|vm_size|vmSize| + +#### Command `az networkcloud clustermanager update` + +##### Example +``` +az networkcloud clustermanager update --name "clusterManagerName" --tags key1="myvalue1" key2="myvalue2" \ +--resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-manager-name**|string|The name of the cluster manager.|cluster_manager_name|clusterManagerName| +|**--tags**|dictionary|The Azure resource tags that will replace the existing ones.|tags|tags| + +#### Command `az networkcloud clustermanager delete` + +##### Example +``` +az networkcloud clustermanager delete --name "clusterManagerName" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-manager-name**|string|The name of the cluster manager.|cluster_manager_name|clusterManagerName| + +### group `az networkcloud console` +#### Command `az networkcloud console list` + +##### Example +``` +az networkcloud console list --resource-group "resourceGroupName" --virtual-machine-name "virtualMachineName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--virtual-machine-name**|string|The name of the virtual machine.|virtual_machine_name|virtualMachineName| + +#### Command `az networkcloud console show` + +##### Example +``` +az networkcloud console show --name "default" --resource-group "resourceGroupName" --virtual-machine-name \ +"virtualMachineName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--virtual-machine-name**|string|The name of the virtual machine.|virtual_machine_name|virtualMachineName| +|**--console-name**|string|The name of the virtual machine console.|console_name|consoleName| + +#### Command `az networkcloud console create` + +##### Example +``` +az networkcloud console create --name "default" --extended-location name="/subscriptions/subscriptionId/resourceGroups/\ +resourceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterManagerExtendedLocationName" \ +type="CustomLocation" --location "location" --enabled "True" --expiration "2022-06-01T01:27:03.008Z" --key-data \ +"ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeR\ +qiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXISTRnIDpcf5qytjs1Xo+yYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOK\ +pzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm" --tags key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" \ +--virtual-machine-name "virtualMachineName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--virtual-machine-name**|string|The name of the virtual machine.|virtual_machine_name|virtualMachineName| +|**--console-name**|string|The name of the virtual machine console.|console_name|consoleName| +|**--location**|string|The geo-location where the resource lives|location|location| +|**--extended-location**|object|The extended location of the cluster manager associated with the cluster this virtual machine is created on.|extended_location|extendedLocation| +|**--enabled**|choice|The indicator of whether the console access is enabled.|enabled|enabled| +|**--key-data**|string|The public ssh key of the user.|key_data|keyData| +|**--tags**|dictionary|Resource tags.|tags|tags| +|**--expiration**|date-time|The date and time after which the key will be disallowed access.|expiration|expiration| + +#### Command `az networkcloud console update` + +##### Example +``` +az networkcloud console update --name "default" --enabled "True" --expiration "2022-06-01T01:27:03.008Z" --key-data \ +"ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeR\ +qiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXISTRnIDpcf5qytjs1Xo+yYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOK\ +pzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm" --tags key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" \ +--virtual-machine-name "virtualMachineName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--virtual-machine-name**|string|The name of the virtual machine.|virtual_machine_name|virtualMachineName| +|**--console-name**|string|The name of the virtual machine console.|console_name|consoleName| +|**--tags**|dictionary|The Azure resource tags that will replace the existing ones.|tags|tags| +|**--enabled**|choice|The credentials used to login to the image repository that has access to the specified image.|enabled|enabled| +|**--expiration**|date-time|The date and time after which the key will be disallowed access.|expiration|expiration| +|**--key-data**|string|The public ssh key of the user.|key_data|keyData| + +#### Command `az networkcloud console delete` + +##### Example +``` +az networkcloud console delete --name "default" --resource-group "resourceGroupName" --virtual-machine-name \ +"virtualMachineName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--virtual-machine-name**|string|The name of the virtual machine.|virtual_machine_name|virtualMachineName| +|**--console-name**|string|The name of the virtual machine console.|console_name|consoleName| + +### group `az networkcloud defaultcninetwork` +#### Command `az networkcloud defaultcninetwork list` + +##### Example +``` +az networkcloud defaultcninetwork list --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| + +#### Command `az networkcloud defaultcninetwork list` + +##### Example +``` +az networkcloud defaultcninetwork list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| + +#### Command `az networkcloud defaultcninetwork show` + +##### Example +``` +az networkcloud defaultcninetwork show --name "defaultCniNetworkName" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--default-cni-network-name**|string|The name of the default CNI network.|default_cni_network_name|defaultCniNetworkName| + +#### Command `az networkcloud defaultcninetwork create` + +##### Example +``` +az networkcloud defaultcninetwork create --name "defaultCniNetworkName" --extended-location \ +name="/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocatio\ +ns/clusterExtendedLocationName" type="CustomLocation" --location "location" --bgp-peers as-number=64497 \ +peer-ip="203.0.113.254" --community-advertisements communities="64512:100" subnet-prefix="192.0.2.0/27" \ +--service-external-prefixes "192.0.2.0/28" --service-load-balancer-prefixes "192.0.2.16/28" --ip-allocation-type \ +"DualStack" --ipv4-connected-prefix "203.0.113.0/24" --ipv6-connected-prefix "2001:db8:0:3::/64" \ +--l3-isolation-domain-id "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNet\ +workFabric/l3IsolationDomains/l3IsolationDomainName" --vlan 12 --tags key1="myvalue1" key2="myvalue2" --resource-group \ +"resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--default-cni-network-name**|string|The name of the default CNI network.|default_cni_network_name|defaultCniNetworkName| +|**--location**|string|The geo-location where the resource lives|location|location| +|**--extended-location**|object|The extended location of the cluster associated with the resource.|extended_location|extendedLocation| +|**--l3-isolation-domain-id**|string|The resource ID of the Network Fabric l3IsolationDomain.|l3_isolation_domain_id|l3IsolationDomainId| +|**--vlan**|integer|The VLAN from the l3IsolationDomain that is used for this network.|vlan|vlan| +|**--tags**|dictionary|Resource tags.|tags|tags| +|**--ip-allocation-type**|choice|The type of the IP address allocation.|ip_allocation_type|ipAllocationType| +|**--ipv4-connected-prefix**|string|The IPV4 prefix (CIDR) assigned to this default CNI network. It is required when the IP allocation type is IPV4 or DualStack.|ipv4_connected_prefix|ipv4ConnectedPrefix| +|**--ipv6-connected-prefix**|string|The IPV6 prefix (CIDR) assigned to this default CNI network. It is required when the IP allocation type is IPV6 or DualStack.|ipv6_connected_prefix|ipv6ConnectedPrefix| +|**--bgp-peers**|array|The list of BgpPeer entities that the Hybrid AKS cluster will peer with in addition to peering that occurs automatically with the switch fabric.|bgp_peers|bgpPeers| +|**--community-advertisements**|array|The list of prefix community advertisement properties. Each prefix community specifies a prefix, and the communities that should be associated with that prefix when it is announced.|community_advertisements|communityAdvertisements| +|**--node-mesh-password**|string|The password of the Calico node mesh. It defaults to a randomly-generated string when not provided.|node_mesh_password|nodeMeshPassword| +|**--service-external-prefixes**|array|The subnet blocks in CIDR format for Kubernetes service external IPs to be advertised over BGP.|service_external_prefixes|serviceExternalPrefixes| +|**--service-load-balancer-prefixes**|array|The subnet blocks in CIDR format for Kubernetes load balancers. Load balancer IPs will only be advertised if they are within one of these blocks.|service_load_balancer_prefixes|serviceLoadBalancerPrefixes| + +#### Command `az networkcloud defaultcninetwork update` + +##### Example +``` +az networkcloud defaultcninetwork update --tags key1="myvalue1" key2="myvalue2" --name "defaultCniNetworkName" \ +--resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--default-cni-network-name**|string|The name of the default CNI network.|default_cni_network_name|defaultCniNetworkName| +|**--tags**|dictionary|The Azure resource tags that will replace the existing ones.|tags|tags| + +#### Command `az networkcloud defaultcninetwork delete` + +##### Example +``` +az networkcloud defaultcninetwork delete --name "defaultCniNetworkName" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--default-cni-network-name**|string|The name of the default CNI network.|default_cni_network_name|defaultCniNetworkName| + +### group `az networkcloud hybridakscluster` +#### Command `az networkcloud hybridakscluster list` + +##### Example +``` +az networkcloud hybridakscluster list --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| + +#### Command `az networkcloud hybridakscluster list` + +##### Example +``` +az networkcloud hybridakscluster list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| + +#### Command `az networkcloud hybridakscluster show` + +##### Example +``` +az networkcloud hybridakscluster show --name "hybridAksClusterName" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--hybrid-aks-cluster-name**|string|The name of the Hybrid AKS cluster.|hybrid_aks_cluster_name|hybridAksClusterName| + +#### Command `az networkcloud hybridakscluster create` + +##### Example +``` +az networkcloud hybridakscluster create --name "hybridAksClusterName" --extended-location \ +name="/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocatio\ +ns/clusterExtendedLocationName" type="CustomLocation" --location "location" --associated-network-ids \ +"/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/l3Networks/l3NetworkNa\ +me" --control-plane-count 4 --hybrid-aks-provisioned-cluster-id "/subscriptions/subscriptionId/resourceGroups/resourceG\ +roupName/providers/Microsoft.HybridContainerService/provisionedClusters/hybridAksClusterName" --worker-count 8 --tags \ +key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--hybrid-aks-cluster-name**|string|The name of the Hybrid AKS cluster.|hybrid_aks_cluster_name|hybridAksClusterName| +|**--location**|string|The geo-location where the resource lives|location|location| +|**--extended-location**|object|The extended location of the cluster associated with the resource.|extended_location|extendedLocation| +|**--associated-network-ids**|array|The list of resource IDs for the workload networks associated with the Hybrid AKS cluster. It can be any of l2Networks, l3Networks, or trunkedNetworks resources. This field will also contain one cloudServicesNetwork and one defaultCniNetwork.|associated_network_ids|associatedNetworkIds| +|**--control-plane-count**|integer|The number of control plane node VMs.|control_plane_count|controlPlaneCount| +|**--hybrid-aks-provisioned-cluster-id**|string|The resource ID of the Hybrid AKS cluster that this additional information is for.|hybrid_aks_provisioned_cluster_id|hybridAksProvisionedClusterId| +|**--worker-count**|integer|The number of worker node VMs.|worker_count|workerCount| +|**--tags**|dictionary|Resource tags.|tags|tags| + +#### Command `az networkcloud hybridakscluster update` + +##### Example +``` +az networkcloud hybridakscluster update --name "hybridAksClusterName" --tags key1="myvalue1" key2="myvalue2" \ +--resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--hybrid-aks-cluster-name**|string|The name of the Hybrid AKS cluster.|hybrid_aks_cluster_name|hybridAksClusterName| +|**--tags**|dictionary|The Azure resource tags that will replace the existing ones.|tags|tags| + +#### Command `az networkcloud hybridakscluster delete` + +##### Example +``` +az networkcloud hybridakscluster delete --name "hybridAksClusterName" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--hybrid-aks-cluster-name**|string|The name of the Hybrid AKS cluster.|hybrid_aks_cluster_name|hybridAksClusterName| + +#### Command `az networkcloud hybridakscluster restart-node` + +##### Example +``` +az networkcloud hybridakscluster restart-node --name "hybridAksClusterName" --node-name "nodeName" --resource-group \ +"resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--hybrid-aks-cluster-name**|string|The name of the Hybrid AKS cluster.|hybrid_aks_cluster_name|hybridAksClusterName| +|**--node-name**|string|The name of the node to restart.|node_name|nodeName| + +### group `az networkcloud l2network` +#### Command `az networkcloud l2network list` + +##### Example +``` +az networkcloud l2network list --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| + +#### Command `az networkcloud l2network list` + +##### Example +``` +az networkcloud l2network list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| + +#### Command `az networkcloud l2network show` + +##### Example +``` +az networkcloud l2network show --name "l2NetworkName" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--l2-network-name**|string|The name of the L2 network.|l2_network_name|l2NetworkName| + +#### Command `az networkcloud l2network create` + +##### Example +``` +az networkcloud l2network create --name "l2NetworkName" --extended-location name="/subscriptions/subscriptionId/resourc\ +eGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterExtendedLocationName" \ +type="CustomLocation" --location "location" --hybrid-aks-plugin-type "DPDK" --interface-name "eth0" \ +--l2-isolation-domain-id "/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNet\ +workFabric/l2IsolationDomains/l2IsolationDomainName" --tags key1="myvalue1" key2="myvalue2" --resource-group \ +"resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--l2-network-name**|string|The name of the L2 network.|l2_network_name|l2NetworkName| +|**--location**|string|The geo-location where the resource lives|location|location| +|**--extended-location**|object|The extended location of the cluster associated with the resource.|extended_location|extendedLocation| +|**--l2-isolation-domain-id**|string|The resource ID of the Network Fabric l2IsolationDomain.|l2_isolation_domain_id|l2IsolationDomainId| +|**--tags**|dictionary|Resource tags.|tags|tags| +|**--hybrid-aks-plugin-type**|choice|The network plugin type for Hybrid AKS.|hybrid_aks_plugin_type|hybridAksPluginType| +|**--interface-name**|string|The default interface name for this L2 network in the virtual machine. This name can be overridden by the name supplied in the network attachment configuration of that virtual machine.|interface_name|interfaceName| + +#### Command `az networkcloud l2network update` + +##### Example +``` +az networkcloud l2network update --name "l2NetworkName" --tags key1="myvalue1" key2="myvalue2" --resource-group \ +"resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--l2-network-name**|string|The name of the L2 network.|l2_network_name|l2NetworkName| +|**--tags**|dictionary|The Azure resource tags that will replace the existing ones.|tags|tags| + +#### Command `az networkcloud l2network delete` + +##### Example +``` +az networkcloud l2network delete --name "l2NetworkName" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--l2-network-name**|string|The name of the L2 network.|l2_network_name|l2NetworkName| + +### group `az networkcloud l3network` +#### Command `az networkcloud l3network list` + +##### Example +``` +az networkcloud l3network list --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| + +#### Command `az networkcloud l3network list` + +##### Example +``` +az networkcloud l3network list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| + +#### Command `az networkcloud l3network show` + +##### Example +``` +az networkcloud l3network show --name "l3NetworkName" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--l3-network-name**|string|The name of the L3 network.|l3_network_name|l3NetworkName| + +#### Command `az networkcloud l3network create` + +##### Example +``` +az networkcloud l3network create --name "l3NetworkName" --extended-location name="/subscriptions/subscriptionId/resourc\ +eGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterExtendedLocationName" \ +type="CustomLocation" --location "location" --hybrid-aks-ipam-enabled "True" --hybrid-aks-plugin-type "DPDK" \ +--interface-name "eth0" --ip-allocation-type "DualStack" --ipv4-connected-prefix "198.51.100.0/24" \ +--ipv6-connected-prefix "2001:db8::/64" --l3-isolation-domain-id "/subscriptions/subscriptionId/resourceGroups/resource\ +GroupName/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/l3IsolationDomainName" --vlan 12 --tags \ +key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--l3-network-name**|string|The name of the L3 network.|l3_network_name|l3NetworkName| +|**--location**|string|The geo-location where the resource lives|location|location| +|**--extended-location**|object|The extended location of the cluster associated with the resource.|extended_location|extendedLocation| +|**--l3-isolation-domain-id**|string|The resource ID of the Network Fabric l3IsolationDomain.|l3_isolation_domain_id|l3IsolationDomainId| +|**--vlan**|integer|The VLAN from the l3IsolationDomain that is used for this network.|vlan|vlan| +|**--tags**|dictionary|Resource tags.|tags|tags| +|**--hybrid-aks-ipam-enabled**|choice|The indicator of whether or not to disable IPAM allocation on the network attachment definition injected into the Hybrid AKS Cluster.|hybrid_aks_ipam_enabled|hybridAksIpamEnabled| +|**--hybrid-aks-plugin-type**|choice|The network plugin type for Hybrid AKS.|hybrid_aks_plugin_type|hybridAksPluginType| +|**--interface-name**|string|The default interface name for this L3 network in the virtual machine. This name can be overridden by the name supplied in the network attachment configuration of that virtual machine.|interface_name|interfaceName| +|**--ip-allocation-type**|choice|The type of the IP address allocation, defaulted to "DualStack".|ip_allocation_type|ipAllocationType| +|**--ipv4-connected-prefix**|string|The IPV4 prefix (CIDR) assigned to this L3 network. Required when the IP allocation type is IPV4 or DualStack.|ipv4_connected_prefix|ipv4ConnectedPrefix| +|**--ipv6-connected-prefix**|string|The IPV6 prefix (CIDR) assigned to this L3 network. Required when the IP allocation type is IPV6 or DualStack.|ipv6_connected_prefix|ipv6ConnectedPrefix| + +#### Command `az networkcloud l3network update` + +##### Example +``` +az networkcloud l3network update --name "l3NetworkName" --tags key1="myvalue1" key2="myvalue2" --resource-group \ +"resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--l3-network-name**|string|The name of the L3 network.|l3_network_name|l3NetworkName| +|**--tags**|dictionary|The Azure resource tags that will replace the existing ones.|tags|tags| + +#### Command `az networkcloud l3network delete` + +##### Example +``` +az networkcloud l3network delete --name "l3NetworkName" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--l3-network-name**|string|The name of the L3 network.|l3_network_name|l3NetworkName| + +### group `az networkcloud metricsconfiguration` +#### Command `az networkcloud metricsconfiguration list` + +##### Example +``` +az networkcloud metricsconfiguration list --cluster-name "clusterName" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the cluster.|cluster_name|clusterName| + +#### Command `az networkcloud metricsconfiguration show` + +##### Example +``` +az networkcloud metricsconfiguration show --cluster-name "clusterName" --name "default" --resource-group \ +"resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the cluster.|cluster_name|clusterName| +|**--metrics-configuration-name**|string|The name of the metrics configuration for the cluster.|metrics_configuration_name|metricsConfigurationName| + +#### Command `az networkcloud metricsconfiguration create` + +##### Example +``` +az networkcloud metricsconfiguration create --cluster-name "clusterName" --name "default" --extended-location \ +name="/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocatio\ +ns/clusterExtendedLocationName" type="CustomLocation" --location "location" --collection-interval 15 --enabled-metrics \ +"metric1" "metric2" --tags key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the cluster.|cluster_name|clusterName| +|**--metrics-configuration-name**|string|The name of the metrics configuration for the cluster.|metrics_configuration_name|metricsConfigurationName| +|**--location**|string|The geo-location where the resource lives|location|location| +|**--extended-location**|object|The extended location of the cluster associated with the resource.|extended_location|extendedLocation| +|**--collection-interval**|integer|The interval in minutes by which metrics will be collected.|collection_interval|collectionInterval| +|**--tags**|dictionary|Resource tags.|tags|tags| +|**--enabled-metrics**|array|The list of metric names that have been chosen to be enabled in addition to the core set of enabled metrics.|enabled_metrics|enabledMetrics| + +#### Command `az networkcloud metricsconfiguration update` + +##### Example +``` +az networkcloud metricsconfiguration update --cluster-name "clusterName" --name "default" --collection-interval 15 \ +--enabled-metrics "metric1" "metric2" --tags key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the cluster.|cluster_name|clusterName| +|**--metrics-configuration-name**|string|The name of the metrics configuration for the cluster.|metrics_configuration_name|metricsConfigurationName| +|**--tags**|dictionary|The Azure resource tags that will replace the existing ones.|tags|tags| +|**--collection-interval**|integer|The interval in minutes by which metrics will be collected.|collection_interval|collectionInterval| +|**--enabled-metrics**|array|The list of metric names that have been chosen to be enabled in addition to the core set of enabled metrics.|enabled_metrics|enabledMetrics| + +#### Command `az networkcloud metricsconfiguration delete` + +##### Example +``` +az networkcloud metricsconfiguration delete --cluster-name "clusterName" --name "default" --resource-group \ +"resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--cluster-name**|string|The name of the cluster.|cluster_name|clusterName| +|**--metrics-configuration-name**|string|The name of the metrics configuration for the cluster.|metrics_configuration_name|metricsConfigurationName| + +### group `az networkcloud rack` +#### Command `az networkcloud rack list` + +##### Example +``` +az networkcloud rack list --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| + +#### Command `az networkcloud rack list` + +##### Example +``` +az networkcloud rack list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| + +#### Command `az networkcloud rack show` + +##### Example +``` +az networkcloud rack show --name "rackName" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--rack-name**|string|The name of the rack.|rack_name|rackName| + +#### Command `az networkcloud rack create` + +##### Example +``` +az networkcloud rack create --name "rackName" --extended-location name="/subscriptions/subscriptionId/resourceGroups/re\ +sourceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterExtendedLocationName" \ +type="CustomLocation" --location "location" --availability-zone "1" --rack-location "Rack 28" --rack-serial-number \ +"RACK_SERIAL_NUMBER" --rack-sku-id "RACK-TYPE-1" --tags key1="myvalue1" key2="myvalue2" --resource-group \ +"resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--rack-name**|string|The name of the rack.|rack_name|rackName| +|**--location**|string|The geo-location where the resource lives|location|location| +|**--extended-location**|object|The extended location of the cluster associated with the resource.|extended_location|extendedLocation| +|**--availability-zone**|string|The value that will be used for machines in this rack to represent the availability zones that can be referenced by Hybrid AKS Clusters for node arrangement.|availability_zone|availabilityZone| +|**--rack-location**|string|The free-form description of the rack location. (e.g. “DTN Datacenter, Floor 3, Isle 9, Rack 2B”)|rack_location|rackLocation| +|**--rack-serial-number**|string|The unique identifier for the rack within Network Cloud cluster. An alternate unique alphanumeric value other than a serial number may be provided if desired.|rack_serial_number|rackSerialNumber| +|**--rack-sku-id**|string|The SKU for the rack.|rack_sku_id|rackSkuId| +|**--tags**|dictionary|Resource tags.|tags|tags| + +#### Command `az networkcloud rack update` + +##### Example +``` +az networkcloud rack update --name "rackName" --rack-location "Rack 2B" --rack-serial-number "RACK_SERIAL_NUMBER" \ +--tags key1="myvalue1" key2="myvalue2" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--rack-name**|string|The name of the rack.|rack_name|rackName| +|**--tags**|dictionary|The Azure resource tags that will replace the existing ones.|tags|tags| +|**--rack-location**|string|The free-form description of the rack location. (e.g. “DTN Datacenter, Floor 3, Isle 9, Rack 2B”)|rack_location|rackLocation| +|**--rack-serial-number**|string|The globally unique identifier for the rack.|rack_serial_number|rackSerialNumber| + +#### Command `az networkcloud rack delete` + +##### Example +``` +az networkcloud rack delete --name "rackName" --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--rack-name**|string|The name of the rack.|rack_name|rackName| + +### group `az networkcloud racksku` +#### Command `az networkcloud racksku list` + +##### Example +``` +az networkcloud racksku list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| + +#### Command `az networkcloud racksku show` + +##### Example +``` +az networkcloud racksku show --name "rackSkuName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--rack-sku-name**|string|The name of the rack SKU.|rack_sku_name|rackSkuName| + +### group `az networkcloud storageappliance` +#### Command `az networkcloud storageappliance list` + +##### Example +``` +az networkcloud storageappliance list --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| + +#### Command `az networkcloud storageappliance list` + +##### Example +``` +az networkcloud storageappliance list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| + +#### Command `az networkcloud storageappliance show` + +##### Example +``` +az networkcloud storageappliance show --resource-group "resourceGroupName" --name "storageApplianceName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-appliance-name**|string|The name of the storage appliance.|storage_appliance_name|storageApplianceName| + +#### Command `az networkcloud storageappliance create` + +##### Example +``` +az networkcloud storageappliance create --resource-group "resourceGroupName" --name "storageApplianceName" \ +--extended-location name="/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLo\ +cation/customLocations/clusterExtendedLocationName" type="CustomLocation" --location "location" \ +--administrator-credentials password="{password}" username="adminUser" --rack-id "/subscriptions/subscriptionId/resourc\ +eGroups/resourceGroupName/providers/Microsoft.NetworkCloud/racks/rackName" --rack-slot 1 --serial-number "BM1219XXX" \ +--storage-appliance-sku-id "684E-3B16-399E" --tags key1="myvalue1" key2="myvalue2" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-appliance-name**|string|The name of the storage appliance.|storage_appliance_name|storageApplianceName| +|**--location**|string|The geo-location where the resource lives|location|location| +|**--extended-location**|object|The extended location of the cluster associated with the resource.|extended_location|extendedLocation| +|**--administrator-credentials**|object|The credentials of the administrative interface on this storage appliance.|administrator_credentials|administratorCredentials| +|**--rack-id**|string|The resource ID of the rack where this storage appliance resides.|rack_id|rackId| +|**--rack-slot**|integer|The slot the storage appliance is in the rack based on the BOM configuration.|rack_slot|rackSlot| +|**--serial-number**|string|The serial number for the storage appliance.|serial_number|serialNumber| +|**--storage-appliance-sku-id**|string|The SKU for the storage appliance.|storage_appliance_sku_id|storageApplianceSkuId| +|**--tags**|dictionary|Resource tags.|tags|tags| + +#### Command `az networkcloud storageappliance update` + +##### Example +``` +az networkcloud storageappliance update --resource-group "resourceGroupName" --name "storageApplianceName" \ +--serial-number "BM1219XXX" --tags key1="myvalue1" key2="myvalue2" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-appliance-name**|string|The name of the storage appliance.|storage_appliance_name|storageApplianceName| +|**--tags**|dictionary|The Azure resource tags that will replace the existing ones.|tags|tags| +|**--serial-number**|string|The serial number for the storage appliance.|serial_number|serialNumber| + +#### Command `az networkcloud storageappliance delete` + +##### Example +``` +az networkcloud storageappliance delete --resource-group "resourceGroupName" --name "storageApplianceName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-appliance-name**|string|The name of the storage appliance.|storage_appliance_name|storageApplianceName| + +#### Command `az networkcloud storageappliance disable-remote-vendor-management` + +##### Example +``` +az networkcloud storageappliance disable-remote-vendor-management --resource-group "resourceGroupName" --name \ +"storageApplianceName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-appliance-name**|string|The name of the storage appliance.|storage_appliance_name|storageApplianceName| + +#### Command `az networkcloud storageappliance enable-remote-vendor-management` + +##### Example +``` +az networkcloud storageappliance enable-remote-vendor-management --resource-group "resourceGroupName" \ +--support-endpoints "10.0.0.0/24" --name "storageApplianceName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-appliance-name**|string|The name of the storage appliance.|storage_appliance_name|storageApplianceName| +|**--support-endpoints**|array|Field Deprecated. This field is not used and will be rejected if provided. The list of IPv4 subnets (in CIDR format), IPv6 subnets (in CIDR format), or hostnames that the storage appliance needs accessible in order to turn on the remote vendor management.|support_endpoints|supportEndpoints| + +#### Command `az networkcloud storageappliance run-read-command` + +##### Example +``` +az networkcloud storageappliance run-read-command --resource-group "resourceGroupName" --name "storageApplianceName" \ +--limit-time-seconds 60 --commands command="AlertList" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-appliance-name**|string|The name of the storage appliance.|storage_appliance_name|storageApplianceName| +|**--commands**|array|The list of read-only commands to run.|commands|commands| +|**--limit-time-seconds**|integer|The maximum time the commands are allowed to run. If the execution time exceeds the maximum, the script will be stopped, any output produced until then will be captured, and the exit code matching a timeout will be returned (252).|limit_time_seconds|limitTimeSeconds| + +#### Command `az networkcloud storageappliance validate-hardware` + +##### Example +``` +az networkcloud storageappliance validate-hardware --resource-group "resourceGroupName" --name "storageApplianceName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--storage-appliance-name**|string|The name of the storage appliance.|storage_appliance_name|storageApplianceName| + +### group `az networkcloud trunkednetwork` +#### Command `az networkcloud trunkednetwork list` + +##### Example +``` +az networkcloud trunkednetwork list --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| + +#### Command `az networkcloud trunkednetwork list` + +##### Example +``` +az networkcloud trunkednetwork list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| + +#### Command `az networkcloud trunkednetwork show` + +##### Example +``` +az networkcloud trunkednetwork show --resource-group "resourceGroupName" --name "trunkedNetworkName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--trunked-network-name**|string|The name of the trunked network.|trunked_network_name|trunkedNetworkName| + +#### Command `az networkcloud trunkednetwork create` + +##### Example +``` +az networkcloud trunkednetwork create --resource-group "resourceGroupName" --name "trunkedNetworkName" \ +--extended-location name="/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLo\ +cation/customLocations/clusterExtendedLocationName" type="CustomLocation" --location "location" \ +--hybrid-aks-plugin-type "DPDK" --interface-name "eth0" --isolation-domain-ids "/subscriptions/subscriptionId/resourceG\ +roups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/l2IsolationDomains/l2IsolationDomainName" \ +"/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ManagedNetworkFabric/l3IsolationDom\ +ains/l3IsolationDomainName" --vlans 12 14 --tags key1="myvalue1" key2="myvalue2" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--trunked-network-name**|string|The name of the trunked network.|trunked_network_name|trunkedNetworkName| +|**--location**|string|The geo-location where the resource lives|location|location| +|**--extended-location**|object|The extended location of the cluster associated with the resource.|extended_location|extendedLocation| +|**--isolation-domain-ids**|array|The list of resource IDs representing the Network Fabric isolation domains. It can be any combination of l2IsolationDomain and l3IsolationDomain resources.|isolation_domain_ids|isolationDomainIds| +|**--vlans**|array|The list of vlans that are selected from the isolation domains for trunking.|vlans|vlans| +|**--tags**|dictionary|Resource tags.|tags|tags| +|**--hybrid-aks-plugin-type**|choice|The network plugin type for Hybrid AKS.|hybrid_aks_plugin_type|hybridAksPluginType| +|**--interface-name**|string|The default interface name for this trunked network in the virtual machine. This name can be overridden by the name supplied in the network attachment configuration of that virtual machine.|interface_name|interfaceName| + +#### Command `az networkcloud trunkednetwork update` + +##### Example +``` +az networkcloud trunkednetwork update --resource-group "resourceGroupName" --name "trunkedNetworkName" --tags \ +key1="myvalue1" key2="myvalue2" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--trunked-network-name**|string|The name of the trunked network.|trunked_network_name|trunkedNetworkName| +|**--tags**|dictionary|The Azure resource tags that will replace the existing ones.|tags|tags| + +#### Command `az networkcloud trunkednetwork delete` + +##### Example +``` +az networkcloud trunkednetwork delete --resource-group "resourceGroupName" --name "trunkedNetworkName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--trunked-network-name**|string|The name of the trunked network.|trunked_network_name|trunkedNetworkName| + +### group `az networkcloud virtualmachine` +#### Command `az networkcloud virtualmachine list` + +##### Example +``` +az networkcloud virtualmachine list --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| + +#### Command `az networkcloud virtualmachine list` + +##### Example +``` +az networkcloud virtualmachine list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| + +#### Command `az networkcloud virtualmachine show` + +##### Example +``` +az networkcloud virtualmachine show --resource-group "resourceGroupName" --name "virtualMachineName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--virtual-machine-name**|string|The name of the virtual machine.|virtual_machine_name|virtualMachineName| + +#### Command `az networkcloud virtualmachine create` + +##### Example +``` +az networkcloud virtualmachine create --resource-group "resourceGroupName" --name "virtualMachineName" \ +--virtual-machine-parameters "{\\"extendedLocation\\":{\\"name\\":\\"/subscriptions/subscriptionId/resourceGroups/resou\ +rceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterExtendedLocationName\\",\\"type\\":\\"CustomLo\ +cation\\"},\\"location\\":\\"location\\",\\"tags\\":{\\"key1\\":\\"myvalue1\\",\\"key2\\":\\"myvalue2\\"},\\"adminUsern\ +ame\\":\\"username\\",\\"bootMethod\\":\\"UEFI\\",\\"cloudServicesNetworkAttachment\\":{\\"attachedNetworkId\\":\\"/sub\ +scriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/cloudServicesNetworks/cloud\ +ServicesNetworkName\\",\\"ipAllocationMethod\\":\\"Dynamic\\"},\\"cpuCores\\":2,\\"memorySizeGB\\":8,\\"networkAttachme\ +nts\\":[{\\"attachedNetworkId\\":\\"/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.\ +NetworkCloud/l3Networks/l3NetworkName\\",\\"defaultGateway\\":\\"True\\",\\"ipAllocationMethod\\":\\"Dynamic\\",\\"ipv4\ +Address\\":\\"198.51.100.1\\",\\"ipv6Address\\":\\"2001:0db8:0000:0000:0000:0000:0000:0000\\",\\"networkAttachmentName\ +\\":\\"netAttachName01\\"}],\\"networkData\\":\\"bmV0d29ya0RhdGVTYW1wbGU=\\",\\"placementHints\\":[{\\"hintType\\":\\"A\ +ffinity\\",\\"resourceId\\":\\"/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.Netwo\ +rkCloud/racks/rackName\\",\\"schedulingExecution\\":\\"Hard\\",\\"scope\\":\\"\\"}],\\"sshPublicKeys\\":[{\\"keyData\\"\ +:\\"ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0I\ +XeRqiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXISTRnIDpcf5qytjs1Xo+yYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0\ +XOKpzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm\\"}],\\"storageProfile\\":{\\"osDisk\\":{\\"createOption\\":\\"Ephemeral\\"\ +,\\"deleteOption\\":\\"Delete\\",\\"diskSizeGB\\":120},\\"volumeAttachments\\":[\\"/subscriptions/subscriptionId/resour\ +ceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/volumes/volumeName\\"]},\\"userData\\":\\"dXNlckRhdGVTYW1wb\ +GU=\\",\\"vmDeviceModel\\":\\"T2\\",\\"vmImage\\":\\"myacr.azurecr.io/foobar:latest\\",\\"vmImageRepositoryCredentials\ +\\":{\\"password\\":\\"{password}\\",\\"registryUrl\\":\\"myacr.azurecr.io\\",\\"username\\":\\"myuser\\"}}" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--virtual-machine-name**|string|The name of the virtual machine.|virtual_machine_name|virtualMachineName| +|**--virtual-machine-parameters**|object|The request body.|virtual_machine_parameters|virtualMachineParameters| + +#### Command `az networkcloud virtualmachine update` + +##### Example +``` +az networkcloud virtualmachine update --resource-group "resourceGroupName" --name "virtualMachineName" \ +--vm-image-repository-credentials password="{password}" registry-url="myacr.azurecr.io" username="myuser" --tags \ +key1="myvalue1" key2="myvalue2" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--virtual-machine-name**|string|The name of the virtual machine.|virtual_machine_name|virtualMachineName| +|**--tags**|dictionary|The Azure resource tags that will replace the existing ones.|tags|tags| +|**--vm-image-repository-credentials**|object|The credentials used to login to the image repository that has access to the specified image.|vm_image_repository_credentials|vmImageRepositoryCredentials| + +#### Command `az networkcloud virtualmachine delete` + +##### Example +``` +az networkcloud virtualmachine delete --resource-group "resourceGroupName" --name "virtualMachineName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--virtual-machine-name**|string|The name of the virtual machine.|virtual_machine_name|virtualMachineName| + +#### Command `az networkcloud virtualmachine attach-volume` + +##### Example +``` +az networkcloud virtualmachine attach-volume --resource-group "resourceGroupName" --volume-id \ +"/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/volumes/volumeName" \ +--name "virtualMachineName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--virtual-machine-name**|string|The name of the virtual machine.|virtual_machine_name|virtualMachineName| +|**--volume-id**|string|The resource ID of the volume.|volume_id|volumeId| + +#### Command `az networkcloud virtualmachine detach-volume` + +##### Example +``` +az networkcloud virtualmachine detach-volume --resource-group "resourceGroupName" --volume-id \ +"/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.NetworkCloud/volumes/volumeName" \ +--name "virtualMachineName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--virtual-machine-name**|string|The name of the virtual machine.|virtual_machine_name|virtualMachineName| +|**--volume-id**|string|The resource ID of the volume.|volume_id|volumeId| + +#### Command `az networkcloud virtualmachine power-off` + +##### Example +``` +az networkcloud virtualmachine power-off --resource-group "resourceGroupName" --name "virtualMachineName" \ +--skip-shutdown "True" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--virtual-machine-name**|string|The name of the virtual machine.|virtual_machine_name|virtualMachineName| +|**--skip-shutdown**|choice|The indicator of whether to skip the graceful OS shutdown and power off the virtual machine immediately.|skip_shutdown|skipShutdown| + +#### Command `az networkcloud virtualmachine reimage` + +##### Example +``` +az networkcloud virtualmachine reimage --resource-group "resourceGroupName" --name "virtualMachineName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--virtual-machine-name**|string|The name of the virtual machine.|virtual_machine_name|virtualMachineName| + +#### Command `az networkcloud virtualmachine restart` + +##### Example +``` +az networkcloud virtualmachine restart --resource-group "resourceGroupName" --name "virtualMachineName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--virtual-machine-name**|string|The name of the virtual machine.|virtual_machine_name|virtualMachineName| + +#### Command `az networkcloud virtualmachine start` + +##### Example +``` +az networkcloud virtualmachine start --resource-group "resourceGroupName" --name "virtualMachineName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--virtual-machine-name**|string|The name of the virtual machine.|virtual_machine_name|virtualMachineName| + +### group `az networkcloud volume` +#### Command `az networkcloud volume list` + +##### Example +``` +az networkcloud volume list --resource-group "resourceGroupName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| + +#### Command `az networkcloud volume list` + +##### Example +``` +az networkcloud volume list +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| + +#### Command `az networkcloud volume show` + +##### Example +``` +az networkcloud volume show --resource-group "resourceGroupName" --name "volumeName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--volume-name**|string|The name of the volume.|volume_name|volumeName| + +#### Command `az networkcloud volume create` + +##### Example +``` +az networkcloud volume create --resource-group "resourceGroupName" --name "volumeName" --extended-location \ +name="/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocatio\ +ns/clusterExtendedLocationName" type="CustomLocation" --location "location" --size-mi-b 10000 --tags key1="myvalue1" \ +key2="myvalue2" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--volume-name**|string|The name of the volume.|volume_name|volumeName| +|**--location**|string|The geo-location where the resource lives|location|location| +|**--extended-location**|object|The extended location of the cluster associated with the resource.|extended_location|extendedLocation| +|**--size-mi-b**|integer|The size of the allocation for this volume in Mebibytes.|size_mi_b|sizeMiB| +|**--tags**|dictionary|Resource tags.|tags|tags| + +#### Command `az networkcloud volume update` + +##### Example +``` +az networkcloud volume update --resource-group "resourceGroupName" --name "volumeName" --tags key1="myvalue1" \ +key2="myvalue2" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--volume-name**|string|The name of the volume.|volume_name|volumeName| +|**--tags**|dictionary|The Azure resource tags that will replace the existing ones.|tags|tags| + +#### Command `az networkcloud volume delete` + +##### Example +``` +az networkcloud volume delete --resource-group "resourceGroupName" --name "volumeName" +``` +##### Parameters +|Option|Type|Description|Path (SDK)|Swagger name| +|------|----|-----------|----------|------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name|resourceGroupName| +|**--volume-name**|string|The name of the volume.|volume_name|volumeName| diff --git a/src/networkcloud/setup.cfg b/src/networkcloud/setup.cfg new file mode 100644 index 00000000000..2fdd96e5d39 --- /dev/null +++ b/src/networkcloud/setup.cfg @@ -0,0 +1 @@ +#setup.cfg \ No newline at end of file diff --git a/src/networkcloud/setup.py b/src/networkcloud/setup.py new file mode 100644 index 00000000000..f6f9cf64c71 --- /dev/null +++ b/src/networkcloud/setup.py @@ -0,0 +1,49 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +from codecs import open +from setuptools import setup, find_packages + + +# HISTORY.rst entry. +VERSION = '0.3.0.0' + +# The full list of classifiers is available at +# https://pypi.python.org/pypi?%3Aaction=list_classifiers +CLASSIFIERS = [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Intended Audience :: System Administrators', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', +] + +DEPENDENCIES = [] + +with open('README.md', 'r', encoding='utf-8') as f: + README = f.read() +with open('HISTORY.rst', 'r', encoding='utf-8') as f: + HISTORY = f.read() + +setup( + name='networkcloud', + version=VERSION, + description='Support for Azure Operator Nexus network cloud commands based on 2022-12-12-preview API version.', + long_description=README + '\n\n' + HISTORY, + license='MIT', + author='Microsoft Corporation', + author_email='azpycli@microsoft.com', + url='https://github.com/Azure/azure-cli-extensions/tree/main/src/networkcloud', + classifiers=CLASSIFIERS, + packages=find_packages(exclude=["tests"]), + package_data={'azext_networkcloud': ['azext_metadata.json']}, + install_requires=DEPENDENCIES +) diff --git a/src/service_name.json b/src/service_name.json index fa2f9485e2d..ca567eb7c4a 100644 --- a/src/service_name.json +++ b/src/service_name.json @@ -389,6 +389,11 @@ "AzureServiceName": "Azure Network Bastion", "URL": "https://learn.microsoft.com/en-us/azure/bastion/" }, + { + "Command": "az networkcloud", + "AzureServiceName": "Azure Operator Nexus", + "URL": "https://learn.microsoft.com/en-us/azure/operator-nexus/" + }, { "Command": "az network-function", "AzureServiceName": "Azure Network Function",