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
5 changes: 5 additions & 0 deletions src/databox/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

Release History
===============
1.2.0
++++++
* `az databox job create`: Add new parameters `--model` to support new generation of databox devices.
* `az databox available-skus`: Add new command to fetch list of available databox skus.
* `az databox job`: Add new subcommand `mitigate` to support customer intervention for databox jobs.

1.1.0
++++++
Expand Down
4 changes: 4 additions & 0 deletions src/databox/azext_databox/aaz/latest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------

# pylint: skip-file
# flake8: noqa

1 change: 1 addition & 0 deletions src/databox/azext_databox/aaz/latest/databox/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
# flake8: noqa

from .__cmd_group import *
from ._available_skus import *
323 changes: 323 additions & 0 deletions src/databox/azext_databox/aaz/latest/databox/_available_skus.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,323 @@
# --------------------------------------------------------------------------------------------
# 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(
"databox available-skus",
)
class AvailableSkus(AAZCommand):
"""This method provides the list of available skus for the given subscription, resource group and location.

:example: AvailableSkusPost
az databox available-skus --g YourResourceGroupName --country US --l westus --transfer-type ImportToAzure
"""

_aaz_info = {
"version": "2025-02-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.databox/locations/{}/availableskus", "2025-02-01"],
]
}

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.location = AAZResourceLocationArg(
required=True,
fmt=AAZResourceLocationArgFormat(
resource_group_arg="resource_group",
),
)
_args_schema.resource_group = AAZResourceGroupNameArg(
required=True,
)

# define Arg Group "AvailableSkuRequest"

_args_schema = cls._args_schema
_args_schema.country = AAZStrArg(
options=["--country"],
arg_group="AvailableSkuRequest",
help="ISO country code. Country for hardware shipment. For codes check: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements",
required=True,
)
_args_schema.sku_names = AAZListArg(
options=["--sku-names"],
arg_group="AvailableSkuRequest",
help="Sku Names to filter for available skus",
)
_args_schema.transfer_type = AAZStrArg(
options=["--transfer-type"],
arg_group="AvailableSkuRequest",
help="Type of the transfer.",
required=True,
enum={"ExportFromAzure": "ExportFromAzure", "ImportToAzure": "ImportToAzure"},
)

sku_names = cls._args_schema.sku_names
sku_names.Element = AAZStrArg(
enum={"DataBox": "DataBox", "DataBoxCustomerDisk": "DataBoxCustomerDisk", "DataBoxDisk": "DataBoxDisk", "DataBoxHeavy": "DataBoxHeavy"},
)
return cls._args_schema

def _execute_operations(self):
self.pre_operations()
self.ServiceListAvailableSkusByResourceGroup(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 ServiceListAvailableSkusByResourceGroup(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.DataBox/locations/{location}/availableSkus",
**self.url_parameters
)

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

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

@property
def url_parameters(self):
parameters = {
**self.serialize_url_param(
"location", self.ctx.args.location,
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", "2025-02-01",
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("country", AAZStrType, ".country", typ_kwargs={"flags": {"required": True}})
_builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}})
_builder.set_prop("skuNames", AAZListType, ".sku_names")
_builder.set_prop("transferType", AAZStrType, ".transfer_type", typ_kwargs={"flags": {"required": True}})

sku_names = _builder.get(".skuNames")
if sku_names is not None:
sku_names.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.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.enabled = AAZBoolType(
flags={"read_only": True},
)
_element.properties = AAZObjectType(
flags={"client_flatten": True, "read_only": True},
)
_element.sku = AAZObjectType(
flags={"read_only": True},
)

properties = cls._schema_on_200.value.Element.properties
properties.api_versions = AAZListType(
serialized_name="apiVersions",
flags={"read_only": True},
)
properties.capacity = AAZObjectType(
flags={"read_only": True},
)
properties.costs = AAZListType(
flags={"read_only": True},
)
properties.countries_within_commerce_boundary = AAZListType(
serialized_name="countriesWithinCommerceBoundary",
flags={"read_only": True},
)
properties.data_location_to_service_location_map = AAZListType(
serialized_name="dataLocationToServiceLocationMap",
flags={"read_only": True},
)
properties.disabled_reason = AAZStrType(
serialized_name="disabledReason",
flags={"read_only": True},
)
properties.disabled_reason_message = AAZStrType(
serialized_name="disabledReasonMessage",
flags={"read_only": True},
)
properties.required_feature = AAZStrType(
serialized_name="requiredFeature",
flags={"read_only": True},
)

api_versions = cls._schema_on_200.value.Element.properties.api_versions
api_versions.Element = AAZStrType()

capacity = cls._schema_on_200.value.Element.properties.capacity
capacity.individual_sku_usable = AAZStrType(
serialized_name="individualSkuUsable",
flags={"read_only": True},
)
capacity.maximum = AAZStrType(
flags={"read_only": True},
)
capacity.usable = AAZStrType(
flags={"read_only": True},
)

costs = cls._schema_on_200.value.Element.properties.costs
costs.Element = AAZObjectType()

_element = cls._schema_on_200.value.Element.properties.costs.Element
_element.meter_id = AAZStrType(
serialized_name="meterId",
flags={"read_only": True},
)
_element.meter_type = AAZStrType(
serialized_name="meterType",
flags={"read_only": True},
)
_element.multiplier = AAZFloatType(
flags={"read_only": True},
)

countries_within_commerce_boundary = cls._schema_on_200.value.Element.properties.countries_within_commerce_boundary
countries_within_commerce_boundary.Element = AAZStrType()

data_location_to_service_location_map = cls._schema_on_200.value.Element.properties.data_location_to_service_location_map
data_location_to_service_location_map.Element = AAZObjectType()

_element = cls._schema_on_200.value.Element.properties.data_location_to_service_location_map.Element
_element.data_location = AAZStrType(
serialized_name="dataLocation",
flags={"read_only": True},
)
_element.service_location = AAZStrType(
serialized_name="serviceLocation",
flags={"read_only": True},
)

sku = cls._schema_on_200.value.Element.sku
sku.display_name = AAZStrType(
serialized_name="displayName",
)
sku.family = AAZStrType()
sku.model = AAZStrType()
sku.name = AAZStrType(
flags={"required": True},
)

return cls._schema_on_200


class _AvailableSkusHelper:
"""Helper class for AvailableSkus"""


__all__ = ["AvailableSkus"]
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
from ._list import *
from ._list_credential import *
from ._mark_devices_shipped import *
from ._mitigate import *
from ._show import *
from ._update import *
11 changes: 7 additions & 4 deletions src/databox/azext_databox/aaz/latest/databox/job/_cancel.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ class Cancel(AAZCommand):

:example: Cancel job
az databox job cancel -g rg --job-name name --reason reason

:example: JobsCancelPost
az databox job cancel --resource-group YourResourceGroupName --job-name TestJobName1 --reason CancelTest
"""

_aaz_info = {
"version": "2022-12-01",
"version": "2025-02-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.databox/jobs/{}/cancel", "2022-12-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.databox/jobs/{}/cancel", "2025-02-01"],
]
}

Expand All @@ -51,7 +54,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
id_part="name",
fmt=AAZStrArgFormat(
pattern="^[-\w\.]+$",
pattern="^[-\\w\\.]+$",
max_length=24,
min_length=3,
),
Expand Down Expand Up @@ -132,7 +135,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2022-12-01",
"api-version", "2025-02-01",
required=True,
),
}
Expand Down
Loading
Loading