Skip to content

Commit 2d378ad

Browse files
authored
{Databoxedge} az databoxedge: Migrate to AAZ (#31839)
1 parent 70b6356 commit 2d378ad

58 files changed

Lines changed: 8602 additions & 1896 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,27 @@
1-
# --------------------------------------------------------------------------
1+
# --------------------------------------------------------------------------------------------
22
# Copyright (c) Microsoft Corporation. All rights reserved.
3-
# Licensed under the MIT License. See License.txt in the project root for
4-
# license information.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
54
#
6-
# Code generated by Microsoft (R) AutoRest Code Generator.
7-
# Changes may cause incorrect behavior and will be lost if the code is
8-
# regenerated.
9-
# --------------------------------------------------------------------------
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
107

118
from azure.cli.core import AzCommandsLoader
12-
from .generated._help import helps # pylint: disable=unused-import
13-
try:
14-
from .manual._help import helps # pylint: disable=reimported
15-
except ImportError:
16-
pass
9+
from azure.cli.command_modules.databoxedge._help import helps # pylint: disable=unused-import
10+
# from azure.cli.core.profiles import ResourceType # required when using python sdk
1711

1812

19-
class DataBoxEdgeManagementClientCommandsLoader(AzCommandsLoader):
13+
class DataboxedgeCommandsLoader(AzCommandsLoader):
2014

2115
def __init__(self, cli_ctx=None):
2216
from azure.cli.core.commands import CliCommandType
23-
from azure.cli.core.profiles import ResourceType
24-
databoxedge_custom = CliCommandType(
17+
custom_command_type = CliCommandType(
2518
operations_tmpl='azure.cli.command_modules.databoxedge.custom#{}')
26-
super().__init__(cli_ctx=cli_ctx, custom_command_type=databoxedge_custom,
27-
resource_type=ResourceType.MGMT_DATABOXEDGE)
19+
super().__init__(cli_ctx=cli_ctx,
20+
# resource_type=ResourceType.XXX # required when using python sdk
21+
custom_command_type=custom_command_type)
2822

2923
def load_command_table(self, args):
30-
from .generated.commands import load_command_table
24+
from azure.cli.command_modules.databoxedge.commands import load_command_table
3125
from azure.cli.core.aaz import load_aaz_command_table
3226
try:
3327
from . import aaz
@@ -40,21 +34,11 @@ def load_command_table(self, args):
4034
args=args
4135
)
4236
load_command_table(self, args)
43-
try:
44-
from .manual.commands import load_command_table as load_command_table_manual
45-
load_command_table_manual(self, args)
46-
except ImportError:
47-
pass
4837
return self.command_table
4938

5039
def load_arguments(self, command):
51-
from .generated._params import load_arguments
40+
from azure.cli.command_modules.databoxedge._params import load_arguments
5241
load_arguments(self, command)
53-
try:
54-
from .manual._params import load_arguments as load_arguments_manual
55-
load_arguments_manual(self, command)
56-
except ImportError:
57-
pass
5842

5943

60-
COMMAND_LOADER_CLS = DataBoxEdgeManagementClientCommandsLoader
44+
COMMAND_LOADER_CLS = DataboxedgeCommandsLoader
Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
# --------------------------------------------------------------------------
1+
# --------------------------------------------------------------------------------------------
22
# Copyright (c) Microsoft Corporation. All rights reserved.
3-
# Licensed under the MIT License. See License.txt in the project root for
4-
# license information.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
54
#
6-
# Code generated by Microsoft (R) AutoRest Code Generator.
7-
# Changes may cause incorrect behavior and will be lost if the code is
8-
# regenerated.
9-
# --------------------------------------------------------------------------
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
107

11-
from .generated._help import helps # pylint: disable=unused-import
12-
try:
13-
from .manual._help import helps # pylint: disable=reimported
14-
except ImportError:
15-
pass
8+
# pylint: disable=line-too-long
9+
# pylint: disable=too-many-lines
10+
11+
from knack.help_files import helps # pylint: disable=unused-import
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: disable=too-many-lines
9+
# pylint: disable=too-many-statements
10+
11+
12+
def load_arguments(self, _): # pylint: disable=unused-argument
13+
pass

src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/__cmd_group.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Licensed under the MIT License. See License.txt in the project root for license information.
44
#
55
# Code generated by aaz-dev-tools
6+
# swagger change: https://github.com/Azure/azure-rest-api-specs/pull/32901
67
# --------------------------------------------------------------------------------------------
78

89
# pylint: skip-file

src/azure-cli/azure/cli/command_modules/databoxedge/aaz/latest/databoxedge/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@
99
# flake8: noqa
1010

1111
from .__cmd_group import *
12+
from ._list_node import *
13+
from ._list_sku import *
14+
from ._show_job import *
Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
# --------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
#
5+
# Code generated by aaz-dev-tools
6+
# --------------------------------------------------------------------------------------------
7+
8+
# pylint: skip-file
9+
# flake8: noqa
10+
11+
from azure.cli.core.aaz import *
12+
13+
14+
@register_command(
15+
"databoxedge list-node",
16+
)
17+
class ListNode(AAZCommand):
18+
"""List all the nodes currently configured under this Data Box Edge device
19+
20+
:example: Get all the nodes currently configured under this Data Box Edge device.
21+
az databoxedge list-node --device-name testedgedevice --resource-group GroupForEdgeAutomation
22+
"""
23+
24+
_aaz_info = {
25+
"version": "2021-02-01-preview",
26+
"resources": [
27+
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.databoxedge/databoxedgedevices/{}/nodes", "2021-02-01-preview"],
28+
]
29+
}
30+
31+
AZ_SUPPORT_PAGINATION = True
32+
33+
def _handler(self, command_args):
34+
super()._handler(command_args)
35+
return self.build_paging(self._execute_operations, self._output)
36+
37+
_args_schema = None
38+
39+
@classmethod
40+
def _build_arguments_schema(cls, *args, **kwargs):
41+
if cls._args_schema is not None:
42+
return cls._args_schema
43+
cls._args_schema = super()._build_arguments_schema(*args, **kwargs)
44+
45+
# define Arg Group ""
46+
47+
_args_schema = cls._args_schema
48+
_args_schema.device_name = AAZStrArg(
49+
options=["-d", "--device-name"],
50+
help="The device name.",
51+
required=True,
52+
)
53+
_args_schema.resource_group = AAZResourceGroupNameArg(
54+
required=True,
55+
)
56+
return cls._args_schema
57+
58+
def _execute_operations(self):
59+
self.pre_operations()
60+
self.NodesListByDataBoxEdgeDevice(ctx=self.ctx)()
61+
self.post_operations()
62+
63+
@register_callback
64+
def pre_operations(self):
65+
pass
66+
67+
@register_callback
68+
def post_operations(self):
69+
pass
70+
71+
def _output(self, *args, **kwargs):
72+
result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True)
73+
next_link = self.deserialize_output(self.ctx.vars.instance.next_link)
74+
return result, next_link
75+
76+
class NodesListByDataBoxEdgeDevice(AAZHttpOperation):
77+
CLIENT_TYPE = "MgmtClient"
78+
79+
def __call__(self, *args, **kwargs):
80+
request = self.make_request()
81+
session = self.client.send_request(request=request, stream=False, **kwargs)
82+
if session.http_response.status_code in [200]:
83+
return self.on_200(session)
84+
85+
return self.on_error(session.http_response)
86+
87+
@property
88+
def url(self):
89+
return self.client.format_url(
90+
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/nodes",
91+
**self.url_parameters
92+
)
93+
94+
@property
95+
def method(self):
96+
return "GET"
97+
98+
@property
99+
def error_format(self):
100+
return "ODataV4Format"
101+
102+
@property
103+
def url_parameters(self):
104+
parameters = {
105+
**self.serialize_url_param(
106+
"deviceName", self.ctx.args.device_name,
107+
required=True,
108+
),
109+
**self.serialize_url_param(
110+
"resourceGroupName", self.ctx.args.resource_group,
111+
required=True,
112+
),
113+
**self.serialize_url_param(
114+
"subscriptionId", self.ctx.subscription_id,
115+
required=True,
116+
),
117+
}
118+
return parameters
119+
120+
@property
121+
def query_parameters(self):
122+
parameters = {
123+
**self.serialize_query_param(
124+
"api-version", "2021-02-01-preview",
125+
required=True,
126+
),
127+
}
128+
return parameters
129+
130+
@property
131+
def header_parameters(self):
132+
parameters = {
133+
**self.serialize_header_param(
134+
"Accept", "application/json",
135+
),
136+
}
137+
return parameters
138+
139+
def on_200(self, session):
140+
data = self.deserialize_http_content(session)
141+
self.ctx.set_var(
142+
"instance",
143+
data,
144+
schema_builder=self._build_schema_on_200
145+
)
146+
147+
_schema_on_200 = None
148+
149+
@classmethod
150+
def _build_schema_on_200(cls):
151+
if cls._schema_on_200 is not None:
152+
return cls._schema_on_200
153+
154+
cls._schema_on_200 = AAZObjectType()
155+
156+
_schema_on_200 = cls._schema_on_200
157+
_schema_on_200.next_link = AAZStrType(
158+
serialized_name="nextLink",
159+
)
160+
_schema_on_200.value = AAZListType(
161+
flags={"read_only": True},
162+
)
163+
164+
value = cls._schema_on_200.value
165+
value.Element = AAZObjectType()
166+
167+
_element = cls._schema_on_200.value.Element
168+
_element.id = AAZStrType(
169+
flags={"read_only": True},
170+
)
171+
_element.name = AAZStrType(
172+
flags={"read_only": True},
173+
)
174+
_element.properties = AAZObjectType(
175+
flags={"client_flatten": True, "read_only": True},
176+
)
177+
_element.type = AAZStrType(
178+
flags={"read_only": True},
179+
)
180+
181+
properties = cls._schema_on_200.value.Element.properties
182+
properties.node_chassis_serial_number = AAZStrType(
183+
serialized_name="nodeChassisSerialNumber",
184+
flags={"read_only": True},
185+
)
186+
properties.node_display_name = AAZStrType(
187+
serialized_name="nodeDisplayName",
188+
flags={"read_only": True},
189+
)
190+
properties.node_friendly_software_version = AAZStrType(
191+
serialized_name="nodeFriendlySoftwareVersion",
192+
flags={"read_only": True},
193+
)
194+
properties.node_hcs_version = AAZStrType(
195+
serialized_name="nodeHcsVersion",
196+
flags={"read_only": True},
197+
)
198+
properties.node_instance_id = AAZStrType(
199+
serialized_name="nodeInstanceId",
200+
flags={"read_only": True},
201+
)
202+
properties.node_serial_number = AAZStrType(
203+
serialized_name="nodeSerialNumber",
204+
flags={"read_only": True},
205+
)
206+
properties.node_status = AAZStrType(
207+
serialized_name="nodeStatus",
208+
flags={"read_only": True},
209+
)
210+
211+
return cls._schema_on_200
212+
213+
214+
class _ListNodeHelper:
215+
"""Helper class for ListNode"""
216+
217+
218+
__all__ = ["ListNode"]

0 commit comments

Comments
 (0)