From 2cd9f12759a489760b5e3cac22e2a9fae27f8006 Mon Sep 17 00:00:00 2001 From: Fuming Zhang Date: Thu, 14 Oct 2021 17:39:58 +0800 Subject: [PATCH 1/4] refactor nat gateway profile --- .../azext_aks_preview/decorator.py | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/src/aks-preview/azext_aks_preview/decorator.py b/src/aks-preview/azext_aks_preview/decorator.py index d23567a38f0..b7053d4959e 100644 --- a/src/aks-preview/azext_aks_preview/decorator.py +++ b/src/aks-preview/azext_aks_preview/decorator.py @@ -286,6 +286,51 @@ def get_node_resource_group(self) -> Union[str, None]: # this parameter does not need validation return node_resource_group + def get_nat_gateway_managed_outbound_ip_count(self) -> Union[int, None]: + """Obtain the value of nat_gateway_managed_outbound_ip_count. + + :return: string or None + """ + # read the original value passed by the command + nat_gateway_managed_outbound_ip_count = self.raw_param.get("nat_gateway_managed_outbound_ip_count") + # try to read the property value corresponding to the parameter from the `mc` object + if ( + self.mc and + self.mc.network_profile and + self.mc.network_profile.nat_gateway_profile and + self.mc.network_profile.nat_gateway_profile.managed_outbound_ip_profile and + self.mc.network_profile.nat_gateway_profile.managed_outbound_ip_profile.count is not None + ): + nat_gateway_managed_outbound_ip_count = ( + self.mc.network_profile.nat_gateway_profile.managed_outbound_ip_profile.count + ) + + # this parameter does not need dynamic completion + # this parameter does not need validation + return nat_gateway_managed_outbound_ip_count + + def get_nat_gateway_idle_timeout(self) -> Union[int, None]: + """Obtain the value of nat_gateway_idle_timeout. + + :return: string or None + """ + # read the original value passed by the command + nat_gateway_idle_timeout = self.raw_param.get("nat_gateway_idle_timeout") + # try to read the property value corresponding to the parameter from the `mc` object + if ( + self.mc and + self.mc.network_profile and + self.mc.network_profile.nat_gateway_profile and + self.mc.network_profile.nat_gateway_profile.idle_timeout_in_minutes is not None + ): + nat_gateway_idle_timeout = ( + self.mc.network_profile.nat_gateway_profile.idle_timeout_in_minutes + ) + + # this parameter does not need dynamic completion + # this parameter does not need validation + return nat_gateway_idle_timeout + class AKSPreviewCreateDecorator(AKSCreateDecorator): # pylint: disable=super-init-not-called From 52044534dbf169af7cee0d2838b6928777d43169 Mon Sep 17 00:00:00 2001 From: Fuming Zhang Date: Mon, 18 Oct 2021 13:29:11 +0800 Subject: [PATCH 2/4] update natgateway profile --- .../azext_aks_preview/_natgateway.py | 17 +++--- src/aks-preview/azext_aks_preview/custom.py | 15 ++++- .../azext_aks_preview/decorator.py | 56 +++++++++++++++++++ .../tests/latest/test_natgateway.py | 40 +++++++++---- 4 files changed, 107 insertions(+), 21 deletions(-) diff --git a/src/aks-preview/azext_aks_preview/_natgateway.py b/src/aks-preview/azext_aks_preview/_natgateway.py index e5976e66bb6..85ac09f1363 100644 --- a/src/aks-preview/azext_aks_preview/_natgateway.py +++ b/src/aks-preview/azext_aks_preview/_natgateway.py @@ -3,37 +3,36 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- -from .vendored_sdks.azure_mgmt_preview_aks.v2021_08_01.models import ManagedClusterNATGatewayProfile -from .vendored_sdks.azure_mgmt_preview_aks.v2021_08_01.models import ManagedClusterManagedOutboundIPProfile - -def create_nat_gateway_profile(managed_outbound_ip_count, idle_timeout): +def create_nat_gateway_profile(managed_outbound_ip_count, idle_timeout, models): """parse and build NAT gateway profile""" if not is_nat_gateway_profile_provided(managed_outbound_ip_count, idle_timeout): return None - profile = ManagedClusterNATGatewayProfile() - return configure_nat_gateway_profile(managed_outbound_ip_count, idle_timeout, profile) + # profile = ManagedClusterNATGatewayProfile() + profile = models.get("ManagedClusterNATGatewayProfile") + return configure_nat_gateway_profile(managed_outbound_ip_count, idle_timeout, profile, models) -def update_nat_gateway_profile(managed_outbound_ip_count, idle_timeout, profile): +def update_nat_gateway_profile(managed_outbound_ip_count, idle_timeout, profile, models): """parse and update an existing NAT gateway profile""" if not is_nat_gateway_profile_provided(managed_outbound_ip_count, idle_timeout): return profile - return configure_nat_gateway_profile(managed_outbound_ip_count, idle_timeout, profile) + return configure_nat_gateway_profile(managed_outbound_ip_count, idle_timeout, profile, models) def is_nat_gateway_profile_provided(managed_outbound_ip_count, idle_timeout): return any([managed_outbound_ip_count, idle_timeout]) -def configure_nat_gateway_profile(managed_outbound_ip_count, idle_timeout, profile): +def configure_nat_gateway_profile(managed_outbound_ip_count, idle_timeout, profile, models): """configure a NAT Gateway with customer supplied values""" if not profile: return profile if managed_outbound_ip_count: + ManagedClusterManagedOutboundIPProfile = models.get("ManagedClusterManagedOutboundIPProfile") profile.managed_outbound_ip_profile = ManagedClusterManagedOutboundIPProfile( count=managed_outbound_ip_count ) diff --git a/src/aks-preview/azext_aks_preview/custom.py b/src/aks-preview/azext_aks_preview/custom.py index daa6699175e..fec08993972 100644 --- a/src/aks-preview/azext_aks_preview/custom.py +++ b/src/aks-preview/azext_aks_preview/custom.py @@ -54,6 +54,7 @@ KeyCredential, ServicePrincipalCreateParameters, GetObjectsParameters) +from azext_aks_preview._client_factory import CUSTOM_MGMT_AKS_PREVIEW from .vendored_sdks.azure_mgmt_preview_aks.v2021_08_01.models import (ContainerServiceLinuxProfile, ManagedClusterWindowsProfile, ContainerServiceNetworkProfile, @@ -987,9 +988,14 @@ def aks_create(cmd, # pylint: disable=too-many-locals,too-many-statements,to load_balancer_outbound_ports, load_balancer_idle_timeout) + from azext_aks_preview.decorator import AKSPreviewModels + # store all the models used by nat gateway + nat_gateway_models = AKSPreviewModels(cmd, CUSTOM_MGMT_AKS_PREVIEW).nat_gateway_models nat_gateway_profile = create_nat_gateway_profile( nat_gateway_managed_outbound_ip_count, - nat_gateway_idle_timeout) + nat_gateway_idle_timeout, + models=nat_gateway_models, + ) outbound_type = _set_outbound_type( outbound_type, vnet_subnet_id, load_balancer_sku, load_balancer_profile) @@ -1479,10 +1485,15 @@ def aks_update(cmd, # pylint: disable=too-many-statements,too-many-branches, instance.network_profile.load_balancer_profile) if update_natgw_profile: + from azext_aks_preview.decorator import AKSPreviewModels + # store all the models used by nat gateway + nat_gateway_models = AKSPreviewModels(cmd, CUSTOM_MGMT_AKS_PREVIEW).nat_gateway_models instance.network_profile.nat_gateway_profile = update_nat_gateway_profile( nat_gateway_managed_outbound_ip_count, nat_gateway_idle_timeout, - instance.network_profile.nat_gateway_profile) + instance.network_profile.nat_gateway_profile, + models=nat_gateway_models, + ) if attach_acr and detach_acr: raise CLIError( diff --git a/src/aks-preview/azext_aks_preview/decorator.py b/src/aks-preview/azext_aks_preview/decorator.py index b7053d4959e..8a5aebd1692 100644 --- a/src/aks-preview/azext_aks_preview/decorator.py +++ b/src/aks-preview/azext_aks_preview/decorator.py @@ -19,6 +19,10 @@ CLIInternalError, InvalidArgumentValueError, ) + +from azext_aks_preview._natgateway import( + create_nat_gateway_profile +) from azure.cli.core.commands import AzCliCommand from azure.cli.core.profiles import ResourceType from azure.cli.core.util import get_file_json @@ -57,6 +61,31 @@ def __init__(self, cmd: AzCommandsLoader, resource_type: ResourceType): resource_type=self.resource_type, operation_group="managed_clusters", ) + # init nat gateway models + self.init_nat_gateway_models() + + def init_nat_gateway_models(self) -> None: + """Initialize models used by nat gateway. + + The models are stored in a dictionary, the key is the model name and the value is the model type. + + :return: None + """ + nat_gateway_models = {} + nat_gateway_models["ManagedClusterNATGatewayProfile"] = self.__cmd.get_models( + "ManagedClusterNATGatewayProfile", + resource_type=self.resource_type, + operation_group="managed_clusters", + ) + nat_gateway_models["ManagedClusterManagedOutboundIPProfile"] = self.__cmd.get_models( + "ManagedClusterManagedOutboundIPProfile", + resource_type=self.resource_type, + operation_group="managed_clusters", + ) + self.nat_gateway_models = nat_gateway_models + # Note: Uncomment the followings to add these models as class attributes. + # for model_name, model_type in nat_gateway_models.items(): + # setattr(self, model_name, model_type) # pylint: disable=too-many-public-methods @@ -363,6 +392,9 @@ def __init__( def set_up_agent_pool_profiles(self, mc: ManagedCluster) -> ManagedCluster: """Set up agent pool profiles for the ManagedCluster object. + Call the method of the same name in the parent class to set up agent_pool_profiles, and then set some additional + properties on this basis. + :return: the ManagedCluster object """ mc = super().set_up_agent_pool_profiles(mc) @@ -407,6 +439,30 @@ def set_up_node_resource_group(self, mc: ManagedCluster) -> ManagedCluster: mc.node_resource_group = self.context.get_node_resource_group() return mc + def set_up_network_profile(self, mc: ManagedCluster) -> ManagedCluster: + """Set up network profile for the ManagedCluster object. + + Call the method of the same name in the parent class to set up network_profile, and then set the + nat_gateway_profile on this basis. + + :return: the ManagedCluster object + """ + mc = super().set_up_network_profile(mc) + network_profile = mc.network_profile + + # build nat gateway profile, which is part of the network profile + nat_gateway_profile = create_nat_gateway_profile( + self.context.get_nat_gateway_managed_outbound_ip_count(), + self.context.get_assign_identity(), + models=self.models.nat_gateway_models, + ) + + load_balancer_sku = self.context.get_load_balancer_sku() + if load_balancer_sku != "basic": + network_profile.nat_gateway_profile = nat_gateway_profile + mc.nat_gateway_profile = nat_gateway_profile + return mc + def construct_preview_mc_profile(self) -> ManagedCluster: """The overall controller used to construct the preview ManagedCluster profile. diff --git a/src/aks-preview/azext_aks_preview/tests/latest/test_natgateway.py b/src/aks-preview/azext_aks_preview/tests/latest/test_natgateway.py index d5f08a2639e..a4e65e6f29a 100644 --- a/src/aks-preview/azext_aks_preview/tests/latest/test_natgateway.py +++ b/src/aks-preview/azext_aks_preview/tests/latest/test_natgateway.py @@ -3,42 +3,62 @@ # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------------------------------- import unittest + import azext_aks_preview._natgateway as natgateway -from azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks.v2021_08_01.models import ManagedClusterNATGatewayProfile -from azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks.v2021_08_01.models import ManagedClusterManagedOutboundIPProfile +from azext_aks_preview.__init__ import register_aks_preview_resource_type +from azext_aks_preview._client_factory import CUSTOM_MGMT_AKS_PREVIEW +from azext_aks_preview.decorator import AKSPreviewModels +from azext_aks_preview.tests.latest.mocks import MockCLI, MockCmd + class TestCreateNatGatewayProfile(unittest.TestCase): + def setUp(self): + # manually register CUSTOM_MGMT_AKS_PREVIEW + register_aks_preview_resource_type() + self.cli_ctx = MockCLI() + self.cmd = MockCmd(self.cli_ctx) + # store all the models used by nat gateway + self.nat_gateway_models = AKSPreviewModels(self.cmd, CUSTOM_MGMT_AKS_PREVIEW).nat_gateway_models + def test_empty_arguments(self): - profile = natgateway.create_nat_gateway_profile(None, None) + profile = natgateway.create_nat_gateway_profile(None, None, models=self.nat_gateway_models) self.assertIsNone(profile) def test_nonempty_arguments(self): managed_outbound_ip_count = 2 idle_timeout = 30 - profile = natgateway.create_nat_gateway_profile(managed_outbound_ip_count, idle_timeout) + profile = natgateway.create_nat_gateway_profile(managed_outbound_ip_count, idle_timeout, models=self.nat_gateway_models) self.assertEqual(profile.managed_outbound_ip_profile.count, managed_outbound_ip_count) self.assertEqual(profile.idle_timeout_in_minutes, idle_timeout) class TestUpdateNatGatewayProfile(unittest.TestCase): + def setUp(self): + # manually register CUSTOM_MGMT_AKS_PREVIEW + register_aks_preview_resource_type() + self.cli_ctx = MockCLI() + self.cmd = MockCmd(self.cli_ctx) + # store all the models used by nat gateway + self.nat_gateway_models = AKSPreviewModels(self.cmd, CUSTOM_MGMT_AKS_PREVIEW).nat_gateway_models + def test_empty_arguments(self): - origin_profile = ManagedClusterNATGatewayProfile( - managed_outbound_ip_profile=ManagedClusterManagedOutboundIPProfile( + origin_profile = self.nat_gateway_models["ManagedClusterNATGatewayProfile"]( + managed_outbound_ip_profile=self.nat_gateway_models["ManagedClusterManagedOutboundIPProfile"]( count=1 ), idle_timeout_in_minutes=4 ) - profile = natgateway.update_nat_gateway_profile(None, None, origin_profile) + profile = natgateway.update_nat_gateway_profile(None, None, origin_profile, models=self.nat_gateway_models) self.assertEqual(profile.managed_outbound_ip_profile.count, origin_profile.managed_outbound_ip_profile.count) self.assertEqual(profile.idle_timeout_in_minutes, origin_profile.idle_timeout_in_minutes) def test_nonempty_arguments(self): - origin_profile = ManagedClusterNATGatewayProfile( - managed_outbound_ip_profile=ManagedClusterManagedOutboundIPProfile( + origin_profile = self.nat_gateway_models["ManagedClusterNATGatewayProfile"]( + managed_outbound_ip_profile=self.nat_gateway_models["ManagedClusterManagedOutboundIPProfile"]( count=1 ), idle_timeout_in_minutes=4 @@ -46,7 +66,7 @@ def test_nonempty_arguments(self): new_managed_outbound_ip_count = 2 new_idle_timeout = 30 - profile = natgateway.update_nat_gateway_profile(new_managed_outbound_ip_count, new_idle_timeout, origin_profile) + profile = natgateway.update_nat_gateway_profile(new_managed_outbound_ip_count, new_idle_timeout, origin_profile, models=self.nat_gateway_models) self.assertEqual(profile.managed_outbound_ip_profile.count, new_managed_outbound_ip_count) self.assertEqual(profile.idle_timeout_in_minutes, new_idle_timeout) From 0d5a800b45817f636ca9262b21468e8a6f155f6b Mon Sep 17 00:00:00 2001 From: Fuming Zhang Date: Mon, 18 Oct 2021 14:14:59 +0800 Subject: [PATCH 3/4] add test --- .../azext_aks_preview/_natgateway.py | 2 +- .../azext_aks_preview/decorator.py | 4 +- .../tests/latest/test_decorator.py | 144 ++++++++++++++++++ 3 files changed, 147 insertions(+), 3 deletions(-) diff --git a/src/aks-preview/azext_aks_preview/_natgateway.py b/src/aks-preview/azext_aks_preview/_natgateway.py index 85ac09f1363..3909951aa3b 100644 --- a/src/aks-preview/azext_aks_preview/_natgateway.py +++ b/src/aks-preview/azext_aks_preview/_natgateway.py @@ -10,7 +10,7 @@ def create_nat_gateway_profile(managed_outbound_ip_count, idle_timeout, models): return None # profile = ManagedClusterNATGatewayProfile() - profile = models.get("ManagedClusterNATGatewayProfile") + profile = models.get("ManagedClusterNATGatewayProfile")() return configure_nat_gateway_profile(managed_outbound_ip_count, idle_timeout, profile, models) diff --git a/src/aks-preview/azext_aks_preview/decorator.py b/src/aks-preview/azext_aks_preview/decorator.py index 8a5aebd1692..0b67c066e80 100644 --- a/src/aks-preview/azext_aks_preview/decorator.py +++ b/src/aks-preview/azext_aks_preview/decorator.py @@ -453,14 +453,14 @@ def set_up_network_profile(self, mc: ManagedCluster) -> ManagedCluster: # build nat gateway profile, which is part of the network profile nat_gateway_profile = create_nat_gateway_profile( self.context.get_nat_gateway_managed_outbound_ip_count(), - self.context.get_assign_identity(), + self.context.get_nat_gateway_idle_timeout(), models=self.models.nat_gateway_models, ) load_balancer_sku = self.context.get_load_balancer_sku() if load_balancer_sku != "basic": network_profile.nat_gateway_profile = nat_gateway_profile - mc.nat_gateway_profile = nat_gateway_profile + mc.network_profile = network_profile return mc def construct_preview_mc_profile(self) -> ManagedCluster: diff --git a/src/aks-preview/azext_aks_preview/tests/latest/test_decorator.py b/src/aks-preview/azext_aks_preview/tests/latest/test_decorator.py index 661c1cde97d..c64c46fe1ec 100644 --- a/src/aks-preview/azext_aks_preview/tests/latest/test_decorator.py +++ b/src/aks-preview/azext_aks_preview/tests/latest/test_decorator.py @@ -294,6 +294,58 @@ def test_get_node_resource_group(self): ctx_1.get_node_resource_group(), "test_node_resource_group" ) + def test_get_nat_gateway_managed_outbound_ip_count(self): + # default + ctx_1 = AKSPreviewContext( + self.cmd, + {"nat_gateway_managed_outbound_ip_count": None}, + self.models, + decorator_mode=DecoratorMode.CREATE, + ) + self.assertEqual( + ctx_1.get_nat_gateway_managed_outbound_ip_count(), None + ) + nat_gateway_profile = self.models.nat_gateway_models.get( + "ManagedClusterNATGatewayProfile" + )( + managed_outbound_ip_profile=self.models.nat_gateway_models.get( + "ManagedClusterManagedOutboundIPProfile" + )(count=10) + ) + network_profile = self.models.ContainerServiceNetworkProfile( + nat_gateway_profile=nat_gateway_profile + ) + mc = self.models.ManagedCluster( + location="test_location", + network_profile=network_profile, + ) + ctx_1.attach_mc(mc) + self.assertEqual(ctx_1.get_nat_gateway_managed_outbound_ip_count(), 10) + + def test_get_nat_gateway_idle_timeout(self): + # default + ctx_1 = AKSPreviewContext( + self.cmd, + {"nat_gateway_idle_timeout": None}, + self.models, + decorator_mode=DecoratorMode.CREATE, + ) + self.assertEqual(ctx_1.get_nat_gateway_idle_timeout(), None) + nat_gateway_profile = self.models.nat_gateway_models.get( + "ManagedClusterNATGatewayProfile" + )( + idle_timeout_in_minutes=20, + ) + network_profile = self.models.ContainerServiceNetworkProfile( + nat_gateway_profile=nat_gateway_profile + ) + mc = self.models.ManagedCluster( + location="test_location", + network_profile=network_profile, + ) + ctx_1.attach_mc(mc) + self.assertEqual(ctx_1.get_nat_gateway_idle_timeout(), 20) + class AKSPreviewCreateDecoratorTestCase(unittest.TestCase): def setUp(self): @@ -537,6 +589,98 @@ def test_set_up_node_resource_group(self): ) self.assertEqual(dec_mc_2, ground_truth_mc_2) + def test_set_up_network_profile(self): + # default value in `aks_create` + dec_1 = AKSPreviewCreateDecorator( + self.cmd, + self.client, + { + "load_balancer_sku": None, + "load_balancer_managed_outbound_ip_count": None, + "load_balancer_outbound_ips": None, + "load_balancer_outbound_ip_prefixes": None, + "load_balancer_outbound_ports": None, + "load_balancer_idle_timeout": None, + "outbound_type": None, + "network_plugin": None, + "pod_cidr": None, + "service_cidr": None, + "dns_service_ip": None, + "docker_bridge_cidr": None, + "network_policy": None, + "nat_gateway_managed_outbound_ip_count": None, + "nat_gateway_idle_timeout": None, + }, + CUSTOM_MGMT_AKS_PREVIEW, + ) + + mc_1 = self.models.ManagedCluster(location="test_location") + # fail on passing the wrong mc object + with self.assertRaises(CLIInternalError): + dec_1.set_up_network_profile(None) + dec_mc_1 = dec_1.set_up_network_profile(mc_1) + + network_profile_1 = self.models.ContainerServiceNetworkProfile( + network_plugin="kubenet", # default value in SDK + pod_cidr="10.244.0.0/16", # default value in SDK + service_cidr="10.0.0.0/16", # default value in SDK + dns_service_ip="10.0.0.10", # default value in SDK + docker_bridge_cidr="172.17.0.1/16", # default value in SDK + load_balancer_sku="standard", + outbound_type="loadBalancer", + ) + ground_truth_mc_1 = self.models.ManagedCluster( + location="test_location", network_profile=network_profile_1 + ) + self.assertEqual(dec_mc_1, ground_truth_mc_1) + + # custom value + dec_2 = AKSPreviewCreateDecorator( + self.cmd, + self.client, + { + "load_balancer_sku": None, + "load_balancer_managed_outbound_ip_count": None, + "load_balancer_outbound_ips": None, + "load_balancer_outbound_ip_prefixes": None, + "load_balancer_outbound_ports": None, + "load_balancer_idle_timeout": None, + "outbound_type": None, + "network_plugin": "kubenet", + "pod_cidr": "10.246.0.0/16", + "service_cidr": None, + "dns_service_ip": None, + "docker_bridge_cidr": None, + "network_policy": None, + "nat_gateway_managed_outbound_ip_count": 10, + "nat_gateway_idle_timeout": 20, + }, + CUSTOM_MGMT_AKS_PREVIEW, + ) + mc_2 = self.models.ManagedCluster(location="test_location") + dec_mc_2 = dec_2.set_up_network_profile(mc_2) + + nat_gateway_profile_2 = self.models.nat_gateway_models.get("ManagedClusterNATGatewayProfile")( + managed_outbound_ip_profile=self.models.nat_gateway_models.get( + "ManagedClusterManagedOutboundIPProfile" + )(count=10), + idle_timeout_in_minutes=20, + ) + network_profile_2 = self.models.ContainerServiceNetworkProfile( + network_plugin="kubenet", + pod_cidr="10.246.0.0/16", + service_cidr=None, # overwritten to None + dns_service_ip=None, # overwritten to None + docker_bridge_cidr=None, # overwritten to None + load_balancer_sku="standard", + outbound_type="loadBalancer", + nat_gateway_profile=nat_gateway_profile_2, + ) + ground_truth_mc_2 = self.models.ManagedCluster( + location="test_location", network_profile=network_profile_2 + ) + self.assertEqual(dec_mc_2, ground_truth_mc_2) + def test_construct_preview_mc_profile(self): pass From cb986cfc553931a1f63f896ed800e35945552a48 Mon Sep 17 00:00:00 2001 From: Fuming Zhang Date: Mon, 18 Oct 2021 14:36:50 +0800 Subject: [PATCH 4/4] fix lint --- src/aks-preview/azext_aks_preview/decorator.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/aks-preview/azext_aks_preview/decorator.py b/src/aks-preview/azext_aks_preview/decorator.py index 0b67c066e80..86b414f2e42 100644 --- a/src/aks-preview/azext_aks_preview/decorator.py +++ b/src/aks-preview/azext_aks_preview/decorator.py @@ -19,15 +19,13 @@ CLIInternalError, InvalidArgumentValueError, ) - -from azext_aks_preview._natgateway import( - create_nat_gateway_profile -) from azure.cli.core.commands import AzCliCommand from azure.cli.core.profiles import ResourceType from azure.cli.core.util import get_file_json from knack.log import get_logger +from azext_aks_preview._natgateway import create_nat_gateway_profile + logger = get_logger(__name__) # type variables @@ -79,7 +77,7 @@ def init_nat_gateway_models(self) -> None: ) nat_gateway_models["ManagedClusterManagedOutboundIPProfile"] = self.__cmd.get_models( "ManagedClusterManagedOutboundIPProfile", - resource_type=self.resource_type, + resource_type=self.resource_type, operation_group="managed_clusters", ) self.nat_gateway_models = nat_gateway_models