diff --git a/src/networkcloud/HISTORY.rst b/src/networkcloud/HISTORY.rst index 32b64a1dfd1..120fbe6c054 100644 --- a/src/networkcloud/HISTORY.rst +++ b/src/networkcloud/HISTORY.rst @@ -3,6 +3,11 @@ Release History =============== +5.1.0 +++++++++ +* Adds new resource `accessbridge` commands `list`, `show`, `update`, `create`, and `delete`. +* Adds confirmation for `delete` command on `virtualmachine console` resource. + 5.0.1 ++++++++ * Cluster `update` operation was fixed to allow nullable fields on properties. diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/accessbridge/__cmd_group.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/accessbridge/__cmd_group.py new file mode 100644 index 00000000000..505a0df5216 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/accessbridge/__cmd_group.py @@ -0,0 +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( + "networkcloud accessbridge", +) +class __CMDGroup(AAZCommandGroup): + """Manage Access Bridge + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/accessbridge/__init__.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/accessbridge/__init__.py new file mode 100644 index 00000000000..db73033039b --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/accessbridge/__init__.py @@ -0,0 +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 * diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/accessbridge/_create.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/accessbridge/_create.py new file mode 100644 index 00000000000..7fb3a7daa13 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/accessbridge/_create.py @@ -0,0 +1,466 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "networkcloud accessbridge create", +) +class Create(AAZCommand): + """Create a new access bridge or update the properties of the existing access bridge. + + :example: Create or update access bridge + az networkcloud accessbridge create --resource-group resourceGroupName --access-bridge-name Bastion --location location --tags "{key1:myvalue1,key2:myvalue2}" --extended-location "{type:CustomLocation,name:/subscriptions/123e4567-e89b-12d3-a456-426655440000/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterExtendedLocationName}" --ipv4-connected-prefix 198.51.100.0/24 --ipv6-connected-prefix 2001:db8::/64 --network-id /subscriptions/123e4567-e89b-12d3-a456-426655440000/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/l3IsolationDomainName/internalNetworks/internalNetworkName --security-rules "[{description:'Allow management plane egress',port:24562-24570,ipv4-addresses:[10.10.20.10-10.10.20.20],ipv6-addresses:['2001:db8:abcd:12::1000-2001:db8:abcd:12::1fff'],direction:Outbound}]" + """ + + _aaz_info = { + "version": "2026-07-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/accessbridges/{}", "2026-07-01"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(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.access_bridge_name = AAZStrArg( + options=["-n", "--name", "--access-bridge-name"], + help="The name of the access bridge.", + required=True, + enum={"Bastion": "Bastion", "PrivateVault": "PrivateVault", "StorageDashboard": "StorageDashboard"}, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "AccessBridge" + + _args_schema = cls._args_schema + _args_schema.extended_location = AAZObjectArg( + options=["--extended-location"], + arg_group="AccessBridge", + help="The extended location of the cluster associated with the resource.", + required=True, + ) + _args_schema.location = AAZResourceLocationArg( + arg_group="AccessBridge", + help="The geo-location where the resource lives", + required=True, + fmt=AAZResourceLocationArgFormat( + resource_group_arg="resource_group", + ), + ) + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="AccessBridge", + help="Resource tags.", + ) + + extended_location = cls._args_schema.extended_location + extended_location.name = AAZStrArg( + options=["name"], + help="The resource ID of the extended location on which the resource will be created.", + required=True, + ) + extended_location.type = AAZStrArg( + options=["type"], + help="The extended location type, for example, CustomLocation.", + required=True, + enum={"CustomLocation": "CustomLocation", "EdgeZone": "EdgeZone"}, + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.ipv4_connected_prefix = AAZStrArg( + options=["--ipv4-connected-prefix"], + arg_group="Properties", + help="The IPv4 subnet from which the access bridge allocates an address. This subnet must be part of the internal network specified by networkId.", + ) + _args_schema.ipv6_connected_prefix = AAZStrArg( + options=["--ipv6-connected-prefix"], + arg_group="Properties", + help="The IPv6 subnet from which the access bridge allocates an address. This subnet must be part of the internal network specified by networkId.", + ) + _args_schema.network_id = AAZResourceIdArg( + options=["--network-id"], + arg_group="Properties", + help="The resource ID of the internal network in a layer 3 isolation domain containing the IP subnets to use.", + required=True, + ) + _args_schema.security_rules = AAZListArg( + options=["--security-rules"], + arg_group="Properties", + help="The list of security rules enforced by the access bridge.", + ) + + security_rules = cls._args_schema.security_rules + security_rules.Element = AAZObjectArg() + + _element = cls._args_schema.security_rules.Element + _element.description = AAZStrArg( + options=["description"], + help="The user provided value describing this rule.", + ) + _element.direction = AAZStrArg( + options=["direction"], + help="The direction of allowed network traffic based on the rule. Inbound indicates network traffic flowing to the on-premises cluster.", + required=True, + enum={"Inbound": "Inbound", "Outbound": "Outbound"}, + ) + _element.ipv4_addresses = AAZListArg( + options=["ipv4-addresses"], + help="The set of IPv4 addresses permitted as the source or destination of the security rule. For as single address, utilize a /32 (CIDR notation). One or both Ipv4Addresses and Ipv6Addresses must be specified. Example formats: 10.10.10.10-10.10.10.20 or 10.10.10.10/24.", + ) + _element.ipv6_addresses = AAZListArg( + options=["ipv6-addresses"], + help="The set of IPv6 addresses permitted as the source or destination of the security rule. For as single address, utilize a /128 (CIDR notation). One or both Ipv4Addresses and Ipv6Addresses must be specified. Example formats: 2001:db8:abcd::1-2001:db8:abcd::ff or 2001:db8:abcd::1/64.", + ) + _element.port = AAZStrArg( + options=["port"], + help="The source or destination port or port range. Example 24562 or 24562-24570.", + required=True, + ) + + ipv4_addresses = cls._args_schema.security_rules.Element.ipv4_addresses + ipv4_addresses.Element = AAZStrArg() + + ipv6_addresses = cls._args_schema.security_rules.Element.ipv6_addresses + ipv6_addresses.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.AccessBridgesCreateOrUpdate(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 AccessBridgesCreateOrUpdate(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_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/accessBridges/{accessBridgeName}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "accessBridgeName", self.ctx.args.access_bridge_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", "2026-07-01", + 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("extendedLocation", AAZObjectType, ".extended_location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("location", AAZStrType, ".location", typ_kwargs={"flags": {"required": True}}) + _builder.set_prop("properties", AAZObjectType, ".", typ_kwargs={"flags": {"required": True, "client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + extended_location = _builder.get(".extendedLocation") + if extended_location is not None: + extended_location.set_prop("name", AAZStrType, ".name", typ_kwargs={"flags": {"required": True}}) + extended_location.set_prop("type", AAZStrType, ".type", typ_kwargs={"flags": {"required": True}}) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("ipv4ConnectedPrefix", AAZStrType, ".ipv4_connected_prefix") + properties.set_prop("ipv6ConnectedPrefix", AAZStrType, ".ipv6_connected_prefix") + properties.set_prop("networkId", AAZStrType, ".network_id", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("securityRules", AAZListType, ".security_rules") + + security_rules = _builder.get(".properties.securityRules") + if security_rules is not None: + security_rules.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.securityRules[]") + if _elements is not None: + _elements.set_prop("description", AAZStrType, ".description") + _elements.set_prop("direction", AAZStrType, ".direction", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("ipv4Addresses", AAZListType, ".ipv4_addresses") + _elements.set_prop("ipv6Addresses", AAZListType, ".ipv6_addresses") + _elements.set_prop("port", AAZStrType, ".port", typ_kwargs={"flags": {"required": True}}) + + ipv4_addresses = _builder.get(".properties.securityRules[].ipv4Addresses") + if ipv4_addresses is not None: + ipv4_addresses.set_elements(AAZStrType, ".") + + ipv6_addresses = _builder.get(".properties.securityRules[].ipv6Addresses") + if ipv6_addresses is not None: + ipv6_addresses.set_elements(AAZStrType, ".") + + 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.etag = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.tags = AAZDictType() + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200_201.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.endpoints = AAZListType( + flags={"read_only": True}, + ) + properties.ipv4_connected_prefix = AAZStrType( + serialized_name="ipv4ConnectedPrefix", + ) + properties.ipv6_connected_prefix = AAZStrType( + serialized_name="ipv6ConnectedPrefix", + ) + properties.network_id = AAZStrType( + serialized_name="networkId", + flags={"required": True}, + ) + properties.protocol = AAZStrType( + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.security_rules = AAZListType( + serialized_name="securityRules", + ) + + endpoints = cls._schema_on_200_201.properties.endpoints + endpoints.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.endpoints.Element + _element.fqdn = AAZStrType( + flags={"read_only": True}, + ) + _element.ipv4_address = AAZStrType( + serialized_name="ipv4Address", + flags={"read_only": True}, + ) + _element.ipv6_address = AAZStrType( + serialized_name="ipv6Address", + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + + security_rules = cls._schema_on_200_201.properties.security_rules + security_rules.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.security_rules.Element + _element.description = AAZStrType() + _element.direction = AAZStrType( + flags={"required": True}, + ) + _element.ipv4_addresses = AAZListType( + serialized_name="ipv4Addresses", + ) + _element.ipv6_addresses = AAZListType( + serialized_name="ipv6Addresses", + ) + _element.port = AAZStrType( + flags={"required": True}, + ) + + ipv4_addresses = cls._schema_on_200_201.properties.security_rules.Element.ipv4_addresses + ipv4_addresses.Element = AAZStrType() + + ipv6_addresses = cls._schema_on_200_201.properties.security_rules.Element.ipv6_addresses + ipv6_addresses.Element = AAZStrType() + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + 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/networkcloud/azext_networkcloud/aaz/latest/networkcloud/accessbridge/_delete.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/accessbridge/_delete.py new file mode 100644 index 00000000000..75cc6ffead1 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/accessbridge/_delete.py @@ -0,0 +1,351 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "networkcloud accessbridge delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete the specified access bridge. + + :example: Delete access bridge + az networkcloud accessbridge delete --resource-group resourceGroupName --access-bridge-name Bastion + """ + + _aaz_info = { + "version": "2026-07-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/accessbridges/{}", "2026-07-01"], + ] + } + + 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.if_match = AAZStrArg( + options=["--if-match"], + help="The ETag of the transformation. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes.", + ) + _args_schema.if_none_match = AAZStrArg( + options=["--if-none-match"], + help="Set to '*' to allow a new record set to be created, but to prevent updating an existing resource. Other values will result in error from server as they are not supported.", + ) + _args_schema.access_bridge_name = AAZStrArg( + options=["-n", "--name", "--access-bridge-name"], + help="The name of the access bridge.", + required=True, + id_part="name", + enum={"Bastion": "Bastion", "PrivateVault": "PrivateVault", "StorageDashboard": "StorageDashboard"}, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.AccessBridgesDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class AccessBridgesDelete(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_201, + 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, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + 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.NetworkCloud/accessBridges/{accessBridgeName}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "accessBridgeName", self.ctx.args.access_bridge_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", "2026-07-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "If-Match", self.ctx.args.if_match, + ), + **self.serialize_header_param( + "If-None-Match", self.ctx.args.if_none_match, + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_204(self, session): + pass + + 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() + _DeleteHelper._build_schema_operation_status_result_read(cls._schema_on_200_201) + + return cls._schema_on_200_201 + + +class _DeleteHelper: + """Helper class for Delete""" + + _schema_error_detail_read = None + + @classmethod + def _build_schema_error_detail_read(cls, _schema): + if cls._schema_error_detail_read is not None: + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + return + + cls._schema_error_detail_read = _schema_error_detail_read = AAZObjectType( + flags={"read_only": True} + ) + + error_detail_read = _schema_error_detail_read + error_detail_read.additional_info = AAZListType( + serialized_name="additionalInfo", + flags={"read_only": True}, + ) + error_detail_read.code = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.details = AAZListType( + flags={"read_only": True}, + ) + error_detail_read.message = AAZStrType( + flags={"read_only": True}, + ) + error_detail_read.target = AAZStrType( + flags={"read_only": True}, + ) + + additional_info = _schema_error_detail_read.additional_info + additional_info.Element = AAZObjectType() + + _element = _schema_error_detail_read.additional_info.Element + _element.info = AAZDictType( + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + info = _schema_error_detail_read.additional_info.Element.info + info.Element = AAZAnyType() + + details = _schema_error_detail_read.details + details.Element = AAZObjectType() + cls._build_schema_error_detail_read(details.Element) + + _schema.additional_info = cls._schema_error_detail_read.additional_info + _schema.code = cls._schema_error_detail_read.code + _schema.details = cls._schema_error_detail_read.details + _schema.message = cls._schema_error_detail_read.message + _schema.target = cls._schema_error_detail_read.target + + _schema_operation_status_result_read = None + + @classmethod + def _build_schema_operation_status_result_read(cls, _schema): + if cls._schema_operation_status_result_read is not None: + _schema.end_time = cls._schema_operation_status_result_read.end_time + _schema.error = cls._schema_operation_status_result_read.error + _schema.id = cls._schema_operation_status_result_read.id + _schema.name = cls._schema_operation_status_result_read.name + _schema.operations = cls._schema_operation_status_result_read.operations + _schema.percent_complete = cls._schema_operation_status_result_read.percent_complete + _schema.properties = cls._schema_operation_status_result_read.properties + _schema.resource_id = cls._schema_operation_status_result_read.resource_id + _schema.start_time = cls._schema_operation_status_result_read.start_time + _schema.status = cls._schema_operation_status_result_read.status + return + + cls._schema_operation_status_result_read = _schema_operation_status_result_read = AAZObjectType() + + operation_status_result_read = _schema_operation_status_result_read + operation_status_result_read.end_time = AAZStrType( + serialized_name="endTime", + flags={"read_only": True}, + ) + operation_status_result_read.error = AAZObjectType( + flags={"read_only": True}, + ) + cls._build_schema_error_detail_read(operation_status_result_read.error) + operation_status_result_read.id = AAZStrType( + flags={"read_only": True}, + ) + operation_status_result_read.name = AAZStrType( + flags={"read_only": True}, + ) + operation_status_result_read.operations = AAZListType( + flags={"read_only": True}, + ) + operation_status_result_read.percent_complete = AAZFloatType( + serialized_name="percentComplete", + flags={"read_only": True}, + ) + operation_status_result_read.properties = AAZObjectType( + flags={"client_flatten": True}, + ) + operation_status_result_read.resource_id = AAZStrType( + serialized_name="resourceId", + flags={"read_only": True}, + ) + operation_status_result_read.start_time = AAZStrType( + serialized_name="startTime", + flags={"read_only": True}, + ) + operation_status_result_read.status = AAZStrType( + flags={"required": True}, + ) + + operations = _schema_operation_status_result_read.operations + operations.Element = AAZObjectType() + cls._build_schema_operation_status_result_read(operations.Element) + + properties = _schema_operation_status_result_read.properties + properties.exit_code = AAZStrType( + serialized_name="exitCode", + flags={"read_only": True}, + ) + properties.output_head = AAZStrType( + serialized_name="outputHead", + flags={"read_only": True}, + ) + properties.result_ref = AAZStrType( + serialized_name="resultRef", + flags={"read_only": True}, + ) + properties.result_url = AAZStrType( + serialized_name="resultUrl", + flags={"read_only": True}, + ) + + _schema.end_time = cls._schema_operation_status_result_read.end_time + _schema.error = cls._schema_operation_status_result_read.error + _schema.id = cls._schema_operation_status_result_read.id + _schema.name = cls._schema_operation_status_result_read.name + _schema.operations = cls._schema_operation_status_result_read.operations + _schema.percent_complete = cls._schema_operation_status_result_read.percent_complete + _schema.properties = cls._schema_operation_status_result_read.properties + _schema.resource_id = cls._schema_operation_status_result_read.resource_id + _schema.start_time = cls._schema_operation_status_result_read.start_time + _schema.status = cls._schema_operation_status_result_read.status + + +__all__ = ["Delete"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/accessbridge/_list.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/accessbridge/_list.py new file mode 100644 index 00000000000..0699d244437 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/accessbridge/_list.py @@ -0,0 +1,546 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "networkcloud accessbridge list", +) +class List(AAZCommand): + """List a list of access bridges in the provided subscription. + + :example: List access bridges for subscription + az networkcloud accessbridge list + """ + + _aaz_info = { + "version": "2026-07-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.networkcloud/accessbridges", "2026-07-01"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/accessbridges", "2026-07-01"], + ] + } + + AZ_SUPPORT_PAGINATION = True + + 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="The opaque token that the server returns to indicate where to continue listing resources from. This is used for paging through large result sets.", + ) + _args_schema.top = AAZIntArg( + options=["--top"], + help="The maximum number of resources to return from the operation. Example: '$top=10'.", + ) + 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.AccessBridgesListBySubscription(ctx=self.ctx)() + if condition_1: + self.AccessBridgesListByResourceGroup(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 AccessBridgesListBySubscription(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.NetworkCloud/accessBridges", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @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", "2026-07-01", + 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( + flags={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.etag = AAZStrType( + flags={"read_only": True}, + ) + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.value.Element.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.endpoints = AAZListType( + flags={"read_only": True}, + ) + properties.ipv4_connected_prefix = AAZStrType( + serialized_name="ipv4ConnectedPrefix", + ) + properties.ipv6_connected_prefix = AAZStrType( + serialized_name="ipv6ConnectedPrefix", + ) + properties.network_id = AAZStrType( + serialized_name="networkId", + flags={"required": True}, + ) + properties.protocol = AAZStrType( + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.security_rules = AAZListType( + serialized_name="securityRules", + ) + + endpoints = cls._schema_on_200.value.Element.properties.endpoints + endpoints.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.endpoints.Element + _element.fqdn = AAZStrType( + flags={"read_only": True}, + ) + _element.ipv4_address = AAZStrType( + serialized_name="ipv4Address", + flags={"read_only": True}, + ) + _element.ipv6_address = AAZStrType( + serialized_name="ipv6Address", + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + + security_rules = cls._schema_on_200.value.Element.properties.security_rules + security_rules.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.security_rules.Element + _element.description = AAZStrType() + _element.direction = AAZStrType( + flags={"required": True}, + ) + _element.ipv4_addresses = AAZListType( + serialized_name="ipv4Addresses", + ) + _element.ipv6_addresses = AAZListType( + serialized_name="ipv6Addresses", + ) + _element.port = AAZStrType( + flags={"required": True}, + ) + + ipv4_addresses = cls._schema_on_200.value.Element.properties.security_rules.Element.ipv4_addresses + ipv4_addresses.Element = AAZStrType() + + ipv6_addresses = cls._schema_on_200.value.Element.properties.security_rules.Element.ipv6_addresses + ipv6_addresses.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.value.Element.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + class AccessBridgesListByResourceGroup(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.NetworkCloud/accessBridges", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @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", "2026-07-01", + 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( + flags={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.etag = AAZStrType( + flags={"read_only": True}, + ) + _element.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.location = AAZStrType( + flags={"required": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.tags = AAZDictType() + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.value.Element.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.endpoints = AAZListType( + flags={"read_only": True}, + ) + properties.ipv4_connected_prefix = AAZStrType( + serialized_name="ipv4ConnectedPrefix", + ) + properties.ipv6_connected_prefix = AAZStrType( + serialized_name="ipv6ConnectedPrefix", + ) + properties.network_id = AAZStrType( + serialized_name="networkId", + flags={"required": True}, + ) + properties.protocol = AAZStrType( + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.security_rules = AAZListType( + serialized_name="securityRules", + ) + + endpoints = cls._schema_on_200.value.Element.properties.endpoints + endpoints.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.endpoints.Element + _element.fqdn = AAZStrType( + flags={"read_only": True}, + ) + _element.ipv4_address = AAZStrType( + serialized_name="ipv4Address", + flags={"read_only": True}, + ) + _element.ipv6_address = AAZStrType( + serialized_name="ipv6Address", + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + + security_rules = cls._schema_on_200.value.Element.properties.security_rules + security_rules.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.security_rules.Element + _element.description = AAZStrType() + _element.direction = AAZStrType( + flags={"required": True}, + ) + _element.ipv4_addresses = AAZListType( + serialized_name="ipv4Addresses", + ) + _element.ipv6_addresses = AAZListType( + serialized_name="ipv6Addresses", + ) + _element.port = AAZStrType( + flags={"required": True}, + ) + + ipv4_addresses = cls._schema_on_200.value.Element.properties.security_rules.Element.ipv4_addresses + ipv4_addresses.Element = AAZStrType() + + ipv6_addresses = cls._schema_on_200.value.Element.properties.security_rules.Element.ipv6_addresses + ipv6_addresses.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + 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/networkcloud/azext_networkcloud/aaz/latest/networkcloud/accessbridge/_show.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/accessbridge/_show.py new file mode 100644 index 00000000000..8497a1e8327 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/accessbridge/_show.py @@ -0,0 +1,299 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "networkcloud accessbridge show", +) +class Show(AAZCommand): + """Get the properties of the provided access bridge. + + :example: Get access bridge + az networkcloud accessbridge show --resource-group resourceGroupName --access-bridge-name Bastion + """ + + _aaz_info = { + "version": "2026-07-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/accessbridges/{}", "2026-07-01"], + ] + } + + 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_bridge_name = AAZStrArg( + options=["-n", "--name", "--access-bridge-name"], + help="The name of the access bridge.", + required=True, + id_part="name", + enum={"Bastion": "Bastion", "PrivateVault": "PrivateVault", "StorageDashboard": "StorageDashboard"}, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AccessBridgesGet(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 AccessBridgesGet(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.NetworkCloud/accessBridges/{accessBridgeName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "accessBridgeName", self.ctx.args.access_bridge_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", "2026-07-01", + 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.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.endpoints = AAZListType( + flags={"read_only": True}, + ) + properties.ipv4_connected_prefix = AAZStrType( + serialized_name="ipv4ConnectedPrefix", + ) + properties.ipv6_connected_prefix = AAZStrType( + serialized_name="ipv6ConnectedPrefix", + ) + properties.network_id = AAZStrType( + serialized_name="networkId", + flags={"required": True}, + ) + properties.protocol = AAZStrType( + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.security_rules = AAZListType( + serialized_name="securityRules", + ) + + endpoints = cls._schema_on_200.properties.endpoints + endpoints.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.endpoints.Element + _element.fqdn = AAZStrType( + flags={"read_only": True}, + ) + _element.ipv4_address = AAZStrType( + serialized_name="ipv4Address", + flags={"read_only": True}, + ) + _element.ipv6_address = AAZStrType( + serialized_name="ipv6Address", + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + + security_rules = cls._schema_on_200.properties.security_rules + security_rules.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.security_rules.Element + _element.description = AAZStrType() + _element.direction = AAZStrType( + flags={"required": True}, + ) + _element.ipv4_addresses = AAZListType( + serialized_name="ipv4Addresses", + ) + _element.ipv6_addresses = AAZListType( + serialized_name="ipv6Addresses", + ) + _element.port = AAZStrType( + flags={"required": True}, + ) + + ipv4_addresses = cls._schema_on_200.properties.security_rules.Element.ipv4_addresses + ipv4_addresses.Element = AAZStrType() + + ipv6_addresses = cls._schema_on_200.properties.security_rules.Element.ipv6_addresses + ipv6_addresses.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + 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/networkcloud/azext_networkcloud/aaz/latest/networkcloud/accessbridge/_update.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/accessbridge/_update.py new file mode 100644 index 00000000000..4ef8d75c08a --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/accessbridge/_update.py @@ -0,0 +1,428 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "networkcloud accessbridge update", +) +class Update(AAZCommand): + """Update properties of the provided access bridge, or update tags associated with the access bridge. Properties and tag updates can be done independently. + + :example: Patch access bridge resource + az networkcloud accessbridge update --resource-group resourceGroupName --access-bridge-name Bastion --security-rules "[{description:'Allow management plane egress',port:24562-24570,ipv4-addresses:[10.10.20.10-10.10.20.20],ipv6-addresses:['2001:db8:abcd:12::1000-2001:db8:abcd:12::1fff'],direction:Outbound}]" + """ + + _aaz_info = { + "version": "2026-07-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/accessbridges/{}", "2026-07-01"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(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.if_match = AAZStrArg( + options=["--if-match"], + help="The ETag of the transformation. Omit this value to always overwrite the current resource. Specify the last-seen ETag value to prevent accidentally overwriting concurrent changes.", + ) + _args_schema.if_none_match = AAZStrArg( + options=["--if-none-match"], + help="Set to '*' to allow a new record set to be created, but to prevent updating an existing resource. Other values will result in error from server as they are not supported.", + ) + _args_schema.access_bridge_name = AAZStrArg( + options=["-n", "--name", "--access-bridge-name"], + help="The name of the access bridge.", + required=True, + id_part="name", + enum={"Bastion": "Bastion", "PrivateVault": "PrivateVault", "StorageDashboard": "StorageDashboard"}, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "AccessBridgeUpdateParameters" + + _args_schema = cls._args_schema + _args_schema.tags = AAZDictArg( + options=["--tags"], + arg_group="AccessBridgeUpdateParameters", + help="The Azure resource tags that will replace the existing ones.", + ) + + tags = cls._args_schema.tags + tags.Element = AAZStrArg() + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.security_rules = AAZListArg( + options=["--security-rules"], + arg_group="Properties", + help="The list of security rules enforced by the access bridge.", + ) + + security_rules = cls._args_schema.security_rules + security_rules.Element = AAZObjectArg() + + _element = cls._args_schema.security_rules.Element + _element.description = AAZStrArg( + options=["description"], + help="The user provided value describing this rule.", + ) + _element.direction = AAZStrArg( + options=["direction"], + help="The direction of allowed network traffic based on the rule. Inbound indicates network traffic flowing to the on-premises cluster.", + required=True, + enum={"Inbound": "Inbound", "Outbound": "Outbound"}, + ) + _element.ipv4_addresses = AAZListArg( + options=["ipv4-addresses"], + help="The set of IPv4 addresses permitted as the source or destination of the security rule. For as single address, utilize a /32 (CIDR notation). One or both Ipv4Addresses and Ipv6Addresses must be specified. Example formats: 10.10.10.10-10.10.10.20 or 10.10.10.10/24.", + ) + _element.ipv6_addresses = AAZListArg( + options=["ipv6-addresses"], + help="The set of IPv6 addresses permitted as the source or destination of the security rule. For as single address, utilize a /128 (CIDR notation). One or both Ipv4Addresses and Ipv6Addresses must be specified. Example formats: 2001:db8:abcd::1-2001:db8:abcd::ff or 2001:db8:abcd::1/64.", + ) + _element.port = AAZStrArg( + options=["port"], + help="The source or destination port or port range. Example 24562 or 24562-24570.", + required=True, + ) + + ipv4_addresses = cls._args_schema.security_rules.Element.ipv4_addresses + ipv4_addresses.Element = AAZStrArg() + + ipv6_addresses = cls._args_schema.security_rules.Element.ipv6_addresses + ipv6_addresses.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.AccessBridgesUpdate(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 AccessBridgesUpdate(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, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/accessBridges/{accessBridgeName}", + **self.url_parameters + ) + + @property + def method(self): + return "PATCH" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "accessBridgeName", self.ctx.args.access_bridge_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", "2026-07-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "If-Match", self.ctx.args.if_match, + ), + **self.serialize_header_param( + "If-None-Match", self.ctx.args.if_none_match, + ), + **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": {"client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}}) + _builder.set_prop("tags", AAZDictType, ".tags") + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("securityRules", AAZListType, ".security_rules") + + security_rules = _builder.get(".properties.securityRules") + if security_rules is not None: + security_rules.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.securityRules[]") + if _elements is not None: + _elements.set_prop("description", AAZStrType, ".description") + _elements.set_prop("direction", AAZStrType, ".direction", typ_kwargs={"flags": {"required": True}}) + _elements.set_prop("ipv4Addresses", AAZListType, ".ipv4_addresses") + _elements.set_prop("ipv6Addresses", AAZListType, ".ipv6_addresses") + _elements.set_prop("port", AAZStrType, ".port", typ_kwargs={"flags": {"required": True}}) + + ipv4_addresses = _builder.get(".properties.securityRules[].ipv4Addresses") + if ipv4_addresses is not None: + ipv4_addresses.set_elements(AAZStrType, ".") + + ipv6_addresses = _builder.get(".properties.securityRules[].ipv6Addresses") + if ipv6_addresses is not None: + ipv6_addresses.set_elements(AAZStrType, ".") + + tags = _builder.get(".tags") + if tags is not None: + tags.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + 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.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.endpoints = AAZListType( + flags={"read_only": True}, + ) + properties.ipv4_connected_prefix = AAZStrType( + serialized_name="ipv4ConnectedPrefix", + ) + properties.ipv6_connected_prefix = AAZStrType( + serialized_name="ipv6ConnectedPrefix", + ) + properties.network_id = AAZStrType( + serialized_name="networkId", + flags={"required": True}, + ) + properties.protocol = AAZStrType( + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.security_rules = AAZListType( + serialized_name="securityRules", + ) + + endpoints = cls._schema_on_200.properties.endpoints + endpoints.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.endpoints.Element + _element.fqdn = AAZStrType( + flags={"read_only": True}, + ) + _element.ipv4_address = AAZStrType( + serialized_name="ipv4Address", + flags={"read_only": True}, + ) + _element.ipv6_address = AAZStrType( + serialized_name="ipv6Address", + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + + security_rules = cls._schema_on_200.properties.security_rules + security_rules.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.security_rules.Element + _element.description = AAZStrType() + _element.direction = AAZStrType( + flags={"required": True}, + ) + _element.ipv4_addresses = AAZListType( + serialized_name="ipv4Addresses", + ) + _element.ipv6_addresses = AAZListType( + serialized_name="ipv6Addresses", + ) + _element.port = AAZStrType( + flags={"required": True}, + ) + + ipv4_addresses = cls._schema_on_200.properties.security_rules.Element.ipv4_addresses + ipv4_addresses.Element = AAZStrType() + + ipv6_addresses = cls._schema_on_200.properties.security_rules.Element.ipv6_addresses + ipv6_addresses.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _UpdateHelper: + """Helper class for Update""" + + +__all__ = ["Update"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/accessbridge/_wait.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/accessbridge/_wait.py new file mode 100644 index 00000000000..44bb8139dc1 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/accessbridge/_wait.py @@ -0,0 +1,295 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "networkcloud accessbridge 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.networkcloud/accessbridges/{}", "2026-07-01"], + ] + } + + 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_bridge_name = AAZStrArg( + options=["-n", "--name", "--access-bridge-name"], + help="The name of the access bridge.", + required=True, + id_part="name", + enum={"Bastion": "Bastion", "PrivateVault": "PrivateVault", "StorageDashboard": "StorageDashboard"}, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AccessBridgesGet(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 AccessBridgesGet(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.NetworkCloud/accessBridges/{accessBridgeName}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "accessBridgeName", self.ctx.args.access_bridge_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", "2026-07-01", + 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.extended_location = AAZObjectType( + serialized_name="extendedLocation", + flags={"required": True}, + ) + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.location = AAZStrType( + flags={"required": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType( + flags={"required": True, "client_flatten": True}, + ) + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.tags = AAZDictType() + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + extended_location = cls._schema_on_200.extended_location + extended_location.name = AAZStrType( + flags={"required": True}, + ) + extended_location.type = AAZStrType( + flags={"required": True}, + ) + + properties = cls._schema_on_200.properties + properties.detailed_status = AAZStrType( + serialized_name="detailedStatus", + flags={"read_only": True}, + ) + properties.detailed_status_message = AAZStrType( + serialized_name="detailedStatusMessage", + flags={"read_only": True}, + ) + properties.endpoints = AAZListType( + flags={"read_only": True}, + ) + properties.ipv4_connected_prefix = AAZStrType( + serialized_name="ipv4ConnectedPrefix", + ) + properties.ipv6_connected_prefix = AAZStrType( + serialized_name="ipv6ConnectedPrefix", + ) + properties.network_id = AAZStrType( + serialized_name="networkId", + flags={"required": True}, + ) + properties.protocol = AAZStrType( + flags={"read_only": True}, + ) + properties.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + properties.security_rules = AAZListType( + serialized_name="securityRules", + ) + + endpoints = cls._schema_on_200.properties.endpoints + endpoints.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.endpoints.Element + _element.fqdn = AAZStrType( + flags={"read_only": True}, + ) + _element.ipv4_address = AAZStrType( + serialized_name="ipv4Address", + flags={"read_only": True}, + ) + _element.ipv6_address = AAZStrType( + serialized_name="ipv6Address", + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + + security_rules = cls._schema_on_200.properties.security_rules + security_rules.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.security_rules.Element + _element.description = AAZStrType() + _element.direction = AAZStrType( + flags={"required": True}, + ) + _element.ipv4_addresses = AAZListType( + serialized_name="ipv4Addresses", + ) + _element.ipv6_addresses = AAZListType( + serialized_name="ipv6Addresses", + ) + _element.port = AAZStrType( + flags={"required": True}, + ) + + ipv4_addresses = cls._schema_on_200.properties.security_rules.Element.ipv4_addresses + ipv4_addresses.Element = AAZStrType() + + ipv6_addresses = cls._schema_on_200.properties.security_rules.Element.ipv6_addresses + ipv6_addresses.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + tags = cls._schema_on_200.tags + tags.Element = AAZStrType() + + return cls._schema_on_200 + + +class _WaitHelper: + """Helper class for Wait""" + + +__all__ = ["Wait"] diff --git a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/_delete.py b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/_delete.py index 4fa438c3831..f24957f8bcc 100644 --- a/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/_delete.py +++ b/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/virtualmachine/console/_delete.py @@ -14,6 +14,7 @@ @register_command( "networkcloud virtualmachine console delete", is_preview=True, + confirmation="Are you sure you want to perform this operation?", ) class Delete(AAZCommand): """Delete the provided virtual machine console. diff --git a/src/networkcloud/azext_networkcloud/tests/latest/config.ini b/src/networkcloud/azext_networkcloud/tests/latest/config.ini index 8aaf860717b..d2952aac67b 100644 --- a/src/networkcloud/azext_networkcloud/tests/latest/config.ini +++ b/src/networkcloud/azext_networkcloud/tests/latest/config.ini @@ -93,6 +93,20 @@ storage_mode="Standard" storage_size_mi_b=10240 storage_appliance_id='/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/nc-cli-testing_id-simdev-2444489/providers/Microsoft.NetworkCloud/storageAppliances/storageAppliance1' +[ACCESS_BRIDGE] +name=Bastion +resource_group=mock-accessbridge-rg +location=eastus +extended_location=/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mock-cluster-rg/providers/Microsoft.ExtendedLocation/customLocations/mock-custom-location +extended_location_type=CustomLocation +network_id=/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mock-fabric-rg/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/mock-l3-isolation-domain/internalNetworks/mock-internal-network +ipv4_connected_prefix=10.20.0.0/24 +ipv6_connected_prefix=2001:db8:20::/64 +security_rules="[{description:'Allow management access',direction:Inbound,ipv4-addresses:['10.10.10.10/32'],ipv6-addresses:['2001:db8:10::10/128'],port:443}]" +security_rules_update="[{description:'Updated management access',direction:Inbound,ipv4-addresses:['10.10.20.0/24'],ipv6-addresses:['2001:db8:20::/64'],port:8443}]" +tags="{environment:'mock',version:'1'}" +tags_update="{environment:'mock',version:'2'}" + [CLUSTER] kind='AzureLocal' resource_group="clitest000002" diff --git a/src/networkcloud/azext_networkcloud/tests/latest/recordings/test_accessbridge_scenario1.yaml b/src/networkcloud/azext_networkcloud/tests/latest/recordings/test_accessbridge_scenario1.yaml new file mode 100644 index 00000000000..61d751ba56a --- /dev/null +++ b/src/networkcloud/azext_networkcloud/tests/latest/recordings/test_accessbridge_scenario1.yaml @@ -0,0 +1,148 @@ +interactions: +- request: + body: '{"extendedLocation": {"name": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mock-cluster-rg/providers/Microsoft.ExtendedLocation/customLocations/mock-custom-location", "type": "CustomLocation"}, "location": "eastus", "properties": {"ipv4ConnectedPrefix": "10.20.0.0/24", "ipv6ConnectedPrefix": "2001:db8:20::/64", "networkId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mock-fabric-rg/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/mock-l3-isolation-domain/internalNetworks/mock-internal-network", "securityRules": [{"description": "Allow management access", "direction": "Inbound", "ipv4Addresses": ["10.10.10.10/32"], "ipv6Addresses": ["2001:db8:10::10/128"], "port": "443"}]}, "tags": {"environment": "mock", "version": "1"}}' + headers: + Accept: + - application/json + CommandName: + - networkcloud accessbridge create + Content-Type: + - application/json + ParameterSetName: + - --name --resource-group --extended-location --location --network-id + --ipv4-connected-prefix --ipv6-connected-prefix --security-rules --tags + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mock-accessbridge-rg/providers/Microsoft.NetworkCloud/accessBridges/Bastion?api-version=2026-07-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mock-accessbridge-rg/providers/Microsoft.NetworkCloud/accessBridges/Bastion","name":"Bastion","type":"microsoft.networkcloud/accessbridges","location":"eastus","extendedLocation":{"name":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mock-cluster-rg/providers/Microsoft.ExtendedLocation/customLocations/mock-custom-location","type":"CustomLocation"},"tags":{"environment":"mock","version":"1"},"properties":{"detailedStatus":"Running","detailedStatusMessage":"The access bridge is healthy.","endpoints":[{"fqdn":"bastion.mock.example.com","ipv4Address":"10.20.0.10","ipv6Address":"2001:db8:20::10","name":"VIP"},{"fqdn":"bastion-host.mock.example.com","ipv4Address":"10.20.0.11","ipv6Address":"2001:db8:20::11","name":"Host"}],"ipv4ConnectedPrefix":"10.20.0.0/24","ipv6ConnectedPrefix":"2001:db8:20::/64","networkId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mock-fabric-rg/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/mock-l3-isolation-domain/internalNetworks/mock-internal-network","protocol":"TCP","provisioningState":"Succeeded","securityRules":[{"description":"Allow management access","direction":"Inbound","ipv4Addresses":["10.10.10.10/32"],"ipv6Addresses":["2001:db8:10::10/128"],"port":"443"}]}}' + headers: + content-type: + - application/json; charset=utf-8 + etag: + - '"mock-etag-1"' + status: + code: 200 + message: OK +- request: + body: '{"properties": {"securityRules": [{"description": "Updated management access", "direction": "Inbound", "ipv4Addresses": ["10.10.20.0/24"], "ipv6Addresses": ["2001:db8:20::/64"], "port": "8443"}]}, "tags": {"environment": "mock", "version": "2"}}' + headers: + Accept: + - application/json + CommandName: + - networkcloud accessbridge update + Content-Type: + - application/json + ParameterSetName: + - --name --resource-group --security-rules --tags + method: PATCH + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mock-accessbridge-rg/providers/Microsoft.NetworkCloud/accessBridges/Bastion?api-version=2026-07-01 + response: + body: + string: &updated_access_bridge '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mock-accessbridge-rg/providers/Microsoft.NetworkCloud/accessBridges/Bastion","name":"Bastion","type":"microsoft.networkcloud/accessbridges","location":"eastus","extendedLocation":{"name":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mock-cluster-rg/providers/Microsoft.ExtendedLocation/customLocations/mock-custom-location","type":"CustomLocation"},"tags":{"environment":"mock","version":"2"},"properties":{"detailedStatus":"Running","detailedStatusMessage":"The access bridge is healthy.","endpoints":[{"fqdn":"bastion.mock.example.com","ipv4Address":"10.20.0.10","ipv6Address":"2001:db8:20::10","name":"VIP"},{"fqdn":"bastion-host.mock.example.com","ipv4Address":"10.20.0.11","ipv6Address":"2001:db8:20::11","name":"Host"}],"ipv4ConnectedPrefix":"10.20.0.0/24","ipv6ConnectedPrefix":"2001:db8:20::/64","networkId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mock-fabric-rg/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/mock-l3-isolation-domain/internalNetworks/mock-internal-network","protocol":"TCP","provisioningState":"Succeeded","securityRules":[{"description":"Updated management access","direction":"Inbound","ipv4Addresses":["10.10.20.0/24"],"ipv6Addresses":["2001:db8:20::/64"],"port":"8443"}]}}' + headers: + content-type: + - application/json; charset=utf-8 + etag: + - '"mock-etag-2"' + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + CommandName: + - networkcloud accessbridge wait + ParameterSetName: + - --name --resource-group --created + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mock-accessbridge-rg/providers/Microsoft.NetworkCloud/accessBridges/Bastion?api-version=2026-07-01 + response: + body: + string: *updated_access_bridge + headers: + content-type: + - application/json; charset=utf-8 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + CommandName: + - networkcloud accessbridge show + ParameterSetName: + - --name --resource-group + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mock-accessbridge-rg/providers/Microsoft.NetworkCloud/accessBridges/Bastion?api-version=2026-07-01 + response: + body: + string: *updated_access_bridge + headers: + content-type: + - application/json; charset=utf-8 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + CommandName: + - networkcloud accessbridge list + ParameterSetName: + - --resource-group + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mock-accessbridge-rg/providers/Microsoft.NetworkCloud/accessBridges?api-version=2026-07-01 + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mock-accessbridge-rg/providers/Microsoft.NetworkCloud/accessBridges/Bastion","name":"Bastion","type":"microsoft.networkcloud/accessbridges","location":"eastus","extendedLocation":{"name":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mock-cluster-rg/providers/Microsoft.ExtendedLocation/customLocations/mock-custom-location","type":"CustomLocation"},"tags":{"environment":"mock","version":"2"},"properties":{"detailedStatus":"Running","detailedStatusMessage":"The access bridge is healthy.","endpoints":[{"fqdn":"bastion.mock.example.com","ipv4Address":"10.20.0.10","ipv6Address":"2001:db8:20::10","name":"VIP"},{"fqdn":"bastion-host.mock.example.com","ipv4Address":"10.20.0.11","ipv6Address":"2001:db8:20::11","name":"Host"}],"ipv4ConnectedPrefix":"10.20.0.0/24","ipv6ConnectedPrefix":"2001:db8:20::/64","networkId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mock-fabric-rg/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/mock-l3-isolation-domain/internalNetworks/mock-internal-network","protocol":"TCP","provisioningState":"Succeeded","securityRules":[{"description":"Updated management access","direction":"Inbound","ipv4Addresses":["10.10.20.0/24"],"ipv6Addresses":["2001:db8:20::/64"],"port":"8443"}]}}]}' + headers: + content-type: + - application/json; charset=utf-8 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + CommandName: + - networkcloud accessbridge list + ParameterSetName: + - --top + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.NetworkCloud/accessBridges?$top=10&api-version=2026-07-01 + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mock-accessbridge-rg/providers/Microsoft.NetworkCloud/accessBridges/Bastion","name":"Bastion","type":"microsoft.networkcloud/accessbridges","location":"eastus","extendedLocation":{"name":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mock-cluster-rg/providers/Microsoft.ExtendedLocation/customLocations/mock-custom-location","type":"CustomLocation"},"tags":{"environment":"mock","version":"2"},"properties":{"detailedStatus":"Running","detailedStatusMessage":"The access bridge is healthy.","endpoints":[{"fqdn":"bastion.mock.example.com","ipv4Address":"10.20.0.10","ipv6Address":"2001:db8:20::10","name":"VIP"},{"fqdn":"bastion-host.mock.example.com","ipv4Address":"10.20.0.11","ipv6Address":"2001:db8:20::11","name":"Host"}],"ipv4ConnectedPrefix":"10.20.0.0/24","ipv6ConnectedPrefix":"2001:db8:20::/64","networkId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mock-fabric-rg/providers/Microsoft.ManagedNetworkFabric/l3IsolationDomains/mock-l3-isolation-domain/internalNetworks/mock-internal-network","protocol":"TCP","provisioningState":"Succeeded","securityRules":[{"description":"Updated management access","direction":"Inbound","ipv4Addresses":["10.10.20.0/24"],"ipv6Addresses":["2001:db8:20::/64"],"port":"8443"}]}}]}' + headers: + content-type: + - application/json; charset=utf-8 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + CommandName: + - networkcloud accessbridge delete + ParameterSetName: + - --name --resource-group --yes + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mock-accessbridge-rg/providers/Microsoft.NetworkCloud/accessBridges/Bastion?api-version=2026-07-01 + response: + body: + string: '' + headers: {} + status: + code: 204 + message: No Content diff --git a/src/networkcloud/azext_networkcloud/tests/latest/test_accessbridge.py b/src/networkcloud/azext_networkcloud/tests/latest/test_accessbridge.py new file mode 100644 index 00000000000..bd4cf552494 --- /dev/null +++ b/src/networkcloud/azext_networkcloud/tests/latest/test_accessbridge.py @@ -0,0 +1,167 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# -------------------------------------------------------------------------------------------- +# pylint: disable=too-few-public-methods + +"""AccessBridge test scenarios.""" + +from azure.cli.testsdk import ScenarioTest + +from .config import CONFIG + + +def call_scenario1(test): + """Test AccessBridge CRUD operations.""" + step_create( + test, + checks=[ + test.check("name", "{name}"), + test.check("provisioningState", "Succeeded"), + test.check("detailedStatus", "Running"), + test.check("protocol", "TCP"), + test.check("length(endpoints)", 2), + ], + ) + step_update( + test, + checks=[ + test.check("tags", "{tagsUpdateExpected}"), + test.check("securityRules[0].description", "Updated management access"), + test.check("securityRules[0].direction", "Inbound"), + ], + ) + step_wait(test) + step_show( + test, + checks=[ + test.check("name", "{name}"), + test.check("networkId", "{networkId}"), + test.check("ipv4ConnectedPrefix", "{ipv4ConnectedPrefix}"), + test.check("ipv6ConnectedPrefix", "{ipv6ConnectedPrefix}"), + test.check("securityRules[0].description", "Updated management access"), + ], + ) + step_list_resource_group( + test, + checks=[ + test.check("length(@)", 1), + test.check("[0].name", "{name}"), + ], + ) + step_list_subscription( + test, + checks=[ + test.check("length(@)", 1), + test.check("[0].name", "{name}"), + ], + ) + step_delete(test) + + +def step_create(test, checks=None): + """AccessBridge create operation.""" + if checks is None: + checks = [] + test.cmd( + "az networkcloud accessbridge create --name {name} --resource-group {rg} " + "--extended-location name={extendedLocation} type={extendedLocationType} " + "--location {location} --network-id {networkId} " + "--ipv4-connected-prefix {ipv4ConnectedPrefix} " + "--ipv6-connected-prefix {ipv6ConnectedPrefix} " + "--security-rules {securityRules} --tags {tags}", + checks=checks, + ) + + +def step_update(test, checks=None): + """AccessBridge update operation.""" + if checks is None: + checks = [] + test.cmd( + "az networkcloud accessbridge update --name {name} --resource-group {rg} " + "--security-rules {securityRulesUpdate} --tags {tagsUpdate}", + checks=checks, + ) + + +def step_wait(test, checks=None): + """AccessBridge wait operation.""" + if checks is None: + checks = [] + test.cmd( + "az networkcloud accessbridge wait --name {name} --resource-group {rg} " + "--created", + checks=checks, + ) + + +def step_show(test, checks=None): + """AccessBridge show operation.""" + if checks is None: + checks = [] + test.cmd( + "az networkcloud accessbridge show --name {name} --resource-group {rg}", + checks=checks, + ) + + +def step_list_resource_group(test, checks=None): + """AccessBridge list by resource group operation.""" + if checks is None: + checks = [] + test.cmd("az networkcloud accessbridge list --resource-group {rg}", checks=checks) + + +def step_list_subscription(test, checks=None): + """AccessBridge list by subscription operation.""" + if checks is None: + checks = [] + test.cmd("az networkcloud accessbridge list --top 10", checks=checks) + + +def step_delete(test, checks=None): + """AccessBridge delete operation.""" + if checks is None: + checks = [] + test.cmd( + "az networkcloud accessbridge delete --name {name} --resource-group {rg} --yes", + checks=checks, + ) + + +class AccessBridgeScenarioTest(ScenarioTest): + """AccessBridge scenario test.""" + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.kwargs.update( + { + "name": CONFIG.get("ACCESS_BRIDGE", "name"), + "rg": CONFIG.get("ACCESS_BRIDGE", "resource_group"), + "location": CONFIG.get("ACCESS_BRIDGE", "location"), + "extendedLocation": CONFIG.get("ACCESS_BRIDGE", "extended_location"), + "extendedLocationType": CONFIG.get( + "ACCESS_BRIDGE", "extended_location_type" + ), + "networkId": CONFIG.get("ACCESS_BRIDGE", "network_id"), + "ipv4ConnectedPrefix": CONFIG.get( + "ACCESS_BRIDGE", "ipv4_connected_prefix" + ), + "ipv6ConnectedPrefix": CONFIG.get( + "ACCESS_BRIDGE", "ipv6_connected_prefix" + ), + "securityRules": CONFIG.get("ACCESS_BRIDGE", "security_rules"), + "securityRulesUpdate": CONFIG.get( + "ACCESS_BRIDGE", "security_rules_update" + ), + "tags": CONFIG.get("ACCESS_BRIDGE", "tags"), + "tagsUpdate": CONFIG.get("ACCESS_BRIDGE", "tags_update"), + "tagsUpdateExpected": {"environment": "mock", "version": "2"}, + } + ) + + def test_accessbridge_scenario1(self): + """Test scenario for AccessBridge CRUD operations.""" + call_scenario1(self) diff --git a/src/networkcloud/azext_networkcloud/tests/latest/test_virtualmachineconsole.py b/src/networkcloud/azext_networkcloud/tests/latest/test_virtualmachineconsole.py index 12e3fd7a8cf..918b6aa597f 100644 --- a/src/networkcloud/azext_networkcloud/tests/latest/test_virtualmachineconsole.py +++ b/src/networkcloud/azext_networkcloud/tests/latest/test_virtualmachineconsole.py @@ -118,7 +118,7 @@ def step_delete(test, checks=None): checks = [] test.cmd( "az networkcloud virtualmachine console delete --resource-group {resourceGroup} " - "--virtual-machine-name {virtualMachineName}", + "--virtual-machine-name {virtualMachineName} --yes", checks=checks, ) diff --git a/src/networkcloud/setup.py b/src/networkcloud/setup.py index 0ef4c1d6f73..0bdbef56339 100644 --- a/src/networkcloud/setup.py +++ b/src/networkcloud/setup.py @@ -10,7 +10,7 @@ # HISTORY.rst entry. -VERSION = '5.0.1' +VERSION = '5.1.0' # The full list of classifiers is available at # https://pypi.python.org/pypi?%3Aaction=list_classifiers