Skip to content

Commit ed4fb3f

Browse files
committed
update from inhert aaz
1 parent 1c77aa0 commit ed4fb3f

File tree

12 files changed

+145
-164
lines changed

12 files changed

+145
-164
lines changed

src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/log_analytics/cluster/_create.py

Lines changed: 26 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -62,43 +62,46 @@ def _build_arguments_schema(cls, *args, **kwargs):
6262
# define Arg Group "Identity"
6363

6464
_args_schema = cls._args_schema
65-
_args_schema.mi_system_assigned = AAZStrArg(
66-
options=["--system-assigned", "--mi-system-assigned"],
65+
_args_schema.identity_type = AAZStrArg(
66+
options=["--type", "--identity-type"],
6767
arg_group="Identity",
68-
help="Set the system managed identity.",
69-
blank="True",
68+
help="Type of managed service identity.",
69+
default="SystemAssigned",
70+
enum={"None": "None", "SystemAssigned": "SystemAssigned", "SystemAssigned,UserAssigned": "SystemAssigned,UserAssigned", "UserAssigned": "UserAssigned"},
7071
)
71-
_args_schema.mi_user_assigned = AAZListArg(
72-
options=["--user-assigned", "--mi-user-assigned"],
72+
_args_schema.user_assigned_identities = AAZDictArg(
73+
options=["--user-assigned", "--user-assigned-identities"],
7374
arg_group="Identity",
74-
help="Set the user managed identities.",
75-
blank=[],
75+
help="The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.",
7676
)
7777

78-
mi_user_assigned = cls._args_schema.mi_user_assigned
79-
mi_user_assigned.Element = AAZStrArg()
78+
user_assigned_identities = cls._args_schema.user_assigned_identities
79+
user_assigned_identities.Element = AAZObjectArg(
80+
nullable=True,
81+
blank={},
82+
)
8083

81-
# define Arg Group "KeyVaultProperties"
84+
# define Arg Group "Key Properties"
8285

8386
_args_schema = cls._args_schema
8487
_args_schema.key_name = AAZStrArg(
8588
options=["--key-name"],
86-
arg_group="KeyVaultProperties",
89+
arg_group="Key Properties",
8790
help="The name of the key associated with the Log Analytics cluster.",
8891
)
8992
_args_schema.key_rsa_size = AAZIntArg(
9093
options=["--key-rsa-size"],
91-
arg_group="KeyVaultProperties",
94+
arg_group="Key Properties",
9295
help="Selected key minimum required size.",
9396
)
9497
_args_schema.key_vault_uri = AAZStrArg(
9598
options=["--key-vault-uri"],
96-
arg_group="KeyVaultProperties",
99+
arg_group="Key Properties",
97100
help="The Key Vault uri which holds they key associated with the Log Analytics cluster.",
98101
)
99102
_args_schema.key_version = AAZStrArg(
100103
options=["--key-version"],
101-
arg_group="KeyVaultProperties",
104+
arg_group="Key Properties",
102105
help="The version of the key associated with the Log Analytics cluster.",
103106
)
104107

@@ -131,16 +134,6 @@ def _build_arguments_schema(cls, *args, **kwargs):
131134
help="The cluster's billing type.",
132135
enum={"Cluster": "Cluster", "Workspaces": "Workspaces"},
133136
)
134-
_args_schema.is_availability_zones_enabled = AAZBoolArg(
135-
options=["--is-zone-enabled", "--is-availability-zones-enabled"],
136-
arg_group="Properties",
137-
help="Sets whether the cluster will support availability zones. This can be set as true only in regions where Azure Data Explorer support Availability Zones. This Property can not be modified after cluster creation. Default value is 'true' if region supports Availability Zones.",
138-
)
139-
_args_schema.is_double_encryption_enabled = AAZBoolArg(
140-
options=["--enable-d-encrypt", "--is-double-encryption-enabled"],
141-
arg_group="Properties",
142-
help="Configures whether cluster will use double encryption. This Property can not be modified after cluster creation. Default value is 'true'",
143-
)
144137
_args_schema.replication = AAZObjectArg(
145138
options=["--replication"],
146139
arg_group="Properties",
@@ -167,13 +160,14 @@ def _build_arguments_schema(cls, *args, **kwargs):
167160
_args_schema.sku_capacity = AAZIntArg(
168161
options=["--sku-capacity"],
169162
arg_group="Sku",
170-
help="The capacity reservation level in Gigabytes for this cluster.",
163+
help="The capacity of the SKU. It can be decreased only after 31 days.",
171164
enum={"100": 100, "1000": 1000, "10000": 10000, "200": 200, "2000": 2000, "25000": 25000, "300": 300, "400": 400, "500": 500, "5000": 5000, "50000": 50000},
172165
)
173166
_args_schema.sku_name = AAZStrArg(
174167
options=["--sku-name"],
175168
arg_group="Sku",
176-
help="The SKU (tier) of a cluster.",
169+
help="The name of the SKU.",
170+
default="CapacityReservation",
177171
enum={"CapacityReservation": "CapacityReservation"},
178172
)
179173
return cls._args_schema
@@ -292,18 +286,16 @@ def content(self):
292286

293287
identity = _builder.get(".identity")
294288
if identity is not None:
295-
identity.set_prop("userAssigned", AAZListType, ".mi_user_assigned", typ_kwargs={"flags": {"action": "create"}})
296-
identity.set_prop("systemAssigned", AAZStrType, ".mi_system_assigned", typ_kwargs={"flags": {"action": "create"}})
289+
identity.set_prop("type", AAZStrType, ".identity_type", typ_kwargs={"flags": {"required": True}})
290+
identity.set_prop("userAssignedIdentities", AAZDictType, ".user_assigned_identities")
297291

298-
user_assigned = _builder.get(".identity.userAssigned")
299-
if user_assigned is not None:
300-
user_assigned.set_elements(AAZStrType, ".")
292+
user_assigned_identities = _builder.get(".identity.userAssignedIdentities")
293+
if user_assigned_identities is not None:
294+
user_assigned_identities.set_elements(AAZObjectType, ".", typ_kwargs={"nullable": True})
301295

302296
properties = _builder.get(".properties")
303297
if properties is not None:
304298
properties.set_prop("billingType", AAZStrType, ".billing_type")
305-
properties.set_prop("isAvailabilityZonesEnabled", AAZBoolType, ".is_availability_zones_enabled")
306-
properties.set_prop("isDoubleEncryptionEnabled", AAZBoolType, ".is_double_encryption_enabled")
307299
properties.set_prop("keyVaultProperties", AAZObjectType)
308300
properties.set_prop("replication", AAZObjectType, ".replication")
309301

src/azure-cli/azure/cli/command_modules/monitor/aaz/latest/monitor/log_analytics/cluster/_update.py

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -61,30 +61,50 @@ def _build_arguments_schema(cls, *args, **kwargs):
6161

6262
# define Arg Group "Identity"
6363

64-
# define Arg Group "KeyVaultProperties"
64+
_args_schema = cls._args_schema
65+
_args_schema.identity_type = AAZStrArg(
66+
options=["--type", "--identity-type"],
67+
arg_group="Identity",
68+
help="Type of managed service identity.",
69+
enum={"None": "None", "SystemAssigned": "SystemAssigned", "SystemAssigned,UserAssigned": "SystemAssigned,UserAssigned", "UserAssigned": "UserAssigned"},
70+
)
71+
_args_schema.user_assigned_identities = AAZDictArg(
72+
options=["--user-assigned", "--user-assigned-identities"],
73+
arg_group="Identity",
74+
help="The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.",
75+
nullable=True,
76+
)
77+
78+
user_assigned_identities = cls._args_schema.user_assigned_identities
79+
user_assigned_identities.Element = AAZObjectArg(
80+
nullable=True,
81+
blank={},
82+
)
83+
84+
# define Arg Group "Key Properties"
6585

6686
_args_schema = cls._args_schema
6787
_args_schema.key_name = AAZStrArg(
6888
options=["--key-name"],
69-
arg_group="KeyVaultProperties",
89+
arg_group="Key Properties",
7090
help="The name of the key associated with the Log Analytics cluster.",
7191
nullable=True,
7292
)
7393
_args_schema.key_rsa_size = AAZIntArg(
7494
options=["--key-rsa-size"],
75-
arg_group="KeyVaultProperties",
95+
arg_group="Key Properties",
7696
help="Selected key minimum required size.",
7797
nullable=True,
7898
)
7999
_args_schema.key_vault_uri = AAZStrArg(
80100
options=["--key-vault-uri"],
81-
arg_group="KeyVaultProperties",
101+
arg_group="Key Properties",
82102
help="The Key Vault uri which holds they key associated with the Log Analytics cluster.",
83103
nullable=True,
84104
)
85105
_args_schema.key_version = AAZStrArg(
86106
options=["--key-version"],
87-
arg_group="KeyVaultProperties",
107+
arg_group="Key Properties",
88108
help="The version of the key associated with the Log Analytics cluster.",
89109
nullable=True,
90110
)
@@ -114,12 +134,6 @@ def _build_arguments_schema(cls, *args, **kwargs):
114134
nullable=True,
115135
enum={"Cluster": "Cluster", "Workspaces": "Workspaces"},
116136
)
117-
_args_schema.is_availability_zones_enabled = AAZBoolArg(
118-
options=["--is-zone-enabled", "--is-availability-zones-enabled"],
119-
arg_group="Properties",
120-
help="Sets whether the cluster will support availability zones. This can be set as true only in regions where Azure Data Explorer support Availability Zones. This Property can not be modified after cluster creation. Default value is 'true' if region supports Availability Zones.",
121-
nullable=True,
122-
)
123137
_args_schema.replication = AAZObjectArg(
124138
options=["--replication"],
125139
arg_group="Properties",
@@ -145,17 +159,10 @@ def _build_arguments_schema(cls, *args, **kwargs):
145159
_args_schema.sku_capacity = AAZIntArg(
146160
options=["--sku-capacity"],
147161
arg_group="Sku",
148-
help="The capacity reservation level in Gigabytes for this cluster.",
162+
help="The capacity of the SKU. It can be decreased only after 31 days.",
149163
nullable=True,
150164
enum={"100": 100, "1000": 1000, "10000": 10000, "200": 200, "2000": 2000, "25000": 25000, "300": 300, "400": 400, "500": 500, "5000": 5000, "50000": 50000},
151165
)
152-
_args_schema.sku_name = AAZStrArg(
153-
options=["--sku-name"],
154-
arg_group="Sku",
155-
help="The SKU (tier) of a cluster.",
156-
nullable=True,
157-
enum={"CapacityReservation": "CapacityReservation"},
158-
)
159166
return cls._args_schema
160167

161168
def _execute_operations(self):
@@ -398,10 +405,18 @@ def _update_instance(self, instance):
398405
_builder.set_prop("sku", AAZObjectType)
399406
_builder.set_prop("tags", AAZDictType, ".tags")
400407

408+
identity = _builder.get(".identity")
409+
if identity is not None:
410+
identity.set_prop("type", AAZStrType, ".identity_type", typ_kwargs={"flags": {"required": True}})
411+
identity.set_prop("userAssignedIdentities", AAZDictType, ".user_assigned_identities")
412+
413+
user_assigned_identities = _builder.get(".identity.userAssignedIdentities")
414+
if user_assigned_identities is not None:
415+
user_assigned_identities.set_elements(AAZObjectType, ".", typ_kwargs={"nullable": True})
416+
401417
properties = _builder.get(".properties")
402418
if properties is not None:
403419
properties.set_prop("billingType", AAZStrType, ".billing_type")
404-
properties.set_prop("isAvailabilityZonesEnabled", AAZBoolType, ".is_availability_zones_enabled")
405420
properties.set_prop("keyVaultProperties", AAZObjectType)
406421
properties.set_prop("replication", AAZObjectType, ".replication")
407422

@@ -420,7 +435,6 @@ def _update_instance(self, instance):
420435
sku = _builder.get(".sku")
421436
if sku is not None:
422437
sku.set_prop("capacity", AAZIntType, ".sku_capacity")
423-
sku.set_prop("name", AAZStrType, ".sku_name")
424438

425439
tags = _builder.get(".tags")
426440
if tags is not None:

0 commit comments

Comments
 (0)