Skip to content

Commit

Permalink
{Network} Fix inconsistency of aaz model (Azure#26672)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZengTaoxu authored Jul 4, 2023
1 parent 2c3f5e0 commit b88d627
Show file tree
Hide file tree
Showing 71 changed files with 2,867 additions and 9,373 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------
# swagger change: https://github.com/Azure/azure-rest-api-specs/pull/24526

# pylint: skip-file
# flake8: noqa
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------
# swagger change: https://github.com/Azure/azure-rest-api-specs/pull/24526

# pylint: skip-file
# flake8: noqa
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


@register_command(
"network asg delete"
"network asg delete",
)
class Delete(AAZCommand):
"""Delete an application security group.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ def _build_arguments_schema(cls, *args, **kwargs):

def _execute_operations(self):
self.pre_operations()
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
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.ApplicationSecurityGroupsList(ctx=self.ctx)()
if condition_1:
self.ApplicationSecurityGroupsListAll(ctx=self.ctx)()
if condition_1:
self.ApplicationSecurityGroupsList(ctx=self.ctx)()
self.post_operations()

@register_callback
Expand All @@ -70,7 +70,7 @@ def _output(self, *args, **kwargs):
next_link = self.deserialize_output(self.ctx.vars.instance.next_link)
return result, next_link

class ApplicationSecurityGroupsList(AAZHttpOperation):
class ApplicationSecurityGroupsListAll(AAZHttpOperation):
CLIENT_TYPE = "MgmtClient"

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

Expand All @@ -99,10 +99,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 Down Expand Up @@ -188,7 +184,7 @@ def _build_schema_on_200(cls):

return cls._schema_on_200

class ApplicationSecurityGroupsListAll(AAZHttpOperation):
class ApplicationSecurityGroupsList(AAZHttpOperation):
CLIENT_TYPE = "MgmtClient"

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

Expand All @@ -217,6 +213,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 Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,11 @@ def _build_schema_on_200_201(cls):
)

public_ip_addresses = cls._schema_on_200_201.properties.public_ip_addresses
public_ip_addresses.Element = AAZObjectType(
flags={"read_only": True},
)
public_ip_addresses.Element = AAZObjectType()
_CreateHelper._build_schema_sub_resource_read(public_ip_addresses.Element)

virtual_networks = cls._schema_on_200_201.properties.virtual_networks
virtual_networks.Element = AAZObjectType(
flags={"read_only": True},
)
virtual_networks.Element = AAZObjectType()
_CreateHelper._build_schema_sub_resource_read(virtual_networks.Element)

tags = cls._schema_on_200_201.tags
Expand All @@ -269,14 +265,10 @@ def _build_schema_sub_resource_read(cls, _schema):
_schema.id = cls._schema_sub_resource_read.id
return

cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType(
flags={"read_only": True}
)
cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType()

sub_resource_read = _schema_sub_resource_read
sub_resource_read.id = AAZStrType(
flags={"read_only": True},
)
sub_resource_read.id = AAZStrType()

_schema.id = cls._schema_sub_resource_read.id

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


@register_command(
"network ddos-protection delete"
"network ddos-protection delete",
)
class Delete(AAZCommand):
"""Delete a DDoS protection plan.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,11 @@ def _build_schema_on_200(cls):
)

public_ip_addresses = cls._schema_on_200.value.Element.properties.public_ip_addresses
public_ip_addresses.Element = AAZObjectType(
flags={"read_only": True},
)
public_ip_addresses.Element = AAZObjectType()
_ListHelper._build_schema_sub_resource_read(public_ip_addresses.Element)

virtual_networks = cls._schema_on_200.value.Element.properties.virtual_networks
virtual_networks.Element = AAZObjectType(
flags={"read_only": True},
)
virtual_networks.Element = AAZObjectType()
_ListHelper._build_schema_sub_resource_read(virtual_networks.Element)

tags = cls._schema_on_200.value.Element.tags
Expand Down Expand Up @@ -330,15 +326,11 @@ def _build_schema_on_200(cls):
)

public_ip_addresses = cls._schema_on_200.value.Element.properties.public_ip_addresses
public_ip_addresses.Element = AAZObjectType(
flags={"read_only": True},
)
public_ip_addresses.Element = AAZObjectType()
_ListHelper._build_schema_sub_resource_read(public_ip_addresses.Element)

virtual_networks = cls._schema_on_200.value.Element.properties.virtual_networks
virtual_networks.Element = AAZObjectType(
flags={"read_only": True},
)
virtual_networks.Element = AAZObjectType()
_ListHelper._build_schema_sub_resource_read(virtual_networks.Element)

tags = cls._schema_on_200.value.Element.tags
Expand All @@ -358,14 +350,10 @@ def _build_schema_sub_resource_read(cls, _schema):
_schema.id = cls._schema_sub_resource_read.id
return

cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType(
flags={"read_only": True}
)
cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType()

sub_resource_read = _schema_sub_resource_read
sub_resource_read.id = AAZStrType(
flags={"read_only": True},
)
sub_resource_read.id = AAZStrType()

_schema.id = cls._schema_sub_resource_read.id

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,11 @@ def _build_schema_on_200(cls):
)

public_ip_addresses = cls._schema_on_200.properties.public_ip_addresses
public_ip_addresses.Element = AAZObjectType(
flags={"read_only": True},
)
public_ip_addresses.Element = AAZObjectType()
_ShowHelper._build_schema_sub_resource_read(public_ip_addresses.Element)

virtual_networks = cls._schema_on_200.properties.virtual_networks
virtual_networks.Element = AAZObjectType(
flags={"read_only": True},
)
virtual_networks.Element = AAZObjectType()
_ShowHelper._build_schema_sub_resource_read(virtual_networks.Element)

tags = cls._schema_on_200.tags
Expand All @@ -218,14 +214,10 @@ def _build_schema_sub_resource_read(cls, _schema):
_schema.id = cls._schema_sub_resource_read.id
return

cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType(
flags={"read_only": True}
)
cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType()

sub_resource_read = _schema_sub_resource_read
sub_resource_read.id = AAZStrType(
flags={"read_only": True},
)
sub_resource_read.id = AAZStrType()

_schema.id = cls._schema_sub_resource_read.id

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,15 +380,11 @@ def _build_schema_ddos_protection_plan_read(cls, _schema):
)

public_ip_addresses = _schema_ddos_protection_plan_read.properties.public_ip_addresses
public_ip_addresses.Element = AAZObjectType(
flags={"read_only": True},
)
public_ip_addresses.Element = AAZObjectType()
cls._build_schema_sub_resource_read(public_ip_addresses.Element)

virtual_networks = _schema_ddos_protection_plan_read.properties.virtual_networks
virtual_networks.Element = AAZObjectType(
flags={"read_only": True},
)
virtual_networks.Element = AAZObjectType()
cls._build_schema_sub_resource_read(virtual_networks.Element)

tags = _schema_ddos_protection_plan_read.tags
Expand All @@ -410,14 +406,10 @@ def _build_schema_sub_resource_read(cls, _schema):
_schema.id = cls._schema_sub_resource_read.id
return

cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType(
flags={"read_only": True}
)
cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType()

sub_resource_read = _schema_sub_resource_read
sub_resource_read.id = AAZStrType(
flags={"read_only": True},
)
sub_resource_read.id = AAZStrType()

_schema.id = cls._schema_sub_resource_read.id

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,11 @@ def _build_schema_on_200(cls):
)

public_ip_addresses = cls._schema_on_200.properties.public_ip_addresses
public_ip_addresses.Element = AAZObjectType(
flags={"read_only": True},
)
public_ip_addresses.Element = AAZObjectType()
_WaitHelper._build_schema_sub_resource_read(public_ip_addresses.Element)

virtual_networks = cls._schema_on_200.properties.virtual_networks
virtual_networks.Element = AAZObjectType(
flags={"read_only": True},
)
virtual_networks.Element = AAZObjectType()
_WaitHelper._build_schema_sub_resource_read(virtual_networks.Element)

tags = cls._schema_on_200.tags
Expand All @@ -214,14 +210,10 @@ def _build_schema_sub_resource_read(cls, _schema):
_schema.id = cls._schema_sub_resource_read.id
return

cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType(
flags={"read_only": True}
)
cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType()

sub_resource_read = _schema_sub_resource_read
sub_resource_read.id = AAZStrType(
flags={"read_only": True},
)
sub_resource_read.id = AAZStrType()

_schema.id = cls._schema_sub_resource_read.id

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#
# Code generated by aaz-dev-tools
# --------------------------------------------------------------------------------------------
# swagger change: https://github.com/Azure/azure-rest-api-specs/pull/24526

# pylint: skip-file
# flake8: noqa
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
_element.backend_port = AAZIntArg(
options=["backend-port"],
help="The port used for internal connections on the endpoint. Acceptable values are between 1 and 65535.",
required=True,
)
_element.enable_floating_ip = AAZBoolArg(
options=["enable-floating-ip"],
Expand All @@ -260,10 +261,12 @@ def _build_arguments_schema(cls, *args, **kwargs):
_element.frontend_port_range_end = AAZIntArg(
options=["frontend-port-range-end"],
help="The last port number in the range of external ports that will be used to provide Inbound Nat to NICs associated with a load balancer. Acceptable values range between 1 and 65535.",
required=True,
)
_element.frontend_port_range_start = AAZIntArg(
options=["frontend-port-range-start"],
help="The first port number in the range of external ports that will be used to provide Inbound Nat to NICs associated with a load balancer. Acceptable values range between 1 and 65534.",
required=True,
)
_element.idle_timeout_in_minutes = AAZIntArg(
options=["idle-timeout-in-minutes"],
Expand All @@ -272,6 +275,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
_element.protocol = AAZStrArg(
options=["protocol"],
help="The reference to the transport protocol used by the inbound NAT pool.",
required=True,
enum={"All": "All", "Tcp": "Tcp", "Udp": "Udp"},
)

Expand Down Expand Up @@ -539,6 +543,7 @@ def _build_args_public_ip_address_create(cls, _schema):
_schema.delete_option = cls._args_public_ip_address_create.delete_option
_schema.dns_settings = cls._args_public_ip_address_create.dns_settings
_schema.extended_location = cls._args_public_ip_address_create.extended_location
_schema.id = cls._args_public_ip_address_create.id
_schema.idle_timeout_in_minutes = cls._args_public_ip_address_create.idle_timeout_in_minutes
_schema.ip_address = cls._args_public_ip_address_create.ip_address
_schema.ip_tags = cls._args_public_ip_address_create.ip_tags
Expand All @@ -563,6 +568,13 @@ def _build_args_public_ip_address_create(cls, _schema):
help="The extended location of the public ip address.",
)
cls._build_args_extended_location_create(public_ip_address_create.extended_location)
public_ip_address_create.id = AAZResourceIdArg(
options=["id"],
help="Resource ID.",
fmt=AAZResourceIdArgFormat(
template="/subscriptions/{}/resourceGroups/{}/providers/Microsoft.Network/publicIPAddresses/{}",
),
)
public_ip_address_create.location = AAZResourceLocationArg(
options=["l", "location"],
help="Resource location.",
Expand Down Expand Up @@ -764,6 +776,7 @@ def _build_args_public_ip_address_create(cls, _schema):
_schema.delete_option = cls._args_public_ip_address_create.delete_option
_schema.dns_settings = cls._args_public_ip_address_create.dns_settings
_schema.extended_location = cls._args_public_ip_address_create.extended_location
_schema.id = cls._args_public_ip_address_create.id
_schema.idle_timeout_in_minutes = cls._args_public_ip_address_create.idle_timeout_in_minutes
_schema.ip_address = cls._args_public_ip_address_create.ip_address
_schema.ip_tags = cls._args_public_ip_address_create.ip_tags
Expand Down Expand Up @@ -971,7 +984,7 @@ def content(self):
if _elements is not None:
_elements.set_prop("id", AAZStrType, ".id")
_elements.set_prop("name", AAZStrType, ".name")
_elements.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}})
_elements.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True, "client_flatten": True}})

properties = _builder.get(".properties.inboundNatPools[].properties")
if properties is not None:
Expand Down Expand Up @@ -1172,7 +1185,7 @@ def _build_schema_on_200_201(cls):
_element.id = AAZStrType()
_element.name = AAZStrType()
_element.properties = AAZObjectType(
flags={"client_flatten": True},
flags={"required": True, "client_flatten": True},
)
_element.type = AAZStrType(
flags={"read_only": True},
Expand Down Expand Up @@ -1411,6 +1424,7 @@ def _build_schema_public_ip_address_create(cls, _builder):
if _builder is None:
return
cls._build_schema_extended_location_create(_builder.set_prop("extendedLocation", AAZObjectType, ".extended_location"))
_builder.set_prop("id", AAZStrType, ".id")
_builder.set_prop("location", AAZStrType, ".location")
_builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}})
_builder.set_prop("sku", AAZObjectType, ".sku")
Expand Down
Loading

0 comments on commit b88d627

Please sign in to comment.