Skip to content

Commit

Permalink
[dns-resolver] Add DNS resolver 2023-07-01-preview changes into azure…
Browse files Browse the repository at this point in the history
… cli extensions (#8289)

* Add DNS resolver 2023-07-01-preview changes into azure cli extensions

* Re-run test commands and switch to only one command group

* Change parameter names to be shorter

* Fix setup.py name
  • Loading branch information
jamesvoongms authored Nov 15, 2024
1 parent 25efefa commit 4ebc299
Show file tree
Hide file tree
Showing 88 changed files with 15,827 additions and 3,542 deletions.
4 changes: 4 additions & 0 deletions src/dns-resolver/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
Release History
===============
1.0.0
++++++
* Bump from 2022-07-01 to 2023-07-01-preview

0.2.0
++++++
* Bump from 2020-04-01-preview to 2022-07-01
Expand Down
4 changes: 4 additions & 0 deletions src/dns-resolver/azext_dnsresolver/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

Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class Create(AAZCommand):
"""

_aaz_info = {
"version": "2022-07-01",
"version": "2023-07-01-preview",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/dnsresolvers/{}", "2022-07-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/dnsresolvers/{}", "2023-07-01-preview"],
]
}

Expand Down Expand Up @@ -57,12 +57,16 @@ def _build_arguments_schema(cls, *args, **kwargs):
options=["-n", "--name", "--dns-resolver-name"],
help="The name of the DNS resolver.",
required=True,
id_part="name",
)
_args_schema.resource_group = AAZResourceGroupNameArg(
required=True,
)

# define Arg Group "Parameters"

_args_schema = cls._args_schema
_args_schema.location = AAZResourceLocationArg(
arg_group="Parameters",
help="Location. Values from: `az account list-locations`. You can configure the default location using `az configure --defaults location=<location>`.",
required=True,
fmt=AAZResourceLocationArgFormat(
Expand All @@ -71,6 +75,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
)
_args_schema.tags = AAZDictArg(
options=["--tags"],
arg_group="Parameters",
help="Space-separated tags: key[=value] [key[=value] ...].",
)

Expand All @@ -89,7 +94,17 @@ def _build_arguments_schema(cls, *args, **kwargs):
return cls._args_schema

def _execute_operations(self):
self.pre_operations()
yield self.DnsResolversCreateOrUpdate(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)
Expand Down Expand Up @@ -159,7 +174,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2022-07-01",
"api-version", "2023-07-01-preview",
required=True,
),
}
Expand Down Expand Up @@ -276,27 +291,21 @@ def _build_schema_on_200_201(cls):
system_data = cls._schema_on_200_201.system_data
system_data.created_at = AAZStrType(
serialized_name="createdAt",
flags={"read_only": True},
)
system_data.created_by = AAZStrType(
serialized_name="createdBy",
flags={"read_only": True},
)
system_data.created_by_type = AAZStrType(
serialized_name="createdByType",
flags={"read_only": True},
)
system_data.last_modified_at = AAZStrType(
serialized_name="lastModifiedAt",
flags={"read_only": True},
)
system_data.last_modified_by = AAZStrType(
serialized_name="lastModifiedBy",
flags={"read_only": True},
)
system_data.last_modified_by_type = AAZStrType(
serialized_name="lastModifiedByType",
flags={"read_only": True},
)

tags = cls._schema_on_200_201.tags
Expand All @@ -305,4 +314,8 @@ def _build_schema_on_200_201(cls):
return cls._schema_on_200_201


class _CreateHelper:
"""Helper class for Create"""


__all__ = ["Create"]
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class Delete(AAZCommand):
"""

_aaz_info = {
"version": "2022-07-01",
"version": "2023-07-01-preview",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/dnsresolvers/{}", "2022-07-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/dnsresolvers/{}", "2023-07-01-preview"],
]
}

Expand Down Expand Up @@ -62,7 +62,17 @@ def _build_arguments_schema(cls, *args, **kwargs):
return cls._args_schema

def _execute_operations(self):
self.pre_operations()
yield self.DnsResolversDelete(ctx=self.ctx)()
self.post_operations()

@register_callback
def pre_operations(self):
pass

@register_callback
def post_operations(self):
pass

class DnsResolversDelete(AAZHttpOperation):
CLIENT_TYPE = "MgmtClient"
Expand Down Expand Up @@ -137,7 +147,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2022-07-01",
"api-version", "2023-07-01-preview",
required=True,
),
}
Expand All @@ -159,4 +169,8 @@ def on_204(self, session):
pass


class _DeleteHelper:
"""Helper class for Delete"""


__all__ = ["Delete"]
62 changes: 33 additions & 29 deletions src/dns-resolver/azext_dnsresolver/aaz/latest/dns_resolver/_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ class List(AAZCommand):
"""

_aaz_info = {
"version": "2022-07-01",
"version": "2023-07-01-preview",
"resources": [
["mgmt-plane", "/subscriptions/{}/providers/microsoft.network/dnsresolvers", "2022-07-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/dnsresolvers", "2022-07-01"],
["mgmt-plane", "/subscriptions/{}/providers/microsoft.network/dnsresolvers", "2023-07-01-preview"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/dnsresolvers", "2023-07-01-preview"],
]
}

AZ_SUPPORT_PAGINATION = True

def _handler(self, command_args):
super()._handler(command_args)
return self.build_paging(self._execute_operations, self._output)
Expand All @@ -58,19 +60,29 @@ def _build_arguments_schema(cls, *args, **kwargs):
return cls._args_schema

def _execute_operations(self):
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
self.pre_operations()
condition_0 = has_value(self.ctx.subscription_id) and has_value(self.ctx.args.resource_group) is not True
condition_1 = has_value(self.ctx.args.resource_group) and has_value(self.ctx.subscription_id)
if condition_0:
self.DnsResolversListByResourceGroup(ctx=self.ctx)()
if condition_1:
self.DnsResolversList(ctx=self.ctx)()
if condition_1:
self.DnsResolversListByResourceGroup(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 DnsResolversListByResourceGroup(AAZHttpOperation):
class DnsResolversList(AAZHttpOperation):
CLIENT_TYPE = "MgmtClient"

def __call__(self, *args, **kwargs):
Expand All @@ -84,7 +96,7 @@ def __call__(self, *args, **kwargs):
@property
def url(self):
return self.client.format_url(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers",
"/subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsResolvers",
**self.url_parameters
)

Expand All @@ -99,10 +111,6 @@ def error_format(self):
@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,
Expand All @@ -117,7 +125,7 @@ def query_parameters(self):
"$top", self.ctx.args.top,
),
**self.serialize_query_param(
"api-version", "2022-07-01",
"api-version", "2023-07-01-preview",
required=True,
),
}
Expand Down Expand Up @@ -210,35 +218,29 @@ def _build_schema_on_200(cls):
system_data = cls._schema_on_200.value.Element.system_data
system_data.created_at = AAZStrType(
serialized_name="createdAt",
flags={"read_only": True},
)
system_data.created_by = AAZStrType(
serialized_name="createdBy",
flags={"read_only": True},
)
system_data.created_by_type = AAZStrType(
serialized_name="createdByType",
flags={"read_only": True},
)
system_data.last_modified_at = AAZStrType(
serialized_name="lastModifiedAt",
flags={"read_only": True},
)
system_data.last_modified_by = AAZStrType(
serialized_name="lastModifiedBy",
flags={"read_only": True},
)
system_data.last_modified_by_type = AAZStrType(
serialized_name="lastModifiedByType",
flags={"read_only": True},
)

tags = cls._schema_on_200.value.Element.tags
tags.Element = AAZStrType()

return cls._schema_on_200

class DnsResolversList(AAZHttpOperation):
class DnsResolversListByResourceGroup(AAZHttpOperation):
CLIENT_TYPE = "MgmtClient"

def __call__(self, *args, **kwargs):
Expand All @@ -252,7 +254,7 @@ def __call__(self, *args, **kwargs):
@property
def url(self):
return self.client.format_url(
"/subscriptions/{subscriptionId}/providers/Microsoft.Network/dnsResolvers",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsResolvers",
**self.url_parameters
)

Expand All @@ -267,6 +269,10 @@ def error_format(self):
@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,
Expand All @@ -281,7 +287,7 @@ def query_parameters(self):
"$top", self.ctx.args.top,
),
**self.serialize_query_param(
"api-version", "2022-07-01",
"api-version", "2023-07-01-preview",
required=True,
),
}
Expand Down Expand Up @@ -374,27 +380,21 @@ def _build_schema_on_200(cls):
system_data = cls._schema_on_200.value.Element.system_data
system_data.created_at = AAZStrType(
serialized_name="createdAt",
flags={"read_only": True},
)
system_data.created_by = AAZStrType(
serialized_name="createdBy",
flags={"read_only": True},
)
system_data.created_by_type = AAZStrType(
serialized_name="createdByType",
flags={"read_only": True},
)
system_data.last_modified_at = AAZStrType(
serialized_name="lastModifiedAt",
flags={"read_only": True},
)
system_data.last_modified_by = AAZStrType(
serialized_name="lastModifiedBy",
flags={"read_only": True},
)
system_data.last_modified_by_type = AAZStrType(
serialized_name="lastModifiedByType",
flags={"read_only": True},
)

tags = cls._schema_on_200.value.Element.tags
Expand All @@ -403,4 +403,8 @@ def _build_schema_on_200(cls):
return cls._schema_on_200


class _ListHelper:
"""Helper class for List"""


__all__ = ["List"]
Loading

0 comments on commit 4ebc299

Please sign in to comment.