diff --git a/src/nsp/HISTORY.rst b/src/nsp/HISTORY.rst index 12fea33e05b..61d10523e61 100644 --- a/src/nsp/HISTORY.rst +++ b/src/nsp/HISTORY.rst @@ -3,6 +3,13 @@ Release History =============== =============== +##### 0.2.1 +++++++ +No new commands added. + +Existing commands updated: +* perimeter profile access-rule: create, update (remove existing "--nsp" paramter from request. Now access rule doesn't support creation/updation of perimeter based rules. + ##### 0.2.0 ++++++ New commands added: diff --git a/src/nsp/azext_nsp/aaz/latest/network/__cmd_group.py b/src/nsp/azext_nsp/aaz/latest/network/__cmd_group.py index 5093d2928ba..94812d45a99 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/__cmd_group.py +++ b/src/nsp/azext_nsp/aaz/latest/network/__cmd_group.py @@ -1,23 +1,23 @@ -# -------------------------------------------------------------------------------------------- -# 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_group( - "network", -) -class __CMDGroup(AAZCommandGroup): - """Manage Azure Network resources. - """ - pass - - -__all__ = ["__CMDGroup"] +# -------------------------------------------------------------------------------------------- +# 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_group( + "network", +) +class __CMDGroup(AAZCommandGroup): + """Manage Azure Network resources. + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/__init__.py b/src/nsp/azext_nsp/aaz/latest/network/__init__.py index 5a9d61963d6..709a5170d90 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/__init__.py +++ b/src/nsp/azext_nsp/aaz/latest/network/__init__.py @@ -1,11 +1,11 @@ -# -------------------------------------------------------------------------------------------- -# 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 .__cmd_group import * +# -------------------------------------------------------------------------------------------- +# 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 .__cmd_group import * diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/__cmd_group.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/__cmd_group.py index d6ba9595326..f2408b7accd 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/__cmd_group.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/__cmd_group.py @@ -1,23 +1,23 @@ -# -------------------------------------------------------------------------------------------- -# 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_group( - "network perimeter", -) -class __CMDGroup(AAZCommandGroup): - """Manage Network Security Perimeters - """ - pass - - -__all__ = ["__CMDGroup"] +# -------------------------------------------------------------------------------------------- +# 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_group( + "network perimeter", +) +class __CMDGroup(AAZCommandGroup): + """Manage Network Security Perimeters + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/__init__.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/__init__.py index efc3964e3fb..bca7976b1c6 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/__init__.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/__init__.py @@ -1,15 +1,15 @@ -# -------------------------------------------------------------------------------------------- -# 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 .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * +# -------------------------------------------------------------------------------------------- +# 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 .__cmd_group import * +from ._create import * +from ._delete import * +from ._list import * +from ._show import * diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/_create.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/_create.py index f5e98462a66..7df66f5ba76 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/_create.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/_create.py @@ -1,225 +1,225 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter create", -) -class Create(AAZCommand): - """Creates a Network Security Perimeter. - - :example: Create a Network Security Perimeter - az network perimeter create -n MyPerimeter -g MyResourceGroup -l northcentralus - """ - - _aaz_info = { - "version": "2021-02-01-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}", "2021-02-01-preview"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return 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.perimeter_name = AAZStrArg( - options=["-n", "--name", "--perimeter-name"], - help="The name of the network security perimeter.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "Parameters" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - arg_group="Parameters", - help="The location in which NSP is created.", - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="Parameters", - help="Resource tags.", - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NetworkSecurityPerimetersCreateOrUpdate(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) - return result - - class NetworkSecurityPerimetersCreateOrUpdate(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, 201]: - return self.on_200_201(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - 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", "2021-02-01-preview", - 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("location", AAZStrType, ".location") - _builder.set_prop("name", AAZStrType, ".perimeter_name") - _builder.set_prop("tags", AAZDictType, ".tags") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - - _schema_on_200_201 = cls._schema_on_200_201 - _schema_on_200_201.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200_201.location = AAZStrType() - _schema_on_200_201.name = AAZStrType() - _schema_on_200_201.properties = AAZObjectType() - _schema_on_200_201.tags = AAZDictType() - _schema_on_200_201.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200_201.properties - properties.perimeter_guid = AAZStrType( - serialized_name="perimeterGuid", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - tags = cls._schema_on_200_201.tags - tags.Element = AAZStrType() - - return cls._schema_on_200_201 - - -class _CreateHelper: - """Helper class for Create""" - - -__all__ = ["Create"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter create", +) +class Create(AAZCommand): + """Creates a Network Security Perimeter. + + :example: Create a Network Security Perimeter + az network perimeter create -n MyPerimeter -g MyResourceGroup -l northcentralus + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}", "2021-02-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return 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.perimeter_name = AAZStrArg( + options=["-n", "--name", "--perimeter-name"], + help="The name of the network security perimeter.", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Parameters" + + _args_schema = cls._args_schema + _args_schema.location = AAZResourceLocationArg( + arg_group="Parameters", + help="The location in which NSP is created.", + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Parameters", + help="Resource tags.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.NetworkSecurityPerimetersCreateOrUpdate(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) + return result + + class NetworkSecurityPerimetersCreateOrUpdate(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, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + 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", "2021-02-01-preview", + 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("location", AAZStrType, ".location") + _builder.set_prop("name", AAZStrType, ".perimeter_name") + _builder.set_prop("tags", AAZDictType, ".tags") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.location = AAZStrType() + _schema_on_200_201.name = AAZStrType() + _schema_on_200_201.properties = AAZObjectType() + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.perimeter_guid = AAZStrType( + serialized_name="perimeterGuid", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/_delete.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/_delete.py index fd3c8aac14e..f7ca4a7b15d 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/_delete.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/_delete.py @@ -1,139 +1,139 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter delete", - confirmation="Are you sure you want to perform this operation?", -) -class Delete(AAZCommand): - """Deletes a network security perimeter. - - :example: Delete a Network Security Perimeter - az network perimeter delete -g MyResourceGroup -n MyPerimeter - """ - - _aaz_info = { - "version": "2021-02-01-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}", "2021-02-01-preview"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return None - - _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.perimeter_name = AAZStrArg( - options=["-n", "--name", "--perimeter-name"], - help="The name of the network security perimeter.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NetworkSecurityPerimetersDelete(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class NetworkSecurityPerimetersDelete(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) - if session.http_response.status_code in [204]: - return self.on_204(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - 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", "2021-02-01-preview", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Deletes a network security perimeter. + + :example: Delete a Network Security Perimeter + az network perimeter delete -g MyResourceGroup -n MyPerimeter + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}", "2021-02-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return None + + _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.perimeter_name = AAZStrArg( + options=["-n", "--name", "--perimeter-name"], + help="The name of the network security perimeter.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.NetworkSecurityPerimetersDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class NetworkSecurityPerimetersDelete(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) + if session.http_response.status_code in [204]: + return self.on_204(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + 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", "2021-02-01-preview", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/_list.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/_list.py index 43f232412d4..a76f7a2f8fa 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/_list.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/_list.py @@ -1,322 +1,322 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter list", -) -class List(AAZCommand): - """List all network security perimeters in a subscription. - - :example: List Network Security Perimeters - az network perimeter list -g MyResourceGroup - """ - - _aaz_info = { - "version": "2021-02-01-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.network/networksecurityperimeters", "2021-02-01-preview"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters", "2021-02-01-preview"], - ] - } - - 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.resource_group = AAZResourceGroupNameArg() - _args_schema.skip_token = AAZStrArg( - options=["--skip-token"], - help="SkipToken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls.", - ) - _args_schema.top = AAZIntArg( - options=["--top"], - help="An optional query parameter which specifies the maximum number of records to be returned by the server.", - fmt=AAZIntArgFormat( - maximum=20, - minimum=1, - ), - ) - return cls._args_schema - - 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 - if condition_0: - self.NetworkSecurityPerimetersList(ctx=self.ctx)() - if condition_1: - self.NetworkSecurityPerimetersListBySubscription(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 NetworkSecurityPerimetersList(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.Network/networkSecurityPerimeters", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @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, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$skipToken", self.ctx.args.skip_token, - ), - **self.serialize_query_param( - "$top", self.ctx.args.top, - ), - **self.serialize_query_param( - "api-version", "2021-02-01-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.perimeter_guid = AAZStrType( - serialized_name="perimeterGuid", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - class NetworkSecurityPerimetersListBySubscription(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}/providers/Microsoft.Network/networkSecurityPerimeters", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "$skipToken", self.ctx.args.skip_token, - ), - **self.serialize_query_param( - "$top", self.ctx.args.top, - ), - **self.serialize_query_param( - "api-version", "2021-02-01-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.perimeter_guid = AAZStrType( - serialized_name="perimeterGuid", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - -__all__ = ["List"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter list", +) +class List(AAZCommand): + """List all network security perimeters in a subscription. + + :example: List Network Security Perimeters + az network perimeter list -g MyResourceGroup + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.network/networksecurityperimeters", "2021-02-01-preview"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters", "2021-02-01-preview"], + ] + } + + 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.resource_group = AAZResourceGroupNameArg() + _args_schema.skip_token = AAZStrArg( + options=["--skip-token"], + help="SkipToken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls.", + ) + _args_schema.top = AAZIntArg( + options=["--top"], + help="An optional query parameter which specifies the maximum number of records to be returned by the server.", + fmt=AAZIntArgFormat( + maximum=20, + minimum=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + 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.NetworkSecurityPerimetersListBySubscription(ctx=self.ctx)() + if condition_1: + self.NetworkSecurityPerimetersList(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 NetworkSecurityPerimetersListBySubscription(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}/providers/Microsoft.Network/networkSecurityPerimeters", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "$skipToken", self.ctx.args.skip_token, + ), + **self.serialize_query_param( + "$top", self.ctx.args.top, + ), + **self.serialize_query_param( + "api-version", "2021-02-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + 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() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType() + _element.name = AAZStrType() + _element.properties = AAZObjectType() + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.perimeter_guid = AAZStrType( + serialized_name="perimeterGuid", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + class NetworkSecurityPerimetersList(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.Network/networkSecurityPerimeters", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @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, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "$skipToken", self.ctx.args.skip_token, + ), + **self.serialize_query_param( + "$top", self.ctx.args.top, + ), + **self.serialize_query_param( + "api-version", "2021-02-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + 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() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType() + _element.name = AAZStrType() + _element.properties = AAZObjectType() + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.perimeter_guid = AAZStrType( + serialized_name="perimeterGuid", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/_show.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/_show.py index de3c8bbdfd0..0b16ce682c0 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/_show.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/_show.py @@ -1,187 +1,187 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter show", -) -class Show(AAZCommand): - """Gets the specified network security perimeter by the name. - - :example: Get the Network Security Perimeter - az network perimeter show -g MyResourceGroup -n MyPerimeter - """ - - _aaz_info = { - "version": "2021-02-01-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}", "2021-02-01-preview"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return 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.perimeter_name = AAZStrArg( - options=["-n", "--name", "--perimeter-name"], - help="The name of the network security perimeter.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NetworkSecurityPerimetersGet(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) - return result - - class NetworkSecurityPerimetersGet(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - 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", "2021-02-01-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType() - _schema_on_200.name = AAZStrType() - _schema_on_200.properties = AAZObjectType() - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.perimeter_guid = AAZStrType( - serialized_name="perimeterGuid", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - -__all__ = ["Show"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter show", +) +class Show(AAZCommand): + """Gets the specified network security perimeter by the name. + + :example: Get the Network Security Perimeter + az network perimeter show -g MyResourceGroup -n MyPerimeter + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}", "2021-02-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return 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.perimeter_name = AAZStrArg( + options=["-n", "--name", "--perimeter-name"], + help="The name of the network security perimeter.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.NetworkSecurityPerimetersGet(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) + return result + + class NetworkSecurityPerimetersGet(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + 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", "2021-02-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + 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.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType() + _schema_on_200.name = AAZStrType() + _schema_on_200.properties = AAZObjectType() + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.perimeter_guid = AAZStrType( + serialized_name="perimeterGuid", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/__cmd_group.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/__cmd_group.py index e59b2d6a4f1..a2288b49de2 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/__cmd_group.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/__cmd_group.py @@ -1,23 +1,23 @@ -# -------------------------------------------------------------------------------------------- -# 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_group( - "network perimeter association", -) -class __CMDGroup(AAZCommandGroup): - """Manage NSP Associations - """ - pass - - -__all__ = ["__CMDGroup"] +# -------------------------------------------------------------------------------------------- +# 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_group( + "network perimeter association", +) +class __CMDGroup(AAZCommandGroup): + """Manage NSP Associations + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/__init__.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/__init__.py index db73033039b..b0465fd67f0 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/__init__.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/__init__.py @@ -1,17 +1,17 @@ -# -------------------------------------------------------------------------------------------- -# 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 .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * +# -------------------------------------------------------------------------------------------- +# 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 .__cmd_group import * +from ._create import * +from ._delete import * +from ._list import * +from ._show import * +from ._update import * +from ._wait import * diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/_create.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/_create.py index efe22673f78..483b8edbb30 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/_create.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/_create.py @@ -1,311 +1,311 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter association create", -) -class Create(AAZCommand): - """Creates or updates a NSP resource association. - - :example: Create NSP Association - az network perimeter association create -n MyAssociation --perimeter-name MyPerimeter -g MyResourceGroup --access-mode Learning --private-link-resource "{id:}" --profile "{id:}" - """ - - _aaz_info = { - "version": "2021-02-01-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/resourceassociations/{}", "2021-02-01-preview"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return 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.association_name = AAZStrArg( - options=["-n", "--name", "--association-name"], - help="The name of the NSP association.", - required=True, - ) - _args_schema.perimeter_name = AAZStrArg( - options=["--perimeter-name"], - help="The name of the network security perimeter.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "Parameters" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - arg_group="Parameters", - help="Resource location.", - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="Parameters", - help="Resource tags.", - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg() - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.access_mode = AAZStrArg( - options=["--access-mode"], - arg_group="Properties", - help="Access mode on the association.", - enum={"Audit": "Audit", "Enforced": "Enforced", "Learning": "Learning"}, - ) - _args_schema.private_link_resource = AAZObjectArg( - options=["--private-link-resource"], - arg_group="Properties", - help="The PaaS resource to be associated.", - ) - cls._build_args_sub_resource_create(_args_schema.private_link_resource) - _args_schema.profile = AAZObjectArg( - options=["--profile"], - arg_group="Properties", - help="Profile id to which the PaaS resource is associated.", - ) - cls._build_args_sub_resource_create(_args_schema.profile) - return cls._args_schema - - _args_sub_resource_create = None - - @classmethod - def _build_args_sub_resource_create(cls, _schema): - if cls._args_sub_resource_create is not None: - _schema.id = cls._args_sub_resource_create.id - return - - cls._args_sub_resource_create = AAZObjectArg() - - sub_resource_create = cls._args_sub_resource_create - sub_resource_create.id = AAZStrArg( - options=["id"], - help="Resource ID.", - ) - - _schema.id = cls._args_sub_resource_create.id - - def _execute_operations(self): - self.pre_operations() - self.NspAssociationsCreateOrUpdate(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) - return result - - class NspAssociationsCreateOrUpdate(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, 201]: - return self.on_200_201(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/resourceAssociations/{associationName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "associationName", self.ctx.args.association_name, - required=True, - ), - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - 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", "2021-02-01-preview", - 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("location", AAZStrType, ".location") - _builder.set_prop("name", AAZStrType, ".association_name") - _builder.set_prop("properties", AAZObjectType) - _builder.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("accessMode", AAZStrType, ".access_mode") - _CreateHelper._build_schema_sub_resource_create(properties.set_prop("privateLinkResource", AAZObjectType, ".private_link_resource")) - _CreateHelper._build_schema_sub_resource_create(properties.set_prop("profile", AAZObjectType, ".profile")) - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - - _schema_on_200_201 = cls._schema_on_200_201 - _schema_on_200_201.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200_201.location = AAZStrType() - _schema_on_200_201.name = AAZStrType() - _schema_on_200_201.properties = AAZObjectType() - _schema_on_200_201.tags = AAZDictType() - _schema_on_200_201.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200_201.properties - properties.access_mode = AAZStrType( - serialized_name="accessMode", - ) - properties.has_provisioning_issues = AAZStrType( - serialized_name="hasProvisioningIssues", - flags={"read_only": True}, - ) - properties.private_link_resource = AAZObjectType( - serialized_name="privateLinkResource", - ) - _CreateHelper._build_schema_sub_resource_read(properties.private_link_resource) - properties.profile = AAZObjectType() - _CreateHelper._build_schema_sub_resource_read(properties.profile) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - tags = cls._schema_on_200_201.tags - tags.Element = AAZStrType() - - return cls._schema_on_200_201 - - -class _CreateHelper: - """Helper class for Create""" - - @classmethod - def _build_schema_sub_resource_create(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - -__all__ = ["Create"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter association create", +) +class Create(AAZCommand): + """Creates or updates a NSP resource association. + + :example: Create NSP Association + az network perimeter association create -n MyAssociation --perimeter-name MyPerimeter -g MyResourceGroup --access-mode Learning --private-link-resource "{id:}" --profile "{id:}" + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/resourceassociations/{}", "2021-02-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return 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.association_name = AAZStrArg( + options=["-n", "--name", "--association-name"], + help="The name of the NSP association.", + required=True, + ) + _args_schema.perimeter_name = AAZStrArg( + options=["--perimeter-name"], + help="The name of the network security perimeter.", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Parameters" + + _args_schema = cls._args_schema + _args_schema.location = AAZResourceLocationArg( + arg_group="Parameters", + help="Resource location.", + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Parameters", + help="Resource tags.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.access_mode = AAZStrArg( + options=["--access-mode"], + arg_group="Properties", + help="Access mode on the association.", + enum={"Audit": "Audit", "Enforced": "Enforced", "Learning": "Learning"}, + ) + _args_schema.private_link_resource = AAZObjectArg( + options=["--private-link-resource"], + arg_group="Properties", + help="The PaaS resource to be associated.", + ) + cls._build_args_sub_resource_create(_args_schema.private_link_resource) + _args_schema.profile = AAZObjectArg( + options=["--profile"], + arg_group="Properties", + help="Profile id to which the PaaS resource is associated.", + ) + cls._build_args_sub_resource_create(_args_schema.profile) + return cls._args_schema + + _args_sub_resource_create = None + + @classmethod + def _build_args_sub_resource_create(cls, _schema): + if cls._args_sub_resource_create is not None: + _schema.id = cls._args_sub_resource_create.id + return + + cls._args_sub_resource_create = AAZObjectArg() + + sub_resource_create = cls._args_sub_resource_create + sub_resource_create.id = AAZStrArg( + options=["id"], + help="Resource ID.", + ) + + _schema.id = cls._args_sub_resource_create.id + + def _execute_operations(self): + self.pre_operations() + self.NspAssociationsCreateOrUpdate(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) + return result + + class NspAssociationsCreateOrUpdate(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, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/resourceAssociations/{associationName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "associationName", self.ctx.args.association_name, + required=True, + ), + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + 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", "2021-02-01-preview", + 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("location", AAZStrType, ".location") + _builder.set_prop("name", AAZStrType, ".association_name") + _builder.set_prop("properties", AAZObjectType) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("accessMode", AAZStrType, ".access_mode") + _CreateHelper._build_schema_sub_resource_create(properties.set_prop("privateLinkResource", AAZObjectType, ".private_link_resource")) + _CreateHelper._build_schema_sub_resource_create(properties.set_prop("profile", AAZObjectType, ".profile")) + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.location = AAZStrType() + _schema_on_200_201.name = AAZStrType() + _schema_on_200_201.properties = AAZObjectType() + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.access_mode = AAZStrType( + serialized_name="accessMode", + ) + properties.has_provisioning_issues = AAZStrType( + serialized_name="hasProvisioningIssues", + flags={"read_only": True}, + ) + properties.private_link_resource = AAZObjectType( + serialized_name="privateLinkResource", + ) + _CreateHelper._build_schema_sub_resource_read(properties.private_link_resource) + properties.profile = AAZObjectType() + _CreateHelper._build_schema_sub_resource_read(properties.profile) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + @classmethod + def _build_schema_sub_resource_create(cls, _builder): + if _builder is None: + return + _builder.set_prop("id", AAZStrType, ".id") + + _schema_sub_resource_read = None + + @classmethod + def _build_schema_sub_resource_read(cls, _schema): + if cls._schema_sub_resource_read is not None: + _schema.id = cls._schema_sub_resource_read.id + return + + cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() + + sub_resource_read = _schema_sub_resource_read + sub_resource_read.id = AAZStrType() + + _schema.id = cls._schema_sub_resource_read.id + + +__all__ = ["Create"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/_delete.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/_delete.py index 8df4d31f06e..3d3a65fbe56 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/_delete.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/_delete.py @@ -1,173 +1,173 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter association delete", - confirmation="Are you sure you want to perform this operation?", -) -class Delete(AAZCommand): - """Deletes an NSP association resource. - - :example: Delete NSP Association - az network perimeter association delete -n MyAssociation --perimeter-name MyPerimeter -g MyResourceGroup - """ - - _aaz_info = { - "version": "2021-02-01-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/resourceassociations/{}", "2021-02-01-preview"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _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.association_name = AAZStrArg( - options=["-n", "--name", "--association-name"], - help="The name of the NSP association.", - required=True, - id_part="child_name_1", - ) - _args_schema.perimeter_name = AAZStrArg( - options=["--perimeter-name"], - help="The name of the network security perimeter.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.NspAssociationsDelete(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class NspAssociationsDelete(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - 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]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [204]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_204, - self.on_error, - lro_options={"final-state-via": "azure-async-operation"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/resourceAssociations/{associationName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "associationName", self.ctx.args.association_name, - required=True, - ), - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - 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", "2021-02-01-preview", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter association delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Deletes an NSP association resource. + + :example: Delete NSP Association + az network perimeter association delete -n MyAssociation --perimeter-name MyPerimeter -g MyResourceGroup + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/resourceassociations/{}", "2021-02-01-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _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.association_name = AAZStrArg( + options=["-n", "--name", "--association-name"], + help="The name of the NSP association.", + required=True, + id_part="child_name_1", + ) + _args_schema.perimeter_name = AAZStrArg( + options=["--perimeter-name"], + help="The name of the network security perimeter.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.NspAssociationsDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class NspAssociationsDelete(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 [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + 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]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/resourceAssociations/{associationName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "associationName", self.ctx.args.association_name, + required=True, + ), + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + 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", "2021-02-01-preview", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/_list.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/_list.py index e25e59fc022..8574729990a 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/_list.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/_list.py @@ -1,237 +1,237 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter association list", -) -class List(AAZCommand): - """Lists the NSP resource associations. - - :example: List NSP Associations inside a Perimeter - az network perimeter association list --perimeter-name MyPerimeter -g MyResourceGroup - """ - - _aaz_info = { - "version": "2021-02-01-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/resourceassociations", "2021-02-01-preview"], - ] - } - - 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.perimeter_name = AAZStrArg( - options=["--perimeter-name"], - help="The name of the network security perimeter.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.skip_token = AAZStrArg( - options=["--skip-token"], - help="SkipToken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls.", - ) - _args_schema.top = AAZIntArg( - options=["--top"], - help="An optional query parameter which specifies the maximum number of records to be returned by the server.", - fmt=AAZIntArgFormat( - maximum=20, - minimum=1, - ), - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NspAssociationsList(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 NspAssociationsList(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/resourceAssociations", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - 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( - "$skipToken", self.ctx.args.skip_token, - ), - **self.serialize_query_param( - "$top", self.ctx.args.top, - ), - **self.serialize_query_param( - "api-version", "2021-02-01-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.access_mode = AAZStrType( - serialized_name="accessMode", - ) - properties.has_provisioning_issues = AAZStrType( - serialized_name="hasProvisioningIssues", - flags={"read_only": True}, - ) - properties.private_link_resource = AAZObjectType( - serialized_name="privateLinkResource", - ) - _ListHelper._build_schema_sub_resource_read(properties.private_link_resource) - properties.profile = AAZObjectType() - _ListHelper._build_schema_sub_resource_read(properties.profile) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - -__all__ = ["List"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter association list", +) +class List(AAZCommand): + """Lists the NSP resource associations. + + :example: List NSP Associations inside a Perimeter + az network perimeter association list --perimeter-name MyPerimeter -g MyResourceGroup + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/resourceassociations", "2021-02-01-preview"], + ] + } + + 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.perimeter_name = AAZStrArg( + options=["--perimeter-name"], + help="The name of the network security perimeter.", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.skip_token = AAZStrArg( + options=["--skip-token"], + help="SkipToken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls.", + ) + _args_schema.top = AAZIntArg( + options=["--top"], + help="An optional query parameter which specifies the maximum number of records to be returned by the server.", + fmt=AAZIntArgFormat( + maximum=20, + minimum=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.NspAssociationsList(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 NspAssociationsList(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/resourceAssociations", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + 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( + "$skipToken", self.ctx.args.skip_token, + ), + **self.serialize_query_param( + "$top", self.ctx.args.top, + ), + **self.serialize_query_param( + "api-version", "2021-02-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + 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() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType() + _element.name = AAZStrType() + _element.properties = AAZObjectType() + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.access_mode = AAZStrType( + serialized_name="accessMode", + ) + properties.has_provisioning_issues = AAZStrType( + serialized_name="hasProvisioningIssues", + flags={"read_only": True}, + ) + properties.private_link_resource = AAZObjectType( + serialized_name="privateLinkResource", + ) + _ListHelper._build_schema_sub_resource_read(properties.private_link_resource) + properties.profile = AAZObjectType() + _ListHelper._build_schema_sub_resource_read(properties.profile) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + _schema_sub_resource_read = None + + @classmethod + def _build_schema_sub_resource_read(cls, _schema): + if cls._schema_sub_resource_read is not None: + _schema.id = cls._schema_sub_resource_read.id + return + + cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() + + sub_resource_read = _schema_sub_resource_read + sub_resource_read.id = AAZStrType() + + _schema.id = cls._schema_sub_resource_read.id + + +__all__ = ["List"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/_show.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/_show.py index 0864bc5b8ec..10dc4cabc11 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/_show.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/_show.py @@ -1,221 +1,221 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter association show", -) -class Show(AAZCommand): - """Gets the specified NSP association by name. - - :example: Get NSP Association - az network perimeter association show -n MyAssociation --perimeter-name MyPerimeter -g MyResourceGroup - """ - - _aaz_info = { - "version": "2021-02-01-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/resourceassociations/{}", "2021-02-01-preview"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return 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.association_name = AAZStrArg( - options=["-n", "--name", "--association-name"], - help="The name of the NSP association.", - required=True, - id_part="child_name_1", - ) - _args_schema.perimeter_name = AAZStrArg( - options=["--perimeter-name"], - help="The name of the network security perimeter.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NspAssociationsGet(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) - return result - - class NspAssociationsGet(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/resourceAssociations/{associationName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "associationName", self.ctx.args.association_name, - required=True, - ), - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - 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", "2021-02-01-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType() - _schema_on_200.name = AAZStrType() - _schema_on_200.properties = AAZObjectType() - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.access_mode = AAZStrType( - serialized_name="accessMode", - ) - properties.has_provisioning_issues = AAZStrType( - serialized_name="hasProvisioningIssues", - flags={"read_only": True}, - ) - properties.private_link_resource = AAZObjectType( - serialized_name="privateLinkResource", - ) - _ShowHelper._build_schema_sub_resource_read(properties.private_link_resource) - properties.profile = AAZObjectType() - _ShowHelper._build_schema_sub_resource_read(properties.profile) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - -__all__ = ["Show"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter association show", +) +class Show(AAZCommand): + """Gets the specified NSP association by name. + + :example: Get NSP Association + az network perimeter association show -n MyAssociation --perimeter-name MyPerimeter -g MyResourceGroup + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/resourceassociations/{}", "2021-02-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return 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.association_name = AAZStrArg( + options=["-n", "--name", "--association-name"], + help="The name of the NSP association.", + required=True, + id_part="child_name_1", + ) + _args_schema.perimeter_name = AAZStrArg( + options=["--perimeter-name"], + help="The name of the network security perimeter.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.NspAssociationsGet(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) + return result + + class NspAssociationsGet(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/resourceAssociations/{associationName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "associationName", self.ctx.args.association_name, + required=True, + ), + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + 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", "2021-02-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + 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.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType() + _schema_on_200.name = AAZStrType() + _schema_on_200.properties = AAZObjectType() + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.access_mode = AAZStrType( + serialized_name="accessMode", + ) + properties.has_provisioning_issues = AAZStrType( + serialized_name="hasProvisioningIssues", + flags={"read_only": True}, + ) + properties.private_link_resource = AAZObjectType( + serialized_name="privateLinkResource", + ) + _ShowHelper._build_schema_sub_resource_read(properties.private_link_resource) + properties.profile = AAZObjectType() + _ShowHelper._build_schema_sub_resource_read(properties.profile) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + _schema_sub_resource_read = None + + @classmethod + def _build_schema_sub_resource_read(cls, _schema): + if cls._schema_sub_resource_read is not None: + _schema.id = cls._schema_sub_resource_read.id + return + + cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() + + sub_resource_read = _schema_sub_resource_read + sub_resource_read.id = AAZStrType() + + _schema.id = cls._schema_sub_resource_read.id + + +__all__ = ["Show"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/_update.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/_update.py index 360b4cc1121..d752d2ba87f 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/_update.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/_update.py @@ -1,469 +1,469 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter association update", -) -class Update(AAZCommand): - """Creates or updates a NSP resource association. - - :example: Update NSP Association - az network perimeter association update --name MyAssociation --perimeter-name MyPerimeter --resource-group MyResourceGroup --access-mode Enforced --private-link-resource id=" --profile id="ProfileArmID" - """ - - _aaz_info = { - "version": "2021-02-01-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/resourceassociations/{}", "2021-02-01-preview"], - ] - } - - AZ_SUPPORT_GENERIC_UPDATE = True - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return 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.association_name = AAZStrArg( - options=["-n", "--name", "--association-name"], - help="The name of the NSP association.", - required=True, - id_part="child_name_1", - ) - _args_schema.perimeter_name = AAZStrArg( - options=["--perimeter-name"], - help="The name of the network security perimeter.", - 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="Resource location.", - nullable=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="Parameters", - help="Resource tags.", - nullable=True, - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg( - nullable=True, - ) - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.access_mode = AAZStrArg( - options=["--access-mode"], - arg_group="Properties", - help="Access mode on the association.", - nullable=True, - enum={"Audit": "Audit", "Enforced": "Enforced", "Learning": "Learning"}, - ) - _args_schema.private_link_resource = AAZObjectArg( - options=["--private-link-resource"], - arg_group="Properties", - help="The PaaS resource to be associated.", - nullable=True, - ) - cls._build_args_sub_resource_update(_args_schema.private_link_resource) - _args_schema.profile = AAZObjectArg( - options=["--profile"], - arg_group="Properties", - help="Profile id to which the PaaS resource is associated.", - nullable=True, - ) - cls._build_args_sub_resource_update(_args_schema.profile) - return cls._args_schema - - _args_sub_resource_update = None - - @classmethod - def _build_args_sub_resource_update(cls, _schema): - if cls._args_sub_resource_update is not None: - _schema.id = cls._args_sub_resource_update.id - return - - cls._args_sub_resource_update = AAZObjectArg( - nullable=True, - ) - - sub_resource_update = cls._args_sub_resource_update - sub_resource_update.id = AAZStrArg( - options=["id"], - help="Resource ID.", - nullable=True, - ) - - _schema.id = cls._args_sub_resource_update.id - - def _execute_operations(self): - self.pre_operations() - self.NspAssociationsGet(ctx=self.ctx)() - self.pre_instance_update(self.ctx.vars.instance) - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - self.NspAssociationsCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - @register_callback - def pre_instance_update(self, instance): - pass - - @register_callback - def post_instance_update(self, instance): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class NspAssociationsGet(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/resourceAssociations/{associationName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "associationName", self.ctx.args.association_name, - required=True, - ), - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - 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", "2021-02-01-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _UpdateHelper._build_schema_nsp_association_read(cls._schema_on_200) - - return cls._schema_on_200 - - class NspAssociationsCreateOrUpdate(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, 201]: - return self.on_200_201(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/resourceAssociations/{associationName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "associationName", self.ctx.args.association_name, - required=True, - ), - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - 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", "2021-02-01-preview", - 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, - value=self.ctx.vars.instance, - ) - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - _UpdateHelper._build_schema_nsp_association_read(cls._schema_on_200_201) - - return cls._schema_on_200_201 - - class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance(self.ctx.vars.instance) - - def _update_instance(self, instance): - _instance_value, _builder = self.new_content_builder( - self.ctx.args, - value=instance, - typ=AAZObjectType - ) - _builder.set_prop("location", AAZStrType, ".location") - _builder.set_prop("name", AAZStrType, ".association_name") - _builder.set_prop("properties", AAZObjectType) - _builder.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("accessMode", AAZStrType, ".access_mode") - _UpdateHelper._build_schema_sub_resource_update(properties.set_prop("privateLinkResource", AAZObjectType, ".private_link_resource")) - _UpdateHelper._build_schema_sub_resource_update(properties.set_prop("profile", AAZObjectType, ".profile")) - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return _instance_value - - class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance_by_generic( - self.ctx.vars.instance, - self.ctx.generic_update_args - ) - - -class _UpdateHelper: - """Helper class for Update""" - - @classmethod - def _build_schema_sub_resource_update(cls, _builder): - if _builder is None: - return - _builder.set_prop("id", AAZStrType, ".id") - - _schema_nsp_association_read = None - - @classmethod - def _build_schema_nsp_association_read(cls, _schema): - if cls._schema_nsp_association_read is not None: - _schema.id = cls._schema_nsp_association_read.id - _schema.location = cls._schema_nsp_association_read.location - _schema.name = cls._schema_nsp_association_read.name - _schema.properties = cls._schema_nsp_association_read.properties - _schema.tags = cls._schema_nsp_association_read.tags - _schema.type = cls._schema_nsp_association_read.type - return - - cls._schema_nsp_association_read = _schema_nsp_association_read = AAZObjectType() - - nsp_association_read = _schema_nsp_association_read - nsp_association_read.id = AAZStrType( - flags={"read_only": True}, - ) - nsp_association_read.location = AAZStrType() - nsp_association_read.name = AAZStrType() - nsp_association_read.properties = AAZObjectType() - nsp_association_read.tags = AAZDictType() - nsp_association_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_nsp_association_read.properties - properties.access_mode = AAZStrType( - serialized_name="accessMode", - ) - properties.has_provisioning_issues = AAZStrType( - serialized_name="hasProvisioningIssues", - flags={"read_only": True}, - ) - properties.private_link_resource = AAZObjectType( - serialized_name="privateLinkResource", - ) - cls._build_schema_sub_resource_read(properties.private_link_resource) - properties.profile = AAZObjectType() - cls._build_schema_sub_resource_read(properties.profile) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - tags = _schema_nsp_association_read.tags - tags.Element = AAZStrType() - - _schema.id = cls._schema_nsp_association_read.id - _schema.location = cls._schema_nsp_association_read.location - _schema.name = cls._schema_nsp_association_read.name - _schema.properties = cls._schema_nsp_association_read.properties - _schema.tags = cls._schema_nsp_association_read.tags - _schema.type = cls._schema_nsp_association_read.type - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - -__all__ = ["Update"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter association update", +) +class Update(AAZCommand): + """Creates or updates a NSP resource association. + + :example: Update NSP Association + az network perimeter association update --name MyAssociation --perimeter-name MyPerimeter --resource-group MyResourceGroup --access-mode Enforced --private-link-resource id=" --profile id="ProfileArmID" + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/resourceassociations/{}", "2021-02-01-preview"], + ] + } + + AZ_SUPPORT_GENERIC_UPDATE = True + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return 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.association_name = AAZStrArg( + options=["-n", "--name", "--association-name"], + help="The name of the NSP association.", + required=True, + id_part="child_name_1", + ) + _args_schema.perimeter_name = AAZStrArg( + options=["--perimeter-name"], + help="The name of the network security perimeter.", + 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="Resource location.", + nullable=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Parameters", + help="Resource tags.", + nullable=True, + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg( + nullable=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.access_mode = AAZStrArg( + options=["--access-mode"], + arg_group="Properties", + help="Access mode on the association.", + nullable=True, + enum={"Audit": "Audit", "Enforced": "Enforced", "Learning": "Learning"}, + ) + _args_schema.private_link_resource = AAZObjectArg( + options=["--private-link-resource"], + arg_group="Properties", + help="The PaaS resource to be associated.", + nullable=True, + ) + cls._build_args_sub_resource_update(_args_schema.private_link_resource) + _args_schema.profile = AAZObjectArg( + options=["--profile"], + arg_group="Properties", + help="Profile id to which the PaaS resource is associated.", + nullable=True, + ) + cls._build_args_sub_resource_update(_args_schema.profile) + return cls._args_schema + + _args_sub_resource_update = None + + @classmethod + def _build_args_sub_resource_update(cls, _schema): + if cls._args_sub_resource_update is not None: + _schema.id = cls._args_sub_resource_update.id + return + + cls._args_sub_resource_update = AAZObjectArg( + nullable=True, + ) + + sub_resource_update = cls._args_sub_resource_update + sub_resource_update.id = AAZStrArg( + options=["id"], + help="Resource ID.", + nullable=True, + ) + + _schema.id = cls._args_sub_resource_update.id + + def _execute_operations(self): + self.pre_operations() + self.NspAssociationsGet(ctx=self.ctx)() + self.pre_instance_update(self.ctx.vars.instance) + self.InstanceUpdateByJson(ctx=self.ctx)() + self.InstanceUpdateByGeneric(ctx=self.ctx)() + self.post_instance_update(self.ctx.vars.instance) + self.NspAssociationsCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + @register_callback + def pre_instance_update(self, instance): + pass + + @register_callback + def post_instance_update(self, instance): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class NspAssociationsGet(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/resourceAssociations/{associationName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "associationName", self.ctx.args.association_name, + required=True, + ), + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + 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", "2021-02-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + 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() + _UpdateHelper._build_schema_nsp_association_read(cls._schema_on_200) + + return cls._schema_on_200 + + class NspAssociationsCreateOrUpdate(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, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/resourceAssociations/{associationName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "associationName", self.ctx.args.association_name, + required=True, + ), + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + 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", "2021-02-01-preview", + 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, + value=self.ctx.vars.instance, + ) + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + _UpdateHelper._build_schema_nsp_association_read(cls._schema_on_200_201) + + return cls._schema_on_200_201 + + class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance(self.ctx.vars.instance) + + def _update_instance(self, instance): + _instance_value, _builder = self.new_content_builder( + self.ctx.args, + value=instance, + typ=AAZObjectType + ) + _builder.set_prop("location", AAZStrType, ".location") + _builder.set_prop("name", AAZStrType, ".association_name") + _builder.set_prop("properties", AAZObjectType) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("accessMode", AAZStrType, ".access_mode") + _UpdateHelper._build_schema_sub_resource_update(properties.set_prop("privateLinkResource", AAZObjectType, ".private_link_resource")) + _UpdateHelper._build_schema_sub_resource_update(properties.set_prop("profile", AAZObjectType, ".profile")) + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return _instance_value + + class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance_by_generic( + self.ctx.vars.instance, + self.ctx.generic_update_args + ) + + +class _UpdateHelper: + """Helper class for Update""" + + @classmethod + def _build_schema_sub_resource_update(cls, _builder): + if _builder is None: + return + _builder.set_prop("id", AAZStrType, ".id") + + _schema_nsp_association_read = None + + @classmethod + def _build_schema_nsp_association_read(cls, _schema): + if cls._schema_nsp_association_read is not None: + _schema.id = cls._schema_nsp_association_read.id + _schema.location = cls._schema_nsp_association_read.location + _schema.name = cls._schema_nsp_association_read.name + _schema.properties = cls._schema_nsp_association_read.properties + _schema.tags = cls._schema_nsp_association_read.tags + _schema.type = cls._schema_nsp_association_read.type + return + + cls._schema_nsp_association_read = _schema_nsp_association_read = AAZObjectType() + + nsp_association_read = _schema_nsp_association_read + nsp_association_read.id = AAZStrType( + flags={"read_only": True}, + ) + nsp_association_read.location = AAZStrType() + nsp_association_read.name = AAZStrType() + nsp_association_read.properties = AAZObjectType() + nsp_association_read.tags = AAZDictType() + nsp_association_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_nsp_association_read.properties + properties.access_mode = AAZStrType( + serialized_name="accessMode", + ) + properties.has_provisioning_issues = AAZStrType( + serialized_name="hasProvisioningIssues", + flags={"read_only": True}, + ) + properties.private_link_resource = AAZObjectType( + serialized_name="privateLinkResource", + ) + cls._build_schema_sub_resource_read(properties.private_link_resource) + properties.profile = AAZObjectType() + cls._build_schema_sub_resource_read(properties.profile) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + tags = _schema_nsp_association_read.tags + tags.Element = AAZStrType() + + _schema.id = cls._schema_nsp_association_read.id + _schema.location = cls._schema_nsp_association_read.location + _schema.name = cls._schema_nsp_association_read.name + _schema.properties = cls._schema_nsp_association_read.properties + _schema.tags = cls._schema_nsp_association_read.tags + _schema.type = cls._schema_nsp_association_read.type + + _schema_sub_resource_read = None + + @classmethod + def _build_schema_sub_resource_read(cls, _schema): + if cls._schema_sub_resource_read is not None: + _schema.id = cls._schema_sub_resource_read.id + return + + cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() + + sub_resource_read = _schema_sub_resource_read + sub_resource_read.id = AAZStrType() + + _schema.id = cls._schema_sub_resource_read.id + + +__all__ = ["Update"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/_wait.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/_wait.py index 86278864249..c2f228b9670 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/_wait.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/association/_wait.py @@ -1,217 +1,217 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter association wait", -) -class Wait(AAZWaitCommand): - """Place the CLI in a waiting state until a condition is met. - """ - - _aaz_info = { - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/resourceassociations/{}", "2021-02-01-preview"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return 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.association_name = AAZStrArg( - options=["-n", "--name", "--association-name"], - help="The name of the NSP association.", - required=True, - id_part="child_name_1", - ) - _args_schema.perimeter_name = AAZStrArg( - options=["--perimeter-name"], - help="The name of the network security perimeter.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NspAssociationsGet(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=False) - return result - - class NspAssociationsGet(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/resourceAssociations/{associationName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "associationName", self.ctx.args.association_name, - required=True, - ), - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - 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", "2021-02-01-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType() - _schema_on_200.name = AAZStrType() - _schema_on_200.properties = AAZObjectType() - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.access_mode = AAZStrType( - serialized_name="accessMode", - ) - properties.has_provisioning_issues = AAZStrType( - serialized_name="hasProvisioningIssues", - flags={"read_only": True}, - ) - properties.private_link_resource = AAZObjectType( - serialized_name="privateLinkResource", - ) - _WaitHelper._build_schema_sub_resource_read(properties.private_link_resource) - properties.profile = AAZObjectType() - _WaitHelper._build_schema_sub_resource_read(properties.profile) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _WaitHelper: - """Helper class for Wait""" - - _schema_sub_resource_read = None - - @classmethod - def _build_schema_sub_resource_read(cls, _schema): - if cls._schema_sub_resource_read is not None: - _schema.id = cls._schema_sub_resource_read.id - return - - cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() - - sub_resource_read = _schema_sub_resource_read - sub_resource_read.id = AAZStrType() - - _schema.id = cls._schema_sub_resource_read.id - - -__all__ = ["Wait"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter association wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/resourceassociations/{}", "2021-02-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return 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.association_name = AAZStrArg( + options=["-n", "--name", "--association-name"], + help="The name of the NSP association.", + required=True, + id_part="child_name_1", + ) + _args_schema.perimeter_name = AAZStrArg( + options=["--perimeter-name"], + help="The name of the network security perimeter.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.NspAssociationsGet(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=False) + return result + + class NspAssociationsGet(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/resourceAssociations/{associationName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "associationName", self.ctx.args.association_name, + required=True, + ), + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + 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", "2021-02-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + 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.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType() + _schema_on_200.name = AAZStrType() + _schema_on_200.properties = AAZObjectType() + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.access_mode = AAZStrType( + serialized_name="accessMode", + ) + properties.has_provisioning_issues = AAZStrType( + serialized_name="hasProvisioningIssues", + flags={"read_only": True}, + ) + properties.private_link_resource = AAZObjectType( + serialized_name="privateLinkResource", + ) + _WaitHelper._build_schema_sub_resource_read(properties.private_link_resource) + properties.profile = AAZObjectType() + _WaitHelper._build_schema_sub_resource_read(properties.profile) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + _schema_sub_resource_read = None + + @classmethod + def _build_schema_sub_resource_read(cls, _schema): + if cls._schema_sub_resource_read is not None: + _schema.id = cls._schema_sub_resource_read.id + return + + cls._schema_sub_resource_read = _schema_sub_resource_read = AAZObjectType() + + sub_resource_read = _schema_sub_resource_read + sub_resource_read.id = AAZStrType() + + _schema.id = cls._schema_sub_resource_read.id + + +__all__ = ["Wait"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/__cmd_group.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/__cmd_group.py index cfbfe8575a9..0f9cb1388ae 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/__cmd_group.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/__cmd_group.py @@ -1,23 +1,23 @@ -# -------------------------------------------------------------------------------------------- -# 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_group( - "network perimeter link", -) -class __CMDGroup(AAZCommandGroup): - """Manage network security perimeter link - """ - pass - - -__all__ = ["__CMDGroup"] +# -------------------------------------------------------------------------------------------- +# 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_group( + "network perimeter link", +) +class __CMDGroup(AAZCommandGroup): + """Manage network security perimeter link + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/__init__.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/__init__.py index db73033039b..b0465fd67f0 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/__init__.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/__init__.py @@ -1,17 +1,17 @@ -# -------------------------------------------------------------------------------------------- -# 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 .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * -from ._wait import * +# -------------------------------------------------------------------------------------------- +# 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 .__cmd_group import * +from ._create import * +from ._delete import * +from ._list import * +from ._show import * +from ._update import * +from ._wait import * diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/_create.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/_create.py index 7d955ad9571..02770526164 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/_create.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/_create.py @@ -1,297 +1,297 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter link create", -) -class Create(AAZCommand): - """Create NSP link resource. - - :example: Create NSP Link - az network perimeter link create --name link1 --perimeter-name nsp1 --resource-group rg1 --auto-remote-nsp-id --local-inbound-profile "[\'*\']" --remote-inbound-profile "[\'*\']" ' - """ - - _aaz_info = { - "version": "2021-02-01-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/links/{}", "2021-02-01-preview"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return 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.link_name = AAZStrArg( - options=["-n", "--name", "--link-name"], - help="The name of the NSP link.", - required=True, - ) - _args_schema.perimeter_name = AAZStrArg( - options=["--perimeter-name"], - help="The name of the network security perimeter.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.auto_remote_nsp_id = AAZStrArg( - options=["--auto-remote-nsp-id"], - arg_group="Properties", - help="Perimeter ARM Id for the remote NSP with which the link gets created in Auto-approval mode. It should be used when the NSP admin have Microsoft.Network/networkSecurityPerimeters/linkPerimeter/action permission on the remote NSP resource.", - ) - _args_schema.description = AAZStrArg( - options=["--description"], - arg_group="Properties", - help="A message passed to the owner of the remote NSP link resource with this connection request. In case of Auto-approved flow, it is default to 'Auto Approved'. Restricted to 140 chars.", - ) - _args_schema.local_inbound_profile = AAZListArg( - options=["--local-inbound-profile"], - arg_group="Properties", - help="List of local Inbound profile names to which Inbound is allowed. Use ['*'] to allow inbound to all profiles. It's default value is ['*'].", - fmt=AAZListArgFormat( - unique=True, - ), - ) - _args_schema.remote_inbound_profile = AAZListArg( - options=["--remote-inbound-profile"], - arg_group="Properties", - help="List of remote Inbound profile names to which Inbound is allowed. Use ['*'] to allow inbound to all profiles. This property can only be updated in auto-approval mode. It's default value is ['*'].", - fmt=AAZListArgFormat( - unique=True, - ), - ) - - local_inbound_profile = cls._args_schema.local_inbound_profile - local_inbound_profile.Element = AAZStrArg() - - remote_inbound_profile = cls._args_schema.remote_inbound_profile - remote_inbound_profile.Element = AAZStrArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NspLinksCreateOrUpdate(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) - return result - - class NspLinksCreateOrUpdate(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, 201]: - return self.on_200_201(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/links/{linkName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "linkName", self.ctx.args.link_name, - required=True, - ), - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - 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", "2021-02-01-preview", - 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("properties", AAZObjectType) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("autoApprovedRemotePerimeterResourceId", AAZStrType, ".auto_remote_nsp_id") - properties.set_prop("description", AAZStrType, ".description") - properties.set_prop("localInboundProfiles", AAZListType, ".local_inbound_profile") - properties.set_prop("remoteInboundProfiles", AAZListType, ".remote_inbound_profile") - - local_inbound_profiles = _builder.get(".properties.localInboundProfiles") - if local_inbound_profiles is not None: - local_inbound_profiles.set_elements(AAZStrType, ".") - - remote_inbound_profiles = _builder.get(".properties.remoteInboundProfiles") - if remote_inbound_profiles is not None: - remote_inbound_profiles.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - - _schema_on_200_201 = cls._schema_on_200_201 - _schema_on_200_201.etag = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200_201.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200_201.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200_201.properties = AAZObjectType() - _schema_on_200_201.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200_201.properties - properties.auto_approved_remote_perimeter_resource_id = AAZStrType( - serialized_name="autoApprovedRemotePerimeterResourceId", - ) - properties.description = AAZStrType() - properties.local_inbound_profiles = AAZListType( - serialized_name="localInboundProfiles", - ) - properties.local_outbound_profiles = AAZListType( - serialized_name="localOutboundProfiles", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.remote_inbound_profiles = AAZListType( - serialized_name="remoteInboundProfiles", - ) - properties.remote_outbound_profiles = AAZListType( - serialized_name="remoteOutboundProfiles", - flags={"read_only": True}, - ) - properties.remote_perimeter_guid = AAZStrType( - serialized_name="remotePerimeterGuid", - flags={"read_only": True}, - ) - properties.remote_perimeter_location = AAZStrType( - serialized_name="remotePerimeterLocation", - flags={"read_only": True}, - ) - properties.status = AAZStrType( - flags={"read_only": True}, - ) - - local_inbound_profiles = cls._schema_on_200_201.properties.local_inbound_profiles - local_inbound_profiles.Element = AAZStrType() - - local_outbound_profiles = cls._schema_on_200_201.properties.local_outbound_profiles - local_outbound_profiles.Element = AAZStrType() - - remote_inbound_profiles = cls._schema_on_200_201.properties.remote_inbound_profiles - remote_inbound_profiles.Element = AAZStrType() - - remote_outbound_profiles = cls._schema_on_200_201.properties.remote_outbound_profiles - remote_outbound_profiles.Element = AAZStrType() - - return cls._schema_on_200_201 - - -class _CreateHelper: - """Helper class for Create""" - - -__all__ = ["Create"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter link create", +) +class Create(AAZCommand): + """Create NSP link resource. + + :example: Create NSP Link + az network perimeter link create --name link1 --perimeter-name nsp1 --resource-group rg1 --auto-remote-nsp-id --local-inbound-profile "[\'*\']" --remote-inbound-profile "[\'*\']" ' + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/links/{}", "2021-02-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return 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.link_name = AAZStrArg( + options=["-n", "--name", "--link-name"], + help="The name of the NSP link.", + required=True, + ) + _args_schema.perimeter_name = AAZStrArg( + options=["--perimeter-name"], + help="The name of the network security perimeter.", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.auto_remote_nsp_id = AAZStrArg( + options=["--auto-remote-nsp-id"], + arg_group="Properties", + help="Perimeter ARM Id for the remote NSP with which the link gets created in Auto-approval mode. It should be used when the NSP admin have Microsoft.Network/networkSecurityPerimeters/linkPerimeter/action permission on the remote NSP resource.", + ) + _args_schema.description = AAZStrArg( + options=["--description"], + arg_group="Properties", + help="A message passed to the owner of the remote NSP link resource with this connection request. In case of Auto-approved flow, it is default to 'Auto Approved'. Restricted to 140 chars.", + ) + _args_schema.local_inbound_profile = AAZListArg( + options=["--local-inbound-profile"], + arg_group="Properties", + help="List of local Inbound profile names to which Inbound is allowed. Use ['*'] to allow inbound to all profiles. It's default value is ['*'].", + fmt=AAZListArgFormat( + unique=True, + ), + ) + _args_schema.remote_inbound_profile = AAZListArg( + options=["--remote-inbound-profile"], + arg_group="Properties", + help="List of remote Inbound profile names to which Inbound is allowed. Use ['*'] to allow inbound to all profiles. This property can only be updated in auto-approval mode. It's default value is ['*'].", + fmt=AAZListArgFormat( + unique=True, + ), + ) + + local_inbound_profile = cls._args_schema.local_inbound_profile + local_inbound_profile.Element = AAZStrArg() + + remote_inbound_profile = cls._args_schema.remote_inbound_profile + remote_inbound_profile.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.NspLinksCreateOrUpdate(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) + return result + + class NspLinksCreateOrUpdate(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, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/links/{linkName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "linkName", self.ctx.args.link_name, + required=True, + ), + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + 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", "2021-02-01-preview", + 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("properties", AAZObjectType) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("autoApprovedRemotePerimeterResourceId", AAZStrType, ".auto_remote_nsp_id") + properties.set_prop("description", AAZStrType, ".description") + properties.set_prop("localInboundProfiles", AAZListType, ".local_inbound_profile") + properties.set_prop("remoteInboundProfiles", AAZListType, ".remote_inbound_profile") + + local_inbound_profiles = _builder.get(".properties.localInboundProfiles") + if local_inbound_profiles is not None: + local_inbound_profiles.set_elements(AAZStrType, ".") + + remote_inbound_profiles = _builder.get(".properties.remoteInboundProfiles") + if remote_inbound_profiles is not None: + remote_inbound_profiles.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.etag = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.auto_approved_remote_perimeter_resource_id = AAZStrType( + serialized_name="autoApprovedRemotePerimeterResourceId", + ) + properties.description = AAZStrType() + properties.local_inbound_profiles = AAZListType( + serialized_name="localInboundProfiles", + ) + properties.local_outbound_profiles = AAZListType( + serialized_name="localOutboundProfiles", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.remote_inbound_profiles = AAZListType( + serialized_name="remoteInboundProfiles", + ) + properties.remote_outbound_profiles = AAZListType( + serialized_name="remoteOutboundProfiles", + flags={"read_only": True}, + ) + properties.remote_perimeter_guid = AAZStrType( + serialized_name="remotePerimeterGuid", + flags={"read_only": True}, + ) + properties.remote_perimeter_location = AAZStrType( + serialized_name="remotePerimeterLocation", + flags={"read_only": True}, + ) + properties.status = AAZStrType( + flags={"read_only": True}, + ) + + local_inbound_profiles = cls._schema_on_200_201.properties.local_inbound_profiles + local_inbound_profiles.Element = AAZStrType() + + local_outbound_profiles = cls._schema_on_200_201.properties.local_outbound_profiles + local_outbound_profiles.Element = AAZStrType() + + remote_inbound_profiles = cls._schema_on_200_201.properties.remote_inbound_profiles + remote_inbound_profiles.Element = AAZStrType() + + remote_outbound_profiles = cls._schema_on_200_201.properties.remote_outbound_profiles + remote_outbound_profiles.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/_delete.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/_delete.py index b9aef3cffaa..3b66fef2237 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/_delete.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/_delete.py @@ -1,173 +1,173 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter link delete", - confirmation="Are you sure you want to perform this operation?", -) -class Delete(AAZCommand): - """Delete an NSP Link resource. - - :example: Delete NSP link - az network perimeter link delete --name link1 --perimeter-name nsp1 --resource-group rg1 - """ - - _aaz_info = { - "version": "2021-02-01-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/links/{}", "2021-02-01-preview"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _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.link_name = AAZStrArg( - options=["-n", "--name", "--link-name"], - help="The name of the NSP link.", - required=True, - id_part="child_name_1", - ) - _args_schema.perimeter_name = AAZStrArg( - options=["--perimeter-name"], - help="The name of the network security perimeter.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.NspLinksDelete(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class NspLinksDelete(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [204]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_204, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/links/{linkName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "linkName", self.ctx.args.link_name, - required=True, - ), - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - 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", "2021-02-01-preview", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter link delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete an NSP Link resource. + + :example: Delete NSP link + az network perimeter link delete --name link1 --perimeter-name nsp1 --resource-group rg1 + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/links/{}", "2021-02-01-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _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.link_name = AAZStrArg( + options=["-n", "--name", "--link-name"], + help="The name of the NSP link.", + required=True, + id_part="child_name_1", + ) + _args_schema.perimeter_name = AAZStrArg( + options=["--perimeter-name"], + help="The name of the network security perimeter.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.NspLinksDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class NspLinksDelete(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 [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/links/{linkName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "linkName", self.ctx.args.link_name, + required=True, + ), + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + 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", "2021-02-01-preview", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/_list.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/_list.py index f41be70e561..c115ae02354 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/_list.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/_list.py @@ -1,250 +1,250 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter link list", -) -class List(AAZCommand): - """List the NSP Link resources in the specified network security perimeter. - - :example: Lists NSP links in a parameter - az network perimeter link list --perimeter-name nsp1 --resource-group rg1 - """ - - _aaz_info = { - "version": "2021-02-01-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/links", "2021-02-01-preview"], - ] - } - - 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.perimeter_name = AAZStrArg( - options=["--perimeter-name"], - help="The name of the network security perimeter.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.skip_token = AAZStrArg( - options=["--skip-token"], - help="SkipToken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls.", - ) - _args_schema.top = AAZIntArg( - options=["--top"], - help="An optional query parameter which specifies the maximum number of records to be returned by the server.", - fmt=AAZIntArgFormat( - maximum=20, - minimum=1, - ), - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NspLinksList(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 NspLinksList(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/links", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - 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( - "$skipToken", self.ctx.args.skip_token, - ), - **self.serialize_query_param( - "$top", self.ctx.args.top, - ), - **self.serialize_query_param( - "api-version", "2021-02-01-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.auto_approved_remote_perimeter_resource_id = AAZStrType( - serialized_name="autoApprovedRemotePerimeterResourceId", - ) - properties.description = AAZStrType() - properties.local_inbound_profiles = AAZListType( - serialized_name="localInboundProfiles", - ) - properties.local_outbound_profiles = AAZListType( - serialized_name="localOutboundProfiles", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.remote_inbound_profiles = AAZListType( - serialized_name="remoteInboundProfiles", - ) - properties.remote_outbound_profiles = AAZListType( - serialized_name="remoteOutboundProfiles", - flags={"read_only": True}, - ) - properties.remote_perimeter_guid = AAZStrType( - serialized_name="remotePerimeterGuid", - flags={"read_only": True}, - ) - properties.remote_perimeter_location = AAZStrType( - serialized_name="remotePerimeterLocation", - flags={"read_only": True}, - ) - properties.status = AAZStrType( - flags={"read_only": True}, - ) - - local_inbound_profiles = cls._schema_on_200.value.Element.properties.local_inbound_profiles - local_inbound_profiles.Element = AAZStrType() - - local_outbound_profiles = cls._schema_on_200.value.Element.properties.local_outbound_profiles - local_outbound_profiles.Element = AAZStrType() - - remote_inbound_profiles = cls._schema_on_200.value.Element.properties.remote_inbound_profiles - remote_inbound_profiles.Element = AAZStrType() - - remote_outbound_profiles = cls._schema_on_200.value.Element.properties.remote_outbound_profiles - remote_outbound_profiles.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - -__all__ = ["List"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter link list", +) +class List(AAZCommand): + """List the NSP Link resources in the specified network security perimeter. + + :example: Lists NSP links in a parameter + az network perimeter link list --perimeter-name nsp1 --resource-group rg1 + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/links", "2021-02-01-preview"], + ] + } + + 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.perimeter_name = AAZStrArg( + options=["--perimeter-name"], + help="The name of the network security perimeter.", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.skip_token = AAZStrArg( + options=["--skip-token"], + help="SkipToken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls.", + ) + _args_schema.top = AAZIntArg( + options=["--top"], + help="An optional query parameter which specifies the maximum number of records to be returned by the server.", + fmt=AAZIntArgFormat( + maximum=20, + minimum=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.NspLinksList(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 NspLinksList(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/links", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + 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( + "$skipToken", self.ctx.args.skip_token, + ), + **self.serialize_query_param( + "$top", self.ctx.args.top, + ), + **self.serialize_query_param( + "api-version", "2021-02-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + 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() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.etag = AAZStrType( + flags={"read_only": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.auto_approved_remote_perimeter_resource_id = AAZStrType( + serialized_name="autoApprovedRemotePerimeterResourceId", + ) + properties.description = AAZStrType() + properties.local_inbound_profiles = AAZListType( + serialized_name="localInboundProfiles", + ) + properties.local_outbound_profiles = AAZListType( + serialized_name="localOutboundProfiles", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.remote_inbound_profiles = AAZListType( + serialized_name="remoteInboundProfiles", + ) + properties.remote_outbound_profiles = AAZListType( + serialized_name="remoteOutboundProfiles", + flags={"read_only": True}, + ) + properties.remote_perimeter_guid = AAZStrType( + serialized_name="remotePerimeterGuid", + flags={"read_only": True}, + ) + properties.remote_perimeter_location = AAZStrType( + serialized_name="remotePerimeterLocation", + flags={"read_only": True}, + ) + properties.status = AAZStrType( + flags={"read_only": True}, + ) + + local_inbound_profiles = cls._schema_on_200.value.Element.properties.local_inbound_profiles + local_inbound_profiles.Element = AAZStrType() + + local_outbound_profiles = cls._schema_on_200.value.Element.properties.local_outbound_profiles + local_outbound_profiles.Element = AAZStrType() + + remote_inbound_profiles = cls._schema_on_200.value.Element.properties.remote_inbound_profiles + remote_inbound_profiles.Element = AAZStrType() + + remote_outbound_profiles = cls._schema_on_200.value.Element.properties.remote_outbound_profiles + remote_outbound_profiles.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/_show.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/_show.py index 78c06220d0a..942c78ce09e 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/_show.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/_show.py @@ -1,234 +1,234 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter link show", -) -class Show(AAZCommand): - """Get the specified NSP link resource. - - :example: Get NSP link - az network perimeter link list --perimeter-name nsp1 --resource-group rg1 - """ - - _aaz_info = { - "version": "2021-02-01-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/links/{}", "2021-02-01-preview"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return 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.link_name = AAZStrArg( - options=["-n", "--name", "--link-name"], - help="The name of the NSP link.", - required=True, - id_part="child_name_1", - ) - _args_schema.perimeter_name = AAZStrArg( - options=["--perimeter-name"], - help="The name of the network security perimeter.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NspLinksGet(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) - return result - - class NspLinksGet(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/links/{linkName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "linkName", self.ctx.args.link_name, - required=True, - ), - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - 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", "2021-02-01-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.etag = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.auto_approved_remote_perimeter_resource_id = AAZStrType( - serialized_name="autoApprovedRemotePerimeterResourceId", - ) - properties.description = AAZStrType() - properties.local_inbound_profiles = AAZListType( - serialized_name="localInboundProfiles", - ) - properties.local_outbound_profiles = AAZListType( - serialized_name="localOutboundProfiles", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.remote_inbound_profiles = AAZListType( - serialized_name="remoteInboundProfiles", - ) - properties.remote_outbound_profiles = AAZListType( - serialized_name="remoteOutboundProfiles", - flags={"read_only": True}, - ) - properties.remote_perimeter_guid = AAZStrType( - serialized_name="remotePerimeterGuid", - flags={"read_only": True}, - ) - properties.remote_perimeter_location = AAZStrType( - serialized_name="remotePerimeterLocation", - flags={"read_only": True}, - ) - properties.status = AAZStrType( - flags={"read_only": True}, - ) - - local_inbound_profiles = cls._schema_on_200.properties.local_inbound_profiles - local_inbound_profiles.Element = AAZStrType() - - local_outbound_profiles = cls._schema_on_200.properties.local_outbound_profiles - local_outbound_profiles.Element = AAZStrType() - - remote_inbound_profiles = cls._schema_on_200.properties.remote_inbound_profiles - remote_inbound_profiles.Element = AAZStrType() - - remote_outbound_profiles = cls._schema_on_200.properties.remote_outbound_profiles - remote_outbound_profiles.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - -__all__ = ["Show"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter link show", +) +class Show(AAZCommand): + """Get the specified NSP link resource. + + :example: Get NSP link + az network perimeter link list --perimeter-name nsp1 --resource-group rg1 + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/links/{}", "2021-02-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return 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.link_name = AAZStrArg( + options=["-n", "--name", "--link-name"], + help="The name of the NSP link.", + required=True, + id_part="child_name_1", + ) + _args_schema.perimeter_name = AAZStrArg( + options=["--perimeter-name"], + help="The name of the network security perimeter.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.NspLinksGet(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) + return result + + class NspLinksGet(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/links/{linkName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "linkName", self.ctx.args.link_name, + required=True, + ), + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + 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", "2021-02-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + 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.etag = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.auto_approved_remote_perimeter_resource_id = AAZStrType( + serialized_name="autoApprovedRemotePerimeterResourceId", + ) + properties.description = AAZStrType() + properties.local_inbound_profiles = AAZListType( + serialized_name="localInboundProfiles", + ) + properties.local_outbound_profiles = AAZListType( + serialized_name="localOutboundProfiles", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.remote_inbound_profiles = AAZListType( + serialized_name="remoteInboundProfiles", + ) + properties.remote_outbound_profiles = AAZListType( + serialized_name="remoteOutboundProfiles", + flags={"read_only": True}, + ) + properties.remote_perimeter_guid = AAZStrType( + serialized_name="remotePerimeterGuid", + flags={"read_only": True}, + ) + properties.remote_perimeter_location = AAZStrType( + serialized_name="remotePerimeterLocation", + flags={"read_only": True}, + ) + properties.status = AAZStrType( + flags={"read_only": True}, + ) + + local_inbound_profiles = cls._schema_on_200.properties.local_inbound_profiles + local_inbound_profiles.Element = AAZStrType() + + local_outbound_profiles = cls._schema_on_200.properties.local_outbound_profiles + local_outbound_profiles.Element = AAZStrType() + + remote_inbound_profiles = cls._schema_on_200.properties.remote_inbound_profiles + remote_inbound_profiles.Element = AAZStrType() + + remote_outbound_profiles = cls._schema_on_200.properties.remote_outbound_profiles + remote_outbound_profiles.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/_update.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/_update.py index 2f1de45b07f..7cc6f384238 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/_update.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/_update.py @@ -1,444 +1,444 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter link update", -) -class Update(AAZCommand): - """Update NSP link resource. - - :example: Update NSP Link - az network perimeter link update --name link1 --perimeter-name nsp1 --resource-group rg1 --local-inbound-profile "[\'*\']" - """ - - _aaz_info = { - "version": "2021-02-01-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/links/{}", "2021-02-01-preview"], - ] - } - - AZ_SUPPORT_GENERIC_UPDATE = True - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return 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.link_name = AAZStrArg( - options=["-n", "--name", "--link-name"], - help="The name of the NSP link.", - required=True, - id_part="child_name_1", - ) - _args_schema.perimeter_name = AAZStrArg( - options=["--perimeter-name"], - help="The name of the network security perimeter.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.description = AAZStrArg( - options=["--description"], - arg_group="Properties", - help="A message passed to the owner of the remote NSP link resource with this connection request. In case of Auto-approved flow, it is default to 'Auto Approved'. Restricted to 140 chars.", - nullable=True, - ) - _args_schema.local_inbound_profile = AAZListArg( - options=["--local-inbound-profile"], - arg_group="Properties", - help="List of local Inbound profile names to which Inbound is allowed. Use ['*'] to allow inbound to all profiles. It's default value is ['*'].", - nullable=True, - fmt=AAZListArgFormat( - unique=True, - ), - ) - _args_schema.remote_inbound_profile = AAZListArg( - options=["--remote-inbound-profile"], - arg_group="Properties", - help="List of remote Inbound profile names to which Inbound is allowed. Use ['*'] to allow inbound to all profiles. This property can only be updated in auto-approval mode. It's default value is ['*'].", - nullable=True, - fmt=AAZListArgFormat( - unique=True, - ), - ) - - local_inbound_profile = cls._args_schema.local_inbound_profile - local_inbound_profile.Element = AAZStrArg( - nullable=True, - ) - - remote_inbound_profile = cls._args_schema.remote_inbound_profile - remote_inbound_profile.Element = AAZStrArg( - nullable=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NspLinksGet(ctx=self.ctx)() - self.pre_instance_update(self.ctx.vars.instance) - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - self.NspLinksCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - @register_callback - def pre_instance_update(self, instance): - pass - - @register_callback - def post_instance_update(self, instance): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class NspLinksGet(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/links/{linkName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "linkName", self.ctx.args.link_name, - required=True, - ), - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - 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", "2021-02-01-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _UpdateHelper._build_schema_nsp_link_read(cls._schema_on_200) - - return cls._schema_on_200 - - class NspLinksCreateOrUpdate(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, 201]: - return self.on_200_201(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/links/{linkName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "linkName", self.ctx.args.link_name, - required=True, - ), - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - 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", "2021-02-01-preview", - 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, - value=self.ctx.vars.instance, - ) - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - _UpdateHelper._build_schema_nsp_link_read(cls._schema_on_200_201) - - return cls._schema_on_200_201 - - class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance(self.ctx.vars.instance) - - def _update_instance(self, instance): - _instance_value, _builder = self.new_content_builder( - self.ctx.args, - value=instance, - typ=AAZObjectType - ) - _builder.set_prop("properties", AAZObjectType) - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("description", AAZStrType, ".description") - properties.set_prop("localInboundProfiles", AAZListType, ".local_inbound_profile") - properties.set_prop("remoteInboundProfiles", AAZListType, ".remote_inbound_profile") - - local_inbound_profiles = _builder.get(".properties.localInboundProfiles") - if local_inbound_profiles is not None: - local_inbound_profiles.set_elements(AAZStrType, ".") - - remote_inbound_profiles = _builder.get(".properties.remoteInboundProfiles") - if remote_inbound_profiles is not None: - remote_inbound_profiles.set_elements(AAZStrType, ".") - - return _instance_value - - class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance_by_generic( - self.ctx.vars.instance, - self.ctx.generic_update_args - ) - - -class _UpdateHelper: - """Helper class for Update""" - - _schema_nsp_link_read = None - - @classmethod - def _build_schema_nsp_link_read(cls, _schema): - if cls._schema_nsp_link_read is not None: - _schema.etag = cls._schema_nsp_link_read.etag - _schema.id = cls._schema_nsp_link_read.id - _schema.name = cls._schema_nsp_link_read.name - _schema.properties = cls._schema_nsp_link_read.properties - _schema.type = cls._schema_nsp_link_read.type - return - - cls._schema_nsp_link_read = _schema_nsp_link_read = AAZObjectType() - - nsp_link_read = _schema_nsp_link_read - nsp_link_read.etag = AAZStrType( - flags={"read_only": True}, - ) - nsp_link_read.id = AAZStrType( - flags={"read_only": True}, - ) - nsp_link_read.name = AAZStrType( - flags={"read_only": True}, - ) - nsp_link_read.properties = AAZObjectType() - nsp_link_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_nsp_link_read.properties - properties.auto_approved_remote_perimeter_resource_id = AAZStrType( - serialized_name="autoApprovedRemotePerimeterResourceId", - ) - properties.description = AAZStrType() - properties.local_inbound_profiles = AAZListType( - serialized_name="localInboundProfiles", - ) - properties.local_outbound_profiles = AAZListType( - serialized_name="localOutboundProfiles", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.remote_inbound_profiles = AAZListType( - serialized_name="remoteInboundProfiles", - ) - properties.remote_outbound_profiles = AAZListType( - serialized_name="remoteOutboundProfiles", - flags={"read_only": True}, - ) - properties.remote_perimeter_guid = AAZStrType( - serialized_name="remotePerimeterGuid", - flags={"read_only": True}, - ) - properties.remote_perimeter_location = AAZStrType( - serialized_name="remotePerimeterLocation", - flags={"read_only": True}, - ) - properties.status = AAZStrType( - flags={"read_only": True}, - ) - - local_inbound_profiles = _schema_nsp_link_read.properties.local_inbound_profiles - local_inbound_profiles.Element = AAZStrType() - - local_outbound_profiles = _schema_nsp_link_read.properties.local_outbound_profiles - local_outbound_profiles.Element = AAZStrType() - - remote_inbound_profiles = _schema_nsp_link_read.properties.remote_inbound_profiles - remote_inbound_profiles.Element = AAZStrType() - - remote_outbound_profiles = _schema_nsp_link_read.properties.remote_outbound_profiles - remote_outbound_profiles.Element = AAZStrType() - - _schema.etag = cls._schema_nsp_link_read.etag - _schema.id = cls._schema_nsp_link_read.id - _schema.name = cls._schema_nsp_link_read.name - _schema.properties = cls._schema_nsp_link_read.properties - _schema.type = cls._schema_nsp_link_read.type - - -__all__ = ["Update"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter link update", +) +class Update(AAZCommand): + """Update NSP link resource. + + :example: Update NSP Link + az network perimeter link update --name link1 --perimeter-name nsp1 --resource-group rg1 --local-inbound-profile "[\'*\']" + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/links/{}", "2021-02-01-preview"], + ] + } + + AZ_SUPPORT_GENERIC_UPDATE = True + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return 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.link_name = AAZStrArg( + options=["-n", "--name", "--link-name"], + help="The name of the NSP link.", + required=True, + id_part="child_name_1", + ) + _args_schema.perimeter_name = AAZStrArg( + options=["--perimeter-name"], + help="The name of the network security perimeter.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.description = AAZStrArg( + options=["--description"], + arg_group="Properties", + help="A message passed to the owner of the remote NSP link resource with this connection request. In case of Auto-approved flow, it is default to 'Auto Approved'. Restricted to 140 chars.", + nullable=True, + ) + _args_schema.local_inbound_profile = AAZListArg( + options=["--local-inbound-profile"], + arg_group="Properties", + help="List of local Inbound profile names to which Inbound is allowed. Use ['*'] to allow inbound to all profiles. It's default value is ['*'].", + nullable=True, + fmt=AAZListArgFormat( + unique=True, + ), + ) + _args_schema.remote_inbound_profile = AAZListArg( + options=["--remote-inbound-profile"], + arg_group="Properties", + help="List of remote Inbound profile names to which Inbound is allowed. Use ['*'] to allow inbound to all profiles. This property can only be updated in auto-approval mode. It's default value is ['*'].", + nullable=True, + fmt=AAZListArgFormat( + unique=True, + ), + ) + + local_inbound_profile = cls._args_schema.local_inbound_profile + local_inbound_profile.Element = AAZStrArg( + nullable=True, + ) + + remote_inbound_profile = cls._args_schema.remote_inbound_profile + remote_inbound_profile.Element = AAZStrArg( + nullable=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.NspLinksGet(ctx=self.ctx)() + self.pre_instance_update(self.ctx.vars.instance) + self.InstanceUpdateByJson(ctx=self.ctx)() + self.InstanceUpdateByGeneric(ctx=self.ctx)() + self.post_instance_update(self.ctx.vars.instance) + self.NspLinksCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + @register_callback + def pre_instance_update(self, instance): + pass + + @register_callback + def post_instance_update(self, instance): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class NspLinksGet(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/links/{linkName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "linkName", self.ctx.args.link_name, + required=True, + ), + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + 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", "2021-02-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + 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() + _UpdateHelper._build_schema_nsp_link_read(cls._schema_on_200) + + return cls._schema_on_200 + + class NspLinksCreateOrUpdate(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, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/links/{linkName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "linkName", self.ctx.args.link_name, + required=True, + ), + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + 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", "2021-02-01-preview", + 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, + value=self.ctx.vars.instance, + ) + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + _UpdateHelper._build_schema_nsp_link_read(cls._schema_on_200_201) + + return cls._schema_on_200_201 + + class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance(self.ctx.vars.instance) + + def _update_instance(self, instance): + _instance_value, _builder = self.new_content_builder( + self.ctx.args, + value=instance, + typ=AAZObjectType + ) + _builder.set_prop("properties", AAZObjectType) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("description", AAZStrType, ".description") + properties.set_prop("localInboundProfiles", AAZListType, ".local_inbound_profile") + properties.set_prop("remoteInboundProfiles", AAZListType, ".remote_inbound_profile") + + local_inbound_profiles = _builder.get(".properties.localInboundProfiles") + if local_inbound_profiles is not None: + local_inbound_profiles.set_elements(AAZStrType, ".") + + remote_inbound_profiles = _builder.get(".properties.remoteInboundProfiles") + if remote_inbound_profiles is not None: + remote_inbound_profiles.set_elements(AAZStrType, ".") + + return _instance_value + + class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance_by_generic( + self.ctx.vars.instance, + self.ctx.generic_update_args + ) + + +class _UpdateHelper: + """Helper class for Update""" + + _schema_nsp_link_read = None + + @classmethod + def _build_schema_nsp_link_read(cls, _schema): + if cls._schema_nsp_link_read is not None: + _schema.etag = cls._schema_nsp_link_read.etag + _schema.id = cls._schema_nsp_link_read.id + _schema.name = cls._schema_nsp_link_read.name + _schema.properties = cls._schema_nsp_link_read.properties + _schema.type = cls._schema_nsp_link_read.type + return + + cls._schema_nsp_link_read = _schema_nsp_link_read = AAZObjectType() + + nsp_link_read = _schema_nsp_link_read + nsp_link_read.etag = AAZStrType( + flags={"read_only": True}, + ) + nsp_link_read.id = AAZStrType( + flags={"read_only": True}, + ) + nsp_link_read.name = AAZStrType( + flags={"read_only": True}, + ) + nsp_link_read.properties = AAZObjectType() + nsp_link_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_nsp_link_read.properties + properties.auto_approved_remote_perimeter_resource_id = AAZStrType( + serialized_name="autoApprovedRemotePerimeterResourceId", + ) + properties.description = AAZStrType() + properties.local_inbound_profiles = AAZListType( + serialized_name="localInboundProfiles", + ) + properties.local_outbound_profiles = AAZListType( + serialized_name="localOutboundProfiles", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.remote_inbound_profiles = AAZListType( + serialized_name="remoteInboundProfiles", + ) + properties.remote_outbound_profiles = AAZListType( + serialized_name="remoteOutboundProfiles", + flags={"read_only": True}, + ) + properties.remote_perimeter_guid = AAZStrType( + serialized_name="remotePerimeterGuid", + flags={"read_only": True}, + ) + properties.remote_perimeter_location = AAZStrType( + serialized_name="remotePerimeterLocation", + flags={"read_only": True}, + ) + properties.status = AAZStrType( + flags={"read_only": True}, + ) + + local_inbound_profiles = _schema_nsp_link_read.properties.local_inbound_profiles + local_inbound_profiles.Element = AAZStrType() + + local_outbound_profiles = _schema_nsp_link_read.properties.local_outbound_profiles + local_outbound_profiles.Element = AAZStrType() + + remote_inbound_profiles = _schema_nsp_link_read.properties.remote_inbound_profiles + remote_inbound_profiles.Element = AAZStrType() + + remote_outbound_profiles = _schema_nsp_link_read.properties.remote_outbound_profiles + remote_outbound_profiles.Element = AAZStrType() + + _schema.etag = cls._schema_nsp_link_read.etag + _schema.id = cls._schema_nsp_link_read.id + _schema.name = cls._schema_nsp_link_read.name + _schema.properties = cls._schema_nsp_link_read.properties + _schema.type = cls._schema_nsp_link_read.type + + +__all__ = ["Update"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/_wait.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/_wait.py index 64527e4d590..7bd0598ed52 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/_wait.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/link/_wait.py @@ -1,230 +1,230 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter link wait", -) -class Wait(AAZWaitCommand): - """Place the CLI in a waiting state until a condition is met. - """ - - _aaz_info = { - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/links/{}", "2021-02-01-preview"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return 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.link_name = AAZStrArg( - options=["-n", "--name", "--link-name"], - help="The name of the NSP link.", - required=True, - id_part="child_name_1", - ) - _args_schema.perimeter_name = AAZStrArg( - options=["--perimeter-name"], - help="The name of the network security perimeter.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NspLinksGet(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=False) - return result - - class NspLinksGet(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/links/{linkName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "linkName", self.ctx.args.link_name, - required=True, - ), - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - 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", "2021-02-01-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.etag = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.auto_approved_remote_perimeter_resource_id = AAZStrType( - serialized_name="autoApprovedRemotePerimeterResourceId", - ) - properties.description = AAZStrType() - properties.local_inbound_profiles = AAZListType( - serialized_name="localInboundProfiles", - ) - properties.local_outbound_profiles = AAZListType( - serialized_name="localOutboundProfiles", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.remote_inbound_profiles = AAZListType( - serialized_name="remoteInboundProfiles", - ) - properties.remote_outbound_profiles = AAZListType( - serialized_name="remoteOutboundProfiles", - flags={"read_only": True}, - ) - properties.remote_perimeter_guid = AAZStrType( - serialized_name="remotePerimeterGuid", - flags={"read_only": True}, - ) - properties.remote_perimeter_location = AAZStrType( - serialized_name="remotePerimeterLocation", - flags={"read_only": True}, - ) - properties.status = AAZStrType( - flags={"read_only": True}, - ) - - local_inbound_profiles = cls._schema_on_200.properties.local_inbound_profiles - local_inbound_profiles.Element = AAZStrType() - - local_outbound_profiles = cls._schema_on_200.properties.local_outbound_profiles - local_outbound_profiles.Element = AAZStrType() - - remote_inbound_profiles = cls._schema_on_200.properties.remote_inbound_profiles - remote_inbound_profiles.Element = AAZStrType() - - remote_outbound_profiles = cls._schema_on_200.properties.remote_outbound_profiles - remote_outbound_profiles.Element = AAZStrType() - - return cls._schema_on_200 - - -class _WaitHelper: - """Helper class for Wait""" - - -__all__ = ["Wait"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter link wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/links/{}", "2021-02-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return 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.link_name = AAZStrArg( + options=["-n", "--name", "--link-name"], + help="The name of the NSP link.", + required=True, + id_part="child_name_1", + ) + _args_schema.perimeter_name = AAZStrArg( + options=["--perimeter-name"], + help="The name of the network security perimeter.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.NspLinksGet(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=False) + return result + + class NspLinksGet(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/links/{linkName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "linkName", self.ctx.args.link_name, + required=True, + ), + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + 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", "2021-02-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + 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.etag = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.auto_approved_remote_perimeter_resource_id = AAZStrType( + serialized_name="autoApprovedRemotePerimeterResourceId", + ) + properties.description = AAZStrType() + properties.local_inbound_profiles = AAZListType( + serialized_name="localInboundProfiles", + ) + properties.local_outbound_profiles = AAZListType( + serialized_name="localOutboundProfiles", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.remote_inbound_profiles = AAZListType( + serialized_name="remoteInboundProfiles", + ) + properties.remote_outbound_profiles = AAZListType( + serialized_name="remoteOutboundProfiles", + flags={"read_only": True}, + ) + properties.remote_perimeter_guid = AAZStrType( + serialized_name="remotePerimeterGuid", + flags={"read_only": True}, + ) + properties.remote_perimeter_location = AAZStrType( + serialized_name="remotePerimeterLocation", + flags={"read_only": True}, + ) + properties.status = AAZStrType( + flags={"read_only": True}, + ) + + local_inbound_profiles = cls._schema_on_200.properties.local_inbound_profiles + local_inbound_profiles.Element = AAZStrType() + + local_outbound_profiles = cls._schema_on_200.properties.local_outbound_profiles + local_outbound_profiles.Element = AAZStrType() + + remote_inbound_profiles = cls._schema_on_200.properties.remote_inbound_profiles + remote_inbound_profiles.Element = AAZStrType() + + remote_outbound_profiles = cls._schema_on_200.properties.remote_outbound_profiles + remote_outbound_profiles.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/link_reference/__cmd_group.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/link_reference/__cmd_group.py index 8b3bbbdbaac..01962fc10e0 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/link_reference/__cmd_group.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/link_reference/__cmd_group.py @@ -1,23 +1,23 @@ -# -------------------------------------------------------------------------------------------- -# 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_group( - "network perimeter link-reference", -) -class __CMDGroup(AAZCommandGroup): - """Manage network security perimeter link reference - """ - pass - - -__all__ = ["__CMDGroup"] +# -------------------------------------------------------------------------------------------- +# 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_group( + "network perimeter link-reference", +) +class __CMDGroup(AAZCommandGroup): + """Manage network security perimeter link reference + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/link_reference/__init__.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/link_reference/__init__.py index f68091245a7..8b93ee3eb92 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/link_reference/__init__.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/link_reference/__init__.py @@ -1,15 +1,15 @@ -# -------------------------------------------------------------------------------------------- -# 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 .__cmd_group import * -from ._delete import * -from ._list import * -from ._show import * -from ._wait import * +# -------------------------------------------------------------------------------------------- +# 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 .__cmd_group import * +from ._delete import * +from ._list import * +from ._show import * +from ._wait import * diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/link_reference/_delete.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/link_reference/_delete.py index 20d15ff2082..e132529ea67 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/link_reference/_delete.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/link_reference/_delete.py @@ -1,173 +1,173 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter link-reference delete", - confirmation="Are you sure you want to perform this operation?", -) -class Delete(AAZCommand): - """Delete an NSP LinkReference resource. - - :example: Delete a link reference - az network perimeter link-reference delete --perimeter-name nsp2 --resource-group rg1 --name linkref2 - """ - - _aaz_info = { - "version": "2021-02-01-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/linkreferences/{}", "2021-02-01-preview"], - ] - } - - AZ_SUPPORT_NO_WAIT = True - - def _handler(self, command_args): - super()._handler(command_args) - return self.build_lro_poller(self._execute_operations, None) - - _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.link_reference_name = AAZStrArg( - options=["-n", "--name", "--link-reference-name"], - help="The name of the NSP linkReference.", - required=True, - id_part="child_name_1", - ) - _args_schema.perimeter_name = AAZStrArg( - options=["--perimeter-name"], - help="The name of the network security perimeter.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - yield self.NspLinkReferencesDelete(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class NspLinkReferencesDelete(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 [202]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [200]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_200, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - if session.http_response.status_code in [204]: - return self.client.build_lro_polling( - self.ctx.args.no_wait, - session, - self.on_204, - self.on_error, - lro_options={"final-state-via": "location"}, - path_format_arguments=self.url_parameters, - ) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/linkReferences/{linkReferenceName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "linkReferenceName", self.ctx.args.link_reference_name, - required=True, - ), - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - 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", "2021-02-01-preview", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter link-reference delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete an NSP LinkReference resource. + + :example: Delete a link reference + az network perimeter link-reference delete --perimeter-name nsp2 --resource-group rg1 --name linkref2 + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/linkreferences/{}", "2021-02-01-preview"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, None) + + _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.link_reference_name = AAZStrArg( + options=["-n", "--name", "--link-reference-name"], + help="The name of the NSP linkReference.", + required=True, + id_part="child_name_1", + ) + _args_schema.perimeter_name = AAZStrArg( + options=["--perimeter-name"], + help="The name of the network security perimeter.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.NspLinkReferencesDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class NspLinkReferencesDelete(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 [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "location"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/linkReferences/{linkReferenceName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "linkReferenceName", self.ctx.args.link_reference_name, + required=True, + ), + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + 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", "2021-02-01-preview", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/link_reference/_list.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/link_reference/_list.py index 33b2fb6ca84..47e47bfae5f 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/link_reference/_list.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/link_reference/_list.py @@ -1,252 +1,252 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter link-reference list", -) -class List(AAZCommand): - """List the NSP LinkReference resources in the specified network security perimeter. - - :example: List NSP link reference - az network perimeter link-reference list --perimeter-name nsp2 --resource-group rg1 - """ - - _aaz_info = { - "version": "2021-02-01-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/linkreferences", "2021-02-01-preview"], - ] - } - - 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.perimeter_name = AAZStrArg( - options=["--perimeter-name"], - help="The name of the network security perimeter.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.skip_token = AAZStrArg( - options=["--skip-token"], - help="SkipToken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls.", - ) - _args_schema.top = AAZIntArg( - options=["--top"], - help="An optional query parameter which specifies the maximum number of records to be returned by the server.", - fmt=AAZIntArgFormat( - maximum=20, - minimum=1, - ), - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NspLinkReferencesList(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 NspLinkReferencesList(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/linkReferences", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - 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( - "$skipToken", self.ctx.args.skip_token, - ), - **self.serialize_query_param( - "$top", self.ctx.args.top, - ), - **self.serialize_query_param( - "api-version", "2021-02-01-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.etag = AAZStrType( - flags={"read_only": True}, - ) - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.name = AAZStrType( - flags={"read_only": True}, - ) - _element.properties = AAZObjectType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.description = AAZStrType( - flags={"read_only": True}, - ) - properties.local_inbound_profiles = AAZListType( - serialized_name="localInboundProfiles", - ) - properties.local_outbound_profiles = AAZListType( - serialized_name="localOutboundProfiles", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.remote_inbound_profiles = AAZListType( - serialized_name="remoteInboundProfiles", - flags={"read_only": True}, - ) - properties.remote_outbound_profiles = AAZListType( - serialized_name="remoteOutboundProfiles", - flags={"read_only": True}, - ) - properties.remote_perimeter_guid = AAZStrType( - serialized_name="remotePerimeterGuid", - flags={"read_only": True}, - ) - properties.remote_perimeter_location = AAZStrType( - serialized_name="remotePerimeterLocation", - flags={"read_only": True}, - ) - properties.remote_perimeter_resource_id = AAZStrType( - serialized_name="remotePerimeterResourceId", - flags={"read_only": True}, - ) - properties.status = AAZStrType() - - local_inbound_profiles = cls._schema_on_200.value.Element.properties.local_inbound_profiles - local_inbound_profiles.Element = AAZStrType() - - local_outbound_profiles = cls._schema_on_200.value.Element.properties.local_outbound_profiles - local_outbound_profiles.Element = AAZStrType() - - remote_inbound_profiles = cls._schema_on_200.value.Element.properties.remote_inbound_profiles - remote_inbound_profiles.Element = AAZStrType() - - remote_outbound_profiles = cls._schema_on_200.value.Element.properties.remote_outbound_profiles - remote_outbound_profiles.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - -__all__ = ["List"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter link-reference list", +) +class List(AAZCommand): + """List the NSP LinkReference resources in the specified network security perimeter. + + :example: List NSP link reference + az network perimeter link-reference list --perimeter-name nsp2 --resource-group rg1 + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/linkreferences", "2021-02-01-preview"], + ] + } + + 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.perimeter_name = AAZStrArg( + options=["--perimeter-name"], + help="The name of the network security perimeter.", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.skip_token = AAZStrArg( + options=["--skip-token"], + help="SkipToken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls.", + ) + _args_schema.top = AAZIntArg( + options=["--top"], + help="An optional query parameter which specifies the maximum number of records to be returned by the server.", + fmt=AAZIntArgFormat( + maximum=20, + minimum=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.NspLinkReferencesList(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 NspLinkReferencesList(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/linkReferences", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + 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( + "$skipToken", self.ctx.args.skip_token, + ), + **self.serialize_query_param( + "$top", self.ctx.args.top, + ), + **self.serialize_query_param( + "api-version", "2021-02-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + 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() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.etag = AAZStrType( + flags={"read_only": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.description = AAZStrType( + flags={"read_only": True}, + ) + properties.local_inbound_profiles = AAZListType( + serialized_name="localInboundProfiles", + ) + properties.local_outbound_profiles = AAZListType( + serialized_name="localOutboundProfiles", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.remote_inbound_profiles = AAZListType( + serialized_name="remoteInboundProfiles", + flags={"read_only": True}, + ) + properties.remote_outbound_profiles = AAZListType( + serialized_name="remoteOutboundProfiles", + flags={"read_only": True}, + ) + properties.remote_perimeter_guid = AAZStrType( + serialized_name="remotePerimeterGuid", + flags={"read_only": True}, + ) + properties.remote_perimeter_location = AAZStrType( + serialized_name="remotePerimeterLocation", + flags={"read_only": True}, + ) + properties.remote_perimeter_resource_id = AAZStrType( + serialized_name="remotePerimeterResourceId", + flags={"read_only": True}, + ) + properties.status = AAZStrType() + + local_inbound_profiles = cls._schema_on_200.value.Element.properties.local_inbound_profiles + local_inbound_profiles.Element = AAZStrType() + + local_outbound_profiles = cls._schema_on_200.value.Element.properties.local_outbound_profiles + local_outbound_profiles.Element = AAZStrType() + + remote_inbound_profiles = cls._schema_on_200.value.Element.properties.remote_inbound_profiles + remote_inbound_profiles.Element = AAZStrType() + + remote_outbound_profiles = cls._schema_on_200.value.Element.properties.remote_outbound_profiles + remote_outbound_profiles.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/link_reference/_show.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/link_reference/_show.py index be40fae51d1..f2a4984761c 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/link_reference/_show.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/link_reference/_show.py @@ -1,236 +1,236 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter link-reference show", -) -class Show(AAZCommand): - """Get the specified NSP linkReference resource. - - :example: Get a link reference - az network perimeter link-reference show --perimeter-name nsp2 --resource-group rg1 --name linkref2 - """ - - _aaz_info = { - "version": "2021-02-01-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/linkreferences/{}", "2021-02-01-preview"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return 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.link_reference_name = AAZStrArg( - options=["-n", "--name", "--link-reference-name"], - help="The name of the NSP linkReference.", - required=True, - id_part="child_name_1", - ) - _args_schema.perimeter_name = AAZStrArg( - options=["--perimeter-name"], - help="The name of the network security perimeter.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NspLinkReferencesGet(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) - return result - - class NspLinkReferencesGet(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/linkReferences/{linkReferenceName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "linkReferenceName", self.ctx.args.link_reference_name, - required=True, - ), - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - 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", "2021-02-01-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.etag = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.description = AAZStrType( - flags={"read_only": True}, - ) - properties.local_inbound_profiles = AAZListType( - serialized_name="localInboundProfiles", - ) - properties.local_outbound_profiles = AAZListType( - serialized_name="localOutboundProfiles", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.remote_inbound_profiles = AAZListType( - serialized_name="remoteInboundProfiles", - flags={"read_only": True}, - ) - properties.remote_outbound_profiles = AAZListType( - serialized_name="remoteOutboundProfiles", - flags={"read_only": True}, - ) - properties.remote_perimeter_guid = AAZStrType( - serialized_name="remotePerimeterGuid", - flags={"read_only": True}, - ) - properties.remote_perimeter_location = AAZStrType( - serialized_name="remotePerimeterLocation", - flags={"read_only": True}, - ) - properties.remote_perimeter_resource_id = AAZStrType( - serialized_name="remotePerimeterResourceId", - flags={"read_only": True}, - ) - properties.status = AAZStrType() - - local_inbound_profiles = cls._schema_on_200.properties.local_inbound_profiles - local_inbound_profiles.Element = AAZStrType() - - local_outbound_profiles = cls._schema_on_200.properties.local_outbound_profiles - local_outbound_profiles.Element = AAZStrType() - - remote_inbound_profiles = cls._schema_on_200.properties.remote_inbound_profiles - remote_inbound_profiles.Element = AAZStrType() - - remote_outbound_profiles = cls._schema_on_200.properties.remote_outbound_profiles - remote_outbound_profiles.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - -__all__ = ["Show"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter link-reference show", +) +class Show(AAZCommand): + """Get the specified NSP linkReference resource. + + :example: Get a link reference + az network perimeter link-reference show --perimeter-name nsp2 --resource-group rg1 --name linkref2 + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/linkreferences/{}", "2021-02-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return 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.link_reference_name = AAZStrArg( + options=["-n", "--name", "--link-reference-name"], + help="The name of the NSP linkReference.", + required=True, + id_part="child_name_1", + ) + _args_schema.perimeter_name = AAZStrArg( + options=["--perimeter-name"], + help="The name of the network security perimeter.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.NspLinkReferencesGet(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) + return result + + class NspLinkReferencesGet(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/linkReferences/{linkReferenceName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "linkReferenceName", self.ctx.args.link_reference_name, + required=True, + ), + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + 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", "2021-02-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + 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.etag = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.description = AAZStrType( + flags={"read_only": True}, + ) + properties.local_inbound_profiles = AAZListType( + serialized_name="localInboundProfiles", + ) + properties.local_outbound_profiles = AAZListType( + serialized_name="localOutboundProfiles", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.remote_inbound_profiles = AAZListType( + serialized_name="remoteInboundProfiles", + flags={"read_only": True}, + ) + properties.remote_outbound_profiles = AAZListType( + serialized_name="remoteOutboundProfiles", + flags={"read_only": True}, + ) + properties.remote_perimeter_guid = AAZStrType( + serialized_name="remotePerimeterGuid", + flags={"read_only": True}, + ) + properties.remote_perimeter_location = AAZStrType( + serialized_name="remotePerimeterLocation", + flags={"read_only": True}, + ) + properties.remote_perimeter_resource_id = AAZStrType( + serialized_name="remotePerimeterResourceId", + flags={"read_only": True}, + ) + properties.status = AAZStrType() + + local_inbound_profiles = cls._schema_on_200.properties.local_inbound_profiles + local_inbound_profiles.Element = AAZStrType() + + local_outbound_profiles = cls._schema_on_200.properties.local_outbound_profiles + local_outbound_profiles.Element = AAZStrType() + + remote_inbound_profiles = cls._schema_on_200.properties.remote_inbound_profiles + remote_inbound_profiles.Element = AAZStrType() + + remote_outbound_profiles = cls._schema_on_200.properties.remote_outbound_profiles + remote_outbound_profiles.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/link_reference/_wait.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/link_reference/_wait.py index 9bb283694b9..adbfbe36fe4 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/link_reference/_wait.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/link_reference/_wait.py @@ -1,232 +1,232 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter link-reference wait", -) -class Wait(AAZWaitCommand): - """Place the CLI in a waiting state until a condition is met. - """ - - _aaz_info = { - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/linkreferences/{}", "2021-02-01-preview"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return 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.link_reference_name = AAZStrArg( - options=["-n", "--name", "--link-reference-name"], - help="The name of the NSP linkReference.", - required=True, - id_part="child_name_1", - ) - _args_schema.perimeter_name = AAZStrArg( - options=["--perimeter-name"], - help="The name of the network security perimeter.", - required=True, - id_part="name", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NspLinkReferencesGet(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=False) - return result - - class NspLinkReferencesGet(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/linkReferences/{linkReferenceName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "linkReferenceName", self.ctx.args.link_reference_name, - required=True, - ), - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - 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", "2021-02-01-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.etag = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.name = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.properties = AAZObjectType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.description = AAZStrType( - flags={"read_only": True}, - ) - properties.local_inbound_profiles = AAZListType( - serialized_name="localInboundProfiles", - ) - properties.local_outbound_profiles = AAZListType( - serialized_name="localOutboundProfiles", - flags={"read_only": True}, - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.remote_inbound_profiles = AAZListType( - serialized_name="remoteInboundProfiles", - flags={"read_only": True}, - ) - properties.remote_outbound_profiles = AAZListType( - serialized_name="remoteOutboundProfiles", - flags={"read_only": True}, - ) - properties.remote_perimeter_guid = AAZStrType( - serialized_name="remotePerimeterGuid", - flags={"read_only": True}, - ) - properties.remote_perimeter_location = AAZStrType( - serialized_name="remotePerimeterLocation", - flags={"read_only": True}, - ) - properties.remote_perimeter_resource_id = AAZStrType( - serialized_name="remotePerimeterResourceId", - flags={"read_only": True}, - ) - properties.status = AAZStrType() - - local_inbound_profiles = cls._schema_on_200.properties.local_inbound_profiles - local_inbound_profiles.Element = AAZStrType() - - local_outbound_profiles = cls._schema_on_200.properties.local_outbound_profiles - local_outbound_profiles.Element = AAZStrType() - - remote_inbound_profiles = cls._schema_on_200.properties.remote_inbound_profiles - remote_inbound_profiles.Element = AAZStrType() - - remote_outbound_profiles = cls._schema_on_200.properties.remote_outbound_profiles - remote_outbound_profiles.Element = AAZStrType() - - return cls._schema_on_200 - - -class _WaitHelper: - """Helper class for Wait""" - - -__all__ = ["Wait"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter link-reference wait", +) +class Wait(AAZWaitCommand): + """Place the CLI in a waiting state until a condition is met. + """ + + _aaz_info = { + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/linkreferences/{}", "2021-02-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return 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.link_reference_name = AAZStrArg( + options=["-n", "--name", "--link-reference-name"], + help="The name of the NSP linkReference.", + required=True, + id_part="child_name_1", + ) + _args_schema.perimeter_name = AAZStrArg( + options=["--perimeter-name"], + help="The name of the network security perimeter.", + required=True, + id_part="name", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.NspLinkReferencesGet(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=False) + return result + + class NspLinkReferencesGet(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/linkReferences/{linkReferenceName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "linkReferenceName", self.ctx.args.link_reference_name, + required=True, + ), + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + 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", "2021-02-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + 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.etag = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.description = AAZStrType( + flags={"read_only": True}, + ) + properties.local_inbound_profiles = AAZListType( + serialized_name="localInboundProfiles", + ) + properties.local_outbound_profiles = AAZListType( + serialized_name="localOutboundProfiles", + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.remote_inbound_profiles = AAZListType( + serialized_name="remoteInboundProfiles", + flags={"read_only": True}, + ) + properties.remote_outbound_profiles = AAZListType( + serialized_name="remoteOutboundProfiles", + flags={"read_only": True}, + ) + properties.remote_perimeter_guid = AAZStrType( + serialized_name="remotePerimeterGuid", + flags={"read_only": True}, + ) + properties.remote_perimeter_location = AAZStrType( + serialized_name="remotePerimeterLocation", + flags={"read_only": True}, + ) + properties.remote_perimeter_resource_id = AAZStrType( + serialized_name="remotePerimeterResourceId", + flags={"read_only": True}, + ) + properties.status = AAZStrType() + + local_inbound_profiles = cls._schema_on_200.properties.local_inbound_profiles + local_inbound_profiles.Element = AAZStrType() + + local_outbound_profiles = cls._schema_on_200.properties.local_outbound_profiles + local_outbound_profiles.Element = AAZStrType() + + remote_inbound_profiles = cls._schema_on_200.properties.remote_inbound_profiles + remote_inbound_profiles.Element = AAZStrType() + + remote_outbound_profiles = cls._schema_on_200.properties.remote_outbound_profiles + remote_outbound_profiles.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/onboarded_resources/__cmd_group.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/onboarded_resources/__cmd_group.py index f0bac8a9c10..245e391a360 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/onboarded_resources/__cmd_group.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/onboarded_resources/__cmd_group.py @@ -1,23 +1,23 @@ -# -------------------------------------------------------------------------------------------- -# 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_group( - "network perimeter onboarded-resources", -) -class __CMDGroup(AAZCommandGroup): - """Manage resources onboarded to NSP - """ - pass - - -__all__ = ["__CMDGroup"] +# -------------------------------------------------------------------------------------------- +# 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_group( + "network perimeter onboarded-resources", +) +class __CMDGroup(AAZCommandGroup): + """Manage resources onboarded to NSP + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/onboarded_resources/__init__.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/onboarded_resources/__init__.py index d63ae5a6fc9..d4c767bb8ac 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/onboarded_resources/__init__.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/onboarded_resources/__init__.py @@ -1,12 +1,12 @@ -# -------------------------------------------------------------------------------------------- -# 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 .__cmd_group import * -from ._list import * +# -------------------------------------------------------------------------------------------- +# 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 .__cmd_group import * +from ._list import * diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/onboarded_resources/_list.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/onboarded_resources/_list.py index facedaa431b..4e3e41583fe 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/onboarded_resources/_list.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/onboarded_resources/_list.py @@ -1,193 +1,193 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter onboarded-resources list", -) -class List(AAZCommand): - """Gets the list of resources that are onboarded with NSP. These resources can be associated with a network security perimeter. - - :example: List NSP onboarded resources - az network perimeter onboarded-resources list -l northcentralus - """ - - _aaz_info = { - "version": "2021-02-01-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.network/locations/{}/perimeterassociableresourcetypes", "2021-02-01-preview"], - ] - } - - 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, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.PerimeterAssociableResourceTypesList(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 PerimeterAssociableResourceTypesList(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}/providers/Microsoft.Network/locations/{location}/perimeterAssociableResourceTypes", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @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( - "subscriptionId", self.ctx.subscription_id, - required=True, - ), - } - return parameters - - @property - def query_parameters(self): - parameters = { - **self.serialize_query_param( - "api-version", "2021-02-01-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.display_name = AAZStrType( - serialized_name="displayName", - flags={"read_only": True}, - ) - properties.public_dns_zones = AAZListType( - serialized_name="publicDnsZones", - flags={"read_only": True}, - ) - properties.resource_type = AAZStrType( - serialized_name="resourceType", - flags={"read_only": True}, - ) - - public_dns_zones = cls._schema_on_200.value.Element.properties.public_dns_zones - public_dns_zones.Element = AAZStrType() - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - -__all__ = ["List"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter onboarded-resources list", +) +class List(AAZCommand): + """Gets the list of resources that are onboarded with NSP. These resources can be associated with a network security perimeter. + + :example: List NSP onboarded resources + az network perimeter onboarded-resources list -l northcentralus + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.network/locations/{}/perimeterassociableresourcetypes", "2021-02-01-preview"], + ] + } + + 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, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.PerimeterAssociableResourceTypesList(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 PerimeterAssociableResourceTypesList(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}/providers/Microsoft.Network/locations/{location}/perimeterAssociableResourceTypes", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @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( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2021-02-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + 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() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType() + _element.name = AAZStrType() + _element.properties = AAZObjectType() + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.display_name = AAZStrType( + serialized_name="displayName", + flags={"read_only": True}, + ) + properties.public_dns_zones = AAZListType( + serialized_name="publicDnsZones", + flags={"read_only": True}, + ) + properties.resource_type = AAZStrType( + serialized_name="resourceType", + flags={"read_only": True}, + ) + + public_dns_zones = cls._schema_on_200.value.Element.properties.public_dns_zones + public_dns_zones.Element = AAZStrType() + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/__cmd_group.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/__cmd_group.py index 00ed54a28fd..342ad3d88bc 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/__cmd_group.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/__cmd_group.py @@ -1,23 +1,23 @@ -# -------------------------------------------------------------------------------------------- -# 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_group( - "network perimeter profile", -) -class __CMDGroup(AAZCommandGroup): - """Manage Network Profiles under an NSP - """ - pass - - -__all__ = ["__CMDGroup"] +# -------------------------------------------------------------------------------------------- +# 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_group( + "network perimeter profile", +) +class __CMDGroup(AAZCommandGroup): + """Manage Network Profiles under an NSP + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/__init__.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/__init__.py index efc3964e3fb..bca7976b1c6 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/__init__.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/__init__.py @@ -1,15 +1,15 @@ -# -------------------------------------------------------------------------------------------- -# 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 .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * +# -------------------------------------------------------------------------------------------- +# 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 .__cmd_group import * +from ._create import * +from ._delete import * +from ._list import * +from ._show import * diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/_create.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/_create.py index f2ed182ae13..775c8c46e7b 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/_create.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/_create.py @@ -1,234 +1,234 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter profile create", -) -class Create(AAZCommand): - """Creates or updates a network profile. - - :example: Create NSP Profile - az network perimeter profile create -n MyProfile --perimeter-name MyPerimeter -g MyResourceGroup - """ - - _aaz_info = { - "version": "2021-02-01-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/profiles/{}", "2021-02-01-preview"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return 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.perimeter_name = AAZStrArg( - options=["--perimeter-name"], - help="The name of the network security perimeter.", - required=True, - ) - _args_schema.profile_name = AAZStrArg( - options=["-n", "--name", "--profile-name"], - help="The name of the NSP profile.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "Parameters" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - arg_group="Parameters", - help="Resource location.", - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="Parameters", - help="Resource tags.", - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg() - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NspProfilesCreateOrUpdate(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) - return result - - class NspProfilesCreateOrUpdate(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, 201]: - return self.on_200_201(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/profiles/{profileName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - required=True, - ), - **self.serialize_url_param( - "profileName", self.ctx.args.profile_name, - 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", "2021-02-01-preview", - 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("location", AAZStrType, ".location") - _builder.set_prop("name", AAZStrType, ".profile_name") - _builder.set_prop("tags", AAZDictType, ".tags") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - - _schema_on_200_201 = cls._schema_on_200_201 - _schema_on_200_201.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200_201.location = AAZStrType() - _schema_on_200_201.name = AAZStrType() - _schema_on_200_201.properties = AAZObjectType() - _schema_on_200_201.tags = AAZDictType() - _schema_on_200_201.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200_201.properties - properties.access_rules_version = AAZStrType( - serialized_name="accessRulesVersion", - flags={"read_only": True}, - ) - properties.diagnostic_settings_version = AAZStrType( - serialized_name="diagnosticSettingsVersion", - flags={"read_only": True}, - ) - - tags = cls._schema_on_200_201.tags - tags.Element = AAZStrType() - - return cls._schema_on_200_201 - - -class _CreateHelper: - """Helper class for Create""" - - -__all__ = ["Create"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter profile create", +) +class Create(AAZCommand): + """Creates or updates a network profile. + + :example: Create NSP Profile + az network perimeter profile create -n MyProfile --perimeter-name MyPerimeter -g MyResourceGroup + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/profiles/{}", "2021-02-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return 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.perimeter_name = AAZStrArg( + options=["--perimeter-name"], + help="The name of the network security perimeter.", + required=True, + ) + _args_schema.profile_name = AAZStrArg( + options=["-n", "--name", "--profile-name"], + help="The name of the NSP profile.", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Parameters" + + _args_schema = cls._args_schema + _args_schema.location = AAZResourceLocationArg( + arg_group="Parameters", + help="Resource location.", + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Parameters", + help="Resource tags.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.NspProfilesCreateOrUpdate(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) + return result + + class NspProfilesCreateOrUpdate(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, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/profiles/{profileName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + required=True, + ), + **self.serialize_url_param( + "profileName", self.ctx.args.profile_name, + 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", "2021-02-01-preview", + 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("location", AAZStrType, ".location") + _builder.set_prop("name", AAZStrType, ".profile_name") + _builder.set_prop("tags", AAZDictType, ".tags") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.location = AAZStrType() + _schema_on_200_201.name = AAZStrType() + _schema_on_200_201.properties = AAZObjectType() + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.access_rules_version = AAZStrType( + serialized_name="accessRulesVersion", + flags={"read_only": True}, + ) + properties.diagnostic_settings_version = AAZStrType( + serialized_name="diagnosticSettingsVersion", + flags={"read_only": True}, + ) + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/_delete.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/_delete.py index c117cffb748..e08972ed22c 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/_delete.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/_delete.py @@ -1,149 +1,149 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter profile delete", - confirmation="Are you sure you want to perform this operation?", -) -class Delete(AAZCommand): - """Deletes an NSP profile. - - :example: Delete NSP Profile - az network perimeter profile delete -n MyProfile --perimeter-name MyPerimeter -g MyResourceGroup - """ - - _aaz_info = { - "version": "2021-02-01-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/profiles/{}", "2021-02-01-preview"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return None - - _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.perimeter_name = AAZStrArg( - options=["--perimeter-name"], - help="The name of the network security perimeter.", - required=True, - id_part="name", - ) - _args_schema.profile_name = AAZStrArg( - options=["-n", "--name", "--profile-name"], - help="The name of the NSP profile.", - required=True, - id_part="child_name_1", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NspProfilesDelete(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class NspProfilesDelete(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) - if session.http_response.status_code in [204]: - return self.on_204(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/profiles/{profileName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - required=True, - ), - **self.serialize_url_param( - "profileName", self.ctx.args.profile_name, - 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", "2021-02-01-preview", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter profile delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Deletes an NSP profile. + + :example: Delete NSP Profile + az network perimeter profile delete -n MyProfile --perimeter-name MyPerimeter -g MyResourceGroup + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/profiles/{}", "2021-02-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return None + + _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.perimeter_name = AAZStrArg( + options=["--perimeter-name"], + help="The name of the network security perimeter.", + required=True, + id_part="name", + ) + _args_schema.profile_name = AAZStrArg( + options=["-n", "--name", "--profile-name"], + help="The name of the NSP profile.", + required=True, + id_part="child_name_1", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.NspProfilesDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class NspProfilesDelete(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) + if session.http_response.status_code in [204]: + return self.on_204(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/profiles/{profileName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + required=True, + ), + **self.serialize_url_param( + "profileName", self.ctx.args.profile_name, + 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", "2021-02-01-preview", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/_list.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/_list.py index 9c528a990e7..46fdf8bac37 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/_list.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/_list.py @@ -1,213 +1,213 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter profile list", -) -class List(AAZCommand): - """Lists the NSP profiles in the specified network security perimeter. - - :example: List NSP Profiles inside a Perimeter - az network perimeter profile list --perimeter-name MyPerimeter -g MyResourceGroup - """ - - _aaz_info = { - "version": "2021-02-01-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/profiles", "2021-02-01-preview"], - ] - } - - 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.perimeter_name = AAZStrArg( - options=["--perimeter-name"], - help="The name of the network security perimeter.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.skip_token = AAZStrArg( - options=["--skip-token"], - help="SkipToken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls.", - ) - _args_schema.top = AAZIntArg( - options=["--top"], - help="An optional query parameter which specifies the maximum number of records to be returned by the server.", - fmt=AAZIntArgFormat( - maximum=20, - minimum=1, - ), - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NspProfilesList(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 NspProfilesList(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/profiles", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - 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( - "$skipToken", self.ctx.args.skip_token, - ), - **self.serialize_query_param( - "$top", self.ctx.args.top, - ), - **self.serialize_query_param( - "api-version", "2021-02-01-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.access_rules_version = AAZStrType( - serialized_name="accessRulesVersion", - flags={"read_only": True}, - ) - properties.diagnostic_settings_version = AAZStrType( - serialized_name="diagnosticSettingsVersion", - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - -__all__ = ["List"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter profile list", +) +class List(AAZCommand): + """Lists the NSP profiles in the specified network security perimeter. + + :example: List NSP Profiles inside a Perimeter + az network perimeter profile list --perimeter-name MyPerimeter -g MyResourceGroup + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/profiles", "2021-02-01-preview"], + ] + } + + 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.perimeter_name = AAZStrArg( + options=["--perimeter-name"], + help="The name of the network security perimeter.", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.skip_token = AAZStrArg( + options=["--skip-token"], + help="SkipToken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls.", + ) + _args_schema.top = AAZIntArg( + options=["--top"], + help="An optional query parameter which specifies the maximum number of records to be returned by the server.", + fmt=AAZIntArgFormat( + maximum=20, + minimum=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.NspProfilesList(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 NspProfilesList(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/profiles", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + 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( + "$skipToken", self.ctx.args.skip_token, + ), + **self.serialize_query_param( + "$top", self.ctx.args.top, + ), + **self.serialize_query_param( + "api-version", "2021-02-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + 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() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType() + _element.name = AAZStrType() + _element.properties = AAZObjectType() + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.access_rules_version = AAZStrType( + serialized_name="accessRulesVersion", + flags={"read_only": True}, + ) + properties.diagnostic_settings_version = AAZStrType( + serialized_name="diagnosticSettingsVersion", + flags={"read_only": True}, + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/_show.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/_show.py index 8f8d7723a36..f446f7a5a03 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/_show.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/_show.py @@ -1,197 +1,197 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter profile show", -) -class Show(AAZCommand): - """Gets the specified NSP profile. - - :example: Get NSP Profile - az network perimeter profile show --perimeter-name MyPerimeter -g MyResourceGroup -n MyProfile - """ - - _aaz_info = { - "version": "2021-02-01-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/profiles/{}", "2021-02-01-preview"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return 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.perimeter_name = AAZStrArg( - options=["--perimeter-name"], - help="The name of the network security perimeter.", - required=True, - id_part="name", - ) - _args_schema.profile_name = AAZStrArg( - options=["-n", "--name", "--profile-name"], - help="The name of the NSP profile.", - required=True, - id_part="child_name_1", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NspProfilesGet(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) - return result - - class NspProfilesGet(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/profiles/{profileName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - required=True, - ), - **self.serialize_url_param( - "profileName", self.ctx.args.profile_name, - 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", "2021-02-01-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType() - _schema_on_200.name = AAZStrType() - _schema_on_200.properties = AAZObjectType() - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.access_rules_version = AAZStrType( - serialized_name="accessRulesVersion", - flags={"read_only": True}, - ) - properties.diagnostic_settings_version = AAZStrType( - serialized_name="diagnosticSettingsVersion", - flags={"read_only": True}, - ) - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - -__all__ = ["Show"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter profile show", +) +class Show(AAZCommand): + """Gets the specified NSP profile. + + :example: Get NSP Profile + az network perimeter profile show --perimeter-name MyPerimeter -g MyResourceGroup -n MyProfile + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/profiles/{}", "2021-02-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return 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.perimeter_name = AAZStrArg( + options=["--perimeter-name"], + help="The name of the network security perimeter.", + required=True, + id_part="name", + ) + _args_schema.profile_name = AAZStrArg( + options=["-n", "--name", "--profile-name"], + help="The name of the NSP profile.", + required=True, + id_part="child_name_1", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.NspProfilesGet(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) + return result + + class NspProfilesGet(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/profiles/{profileName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + required=True, + ), + **self.serialize_url_param( + "profileName", self.ctx.args.profile_name, + 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", "2021-02-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + 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.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType() + _schema_on_200.name = AAZStrType() + _schema_on_200.properties = AAZObjectType() + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.access_rules_version = AAZStrType( + serialized_name="accessRulesVersion", + flags={"read_only": True}, + ) + properties.diagnostic_settings_version = AAZStrType( + serialized_name="diagnosticSettingsVersion", + flags={"read_only": True}, + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/access_rule/__cmd_group.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/access_rule/__cmd_group.py index c3baa473d0e..b647d678831 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/access_rule/__cmd_group.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/access_rule/__cmd_group.py @@ -1,23 +1,23 @@ -# -------------------------------------------------------------------------------------------- -# 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_group( - "network perimeter profile access-rule", -) -class __CMDGroup(AAZCommandGroup): - """Manage Access Rules of a Profile inside an NSP - """ - pass - - -__all__ = ["__CMDGroup"] +# -------------------------------------------------------------------------------------------- +# 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_group( + "network perimeter profile access-rule", +) +class __CMDGroup(AAZCommandGroup): + """Manage Access Rules of a Profile inside an NSP + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/access_rule/__init__.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/access_rule/__init__.py index c401f439385..1f78565855b 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/access_rule/__init__.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/access_rule/__init__.py @@ -1,16 +1,16 @@ -# -------------------------------------------------------------------------------------------- -# 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 .__cmd_group import * -from ._create import * -from ._delete import * -from ._list import * -from ._show import * -from ._update import * +# -------------------------------------------------------------------------------------------- +# 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 .__cmd_group import * +from ._create import * +from ._delete import * +from ._list import * +from ._show import * +from ._update import * diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/access_rule/_create.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/access_rule/_create.py index 31a57fe134e..fcef581e669 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/access_rule/_create.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/access_rule/_create.py @@ -1,409 +1,386 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter profile access-rule create", -) -class Create(AAZCommand): - """Creates or updates a network access rule. - - :example: Create IP based access rule - az network perimeter profile access-rule create -n MyAccessRule --profile-name MyProfile --perimeter-name MyPerimeter -g MyResourceGroup --address-prefixes "[10.10.0.0/16]" - - :example: Create NSP based access rule - az network perimeter profile access-rule create -n MyAccessRule --profile-name MyProfile --perimeter-name MyPerimeter -g MyResourceGroup --nsp "[{id:}]" - - :example: Create FQDN based access rule - az network perimeter profile access-rule create -n MyAccessRule --profile-name MyProfile --perimeter-name MyPerimeter -g MyResourceGroup --fqdn "['www.abc.com', 'www.google.com']" --direction "Outbound" - - :example: Create Subscription based access rule - az network perimeter profile access-rule create -n MyAccessRule --profile-name MyProfile --perimeter-name MyPerimeter -g MyResourceGroup --subscriptions [0].id="" [1].id="" - """ - - _aaz_info = { - "version": "2021-02-01-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/profiles/{}/accessrules/{}", "2021-02-01-preview"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return 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.access_rule_name = AAZStrArg( - options=["-n", "--name", "--access-rule-name"], - help="The name of the NSP access rule.", - required=True, - ) - _args_schema.perimeter_name = AAZStrArg( - options=["--perimeter-name"], - help="The name of the network security perimeter.", - required=True, - ) - _args_schema.profile_name = AAZStrArg( - options=["--profile-name"], - help="The name of the NSP profile.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "Parameters" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - arg_group="Parameters", - help="Resource location.", - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="Parameters", - help="Resource tags.", - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg() - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.address_prefixes = AAZListArg( - options=["--address-prefixes"], - arg_group="Properties", - help="Inbound address prefixes (IPv4/IPv6)", - ) - _args_schema.direction = AAZStrArg( - options=["--direction"], - arg_group="Properties", - help="Direction that specifies whether the access rules is inbound/outbound.", - enum={"Inbound": "Inbound", "Outbound": "Outbound"}, - ) - _args_schema.email_addresses = AAZListArg( - options=["--email-addresses"], - arg_group="Properties", - help="Outbound rules email address format.", - ) - _args_schema.fqdn = AAZListArg( - options=["--fqdn"], - arg_group="Properties", - help="Outbound rules fully qualified domain name format.", - ) - _args_schema.nsp = AAZListArg( - options=["--nsp"], - arg_group="Properties", - help="Inbound rule specified by the perimeter id.", - ) - _args_schema.phone_numbers = AAZListArg( - options=["--phone-numbers"], - arg_group="Properties", - help="Outbound rules phone number format.", - ) - _args_schema.subscriptions = AAZListArg( - options=["--subscriptions"], - arg_group="Properties", - help="Subscription id in the ARM id format.", - ) - - address_prefixes = cls._args_schema.address_prefixes - address_prefixes.Element = AAZStrArg() - - email_addresses = cls._args_schema.email_addresses - email_addresses.Element = AAZStrArg() - - fqdn = cls._args_schema.fqdn - fqdn.Element = AAZStrArg() - - nsp = cls._args_schema.nsp - nsp.Element = AAZObjectArg() - - _element = cls._args_schema.nsp.Element - _element.id = AAZStrArg( - options=["id"], - help="NSP id in the ARM id format.", - ) - - phone_numbers = cls._args_schema.phone_numbers - phone_numbers.Element = AAZStrArg() - - subscriptions = cls._args_schema.subscriptions - subscriptions.Element = AAZObjectArg() - - _element = cls._args_schema.subscriptions.Element - _element.id = AAZStrArg( - options=["id"], - help="Subscription ID in the ARM ID fromat.", - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NspAccessRulesCreateOrUpdate(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) - return result - - class NspAccessRulesCreateOrUpdate(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, 201]: - return self.on_200_201(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/profiles/{profileName}/accessRules/{accessRuleName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "accessRuleName", self.ctx.args.access_rule_name, - required=True, - ), - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - required=True, - ), - **self.serialize_url_param( - "profileName", self.ctx.args.profile_name, - 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", "2021-02-01-preview", - 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("location", AAZStrType, ".location") - _builder.set_prop("name", AAZStrType, ".access_rule_name") - _builder.set_prop("properties", AAZObjectType) - _builder.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("addressPrefixes", AAZListType, ".address_prefixes") - properties.set_prop("direction", AAZStrType, ".direction") - properties.set_prop("emailAddresses", AAZListType, ".email_addresses") - properties.set_prop("fullyQualifiedDomainNames", AAZListType, ".fqdn") - properties.set_prop("networkSecurityPerimeters", AAZListType, ".nsp") - properties.set_prop("phoneNumbers", AAZListType, ".phone_numbers") - properties.set_prop("subscriptions", AAZListType, ".subscriptions") - - address_prefixes = _builder.get(".properties.addressPrefixes") - if address_prefixes is not None: - address_prefixes.set_elements(AAZStrType, ".") - - email_addresses = _builder.get(".properties.emailAddresses") - if email_addresses is not None: - email_addresses.set_elements(AAZStrType, ".") - - fully_qualified_domain_names = _builder.get(".properties.fullyQualifiedDomainNames") - if fully_qualified_domain_names is not None: - fully_qualified_domain_names.set_elements(AAZStrType, ".") - - network_security_perimeters = _builder.get(".properties.networkSecurityPerimeters") - if network_security_perimeters is not None: - network_security_perimeters.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.networkSecurityPerimeters[]") - if _elements is not None: - _elements.set_prop("id", AAZStrType, ".id") - - phone_numbers = _builder.get(".properties.phoneNumbers") - if phone_numbers is not None: - phone_numbers.set_elements(AAZStrType, ".") - - subscriptions = _builder.get(".properties.subscriptions") - if subscriptions is not None: - subscriptions.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.subscriptions[]") - if _elements is not None: - _elements.set_prop("id", AAZStrType, ".id") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - - _schema_on_200_201 = cls._schema_on_200_201 - _schema_on_200_201.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200_201.location = AAZStrType() - _schema_on_200_201.name = AAZStrType() - _schema_on_200_201.properties = AAZObjectType() - _schema_on_200_201.tags = AAZDictType() - _schema_on_200_201.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200_201.properties - properties.address_prefixes = AAZListType( - serialized_name="addressPrefixes", - ) - properties.direction = AAZStrType() - properties.email_addresses = AAZListType( - serialized_name="emailAddresses", - ) - properties.fully_qualified_domain_names = AAZListType( - serialized_name="fullyQualifiedDomainNames", - ) - properties.network_security_perimeters = AAZListType( - serialized_name="networkSecurityPerimeters", - ) - properties.phone_numbers = AAZListType( - serialized_name="phoneNumbers", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subscriptions = AAZListType() - - address_prefixes = cls._schema_on_200_201.properties.address_prefixes - address_prefixes.Element = AAZStrType() - - email_addresses = cls._schema_on_200_201.properties.email_addresses - email_addresses.Element = AAZStrType() - - fully_qualified_domain_names = cls._schema_on_200_201.properties.fully_qualified_domain_names - fully_qualified_domain_names.Element = AAZStrType() - - network_security_perimeters = cls._schema_on_200_201.properties.network_security_perimeters - network_security_perimeters.Element = AAZObjectType() - - _element = cls._schema_on_200_201.properties.network_security_perimeters.Element - _element.id = AAZStrType() - _element.location = AAZStrType( - flags={"read_only": True}, - ) - _element.perimeter_guid = AAZStrType( - serialized_name="perimeterGuid", - flags={"read_only": True}, - ) - - phone_numbers = cls._schema_on_200_201.properties.phone_numbers - phone_numbers.Element = AAZStrType() - - subscriptions = cls._schema_on_200_201.properties.subscriptions - subscriptions.Element = AAZObjectType() - - _element = cls._schema_on_200_201.properties.subscriptions.Element - _element.id = AAZStrType() - - tags = cls._schema_on_200_201.tags - tags.Element = AAZStrType() - - return cls._schema_on_200_201 - - -class _CreateHelper: - """Helper class for Create""" - - -__all__ = ["Create"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter profile access-rule create", +) +class Create(AAZCommand): + """Creates or updates a network access rule. + + :example: Create IP based access rule + az network perimeter profile access-rule create -n MyAccessRule --profile-name MyProfile --perimeter-name MyPerimeter -g MyResourceGroup --address-prefixes "[10.10.0.0/16]" + + :example: Create FQDN based access rule + az network perimeter profile access-rule create -n MyAccessRule --profile-name MyProfile --perimeter-name MyPerimeter -g MyResourceGroup --fqdn "['www.abc.com', 'www.google.com']" --direction "Outbound" + + :example: Create Subscription based access rule + az network perimeter profile access-rule create -n MyAccessRule --profile-name MyProfile --perimeter-name MyPerimeter -g MyResourceGroup --subscriptions [0].id="" [1].id="" + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/profiles/{}/accessrules/{}", "2021-02-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return 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.access_rule_name = AAZStrArg( + options=["-n", "--name", "--access-rule-name"], + help="The name of the NSP access rule.", + required=True, + ) + _args_schema.perimeter_name = AAZStrArg( + options=["--perimeter-name"], + help="The name of the network security perimeter.", + required=True, + ) + _args_schema.profile_name = AAZStrArg( + options=["--profile-name"], + help="The name of the NSP profile.", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Parameters" + + _args_schema = cls._args_schema + _args_schema.location = AAZResourceLocationArg( + arg_group="Parameters", + help="Resource location.", + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Parameters", + help="Resource tags.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.address_prefixes = AAZListArg( + options=["--address-prefixes"], + arg_group="Properties", + help="Inbound address prefixes (IPv4/IPv6)", + ) + _args_schema.direction = AAZStrArg( + options=["--direction"], + arg_group="Properties", + help="Direction that specifies whether the access rules is inbound/outbound.", + enum={"Inbound": "Inbound", "Outbound": "Outbound"}, + ) + _args_schema.email_addresses = AAZListArg( + options=["--email-addresses"], + arg_group="Properties", + help="Outbound rules email address format.", + ) + _args_schema.fqdn = AAZListArg( + options=["--fqdn"], + arg_group="Properties", + help="Outbound rules fully qualified domain name format.", + ) + _args_schema.phone_numbers = AAZListArg( + options=["--phone-numbers"], + arg_group="Properties", + help="Outbound rules phone number format.", + ) + _args_schema.subscriptions = AAZListArg( + options=["--subscriptions"], + arg_group="Properties", + help="Subscription id in the ARM id format.", + ) + + address_prefixes = cls._args_schema.address_prefixes + address_prefixes.Element = AAZStrArg() + + email_addresses = cls._args_schema.email_addresses + email_addresses.Element = AAZStrArg() + + fqdn = cls._args_schema.fqdn + fqdn.Element = AAZStrArg() + + phone_numbers = cls._args_schema.phone_numbers + phone_numbers.Element = AAZStrArg() + + subscriptions = cls._args_schema.subscriptions + subscriptions.Element = AAZObjectArg() + + _element = cls._args_schema.subscriptions.Element + _element.id = AAZStrArg( + options=["id"], + help="Subscription ID in the ARM ID fromat.", + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.NspAccessRulesCreateOrUpdate(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) + return result + + class NspAccessRulesCreateOrUpdate(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, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/profiles/{profileName}/accessRules/{accessRuleName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "accessRuleName", self.ctx.args.access_rule_name, + required=True, + ), + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + required=True, + ), + **self.serialize_url_param( + "profileName", self.ctx.args.profile_name, + 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", "2021-02-01-preview", + 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("location", AAZStrType, ".location") + _builder.set_prop("name", AAZStrType, ".access_rule_name") + _builder.set_prop("properties", AAZObjectType) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("addressPrefixes", AAZListType, ".address_prefixes") + properties.set_prop("direction", AAZStrType, ".direction") + properties.set_prop("emailAddresses", AAZListType, ".email_addresses") + properties.set_prop("fullyQualifiedDomainNames", AAZListType, ".fqdn") + properties.set_prop("phoneNumbers", AAZListType, ".phone_numbers") + properties.set_prop("subscriptions", AAZListType, ".subscriptions") + + address_prefixes = _builder.get(".properties.addressPrefixes") + if address_prefixes is not None: + address_prefixes.set_elements(AAZStrType, ".") + + email_addresses = _builder.get(".properties.emailAddresses") + if email_addresses is not None: + email_addresses.set_elements(AAZStrType, ".") + + fully_qualified_domain_names = _builder.get(".properties.fullyQualifiedDomainNames") + if fully_qualified_domain_names is not None: + fully_qualified_domain_names.set_elements(AAZStrType, ".") + + phone_numbers = _builder.get(".properties.phoneNumbers") + if phone_numbers is not None: + phone_numbers.set_elements(AAZStrType, ".") + + subscriptions = _builder.get(".properties.subscriptions") + if subscriptions is not None: + subscriptions.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.subscriptions[]") + if _elements is not None: + _elements.set_prop("id", AAZStrType, ".id") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.location = AAZStrType() + _schema_on_200_201.name = AAZStrType() + _schema_on_200_201.properties = AAZObjectType() + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.address_prefixes = AAZListType( + serialized_name="addressPrefixes", + ) + properties.direction = AAZStrType() + properties.email_addresses = AAZListType( + serialized_name="emailAddresses", + ) + properties.fully_qualified_domain_names = AAZListType( + serialized_name="fullyQualifiedDomainNames", + ) + properties.network_security_perimeters = AAZListType( + serialized_name="networkSecurityPerimeters", + flags={"read_only": True}, + ) + properties.phone_numbers = AAZListType( + serialized_name="phoneNumbers", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.subscriptions = AAZListType() + + address_prefixes = cls._schema_on_200_201.properties.address_prefixes + address_prefixes.Element = AAZStrType() + + email_addresses = cls._schema_on_200_201.properties.email_addresses + email_addresses.Element = AAZStrType() + + fully_qualified_domain_names = cls._schema_on_200_201.properties.fully_qualified_domain_names + fully_qualified_domain_names.Element = AAZStrType() + + network_security_perimeters = cls._schema_on_200_201.properties.network_security_perimeters + network_security_perimeters.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.network_security_perimeters.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"read_only": True}, + ) + _element.perimeter_guid = AAZStrType( + serialized_name="perimeterGuid", + flags={"read_only": True}, + ) + + phone_numbers = cls._schema_on_200_201.properties.phone_numbers + phone_numbers.Element = AAZStrType() + + subscriptions = cls._schema_on_200_201.properties.subscriptions + subscriptions.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.subscriptions.Element + _element.id = AAZStrType() + + tags = cls._schema_on_200_201.tags + tags.Element = AAZStrType() + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/access_rule/_delete.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/access_rule/_delete.py index 6e7ab6e3f38..96ff195c262 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/access_rule/_delete.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/access_rule/_delete.py @@ -1,159 +1,159 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter profile access-rule delete", - confirmation="Are you sure you want to perform this operation?", -) -class Delete(AAZCommand): - """Deletes an NSP access rule. - - :example: Delete NSP access rule - az network perimeter profile access-rule delete -n MyAccessRule --profile-name MyProfile --perimeter-name MyPerimeter -g MyResourceGroup - """ - - _aaz_info = { - "version": "2021-02-01-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/profiles/{}/accessrules/{}", "2021-02-01-preview"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return None - - _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.access_rule_name = AAZStrArg( - options=["-n", "--name", "--access-rule-name"], - help="The name of the NSP access rule.", - required=True, - id_part="child_name_2", - ) - _args_schema.perimeter_name = AAZStrArg( - options=["--perimeter-name"], - help="The name of the network security perimeter.", - required=True, - id_part="name", - ) - _args_schema.profile_name = AAZStrArg( - options=["--profile-name"], - help="The name of the NSP profile.", - required=True, - id_part="child_name_1", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NspAccessRulesDelete(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - class NspAccessRulesDelete(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) - if session.http_response.status_code in [204]: - return self.on_204(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/profiles/{profileName}/accessRules/{accessRuleName}", - **self.url_parameters - ) - - @property - def method(self): - return "DELETE" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "accessRuleName", self.ctx.args.access_rule_name, - required=True, - ), - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - required=True, - ), - **self.serialize_url_param( - "profileName", self.ctx.args.profile_name, - 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", "2021-02-01-preview", - required=True, - ), - } - return parameters - - def on_200(self, session): - pass - - def on_204(self, session): - pass - - -class _DeleteHelper: - """Helper class for Delete""" - - -__all__ = ["Delete"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter profile access-rule delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Deletes an NSP access rule. + + :example: Delete NSP access rule + az network perimeter profile access-rule delete -n MyAccessRule --profile-name MyProfile --perimeter-name MyPerimeter -g MyResourceGroup + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/profiles/{}/accessrules/{}", "2021-02-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return None + + _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.access_rule_name = AAZStrArg( + options=["-n", "--name", "--access-rule-name"], + help="The name of the NSP access rule.", + required=True, + id_part="child_name_2", + ) + _args_schema.perimeter_name = AAZStrArg( + options=["--perimeter-name"], + help="The name of the network security perimeter.", + required=True, + id_part="name", + ) + _args_schema.profile_name = AAZStrArg( + options=["--profile-name"], + help="The name of the NSP profile.", + required=True, + id_part="child_name_1", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.NspAccessRulesDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class NspAccessRulesDelete(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) + if session.http_response.status_code in [204]: + return self.on_204(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/profiles/{profileName}/accessRules/{accessRuleName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "accessRuleName", self.ctx.args.access_rule_name, + required=True, + ), + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + required=True, + ), + **self.serialize_url_param( + "profileName", self.ctx.args.profile_name, + 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", "2021-02-01-preview", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/access_rule/_list.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/access_rule/_list.py index 25c1d9dac9a..3851436a78a 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/access_rule/_list.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/access_rule/_list.py @@ -1,266 +1,269 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter profile access-rule list", -) -class List(AAZCommand): - """Lists the NSP access rules in the specified NSP profile. - - :example: List access rules inside a Profile - az network perimeter profile access-rule list --profile-name MyProfile --perimeter-name MyPerimeter -g MyResourceGroup - """ - - _aaz_info = { - "version": "2021-02-01-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/profiles/{}/accessrules", "2021-02-01-preview"], - ] - } - - 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.perimeter_name = AAZStrArg( - options=["--perimeter-name"], - help="The name of the network security perimeter.", - required=True, - ) - _args_schema.profile_name = AAZStrArg( - options=["--profile-name"], - help="The name of the NSP profile.", - required=True, - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - _args_schema.skip_token = AAZStrArg( - options=["--skip-token"], - help="SkipToken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls.", - ) - _args_schema.top = AAZIntArg( - options=["--top"], - help="An optional query parameter which specifies the maximum number of records to be returned by the server.", - fmt=AAZIntArgFormat( - maximum=20, - minimum=1, - ), - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NspAccessRulesList(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 NspAccessRulesList(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/profiles/{profileName}/accessRules", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - required=True, - ), - **self.serialize_url_param( - "profileName", self.ctx.args.profile_name, - 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( - "$skipToken", self.ctx.args.skip_token, - ), - **self.serialize_query_param( - "$top", self.ctx.args.top, - ), - **self.serialize_query_param( - "api-version", "2021-02-01-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - - value = cls._schema_on_200.value - value.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element - _element.id = AAZStrType( - flags={"read_only": True}, - ) - _element.location = AAZStrType() - _element.name = AAZStrType() - _element.properties = AAZObjectType() - _element.tags = AAZDictType() - _element.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.value.Element.properties - properties.address_prefixes = AAZListType( - serialized_name="addressPrefixes", - ) - properties.direction = AAZStrType() - properties.email_addresses = AAZListType( - serialized_name="emailAddresses", - ) - properties.fully_qualified_domain_names = AAZListType( - serialized_name="fullyQualifiedDomainNames", - ) - properties.network_security_perimeters = AAZListType( - serialized_name="networkSecurityPerimeters", - ) - properties.phone_numbers = AAZListType( - serialized_name="phoneNumbers", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subscriptions = AAZListType() - - address_prefixes = cls._schema_on_200.value.Element.properties.address_prefixes - address_prefixes.Element = AAZStrType() - - email_addresses = cls._schema_on_200.value.Element.properties.email_addresses - email_addresses.Element = AAZStrType() - - fully_qualified_domain_names = cls._schema_on_200.value.Element.properties.fully_qualified_domain_names - fully_qualified_domain_names.Element = AAZStrType() - - network_security_perimeters = cls._schema_on_200.value.Element.properties.network_security_perimeters - network_security_perimeters.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.network_security_perimeters.Element - _element.id = AAZStrType() - _element.location = AAZStrType( - flags={"read_only": True}, - ) - _element.perimeter_guid = AAZStrType( - serialized_name="perimeterGuid", - flags={"read_only": True}, - ) - - phone_numbers = cls._schema_on_200.value.Element.properties.phone_numbers - phone_numbers.Element = AAZStrType() - - subscriptions = cls._schema_on_200.value.Element.properties.subscriptions - subscriptions.Element = AAZObjectType() - - _element = cls._schema_on_200.value.Element.properties.subscriptions.Element - _element.id = AAZStrType() - - tags = cls._schema_on_200.value.Element.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ListHelper: - """Helper class for List""" - - -__all__ = ["List"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter profile access-rule list", +) +class List(AAZCommand): + """Lists the NSP access rules in the specified NSP profile. + + :example: List access rules inside a Profile + az network perimeter profile access-rule list --profile-name MyProfile --perimeter-name MyPerimeter -g MyResourceGroup + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/profiles/{}/accessrules", "2021-02-01-preview"], + ] + } + + 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.perimeter_name = AAZStrArg( + options=["--perimeter-name"], + help="The name of the network security perimeter.", + required=True, + ) + _args_schema.profile_name = AAZStrArg( + options=["--profile-name"], + help="The name of the NSP profile.", + required=True, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + _args_schema.skip_token = AAZStrArg( + options=["--skip-token"], + help="SkipToken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skipToken parameter that specifies a starting point to use for subsequent calls.", + ) + _args_schema.top = AAZIntArg( + options=["--top"], + help="An optional query parameter which specifies the maximum number of records to be returned by the server.", + fmt=AAZIntArgFormat( + maximum=20, + minimum=1, + ), + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.NspAccessRulesList(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 NspAccessRulesList(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/profiles/{profileName}/accessRules", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + required=True, + ), + **self.serialize_url_param( + "profileName", self.ctx.args.profile_name, + 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( + "$skipToken", self.ctx.args.skip_token, + ), + **self.serialize_query_param( + "$top", self.ctx.args.top, + ), + **self.serialize_query_param( + "api-version", "2021-02-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + 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() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType() + _element.name = AAZStrType() + _element.properties = AAZObjectType() + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.address_prefixes = AAZListType( + serialized_name="addressPrefixes", + ) + properties.direction = AAZStrType() + properties.email_addresses = AAZListType( + serialized_name="emailAddresses", + ) + properties.fully_qualified_domain_names = AAZListType( + serialized_name="fullyQualifiedDomainNames", + ) + properties.network_security_perimeters = AAZListType( + serialized_name="networkSecurityPerimeters", + flags={"read_only": True}, + ) + properties.phone_numbers = AAZListType( + serialized_name="phoneNumbers", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.subscriptions = AAZListType() + + address_prefixes = cls._schema_on_200.value.Element.properties.address_prefixes + address_prefixes.Element = AAZStrType() + + email_addresses = cls._schema_on_200.value.Element.properties.email_addresses + email_addresses.Element = AAZStrType() + + fully_qualified_domain_names = cls._schema_on_200.value.Element.properties.fully_qualified_domain_names + fully_qualified_domain_names.Element = AAZStrType() + + network_security_perimeters = cls._schema_on_200.value.Element.properties.network_security_perimeters + network_security_perimeters.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.network_security_perimeters.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"read_only": True}, + ) + _element.perimeter_guid = AAZStrType( + serialized_name="perimeterGuid", + flags={"read_only": True}, + ) + + phone_numbers = cls._schema_on_200.value.Element.properties.phone_numbers + phone_numbers.Element = AAZStrType() + + subscriptions = cls._schema_on_200.value.Element.properties.subscriptions + subscriptions.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.subscriptions.Element + _element.id = AAZStrType() + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/access_rule/_show.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/access_rule/_show.py index 5ba637ac52b..4765e08a213 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/access_rule/_show.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/access_rule/_show.py @@ -1,251 +1,254 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter profile access-rule show", -) -class Show(AAZCommand): - """Gets the specified NSP access rule by name. - - :example: Get NSP access rule - az network perimeter profile access-rule show -n MyAccessRule --profile-name MyProfile --perimeter-name MyPerimeter -g MyResourceGroup - """ - - _aaz_info = { - "version": "2021-02-01-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/profiles/{}/accessrules/{}", "2021-02-01-preview"], - ] - } - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return 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.access_rule_name = AAZStrArg( - options=["-n", "--name", "--access-rule-name"], - help="The name of the NSP access rule.", - required=True, - id_part="child_name_2", - ) - _args_schema.perimeter_name = AAZStrArg( - options=["--perimeter-name"], - help="The name of the network security perimeter.", - required=True, - id_part="name", - ) - _args_schema.profile_name = AAZStrArg( - options=["--profile-name"], - help="The name of the NSP profile.", - required=True, - id_part="child_name_1", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NspAccessRulesGet(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) - return result - - class NspAccessRulesGet(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/profiles/{profileName}/accessRules/{accessRuleName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "accessRuleName", self.ctx.args.access_rule_name, - required=True, - ), - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - required=True, - ), - **self.serialize_url_param( - "profileName", self.ctx.args.profile_name, - 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", "2021-02-01-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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.id = AAZStrType( - flags={"read_only": True}, - ) - _schema_on_200.location = AAZStrType() - _schema_on_200.name = AAZStrType() - _schema_on_200.properties = AAZObjectType() - _schema_on_200.tags = AAZDictType() - _schema_on_200.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = cls._schema_on_200.properties - properties.address_prefixes = AAZListType( - serialized_name="addressPrefixes", - ) - properties.direction = AAZStrType() - properties.email_addresses = AAZListType( - serialized_name="emailAddresses", - ) - properties.fully_qualified_domain_names = AAZListType( - serialized_name="fullyQualifiedDomainNames", - ) - properties.network_security_perimeters = AAZListType( - serialized_name="networkSecurityPerimeters", - ) - properties.phone_numbers = AAZListType( - serialized_name="phoneNumbers", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subscriptions = AAZListType() - - address_prefixes = cls._schema_on_200.properties.address_prefixes - address_prefixes.Element = AAZStrType() - - email_addresses = cls._schema_on_200.properties.email_addresses - email_addresses.Element = AAZStrType() - - fully_qualified_domain_names = cls._schema_on_200.properties.fully_qualified_domain_names - fully_qualified_domain_names.Element = AAZStrType() - - network_security_perimeters = cls._schema_on_200.properties.network_security_perimeters - network_security_perimeters.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.network_security_perimeters.Element - _element.id = AAZStrType() - _element.location = AAZStrType( - flags={"read_only": True}, - ) - _element.perimeter_guid = AAZStrType( - serialized_name="perimeterGuid", - flags={"read_only": True}, - ) - - phone_numbers = cls._schema_on_200.properties.phone_numbers - phone_numbers.Element = AAZStrType() - - subscriptions = cls._schema_on_200.properties.subscriptions - subscriptions.Element = AAZObjectType() - - _element = cls._schema_on_200.properties.subscriptions.Element - _element.id = AAZStrType() - - tags = cls._schema_on_200.tags - tags.Element = AAZStrType() - - return cls._schema_on_200 - - -class _ShowHelper: - """Helper class for Show""" - - -__all__ = ["Show"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter profile access-rule show", +) +class Show(AAZCommand): + """Gets the specified NSP access rule by name. + + :example: Get NSP access rule + az network perimeter profile access-rule show -n MyAccessRule --profile-name MyProfile --perimeter-name MyPerimeter -g MyResourceGroup + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/profiles/{}/accessrules/{}", "2021-02-01-preview"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return 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.access_rule_name = AAZStrArg( + options=["-n", "--name", "--access-rule-name"], + help="The name of the NSP access rule.", + required=True, + id_part="child_name_2", + ) + _args_schema.perimeter_name = AAZStrArg( + options=["--perimeter-name"], + help="The name of the network security perimeter.", + required=True, + id_part="name", + ) + _args_schema.profile_name = AAZStrArg( + options=["--profile-name"], + help="The name of the NSP profile.", + required=True, + id_part="child_name_1", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.NspAccessRulesGet(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) + return result + + class NspAccessRulesGet(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/profiles/{profileName}/accessRules/{accessRuleName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "accessRuleName", self.ctx.args.access_rule_name, + required=True, + ), + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + required=True, + ), + **self.serialize_url_param( + "profileName", self.ctx.args.profile_name, + 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", "2021-02-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + 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.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType() + _schema_on_200.name = AAZStrType() + _schema_on_200.properties = AAZObjectType() + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.address_prefixes = AAZListType( + serialized_name="addressPrefixes", + ) + properties.direction = AAZStrType() + properties.email_addresses = AAZListType( + serialized_name="emailAddresses", + ) + properties.fully_qualified_domain_names = AAZListType( + serialized_name="fullyQualifiedDomainNames", + ) + properties.network_security_perimeters = AAZListType( + serialized_name="networkSecurityPerimeters", + flags={"read_only": True}, + ) + properties.phone_numbers = AAZListType( + serialized_name="phoneNumbers", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.subscriptions = AAZListType() + + address_prefixes = cls._schema_on_200.properties.address_prefixes + address_prefixes.Element = AAZStrType() + + email_addresses = cls._schema_on_200.properties.email_addresses + email_addresses.Element = AAZStrType() + + fully_qualified_domain_names = cls._schema_on_200.properties.fully_qualified_domain_names + fully_qualified_domain_names.Element = AAZStrType() + + network_security_perimeters = cls._schema_on_200.properties.network_security_perimeters + network_security_perimeters.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.network_security_perimeters.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"read_only": True}, + ) + _element.perimeter_guid = AAZStrType( + serialized_name="perimeterGuid", + flags={"read_only": True}, + ) + + phone_numbers = cls._schema_on_200.properties.phone_numbers + phone_numbers.Element = AAZStrType() + + subscriptions = cls._schema_on_200.properties.subscriptions + subscriptions.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.subscriptions.Element + _element.id = AAZStrType() + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/access_rule/_update.py b/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/access_rule/_update.py index 307f3e45b17..b357baad058 100644 --- a/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/access_rule/_update.py +++ b/src/nsp/azext_nsp/aaz/latest/network/perimeter/profile/access_rule/_update.py @@ -1,578 +1,554 @@ -# -------------------------------------------------------------------------------------------- -# 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( - "network perimeter profile access-rule update", -) -class Update(AAZCommand): - """Creates or updates a network access rule. - - :example: Update access rule - az network perimeter profile access-rule update -n MyAccessRule --profile-name MyProfile --perimeter-name MyPerimeter -g MyResourceGroup --address-prefixes "[10.10.0.0/16]" - """ - - _aaz_info = { - "version": "2021-02-01-preview", - "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/profiles/{}/accessrules/{}", "2021-02-01-preview"], - ] - } - - AZ_SUPPORT_GENERIC_UPDATE = True - - def _handler(self, command_args): - super()._handler(command_args) - self._execute_operations() - return 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.access_rule_name = AAZStrArg( - options=["-n", "--name", "--access-rule-name"], - help="The name of the NSP access rule.", - required=True, - id_part="child_name_2", - ) - _args_schema.perimeter_name = AAZStrArg( - options=["--perimeter-name"], - help="The name of the network security perimeter.", - required=True, - id_part="name", - ) - _args_schema.profile_name = AAZStrArg( - options=["--profile-name"], - help="The name of the NSP profile.", - required=True, - id_part="child_name_1", - ) - _args_schema.resource_group = AAZResourceGroupNameArg( - required=True, - ) - - # define Arg Group "Parameters" - - _args_schema = cls._args_schema - _args_schema.location = AAZResourceLocationArg( - arg_group="Parameters", - help="Resource location.", - nullable=True, - fmt=AAZResourceLocationArgFormat( - resource_group_arg="resource_group", - ), - ) - _args_schema.tags = AAZDictArg( - options=["--tags"], - arg_group="Parameters", - help="Resource tags.", - nullable=True, - ) - - tags = cls._args_schema.tags - tags.Element = AAZStrArg( - nullable=True, - ) - - # define Arg Group "Properties" - - _args_schema = cls._args_schema - _args_schema.address_prefixes = AAZListArg( - options=["--address-prefixes"], - arg_group="Properties", - help="Inbound address prefixes (IPv4/IPv6)", - nullable=True, - ) - _args_schema.direction = AAZStrArg( - options=["--direction"], - arg_group="Properties", - help="Direction that specifies whether the access rules is inbound/outbound.", - nullable=True, - enum={"Inbound": "Inbound", "Outbound": "Outbound"}, - ) - _args_schema.email_addresses = AAZListArg( - options=["--email-addresses"], - arg_group="Properties", - help="Outbound rules email address format.", - nullable=True, - ) - _args_schema.fqdn = AAZListArg( - options=["--fqdn"], - arg_group="Properties", - help="Outbound rules fully qualified domain name format.", - nullable=True, - ) - _args_schema.nsp = AAZListArg( - options=["--nsp"], - arg_group="Properties", - help="Inbound rule specified by the perimeter id.", - nullable=True, - ) - _args_schema.phone_numbers = AAZListArg( - options=["--phone-numbers"], - arg_group="Properties", - help="Outbound rules phone number format.", - nullable=True, - ) - _args_schema.subscriptions = AAZListArg( - options=["--subscriptions"], - arg_group="Properties", - help="Subscription id in the ARM id format.", - nullable=True, - ) - - address_prefixes = cls._args_schema.address_prefixes - address_prefixes.Element = AAZStrArg( - nullable=True, - ) - - email_addresses = cls._args_schema.email_addresses - email_addresses.Element = AAZStrArg( - nullable=True, - ) - - fqdn = cls._args_schema.fqdn - fqdn.Element = AAZStrArg( - nullable=True, - ) - - nsp = cls._args_schema.nsp - nsp.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_schema.nsp.Element - _element.id = AAZStrArg( - options=["id"], - help="NSP id in the ARM id format.", - nullable=True, - ) - - phone_numbers = cls._args_schema.phone_numbers - phone_numbers.Element = AAZStrArg( - nullable=True, - ) - - subscriptions = cls._args_schema.subscriptions - subscriptions.Element = AAZObjectArg( - nullable=True, - ) - - _element = cls._args_schema.subscriptions.Element - _element.id = AAZStrArg( - options=["id"], - help="Subscription ID in the ARM ID fromat.", - nullable=True, - ) - return cls._args_schema - - def _execute_operations(self): - self.pre_operations() - self.NspAccessRulesGet(ctx=self.ctx)() - self.pre_instance_update(self.ctx.vars.instance) - self.InstanceUpdateByJson(ctx=self.ctx)() - self.InstanceUpdateByGeneric(ctx=self.ctx)() - self.post_instance_update(self.ctx.vars.instance) - self.NspAccessRulesCreateOrUpdate(ctx=self.ctx)() - self.post_operations() - - @register_callback - def pre_operations(self): - pass - - @register_callback - def post_operations(self): - pass - - @register_callback - def pre_instance_update(self, instance): - pass - - @register_callback - def post_instance_update(self, instance): - pass - - def _output(self, *args, **kwargs): - result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) - return result - - class NspAccessRulesGet(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/profiles/{profileName}/accessRules/{accessRuleName}", - **self.url_parameters - ) - - @property - def method(self): - return "GET" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "accessRuleName", self.ctx.args.access_rule_name, - required=True, - ), - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - required=True, - ), - **self.serialize_url_param( - "profileName", self.ctx.args.profile_name, - 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", "2021-02-01-preview", - required=True, - ), - } - return parameters - - @property - def header_parameters(self): - parameters = { - **self.serialize_header_param( - "Accept", "application/json", - ), - } - return parameters - - 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() - _UpdateHelper._build_schema_nsp_access_rule_read(cls._schema_on_200) - - return cls._schema_on_200 - - class NspAccessRulesCreateOrUpdate(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, 201]: - return self.on_200_201(session) - - return self.on_error(session.http_response) - - @property - def url(self): - return self.client.format_url( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/profiles/{profileName}/accessRules/{accessRuleName}", - **self.url_parameters - ) - - @property - def method(self): - return "PUT" - - @property - def error_format(self): - return "ODataV4Format" - - @property - def url_parameters(self): - parameters = { - **self.serialize_url_param( - "accessRuleName", self.ctx.args.access_rule_name, - required=True, - ), - **self.serialize_url_param( - "networkSecurityPerimeterName", self.ctx.args.perimeter_name, - required=True, - ), - **self.serialize_url_param( - "profileName", self.ctx.args.profile_name, - 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", "2021-02-01-preview", - 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, - value=self.ctx.vars.instance, - ) - - return self.serialize_content(_content_value) - - def on_200_201(self, session): - data = self.deserialize_http_content(session) - self.ctx.set_var( - "instance", - data, - schema_builder=self._build_schema_on_200_201 - ) - - _schema_on_200_201 = None - - @classmethod - def _build_schema_on_200_201(cls): - if cls._schema_on_200_201 is not None: - return cls._schema_on_200_201 - - cls._schema_on_200_201 = AAZObjectType() - _UpdateHelper._build_schema_nsp_access_rule_read(cls._schema_on_200_201) - - return cls._schema_on_200_201 - - class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance(self.ctx.vars.instance) - - def _update_instance(self, instance): - _instance_value, _builder = self.new_content_builder( - self.ctx.args, - value=instance, - typ=AAZObjectType - ) - _builder.set_prop("location", AAZStrType, ".location") - _builder.set_prop("name", AAZStrType, ".access_rule_name") - _builder.set_prop("properties", AAZObjectType) - _builder.set_prop("tags", AAZDictType, ".tags") - - properties = _builder.get(".properties") - if properties is not None: - properties.set_prop("addressPrefixes", AAZListType, ".address_prefixes") - properties.set_prop("direction", AAZStrType, ".direction") - properties.set_prop("emailAddresses", AAZListType, ".email_addresses") - properties.set_prop("fullyQualifiedDomainNames", AAZListType, ".fqdn") - properties.set_prop("networkSecurityPerimeters", AAZListType, ".nsp") - properties.set_prop("phoneNumbers", AAZListType, ".phone_numbers") - properties.set_prop("subscriptions", AAZListType, ".subscriptions") - - address_prefixes = _builder.get(".properties.addressPrefixes") - if address_prefixes is not None: - address_prefixes.set_elements(AAZStrType, ".") - - email_addresses = _builder.get(".properties.emailAddresses") - if email_addresses is not None: - email_addresses.set_elements(AAZStrType, ".") - - fully_qualified_domain_names = _builder.get(".properties.fullyQualifiedDomainNames") - if fully_qualified_domain_names is not None: - fully_qualified_domain_names.set_elements(AAZStrType, ".") - - network_security_perimeters = _builder.get(".properties.networkSecurityPerimeters") - if network_security_perimeters is not None: - network_security_perimeters.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.networkSecurityPerimeters[]") - if _elements is not None: - _elements.set_prop("id", AAZStrType, ".id") - - phone_numbers = _builder.get(".properties.phoneNumbers") - if phone_numbers is not None: - phone_numbers.set_elements(AAZStrType, ".") - - subscriptions = _builder.get(".properties.subscriptions") - if subscriptions is not None: - subscriptions.set_elements(AAZObjectType, ".") - - _elements = _builder.get(".properties.subscriptions[]") - if _elements is not None: - _elements.set_prop("id", AAZStrType, ".id") - - tags = _builder.get(".tags") - if tags is not None: - tags.set_elements(AAZStrType, ".") - - return _instance_value - - class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): - - def __call__(self, *args, **kwargs): - self._update_instance_by_generic( - self.ctx.vars.instance, - self.ctx.generic_update_args - ) - - -class _UpdateHelper: - """Helper class for Update""" - - _schema_nsp_access_rule_read = None - - @classmethod - def _build_schema_nsp_access_rule_read(cls, _schema): - if cls._schema_nsp_access_rule_read is not None: - _schema.id = cls._schema_nsp_access_rule_read.id - _schema.location = cls._schema_nsp_access_rule_read.location - _schema.name = cls._schema_nsp_access_rule_read.name - _schema.properties = cls._schema_nsp_access_rule_read.properties - _schema.tags = cls._schema_nsp_access_rule_read.tags - _schema.type = cls._schema_nsp_access_rule_read.type - return - - cls._schema_nsp_access_rule_read = _schema_nsp_access_rule_read = AAZObjectType() - - nsp_access_rule_read = _schema_nsp_access_rule_read - nsp_access_rule_read.id = AAZStrType( - flags={"read_only": True}, - ) - nsp_access_rule_read.location = AAZStrType() - nsp_access_rule_read.name = AAZStrType() - nsp_access_rule_read.properties = AAZObjectType() - nsp_access_rule_read.tags = AAZDictType() - nsp_access_rule_read.type = AAZStrType( - flags={"read_only": True}, - ) - - properties = _schema_nsp_access_rule_read.properties - properties.address_prefixes = AAZListType( - serialized_name="addressPrefixes", - ) - properties.direction = AAZStrType() - properties.email_addresses = AAZListType( - serialized_name="emailAddresses", - ) - properties.fully_qualified_domain_names = AAZListType( - serialized_name="fullyQualifiedDomainNames", - ) - properties.network_security_perimeters = AAZListType( - serialized_name="networkSecurityPerimeters", - ) - properties.phone_numbers = AAZListType( - serialized_name="phoneNumbers", - ) - properties.provisioning_state = AAZStrType( - serialized_name="provisioningState", - flags={"read_only": True}, - ) - properties.subscriptions = AAZListType() - - address_prefixes = _schema_nsp_access_rule_read.properties.address_prefixes - address_prefixes.Element = AAZStrType() - - email_addresses = _schema_nsp_access_rule_read.properties.email_addresses - email_addresses.Element = AAZStrType() - - fully_qualified_domain_names = _schema_nsp_access_rule_read.properties.fully_qualified_domain_names - fully_qualified_domain_names.Element = AAZStrType() - - network_security_perimeters = _schema_nsp_access_rule_read.properties.network_security_perimeters - network_security_perimeters.Element = AAZObjectType() - - _element = _schema_nsp_access_rule_read.properties.network_security_perimeters.Element - _element.id = AAZStrType() - _element.location = AAZStrType( - flags={"read_only": True}, - ) - _element.perimeter_guid = AAZStrType( - serialized_name="perimeterGuid", - flags={"read_only": True}, - ) - - phone_numbers = _schema_nsp_access_rule_read.properties.phone_numbers - phone_numbers.Element = AAZStrType() - - subscriptions = _schema_nsp_access_rule_read.properties.subscriptions - subscriptions.Element = AAZObjectType() - - _element = _schema_nsp_access_rule_read.properties.subscriptions.Element - _element.id = AAZStrType() - - tags = _schema_nsp_access_rule_read.tags - tags.Element = AAZStrType() - - _schema.id = cls._schema_nsp_access_rule_read.id - _schema.location = cls._schema_nsp_access_rule_read.location - _schema.name = cls._schema_nsp_access_rule_read.name - _schema.properties = cls._schema_nsp_access_rule_read.properties - _schema.tags = cls._schema_nsp_access_rule_read.tags - _schema.type = cls._schema_nsp_access_rule_read.type - - -__all__ = ["Update"] +# -------------------------------------------------------------------------------------------- +# 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( + "network perimeter profile access-rule update", +) +class Update(AAZCommand): + """Creates or updates a network access rule. + + :example: Update access rule + az network perimeter profile access-rule update -n MyAccessRule --profile-name MyProfile --perimeter-name MyPerimeter -g MyResourceGroup --address-prefixes "[10.10.0.0/16]" + """ + + _aaz_info = { + "version": "2021-02-01-preview", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.network/networksecurityperimeters/{}/profiles/{}/accessrules/{}", "2021-02-01-preview"], + ] + } + + AZ_SUPPORT_GENERIC_UPDATE = True + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return 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.access_rule_name = AAZStrArg( + options=["-n", "--name", "--access-rule-name"], + help="The name of the NSP access rule.", + required=True, + id_part="child_name_2", + ) + _args_schema.perimeter_name = AAZStrArg( + options=["--perimeter-name"], + help="The name of the network security perimeter.", + required=True, + id_part="name", + ) + _args_schema.profile_name = AAZStrArg( + options=["--profile-name"], + help="The name of the NSP profile.", + required=True, + id_part="child_name_1", + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Parameters" + + _args_schema = cls._args_schema + _args_schema.location = AAZResourceLocationArg( + arg_group="Parameters", + help="Resource location.", + nullable=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="Parameters", + help="Resource tags.", + nullable=True, + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg( + nullable=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.address_prefixes = AAZListArg( + options=["--address-prefixes"], + arg_group="Properties", + help="Inbound address prefixes (IPv4/IPv6)", + nullable=True, + ) + _args_schema.direction = AAZStrArg( + options=["--direction"], + arg_group="Properties", + help="Direction that specifies whether the access rules is inbound/outbound.", + nullable=True, + enum={"Inbound": "Inbound", "Outbound": "Outbound"}, + ) + _args_schema.email_addresses = AAZListArg( + options=["--email-addresses"], + arg_group="Properties", + help="Outbound rules email address format.", + nullable=True, + ) + _args_schema.fqdn = AAZListArg( + options=["--fqdn"], + arg_group="Properties", + help="Outbound rules fully qualified domain name format.", + nullable=True, + ) + _args_schema.phone_numbers = AAZListArg( + options=["--phone-numbers"], + arg_group="Properties", + help="Outbound rules phone number format.", + nullable=True, + ) + _args_schema.subscriptions = AAZListArg( + options=["--subscriptions"], + arg_group="Properties", + help="Subscription id in the ARM id format.", + nullable=True, + ) + + address_prefixes = cls._args_schema.address_prefixes + address_prefixes.Element = AAZStrArg( + nullable=True, + ) + + email_addresses = cls._args_schema.email_addresses + email_addresses.Element = AAZStrArg( + nullable=True, + ) + + fqdn = cls._args_schema.fqdn + fqdn.Element = AAZStrArg( + nullable=True, + ) + + phone_numbers = cls._args_schema.phone_numbers + phone_numbers.Element = AAZStrArg( + nullable=True, + ) + + subscriptions = cls._args_schema.subscriptions + subscriptions.Element = AAZObjectArg( + nullable=True, + ) + + _element = cls._args_schema.subscriptions.Element + _element.id = AAZStrArg( + options=["id"], + help="Subscription ID in the ARM ID fromat.", + nullable=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.NspAccessRulesGet(ctx=self.ctx)() + self.pre_instance_update(self.ctx.vars.instance) + self.InstanceUpdateByJson(ctx=self.ctx)() + self.InstanceUpdateByGeneric(ctx=self.ctx)() + self.post_instance_update(self.ctx.vars.instance) + self.NspAccessRulesCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + @register_callback + def pre_instance_update(self, instance): + pass + + @register_callback + def post_instance_update(self, instance): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class NspAccessRulesGet(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.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/profiles/{profileName}/accessRules/{accessRuleName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "accessRuleName", self.ctx.args.access_rule_name, + required=True, + ), + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + required=True, + ), + **self.serialize_url_param( + "profileName", self.ctx.args.profile_name, + 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", "2021-02-01-preview", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + 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() + _UpdateHelper._build_schema_nsp_access_rule_read(cls._schema_on_200) + + return cls._schema_on_200 + + class NspAccessRulesCreateOrUpdate(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, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkSecurityPerimeters/{networkSecurityPerimeterName}/profiles/{profileName}/accessRules/{accessRuleName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "ODataV4Format" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "accessRuleName", self.ctx.args.access_rule_name, + required=True, + ), + **self.serialize_url_param( + "networkSecurityPerimeterName", self.ctx.args.perimeter_name, + required=True, + ), + **self.serialize_url_param( + "profileName", self.ctx.args.profile_name, + 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", "2021-02-01-preview", + 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, + value=self.ctx.vars.instance, + ) + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + _UpdateHelper._build_schema_nsp_access_rule_read(cls._schema_on_200_201) + + return cls._schema_on_200_201 + + class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance(self.ctx.vars.instance) + + def _update_instance(self, instance): + _instance_value, _builder = self.new_content_builder( + self.ctx.args, + value=instance, + typ=AAZObjectType + ) + _builder.set_prop("location", AAZStrType, ".location") + _builder.set_prop("name", AAZStrType, ".access_rule_name") + _builder.set_prop("properties", AAZObjectType) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("addressPrefixes", AAZListType, ".address_prefixes") + properties.set_prop("direction", AAZStrType, ".direction") + properties.set_prop("emailAddresses", AAZListType, ".email_addresses") + properties.set_prop("fullyQualifiedDomainNames", AAZListType, ".fqdn") + properties.set_prop("phoneNumbers", AAZListType, ".phone_numbers") + properties.set_prop("subscriptions", AAZListType, ".subscriptions") + + address_prefixes = _builder.get(".properties.addressPrefixes") + if address_prefixes is not None: + address_prefixes.set_elements(AAZStrType, ".") + + email_addresses = _builder.get(".properties.emailAddresses") + if email_addresses is not None: + email_addresses.set_elements(AAZStrType, ".") + + fully_qualified_domain_names = _builder.get(".properties.fullyQualifiedDomainNames") + if fully_qualified_domain_names is not None: + fully_qualified_domain_names.set_elements(AAZStrType, ".") + + phone_numbers = _builder.get(".properties.phoneNumbers") + if phone_numbers is not None: + phone_numbers.set_elements(AAZStrType, ".") + + subscriptions = _builder.get(".properties.subscriptions") + if subscriptions is not None: + subscriptions.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.subscriptions[]") + if _elements is not None: + _elements.set_prop("id", AAZStrType, ".id") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return _instance_value + + class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance_by_generic( + self.ctx.vars.instance, + self.ctx.generic_update_args + ) + + +class _UpdateHelper: + """Helper class for Update""" + + _schema_nsp_access_rule_read = None + + @classmethod + def _build_schema_nsp_access_rule_read(cls, _schema): + if cls._schema_nsp_access_rule_read is not None: + _schema.id = cls._schema_nsp_access_rule_read.id + _schema.location = cls._schema_nsp_access_rule_read.location + _schema.name = cls._schema_nsp_access_rule_read.name + _schema.properties = cls._schema_nsp_access_rule_read.properties + _schema.tags = cls._schema_nsp_access_rule_read.tags + _schema.type = cls._schema_nsp_access_rule_read.type + return + + cls._schema_nsp_access_rule_read = _schema_nsp_access_rule_read = AAZObjectType() + + nsp_access_rule_read = _schema_nsp_access_rule_read + nsp_access_rule_read.id = AAZStrType( + flags={"read_only": True}, + ) + nsp_access_rule_read.location = AAZStrType() + nsp_access_rule_read.name = AAZStrType() + nsp_access_rule_read.properties = AAZObjectType() + nsp_access_rule_read.tags = AAZDictType() + nsp_access_rule_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_nsp_access_rule_read.properties + properties.address_prefixes = AAZListType( + serialized_name="addressPrefixes", + ) + properties.direction = AAZStrType() + properties.email_addresses = AAZListType( + serialized_name="emailAddresses", + ) + properties.fully_qualified_domain_names = AAZListType( + serialized_name="fullyQualifiedDomainNames", + ) + properties.network_security_perimeters = AAZListType( + serialized_name="networkSecurityPerimeters", + flags={"read_only": True}, + ) + properties.phone_numbers = AAZListType( + serialized_name="phoneNumbers", + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.subscriptions = AAZListType() + + address_prefixes = _schema_nsp_access_rule_read.properties.address_prefixes + address_prefixes.Element = AAZStrType() + + email_addresses = _schema_nsp_access_rule_read.properties.email_addresses + email_addresses.Element = AAZStrType() + + fully_qualified_domain_names = _schema_nsp_access_rule_read.properties.fully_qualified_domain_names + fully_qualified_domain_names.Element = AAZStrType() + + network_security_perimeters = _schema_nsp_access_rule_read.properties.network_security_perimeters + network_security_perimeters.Element = AAZObjectType() + + _element = _schema_nsp_access_rule_read.properties.network_security_perimeters.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"read_only": True}, + ) + _element.perimeter_guid = AAZStrType( + serialized_name="perimeterGuid", + flags={"read_only": True}, + ) + + phone_numbers = _schema_nsp_access_rule_read.properties.phone_numbers + phone_numbers.Element = AAZStrType() + + subscriptions = _schema_nsp_access_rule_read.properties.subscriptions + subscriptions.Element = AAZObjectType() + + _element = _schema_nsp_access_rule_read.properties.subscriptions.Element + _element.id = AAZStrType() + + tags = _schema_nsp_access_rule_read.tags + tags.Element = AAZStrType() + + _schema.id = cls._schema_nsp_access_rule_read.id + _schema.location = cls._schema_nsp_access_rule_read.location + _schema.name = cls._schema_nsp_access_rule_read.name + _schema.properties = cls._schema_nsp_access_rule_read.properties + _schema.tags = cls._schema_nsp_access_rule_read.tags + _schema.type = cls._schema_nsp_access_rule_read.type + + +__all__ = ["Update"] diff --git a/src/nsp/azext_nsp/azext_metadata.json b/src/nsp/azext_nsp/azext_metadata.json index daed0119d22..d4afd13a66b 100644 --- a/src/nsp/azext_nsp/azext_metadata.json +++ b/src/nsp/azext_nsp/azext_metadata.json @@ -1,4 +1,4 @@ -{ - "azext.isExperimental": true, - "azext.minCliCoreVersion": "2.45.0" +{ + "azext.isExperimental": true, + "azext.minCliCoreVersion": "2.45.0" } \ No newline at end of file diff --git a/src/nsp/setup.py b/src/nsp/setup.py index de698ed47ef..56bebe2b919 100644 --- a/src/nsp/setup.py +++ b/src/nsp/setup.py @@ -10,7 +10,7 @@ # HISTORY.rst entry. -VERSION = '0.2.0' +VERSION = '0.2.1' # The full list of classifiers is available at # https://pypi.python.org/pypi?%3Aaction=list_classifiers