@@ -3415,6 +3415,13 @@ def get_enable_application_load_balancer(self) -> bool:
34153415 """
34163416 return self .raw_param .get ("enable_application_load_balancer" )
34173417
3418+ def get_disable_application_load_balancer (self ) -> bool :
3419+ """Obtain the value of disable_application_load_balancer.
3420+
3421+ :return: bool
3422+ """
3423+ return self .raw_param .get ("disable_application_load_balancer" )
3424+
34183425 def get_enable_app_routing (self ) -> bool :
34193426 """Obtain the value of enable_app_routing.
34203427
@@ -6645,25 +6652,37 @@ def update_application_load_balancer_profile(self, mc: ManagedCluster) -> Manage
66456652
66466653 # get parameters from context
66476654 enable_application_load_balancer = self .context .get_enable_application_load_balancer ()
6655+ disable_application_load_balancer = self .context .get_disable_application_load_balancer ()
6656+
6657+ # Check for mutually exclusive arguments
6658+ if enable_application_load_balancer and disable_application_load_balancer :
6659+ raise MutuallyExclusiveArgumentError (
6660+ "Cannot specify --enable-application-load-balancer and "
6661+ "--disable-application-load-balancer at the same time."
6662+ )
66486663
66496664 # update ManagedCluster object with application load balancer settings
6650- mc .ingress_profile = (
6651- mc .ingress_profile or
6652- self .models .ManagedClusterIngressProfile () # pylint: disable=no-member
6653- )
6654- mc .ingress_profile .application_load_balancer = (
6655- mc .ingress_profile .application_load_balancer or
6656- self .models .ManagedClusterIngressProfileApplicationLoadBalancer () # pylint: disable=no-member
6657- )
6658- if enable_application_load_balancer is not None :
6659- if mc .ingress_profile .application_load_balancer .enabled == enable_application_load_balancer :
6660- error_message = (
6661- "Application Load Balancer (Application Gateway for Containers) is already enabled.\n "
6662- if enable_application_load_balancer
6663- else "Application Load Balancer (Application Gateway for Containers) is already disabled.\n "
6664- )
6665- raise CLIError (error_message )
6666- mc .ingress_profile .application_load_balancer .enabled = enable_application_load_balancer
6665+ if enable_application_load_balancer or disable_application_load_balancer :
6666+ mc .ingress_profile = (
6667+ mc .ingress_profile or
6668+ self .models .ManagedClusterIngressProfile () # pylint: disable=no-member
6669+ )
6670+ mc .ingress_profile .application_load_balancer = (
6671+ mc .ingress_profile .application_load_balancer or
6672+ self .models .ManagedClusterIngressProfileApplicationLoadBalancer () # pylint: disable=no-member
6673+ )
6674+ if enable_application_load_balancer :
6675+ if mc .ingress_profile .application_load_balancer .enabled :
6676+ raise CLIError (
6677+ "Application Load Balancer (Application Gateway for Containers) is already enabled.\n "
6678+ )
6679+ mc .ingress_profile .application_load_balancer .enabled = True
6680+ elif disable_application_load_balancer :
6681+ if mc .ingress_profile .application_load_balancer .enabled is False :
6682+ raise CLIError (
6683+ "Application Load Balancer (Application Gateway for Containers) is already disabled.\n "
6684+ )
6685+ mc .ingress_profile .application_load_balancer .enabled = False
66676686
66686687 return mc
66696688
@@ -7312,6 +7331,8 @@ def update_mc_profile_preview(self) -> ManagedCluster:
73127331 mc = self .update_nat_gateway_profile (mc )
73137332 # update kube proxy config
73147333 mc = self .update_kube_proxy_config (mc )
7334+ # update application load balancer profile
7335+ mc = self .update_application_load_balancer_profile (mc )
73157336 # update ingress profile gateway api
73167337 mc = self .update_ingress_profile_gateway_api (mc )
73177338 # update custom ca trust certificates
0 commit comments