44# --------------------------------------------------------------------------------------------
55# pylint: disable=no-self-use, line-too-long, protected-access, too-few-public-methods, unused-argument
66from knack .log import get_logger
7-
7+ from azure . cli . core . aaz import register_command
88from ..aaz .latest .vmss import ListInstances as _VMSSListInstances
9+ from ..aaz .latest .vmss import Deallocate as _VMSSDeallocate
910
1011logger = get_logger (__name__ )
1112
@@ -25,3 +26,17 @@ def _output(self, *args, **kwargs):
2526 result = self .deserialize_output (self .ctx .vars .instance .value , client_flatten = True )
2627 next_link = self .deserialize_output (self .ctx .vars .instance .next_link )
2728 return result , next_link
29+
30+ class VMSSDeallocate (_VMSSDeallocate ):
31+ def _output (self , * args , ** kwargs ):
32+ from azure .cli .core .aaz import AAZUndefined , has_value
33+
34+ # Resolve flatten conflict
35+ # When the type field conflicts, the type in inner layer is ignored and the outer layer is applied
36+ if has_value (self .ctx .vars .instance .resources ):
37+ for resource in self .ctx .vars .instance .resources :
38+ if has_value (resource .type ):
39+ resource .type = AAZUndefined
40+
41+ result = self .deserialize_output (self .ctx .vars .instance , client_flatten = True )
42+ return result
0 commit comments