Skip to content

Commit 6349d7b

Browse files
committed
fix: 1007-ParaRemove
1 parent 06fad3d commit 6349d7b

File tree

2 files changed

+85
-0
lines changed
  • src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_appliance

2 files changed

+85
-0
lines changed

src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_appliance/_create.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ def _build_arguments_schema(cls, *args, **kwargs):
5757
# define Arg Group "Parameters"
5858

5959
_args_schema = cls._args_schema
60+
_args_schema.identity = AAZObjectArg(
61+
options=["--identity"],
62+
arg_group="Parameters",
63+
help="The service principal that has read access to cloud-init and config blob.",
64+
)
6065
_args_schema.location = AAZResourceLocationArg(
6166
arg_group="Parameters",
6267
help="Location. Values from: `az account list-locations`. You can configure the default location using `az configure --defaults location=<location>`.",
@@ -70,6 +75,35 @@ def _build_arguments_schema(cls, *args, **kwargs):
7075
help="Space-separated tags: key[=value] [key[=value] ...]. Use \"\" to clear existing tags.",
7176
)
7277

78+
identity = cls._args_schema.identity
79+
identity.mi_system_assigned = AAZStrArg(
80+
options=["system-assigned", "mi-system-assigned"],
81+
help="Set the system managed identity.",
82+
blank="True",
83+
)
84+
identity.type = AAZStrArg(
85+
options=["type"],
86+
help="The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the virtual machine.",
87+
enum={"None": "None", "SystemAssigned": "SystemAssigned", "SystemAssigned, UserAssigned": "SystemAssigned, UserAssigned", "UserAssigned": "UserAssigned"},
88+
)
89+
identity.mi_user_assigned = AAZListArg(
90+
options=["user-assigned", "mi-user-assigned"],
91+
help="Set the user managed identities.",
92+
blank=[],
93+
)
94+
identity.user_assigned_identities = AAZDictArg(
95+
options=["user-assigned-identities"],
96+
help="The list of user identities associated with resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.",
97+
)
98+
99+
mi_user_assigned = cls._args_schema.identity.mi_user_assigned
100+
mi_user_assigned.Element = AAZStrArg()
101+
102+
user_assigned_identities = cls._args_schema.identity.user_assigned_identities
103+
user_assigned_identities.Element = AAZObjectArg(
104+
blank={},
105+
)
106+
73107
tags = cls._args_schema.tags
74108
tags.Element = AAZStrArg()
75109

@@ -360,10 +394,26 @@ def content(self):
360394
typ=AAZObjectType,
361395
typ_kwargs={"flags": {"required": True, "client_flatten": True}}
362396
)
397+
_builder.set_prop("identity", AAZIdentityObjectType, ".identity")
363398
_builder.set_prop("location", AAZStrType, ".location")
364399
_builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}})
365400
_builder.set_prop("tags", AAZDictType, ".tags")
366401

402+
identity = _builder.get(".identity")
403+
if identity is not None:
404+
identity.set_prop("type", AAZStrType, ".type")
405+
identity.set_prop("userAssignedIdentities", AAZDictType, ".user_assigned_identities")
406+
identity.set_prop("userAssigned", AAZListType, ".mi_user_assigned", typ_kwargs={"flags": {"action": "create"}})
407+
identity.set_prop("systemAssigned", AAZStrType, ".mi_system_assigned", typ_kwargs={"flags": {"action": "create"}})
408+
409+
user_assigned_identities = _builder.get(".identity.userAssignedIdentities")
410+
if user_assigned_identities is not None:
411+
user_assigned_identities.set_elements(AAZObjectType, ".")
412+
413+
user_assigned = _builder.get(".identity.userAssigned")
414+
if user_assigned is not None:
415+
user_assigned.set_elements(AAZStrType, ".")
416+
367417
properties = _builder.get(".properties")
368418
if properties is not None:
369419
properties.set_prop("additionalNics", AAZListType, ".additional_nics")

src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/virtual_appliance/_update.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ def _build_arguments_schema(cls, *args, **kwargs):
6060
# define Arg Group "Parameters"
6161

6262
_args_schema = cls._args_schema
63+
_args_schema.identity = AAZObjectArg(
64+
options=["--identity"],
65+
arg_group="Parameters",
66+
help="The service principal that has read access to cloud-init and config blob.",
67+
nullable=True,
68+
)
6369
_args_schema.location = AAZResourceLocationArg(
6470
arg_group="Parameters",
6571
help="Location. Values from: `az account list-locations`. You can configure the default location using `az configure --defaults location=<location>`.",
@@ -72,6 +78,25 @@ def _build_arguments_schema(cls, *args, **kwargs):
7278
nullable=True,
7379
)
7480

81+
identity = cls._args_schema.identity
82+
identity.type = AAZStrArg(
83+
options=["type"],
84+
help="The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove any identities from the virtual machine.",
85+
nullable=True,
86+
enum={"None": "None", "SystemAssigned": "SystemAssigned", "SystemAssigned, UserAssigned": "SystemAssigned, UserAssigned", "UserAssigned": "UserAssigned"},
87+
)
88+
identity.user_assigned_identities = AAZDictArg(
89+
options=["user-assigned-identities"],
90+
help="The list of user identities associated with resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.",
91+
nullable=True,
92+
)
93+
94+
user_assigned_identities = cls._args_schema.identity.user_assigned_identities
95+
user_assigned_identities.Element = AAZObjectArg(
96+
nullable=True,
97+
blank={},
98+
)
99+
75100
tags = cls._args_schema.tags
76101
tags.Element = AAZStrArg(
77102
nullable=True,
@@ -534,10 +559,20 @@ def _update_instance(self, instance):
534559
value=instance,
535560
typ=AAZObjectType
536561
)
562+
_builder.set_prop("identity", AAZIdentityObjectType, ".identity")
537563
_builder.set_prop("location", AAZStrType, ".location")
538564
_builder.set_prop("properties", AAZObjectType, typ_kwargs={"flags": {"client_flatten": True}})
539565
_builder.set_prop("tags", AAZDictType, ".tags")
540566

567+
identity = _builder.get(".identity")
568+
if identity is not None:
569+
identity.set_prop("type", AAZStrType, ".type")
570+
identity.set_prop("userAssignedIdentities", AAZDictType, ".user_assigned_identities")
571+
572+
user_assigned_identities = _builder.get(".identity.userAssignedIdentities")
573+
if user_assigned_identities is not None:
574+
user_assigned_identities.set_elements(AAZObjectType, ".")
575+
541576
properties = _builder.get(".properties")
542577
if properties is not None:
543578
properties.set_prop("additionalNics", AAZListType, ".additional_nics")

0 commit comments

Comments
 (0)