Skip to content

Commit 4bf9ff3

Browse files
committed
ready only for associate worksapce and add sku for workspace update
1 parent 51811f4 commit 4bf9ff3

File tree

6 files changed

+39
-0
lines changed

6 files changed

+39
-0
lines changed

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

+1
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ def _build_schema_on_200_201(cls):
368368
properties = cls._schema_on_200_201.properties
369369
properties.associated_workspaces = AAZListType(
370370
serialized_name="associatedWorkspaces",
371+
flags={"read_only": True},
371372
)
372373
properties.billing_type = AAZStrType(
373374
serialized_name="billingType",

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

+1
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ def _build_schema_on_200(cls):
206206
properties = cls._schema_on_200.properties
207207
properties.associated_workspaces = AAZListType(
208208
serialized_name="associatedWorkspaces",
209+
flags={"read_only": True},
209210
)
210211
properties.billing_type = AAZStrType(
211212
serialized_name="billingType",

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

+1
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ def _build_schema_cluster_read(cls, _schema):
501501
properties = _schema_cluster_read.properties
502502
properties.associated_workspaces = AAZListType(
503503
serialized_name="associatedWorkspaces",
504+
flags={"read_only": True},
504505
)
505506
properties.billing_type = AAZStrType(
506507
serialized_name="billingType",

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

+1
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ def _build_schema_on_200(cls):
202202
properties = cls._schema_on_200.properties
203203
properties.associated_workspaces = AAZListType(
204204
serialized_name="associatedWorkspaces",
205+
flags={"read_only": True},
205206
)
206207
properties.billing_type = AAZStrType(
207208
serialized_name="billingType",

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

+7
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,12 @@ def _build_arguments_schema(cls, *args, **kwargs):
148148
nullable=True,
149149
enum={"100": 100, "1000": 1000, "10000": 10000, "200": 200, "2000": 2000, "25000": 25000, "300": 300, "400": 400, "500": 500, "5000": 5000, "50000": 50000},
150150
)
151+
_args_schema.sku_name = AAZStrArg(
152+
options=["--sku", "--sku-name"],
153+
arg_group="Sku",
154+
help="The name of the SKU.",
155+
enum={"CapacityReservation": "CapacityReservation", "Free": "Free", "LACluster": "LACluster", "PerGB2018": "PerGB2018", "PerNode": "PerNode", "Premium": "Premium", "Standalone": "Standalone", "Standard": "Standard"},
156+
)
151157
return cls._args_schema
152158

153159
def _execute_operations(self):
@@ -410,6 +416,7 @@ def _update_instance(self, instance):
410416
sku = _builder.get(".properties.sku")
411417
if sku is not None:
412418
sku.set_prop("capacityReservationLevel", AAZIntType, ".capacity_reservation_level")
419+
sku.set_prop("name", AAZStrType, ".sku_name", typ_kwargs={"flags": {"required": True}})
413420

414421
workspace_capping = _builder.get(".properties.workspaceCapping")
415422
if workspace_capping is not None:

src/azure-cli/azure/cli/command_modules/monitor/tests/latest/test_monitor_log_analytics_workspace.py

+28
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,34 @@ def test_monitor_log_analytics_workspace_default(self, resource_group):
6060

6161
self.cmd("monitor log-analytics workspace delete -g {rg} -n {name} -y")
6262

63+
@ResourceGroupPreparer(name_prefix='cli_test_monitor_workspace_update_sku', location='westus')
64+
@AllowLargeResponse()
65+
def test_monitor_log_analytics_workspace_update_sku(self, resource_group):
66+
workspace_name = self.create_random_name('clitest', 20)
67+
self.kwargs.update({
68+
'name': workspace_name
69+
})
70+
71+
self.cmd("monitor log-analytics workspace create -g {rg} -n {name} --quota 1 --level 100 --sku CapacityReservation", checks=[
72+
self.check('provisioningState', 'Succeeded'),
73+
self.check('retentionInDays', 30),
74+
self.check('sku.name', 'CapacityReservation'),
75+
self.check('sku.capacityReservationLevel', 100),
76+
self.check('workspaceCapping.dailyQuotaGb', 1.0)
77+
])
78+
79+
import time
80+
time.sleep(60)
81+
82+
self.cmd("monitor log-analytics workspace update -g {rg} -n {name} --quota 2 --level 200 --sku Standard", checks=[
83+
self.check('provisioningState', 'Succeeded'),
84+
self.check('sku.capacityReservationLevel', 200),
85+
self.check('sku.name', 'Standard'),
86+
self.check('workspaceCapping.dailyQuotaGb', 2.0)
87+
])
88+
89+
self.cmd("monitor log-analytics workspace delete -g {rg} -n {name} -y")
90+
6391
@record_only()
6492
def test_monitor_log_analytics_workspace_linked_service_common_scenario(self):
6593
cluster_resource_id_1 = '/subscriptions/0b1f6471-1bf0-4dda-aec3-cb9272f09590/resourceGroups/azure-cli-test' \

0 commit comments

Comments
 (0)