Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 14 additions & 30 deletions src/azure-cli/azure/cli/command_modules/databoxedge/__init__.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,27 @@
# --------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

from azure.cli.core import AzCommandsLoader
from .generated._help import helps # pylint: disable=unused-import
try:
from .manual._help import helps # pylint: disable=reimported
except ImportError:
pass
from azure.cli.command_modules.databoxedge._help import helps # pylint: disable=unused-import
# from azure.cli.core.profiles import ResourceType # required when using python sdk


class DataBoxEdgeManagementClientCommandsLoader(AzCommandsLoader):
class DataboxedgeCommandsLoader(AzCommandsLoader):

def __init__(self, cli_ctx=None):
from azure.cli.core.commands import CliCommandType
from azure.cli.core.profiles import ResourceType
databoxedge_custom = CliCommandType(
custom_command_type = CliCommandType(
operations_tmpl='azure.cli.command_modules.databoxedge.custom#{}')
super().__init__(cli_ctx=cli_ctx, custom_command_type=databoxedge_custom,
resource_type=ResourceType.MGMT_DATABOXEDGE)
super().__init__(cli_ctx=cli_ctx,
# resource_type=ResourceType.XXX # required when using python sdk
custom_command_type=custom_command_type)

def load_command_table(self, args):
from .generated.commands import load_command_table
from azure.cli.command_modules.databoxedge.commands import load_command_table
from azure.cli.core.aaz import load_aaz_command_table
try:
from . import aaz
Expand All @@ -40,21 +34,11 @@ def load_command_table(self, args):
args=args
)
load_command_table(self, args)
try:
from .manual.commands import load_command_table as load_command_table_manual
load_command_table_manual(self, args)
except ImportError:
pass
return self.command_table

def load_arguments(self, command):
from .generated._params import load_arguments
from azure.cli.command_modules.databoxedge._params import load_arguments
load_arguments(self, command)
try:
from .manual._params import load_arguments as load_arguments_manual
load_arguments_manual(self, command)
except ImportError:
pass


COMMAND_LOADER_CLS = DataBoxEdgeManagementClientCommandsLoader
COMMAND_LOADER_CLS = DataboxedgeCommandsLoader
20 changes: 8 additions & 12 deletions src/azure-cli/azure/cli/command_modules/databoxedge/_help.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
# --------------------------------------------------------------------------
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

from .generated._help import helps # pylint: disable=unused-import
try:
from .manual._help import helps # pylint: disable=reimported
except ImportError:
pass
# pylint: disable=line-too-long
# pylint: disable=too-many-lines

from knack.help_files import helps # pylint: disable=unused-import
13 changes: 13 additions & 0 deletions src/azure-cli/azure/cli/command_modules/databoxedge/_params.py
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
#
# Code generated by aaz-dev-tools
# swagger change: https://github.com/Azure/azure-rest-api-specs/pull/32901
# --------------------------------------------------------------------------------------------

# pylint: skip-file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@
# flake8: noqa

from .__cmd_group import *
from ._list_node import *
from ._list_sku import *
from ._show_job import *
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
# --------------------------------------------------------------------------------------------
# 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(
"databoxedge list-node",
)
class ListNode(AAZCommand):
"""List all the nodes currently configured under this Data Box Edge device

:example: Get all the nodes currently configured under this Data Box Edge device.
az databoxedge list-node --device-name testedgedevice --resource-group GroupForEdgeAutomation
"""

_aaz_info = {
"version": "2021-02-01-preview",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.databoxedge/databoxedgedevices/{}/nodes", "2021-02-01-preview"],
]
}

AZ_SUPPORT_PAGINATION = True

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.device_name = AAZStrArg(
options=["-d", "--device-name"],
help="The device name.",
required=True,
)
_args_schema.resource_group = AAZResourceGroupNameArg(
required=True,
)
return cls._args_schema

def _execute_operations(self):
self.pre_operations()
self.NodesListByDataBoxEdgeDevice(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 NodesListByDataBoxEdgeDevice(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.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/nodes",
**self.url_parameters
)

@property
def method(self):
return "GET"

@property
def error_format(self):
return "ODataV4Format"

@property
def url_parameters(self):
parameters = {
**self.serialize_url_param(
"deviceName", self.ctx.args.device_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", "2021-02-01-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(
flags={"read_only": True},
)

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={"client_flatten": True, "read_only": True},
)
_element.type = AAZStrType(
flags={"read_only": True},
)

properties = cls._schema_on_200.value.Element.properties
properties.node_chassis_serial_number = AAZStrType(
serialized_name="nodeChassisSerialNumber",
flags={"read_only": True},
)
properties.node_display_name = AAZStrType(
serialized_name="nodeDisplayName",
flags={"read_only": True},
)
properties.node_friendly_software_version = AAZStrType(
serialized_name="nodeFriendlySoftwareVersion",
flags={"read_only": True},
)
properties.node_hcs_version = AAZStrType(
serialized_name="nodeHcsVersion",
flags={"read_only": True},
)
properties.node_instance_id = AAZStrType(
serialized_name="nodeInstanceId",
flags={"read_only": True},
)
properties.node_serial_number = AAZStrType(
serialized_name="nodeSerialNumber",
flags={"read_only": True},
)
properties.node_status = AAZStrType(
serialized_name="nodeStatus",
flags={"read_only": True},
)

return cls._schema_on_200


class _ListNodeHelper:
"""Helper class for ListNode"""


__all__ = ["ListNode"]
Loading
Loading