Skip to content

Commit

Permalink
Updating resource name regex pattern to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
danlope committed Oct 23, 2024
1 parent 73c2d05 commit 9c4b7df
Show file tree
Hide file tree
Showing 28 changed files with 194 additions and 178 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,21 @@ class Create(AAZCommand):
"""Create the Pool resource.
:example: IpamPools_Create
az network manager ipam-pool create --name "myIpamPool" --network-manager-name "myAVNM" --resource-group "myAVNMResourceGroup" --address-prefixes "['10.0.0.0/16', '10.1.0.0/16']" --parent-pool-name "myParentIpamPool" --display-name "myIpamPoolDisplayName" --description "New Description"
az network manager ipam-pool create --name "myIpamPool" --network-manager-name "myAVNM" --resource-group "myAVNMResourceGroup" --address-prefixes "['10.0.0.0/16', '10.1.0.0/16']" --parent-pool-name "myParentIpamPool" --display-name "myIpamPoolDisplayName" --description "Description"
"""

_aaz_info = {
"version": "2024-01-01-preview",
"version": "2024-05-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networkmanagers/{}/ipampools/{}", "2024-01-01-preview"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networkmanagers/{}/ipampools/{}", "2024-05-01"],
]
}

AZ_SUPPORT_NO_WAIT = True

def _handler(self, command_args):
super()._handler(command_args)
self._execute_operations()
return self._output()
return self.build_lro_poller(self._execute_operations, self._output)

_args_schema = None

Expand All @@ -50,15 +51,15 @@ def _build_arguments_schema(cls, *args, **kwargs):
help="The name of the network manager.",
required=True,
fmt=AAZStrArgFormat(
pattern="^[a-zA-Z0-9-]*$",
pattern="^[0-9a-zA-Z]([0-9a-zA-Z_.-]{0,62}[0-9a-zA-Z_])?$",
),
)
_args_schema.pool_name = AAZStrArg(
options=["-n", "--name", "--pool-name"],
help="IP Address Manager Pool resource name.",
required=True,
fmt=AAZStrArgFormat(
pattern="^[a-zA-Z0-9-]*$",
pattern="^[0-9a-zA-Z]([0-9a-zA-Z_.-]{0,62}[0-9a-zA-Z_])?$",
),
)
_args_schema.resource_group = AAZResourceGroupNameArg(
Expand Down Expand Up @@ -116,7 +117,7 @@ def _build_arguments_schema(cls, *args, **kwargs):

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

@register_callback
Expand All @@ -137,8 +138,24 @@ class IpamPoolsCreate(AAZHttpOperation):
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 [202]:
return self.client.build_lro_polling(
self.ctx.args.no_wait,
session,
self.on_200_201,
self.on_error,
lro_options={"final-state-via": "azure-async-operation"},
path_format_arguments=self.url_parameters,
)
if session.http_response.status_code in [200, 201]:
return self.on_200_201(session)
return self.client.build_lro_polling(
self.ctx.args.no_wait,
session,
self.on_200_201,
self.on_error,
lro_options={"final-state-via": "azure-async-operation"},
path_format_arguments=self.url_parameters,
)

return self.on_error(session.http_response)

Expand Down Expand Up @@ -183,7 +200,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2024-01-01-preview",
"api-version", "2024-05-01",
required=True,
),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class Delete(AAZCommand):
"""

_aaz_info = {
"version": "2024-01-01-preview",
"version": "2024-05-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networkmanagers/{}/ipampools/{}", "2024-01-01-preview"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networkmanagers/{}/ipampools/{}", "2024-05-01"],
]
}

Expand All @@ -53,7 +53,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
id_part="name",
fmt=AAZStrArgFormat(
pattern="^[a-zA-Z0-9-]*$",
pattern="^[0-9a-zA-Z]([0-9a-zA-Z_.-]{0,62}[0-9a-zA-Z_])?$",
),
)
_args_schema.pool_name = AAZStrArg(
Expand All @@ -62,7 +62,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
id_part="child_name_1",
fmt=AAZStrArgFormat(
pattern="^[a-zA-Z0-9-]*$",
pattern="^[0-9a-zA-Z]([0-9a-zA-Z_.-]{0,62}[0-9a-zA-Z_])?$",
),
)
_args_schema.resource_group = AAZResourceGroupNameArg(
Expand Down Expand Up @@ -160,7 +160,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2024-01-01-preview",
"api-version", "2024-05-01",
required=True,
),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class GetPoolUsage(AAZCommand):
"""

_aaz_info = {
"version": "2024-01-01-preview",
"version": "2024-05-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networkmanagers/{}/ipampools/{}/getpoolusage", "2024-01-01-preview"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networkmanagers/{}/ipampools/{}/getpoolusage", "2024-05-01"],
]
}

Expand All @@ -51,7 +51,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
id_part="name",
fmt=AAZStrArgFormat(
pattern="^[a-zA-Z0-9-]*$",
pattern="^[0-9a-zA-Z]([0-9a-zA-Z_.-]{0,62}[0-9a-zA-Z_])?$",
),
)
_args_schema.pool_name = AAZStrArg(
Expand All @@ -60,7 +60,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
id_part="child_name_1",
fmt=AAZStrArgFormat(
pattern="^[a-zA-Z0-9-]*$",
pattern="^[0-9a-zA-Z]([0-9a-zA-Z_.-]{0,62}[0-9a-zA-Z_])?$",
),
)
_args_schema.resource_group = AAZResourceGroupNameArg(
Expand Down Expand Up @@ -137,7 +137,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2024-01-01-preview",
"api-version", "2024-05-01",
required=True,
),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class List(AAZCommand):
"""

_aaz_info = {
"version": "2024-01-01-preview",
"version": "2024-05-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networkmanagers/{}/ipampools", "2024-01-01-preview"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networkmanagers/{}/ipampools", "2024-05-01"],
]
}

Expand All @@ -51,7 +51,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
help="The name of the network manager.",
required=True,
fmt=AAZStrArgFormat(
pattern="^[a-zA-Z0-9-]*$",
pattern="^[0-9a-zA-Z]([0-9a-zA-Z_.-]{0,62}[0-9a-zA-Z_])?$",
),
)
_args_schema.resource_group = AAZResourceGroupNameArg(
Expand Down Expand Up @@ -162,7 +162,7 @@ def query_parameters(self):
"top", self.ctx.args.top,
),
**self.serialize_query_param(
"api-version", "2024-01-01-preview",
"api-version", "2024-05-01",
required=True,
),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class ListAssociatedResource(AAZCommand):
"""

_aaz_info = {
"version": "2024-01-01-preview",
"version": "2024-05-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networkmanagers/{}/ipampools/{}/listassociatedresources", "2024-01-01-preview"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networkmanagers/{}/ipampools/{}/listassociatedresources", "2024-05-01"],
]
}

Expand All @@ -51,15 +51,15 @@ def _build_arguments_schema(cls, *args, **kwargs):
help="The name of the network manager.",
required=True,
fmt=AAZStrArgFormat(
pattern="^[a-zA-Z0-9-]*$",
pattern="^[0-9a-zA-Z]([0-9a-zA-Z_.-]{0,62}[0-9a-zA-Z_])?$",
),
)
_args_schema.pool_name = AAZStrArg(
options=["-n", "--name", "--pool-name"],
help="Pool resource name.",
required=True,
fmt=AAZStrArgFormat(
pattern="^[a-zA-Z0-9-]*$",
pattern="^[0-9a-zA-Z]([0-9a-zA-Z_.-]{0,62}[0-9a-zA-Z_])?$",
),
)
_args_schema.resource_group = AAZResourceGroupNameArg(
Expand Down Expand Up @@ -137,7 +137,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2024-01-01-preview",
"api-version", "2024-05-01",
required=True,
),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class Show(AAZCommand):
"""

_aaz_info = {
"version": "2024-01-01-preview",
"version": "2024-05-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networkmanagers/{}/ipampools/{}", "2024-01-01-preview"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networkmanagers/{}/ipampools/{}", "2024-05-01"],
]
}

Expand All @@ -51,7 +51,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
id_part="name",
fmt=AAZStrArgFormat(
pattern="^[a-zA-Z0-9-]*$",
pattern="^[0-9a-zA-Z]([0-9a-zA-Z_.-]{0,62}[0-9a-zA-Z_])?$",
),
)
_args_schema.pool_name = AAZStrArg(
Expand All @@ -60,7 +60,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
id_part="child_name_1",
fmt=AAZStrArgFormat(
pattern="^[a-zA-Z0-9-]*$",
pattern="^[0-9a-zA-Z]([0-9a-zA-Z_.-]{0,62}[0-9a-zA-Z_])?$",
),
)
_args_schema.resource_group = AAZResourceGroupNameArg(
Expand Down Expand Up @@ -137,7 +137,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2024-01-01-preview",
"api-version", "2024-05-01",
required=True,
),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,19 @@ class Update(AAZCommand):
"""

_aaz_info = {
"version": "2024-01-01-preview",
"version": "2024-05-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networkmanagers/{}/ipampools/{}", "2024-01-01-preview"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networkmanagers/{}/ipampools/{}", "2024-05-01"],
]
}

AZ_SUPPORT_NO_WAIT = True

AZ_SUPPORT_GENERIC_UPDATE = True

def _handler(self, command_args):
super()._handler(command_args)
self._execute_operations()
return self._output()
return self.build_lro_poller(self._execute_operations, self._output)

_args_schema = None

Expand All @@ -53,7 +54,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
id_part="name",
fmt=AAZStrArgFormat(
pattern="^[a-zA-Z0-9-]*$",
pattern="^[0-9a-zA-Z]([0-9a-zA-Z_.-]{0,62}[0-9a-zA-Z_])?$",
),
)
_args_schema.pool_name = AAZStrArg(
Expand All @@ -62,7 +63,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
required=True,
id_part="child_name_1",
fmt=AAZStrArgFormat(
pattern="^[a-zA-Z0-9-]*$",
pattern="^[0-9a-zA-Z]([0-9a-zA-Z_.-]{0,62}[0-9a-zA-Z_])?$",
),
)
_args_schema.resource_group = AAZResourceGroupNameArg(
Expand Down Expand Up @@ -108,7 +109,7 @@ def _execute_operations(self):
self.InstanceUpdateByJson(ctx=self.ctx)()
self.InstanceUpdateByGeneric(ctx=self.ctx)()
self.post_instance_update(self.ctx.vars.instance)
self.IpamPoolsCreate(ctx=self.ctx)()
yield self.IpamPoolsCreate(ctx=self.ctx)()
self.post_operations()

@register_callback
Expand Down Expand Up @@ -183,7 +184,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2024-01-01-preview",
"api-version", "2024-05-01",
required=True,
),
}
Expand Down Expand Up @@ -224,8 +225,24 @@ class IpamPoolsCreate(AAZHttpOperation):
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 [202]:
return self.client.build_lro_polling(
self.ctx.args.no_wait,
session,
self.on_200_201,
self.on_error,
lro_options={"final-state-via": "azure-async-operation"},
path_format_arguments=self.url_parameters,
)
if session.http_response.status_code in [200, 201]:
return self.on_200_201(session)
return self.client.build_lro_polling(
self.ctx.args.no_wait,
session,
self.on_200_201,
self.on_error,
lro_options={"final-state-via": "azure-async-operation"},
path_format_arguments=self.url_parameters,
)

return self.on_error(session.http_response)

Expand Down Expand Up @@ -270,7 +287,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2024-01-01-preview",
"api-version", "2024-05-01",
required=True,
),
}
Expand Down
Loading

0 comments on commit 9c4b7df

Please sign in to comment.