Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
am-lim committed Aug 23, 2023
1 parent e8aefba commit 774c417
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@
class Show(AAZCommand):
"""Get an attached network connection configured for a dev center or project.
:example: Get dev center attached network connection
az devcenter admin attached-network show --name "{attachedNetworkConnectionName}" --dev-center-name "Contoso" --resource-group "rg1"
:example: Get a dev center attached network connection
az devcenter admin attached-network show --name" network-uswest3" --dev-center-name "Contoso" --resource-group "rg1"
:example: Get project attached network connection
az devcenter admin attached-network show --name "{attachedNetworkConnectionName}" --project-name "{projectName}" --resource-group "rg1"
:example: Get a project attached network connection
az devcenter admin attached-network show --name "network-uswest3" --project-name "ContosoProject" --resource-group "rg1"
"""

_aaz_info = {
"version": "2023-04-01",
"version": "2023-06-01-preview",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.devcenter/devcenters/{}/attachednetworks/{}", "2023-04-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.devcenter/projects/{}/attachednetworks/{}", "2023-04-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.devcenter/devcenters/{}/attachednetworks/{}", "2023-06-01-preview"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.devcenter/projects/{}/attachednetworks/{}", "2023-06-01-preview"],
]
}

Expand Down Expand Up @@ -144,7 +144,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2023-04-01",
"api-version", "2023-06-01-preview",
required=True,
),
}
Expand Down Expand Up @@ -288,7 +288,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2023-04-01",
"api-version", "2023-06-01-preview",
required=True,
),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@
"devcenter admin devbox-definition show",
)
class Show(AAZCommand):
"""Get a dev box definition
"""Get a dev box definition configured for a dev center or a project.
:example: Get dev center dev box definition
:example: Get a dev center dev box definition
az devcenter admin devbox-definition show --name "WebDevBox" --dev-center-name "Contoso" --resource-group "rg1"
:example: Get project dev box definition
:example: Get a project dev box definition
az devcenter admin devbox-definition show --name "WebDevBox" --project-name "ContosoProject" --resource-group "rg1"
"""

_aaz_info = {
"version": "2023-04-01",
"version": "2023-06-01-preview",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.devcenter/devcenters/{}/devboxdefinitions/{}", "2023-04-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.devcenter/projects/{}/devboxdefinitions/{}", "2023-04-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.devcenter/devcenters/{}/devboxdefinitions/{}", "2023-06-01-preview"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.devcenter/projects/{}/devboxdefinitions/{}", "2023-06-01-preview"],
]
}

Expand All @@ -48,9 +48,9 @@ def _build_arguments_schema(cls, *args, **kwargs):
# define Arg Group ""

_args_schema = cls._args_schema
_args_schema.dev_box_definition_name = AAZStrArg(
_args_schema.devbox_definition_name = AAZStrArg(
options=["-n", "--name", "--devbox-definition-name"],
help="The name of the Dev Box definition.",
help="The name of the dev box definition.",
required=True,
id_part="child_name_1",
)
Expand All @@ -72,8 +72,8 @@ def _build_arguments_schema(cls, *args, **kwargs):

def _execute_operations(self):
self.pre_operations()
condition_0 = has_value(self.ctx.args.dev_box_definition_name) and has_value(self.ctx.args.project_name) and has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id)
condition_1 = has_value(self.ctx.args.dev_box_definition_name) and has_value(self.ctx.args.dev_center_name) and has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id)
condition_0 = has_value(self.ctx.args.devbox_definition_name) and has_value(self.ctx.args.project_name) and has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id)
condition_1 = has_value(self.ctx.args.devbox_definition_name) and has_value(self.ctx.args.dev_center_name) and has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id)
if condition_1:
self.DevBoxDefinitionsGet(ctx=self.ctx)()
elif condition_0:
Expand Down Expand Up @@ -122,7 +122,7 @@ def error_format(self):
def url_parameters(self):
parameters = {
**self.serialize_url_param(
"devBoxDefinitionName", self.ctx.args.dev_box_definition_name,
"devBoxDefinitionName", self.ctx.args.devbox_definition_name,
required=True,
),
**self.serialize_url_param(
Expand All @@ -144,7 +144,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2023-04-01",
"api-version", "2023-06-01-preview",
required=True,
),
}
Expand Down Expand Up @@ -227,6 +227,13 @@ def _build_schema_on_200(cls):
properties.sku = AAZObjectType(
flags={"required": True},
)
properties.validation_error_details = AAZListType(
serialized_name="validationErrorDetails",
flags={"read_only": True},
)
properties.validation_status = AAZStrType(
serialized_name="validationStatus",
)

image_validation_error_details = cls._schema_on_200.properties.image_validation_error_details
image_validation_error_details.code = AAZStrType()
Expand All @@ -241,6 +248,13 @@ def _build_schema_on_200(cls):
sku.size = AAZStrType()
sku.tier = AAZStrType()

validation_error_details = cls._schema_on_200.properties.validation_error_details
validation_error_details.Element = AAZObjectType()

_element = cls._schema_on_200.properties.validation_error_details.Element
_element.code = AAZStrType()
_element.message = AAZStrType()

system_data = cls._schema_on_200.system_data
system_data.created_at = AAZStrType(
serialized_name="createdAt",
Expand Down Expand Up @@ -296,7 +310,7 @@ def error_format(self):
def url_parameters(self):
parameters = {
**self.serialize_url_param(
"devBoxDefinitionName", self.ctx.args.dev_box_definition_name,
"devBoxDefinitionName", self.ctx.args.devbox_definition_name,
required=True,
),
**self.serialize_url_param(
Expand All @@ -318,7 +332,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2023-04-01",
"api-version", "2023-06-01-preview",
required=True,
),
}
Expand Down Expand Up @@ -401,6 +415,13 @@ def _build_schema_on_200(cls):
properties.sku = AAZObjectType(
flags={"required": True},
)
properties.validation_error_details = AAZListType(
serialized_name="validationErrorDetails",
flags={"read_only": True},
)
properties.validation_status = AAZStrType(
serialized_name="validationStatus",
)

image_validation_error_details = cls._schema_on_200.properties.image_validation_error_details
image_validation_error_details.code = AAZStrType()
Expand All @@ -415,6 +436,13 @@ def _build_schema_on_200(cls):
sku.size = AAZStrType()
sku.tier = AAZStrType()

validation_error_details = cls._schema_on_200.properties.validation_error_details
validation_error_details.Element = AAZObjectType()

_element = cls._schema_on_200.properties.validation_error_details.Element
_element.code = AAZStrType()
_element.message = AAZStrType()

system_data = cls._schema_on_200.system_data
system_data.created_at = AAZStrType(
serialized_name="createdAt",
Expand Down
7 changes: 7 additions & 0 deletions src/devcenter/azext_devcenter/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@
AttachedNetworkShow,
AttachedNetworkWait,
CheckNameAvailabilityExecute,
CatalogConnect,
CatalogCreate,
CatalogDelete,
CatalogList,
CatalogShow,
CatalogSync,
CatalogUpdate,
CatalogWait,
CatalogDevBoxDefinitionList,
CatalogDevBoxDefinitionShow,
DevBoxDefinitionCreate,
DevBoxDefinitionDelete,
DevBoxDefinitionList,
Expand Down Expand Up @@ -91,6 +94,7 @@ def load_command_table(self, _):
"devcenter admin check-name-availability execute"
] = CheckNameAvailabilityExecute(loader=self)

self.command_table["devcenter admin catalog connect"] = CatalogConnect(loader=self)
self.command_table["devcenter admin catalog create"] = CatalogCreate(loader=self)
self.command_table["devcenter admin catalog delete"] = CatalogDelete(loader=self)
self.command_table["devcenter admin catalog list"] = CatalogList(loader=self)
Expand All @@ -99,6 +103,9 @@ def load_command_table(self, _):
self.command_table["devcenter admin catalog update"] = CatalogUpdate(loader=self)
self.command_table["devcenter admin catalog wait"] = CatalogWait(loader=self)

self.command_table["devcenter admin catalog-devbox-definition list"] = CatalogDevBoxDefinitionList(loader=self)
self.command_table["devcenter admin catalog-devbox-definition show"] = CatalogDevBoxDefinitionShow(loader=self)

self.command_table[
"devcenter admin devbox-definition create"
] = DevBoxDefinitionCreate(loader=self)
Expand Down
25 changes: 24 additions & 1 deletion src/devcenter/azext_devcenter/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
Wait as _AttachedNetworkWait,
)
from .aaz.latest.devcenter.admin.catalog import (
Connect as _CatalogConnect,
Create as _CatalogCreate,
Delete as _CatalogDelete,
List as _CatalogList,
Expand All @@ -26,6 +27,10 @@
Update as _CatalogUpdate,
Wait as _CatalogWait,
)
from .aaz.latest.devcenter.admin.catalog_devbox_definition import (
List as _CatalogDevBoxDefinitionList,
Show as _CatalogDevBoxDefinitionShow,
)
from .aaz.latest.devcenter.admin.check_name_availability import (
Execute as _CheckNameAvailabilityExecute,
)
Expand Down Expand Up @@ -165,6 +170,12 @@ def _build_arguments_schema(cls, *args, **kwargs):
return args_schema


class CatalogConnect(_CatalogConnect):
def _cli_arguments_loader(self):
args = super()._cli_arguments_loader()
return set_configured_defaults(args)


class CatalogCreate(_CatalogCreate):
def _cli_arguments_loader(self):
args = super()._cli_arguments_loader()
Expand Down Expand Up @@ -211,6 +222,18 @@ def _cli_arguments_loader(self):
return set_configured_defaults(args)


class CatalogDevBoxDefinitionList(_CatalogDevBoxDefinitionList):
def _cli_arguments_loader(self):
args = super()._cli_arguments_loader()
return set_configured_defaults(args)


class CatalogDevBoxDefinitionShow(_CatalogDevBoxDefinitionShow):
def _cli_arguments_loader(self):
args = super()._cli_arguments_loader()
return set_configured_defaults(args)


class DevBoxDefinitionCreate(_DevBoxDefinitionCreate):
@classmethod
def _build_arguments_schema(cls, *args, **kwargs):
Expand Down Expand Up @@ -371,7 +394,7 @@ class PoolCreate(_PoolCreate):
def _build_arguments_schema(cls, *args, **kwargs):
args_schema = super()._build_arguments_schema(*args, **kwargs)
args_schema.license_type._registered = False
args_schema.dev_box_definition_name._required = True
args_schema.devbox_definition_name._required = True
args_schema.local_administrator._required = True
args_schema.network_connection_name._required = True
return args_schema
Expand Down

0 comments on commit 774c417

Please sign in to comment.