Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Monitor] az monitor log-analytics workspace update: Add parameter --sku-name #28411

Merged
merged 14 commits into from
Apr 17, 2024

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class Create(AAZCommand):
"""

_aaz_info = {
"version": "2021-06-01",
"version": "2022-10-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.operationalinsights/clusters/{}", "2021-06-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.operationalinsights/clusters/{}", "2022-10-01"],
]
}

Expand All @@ -49,7 +49,6 @@ def _build_arguments_schema(cls, *args, **kwargs):
options=["-n", "--name", "--cluster-name"],
help="The name of the Log Analytics cluster.",
required=True,
id_part="name",
fmt=AAZStrArgFormat(
pattern="^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$",
max_length=63,
Expand All @@ -59,20 +58,6 @@ def _build_arguments_schema(cls, *args, **kwargs):
_args_schema.resource_group = AAZResourceGroupNameArg(
required=True,
)
_args_schema.location = AAZResourceLocationArg(
help="The geo-location where the resource lives",
required=True,
fmt=AAZResourceLocationArgFormat(
resource_group_arg="resource_group",
),
)
_args_schema.tags = AAZDictArg(
options=["--tags"],
help="Resource tags.",
)

tags = cls._args_schema.tags
tags.Element = AAZStrArg()

# define Arg Group "Identity"

Expand All @@ -82,7 +67,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
arg_group="Identity",
help="Type of managed service identity.",
default="SystemAssigned",
enum={"None": "None", "SystemAssigned": "SystemAssigned", "UserAssigned": "UserAssigned"},
enum={"None": "None", "SystemAssigned": "SystemAssigned", "SystemAssigned,UserAssigned": "SystemAssigned,UserAssigned", "UserAssigned": "UserAssigned"},
)
_args_schema.user_assigned = AAZDictArg(
options=["--user-assigned"],
Expand All @@ -92,6 +77,7 @@ def _build_arguments_schema(cls, *args, **kwargs):

user_assigned = cls._args_schema.user_assigned
user_assigned.Element = AAZObjectArg(
nullable=True,
blank={},
)

Expand Down Expand Up @@ -119,6 +105,26 @@ def _build_arguments_schema(cls, *args, **kwargs):
help="The version of the key associated with the Log Analytics cluster.",
)

# define Arg Group "Parameters"

_args_schema = cls._args_schema
_args_schema.location = AAZResourceLocationArg(
arg_group="Parameters",
help="The geo-location where the resource lives",
required=True,
fmt=AAZResourceLocationArgFormat(
resource_group_arg="resource_group",
),
)
_args_schema.tags = AAZDictArg(
options=["--tags"],
arg_group="Parameters",
help="Resource tags.",
)

tags = cls._args_schema.tags
tags.Element = AAZStrArg()

# define Arg Group "Properties"

_args_schema = cls._args_schema
Expand All @@ -136,7 +142,7 @@ def _build_arguments_schema(cls, *args, **kwargs):
options=["--sku-capacity"],
arg_group="Sku",
help="The capacity of the SKU. It can be decreased only after 31 days.",
enum={"1000": 1000, "2000": 2000, "500": 500, "5000": 5000},
enum={"100": 100, "1000": 1000, "10000": 10000, "200": 200, "2000": 2000, "25000": 25000, "300": 300, "400": 400, "500": 500, "5000": 5000, "50000": 50000},
)
_args_schema.sku_name = AAZStrArg(
options=["--sku-name"],
Expand All @@ -152,11 +158,11 @@ def _execute_operations(self):
yield self.ClustersCreateOrUpdate(ctx=self.ctx)()
self.post_operations()

# @register_callback
@register_callback
def pre_operations(self):
pass

# @register_callback
@register_callback
def post_operations(self):
pass

Expand Down Expand Up @@ -228,7 +234,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2021-06-01",
"api-version", "2022-10-01",
required=True,
),
}
Expand Down Expand Up @@ -266,7 +272,7 @@ def content(self):

user_assigned_identities = _builder.get(".identity.userAssignedIdentities")
if user_assigned_identities is not None:
user_assigned_identities.set_elements(AAZObjectType, ".")
user_assigned_identities.set_elements(AAZObjectType, ".", typ_kwargs={"nullable": True})

properties = _builder.get(".properties")
if properties is not None:
Expand Down Expand Up @@ -345,7 +351,9 @@ def _build_schema_on_200_201(cls):
)

user_assigned_identities = cls._schema_on_200_201.identity.user_assigned_identities
user_assigned_identities.Element = AAZObjectType()
user_assigned_identities.Element = AAZObjectType(
nullable=True,
)

_element = cls._schema_on_200_201.identity.user_assigned_identities.Element
_element.client_id = AAZStrType(
Expand Down Expand Up @@ -379,6 +387,9 @@ def _build_schema_on_200_201(cls):
properties.is_availability_zones_enabled = AAZBoolType(
serialized_name="isAvailabilityZonesEnabled",
)
properties.is_double_encryption_enabled = AAZBoolType(
serialized_name="isDoubleEncryptionEnabled",
)
properties.key_vault_properties = AAZObjectType(
serialized_name="keyVaultProperties",
)
Expand All @@ -392,9 +403,7 @@ def _build_schema_on_200_201(cls):
)

associated_workspaces = cls._schema_on_200_201.properties.associated_workspaces
associated_workspaces.Element = AAZObjectType(
flags={"read_only": True},
)
associated_workspaces.Element = AAZObjectType()

_element = cls._schema_on_200_201.properties.associated_workspaces.Element
_element.associate_date = AAZStrType(
Expand Down Expand Up @@ -448,4 +457,8 @@ def _build_schema_on_200_201(cls):
return cls._schema_on_200_201


class _CreateHelper:
"""Helper class for Create"""


__all__ = ["Create"]
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class Delete(AAZCommand):
"""

_aaz_info = {
"version": "2021-06-01",
"version": "2022-10-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.operationalinsights/clusters/{}", "2021-06-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.operationalinsights/clusters/{}", "2022-10-01"],
]
}

Expand Down Expand Up @@ -62,11 +62,11 @@ def _execute_operations(self):
yield self.ClustersDelete(ctx=self.ctx)()
self.post_operations()

# @register_callback
@register_callback
def pre_operations(self):
pass

# @register_callback
@register_callback
def post_operations(self):
pass

Expand Down Expand Up @@ -143,7 +143,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2021-06-01",
"api-version", "2022-10-01",
required=True,
),
}
Expand All @@ -156,4 +156,8 @@ def on_204(self, session):
pass


class _DeleteHelper:
"""Helper class for Delete"""


__all__ = ["Delete"]
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ class List(AAZCommand):
"""

_aaz_info = {
"version": "2021-06-01",
"version": "2022-10-01",
"resources": [
["mgmt-plane", "/subscriptions/{}/providers/microsoft.operationalinsights/clusters", "2021-06-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.operationalinsights/clusters", "2021-06-01"],
["mgmt-plane", "/subscriptions/{}/providers/microsoft.operationalinsights/clusters", "2022-10-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.operationalinsights/clusters", "2022-10-01"],
]
}

AZ_SUPPORT_PAGINATION = True

def _handler(self, command_args):
super()._handler(command_args)
return self.build_paging(self._execute_operations, self._output)
Expand Down Expand Up @@ -60,11 +62,11 @@ def _execute_operations(self):
self.ClustersList(ctx=self.ctx)()
self.post_operations()

# @register_callback
@register_callback
def pre_operations(self):
pass

# @register_callback
@register_callback
def post_operations(self):
pass

Expand Down Expand Up @@ -117,7 +119,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2021-06-01",
"api-version", "2022-10-01",
required=True,
),
}
Expand Down Expand Up @@ -195,7 +197,9 @@ def _build_schema_on_200(cls):
)

user_assigned_identities = cls._schema_on_200.value.Element.identity.user_assigned_identities
user_assigned_identities.Element = AAZObjectType()
user_assigned_identities.Element = AAZObjectType(
nullable=True,
)

_element = cls._schema_on_200.value.Element.identity.user_assigned_identities.Element
_element.client_id = AAZStrType(
Expand All @@ -210,7 +214,6 @@ def _build_schema_on_200(cls):
properties = cls._schema_on_200.value.Element.properties
properties.associated_workspaces = AAZListType(
serialized_name="associatedWorkspaces",
flags={"read_only": True},
)
properties.billing_type = AAZStrType(
serialized_name="billingType",
Expand All @@ -229,6 +232,9 @@ def _build_schema_on_200(cls):
properties.is_availability_zones_enabled = AAZBoolType(
serialized_name="isAvailabilityZonesEnabled",
)
properties.is_double_encryption_enabled = AAZBoolType(
serialized_name="isDoubleEncryptionEnabled",
)
properties.key_vault_properties = AAZObjectType(
serialized_name="keyVaultProperties",
)
Expand All @@ -242,9 +248,7 @@ def _build_schema_on_200(cls):
)

associated_workspaces = cls._schema_on_200.value.Element.properties.associated_workspaces
associated_workspaces.Element = AAZObjectType(
flags={"read_only": True},
)
associated_workspaces.Element = AAZObjectType()

_element = cls._schema_on_200.value.Element.properties.associated_workspaces.Element
_element.associate_date = AAZStrType(
Expand Down Expand Up @@ -337,7 +341,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2021-06-01",
"api-version", "2022-10-01",
required=True,
),
}
Expand Down Expand Up @@ -415,7 +419,9 @@ def _build_schema_on_200(cls):
)

user_assigned_identities = cls._schema_on_200.value.Element.identity.user_assigned_identities
user_assigned_identities.Element = AAZObjectType()
user_assigned_identities.Element = AAZObjectType(
nullable=True,
)

_element = cls._schema_on_200.value.Element.identity.user_assigned_identities.Element
_element.client_id = AAZStrType(
Expand All @@ -430,7 +436,6 @@ def _build_schema_on_200(cls):
properties = cls._schema_on_200.value.Element.properties
properties.associated_workspaces = AAZListType(
serialized_name="associatedWorkspaces",
flags={"read_only": True},
)
properties.billing_type = AAZStrType(
serialized_name="billingType",
Expand All @@ -449,6 +454,9 @@ def _build_schema_on_200(cls):
properties.is_availability_zones_enabled = AAZBoolType(
serialized_name="isAvailabilityZonesEnabled",
)
properties.is_double_encryption_enabled = AAZBoolType(
serialized_name="isDoubleEncryptionEnabled",
)
properties.key_vault_properties = AAZObjectType(
serialized_name="keyVaultProperties",
)
Expand All @@ -462,9 +470,7 @@ def _build_schema_on_200(cls):
)

associated_workspaces = cls._schema_on_200.value.Element.properties.associated_workspaces
associated_workspaces.Element = AAZObjectType(
flags={"read_only": True},
)
associated_workspaces.Element = AAZObjectType()

_element = cls._schema_on_200.value.Element.properties.associated_workspaces.Element
_element.associate_date = AAZStrType(
Expand Down Expand Up @@ -518,4 +524,8 @@ def _build_schema_on_200(cls):
return cls._schema_on_200


class _ListHelper:
"""Helper class for List"""


__all__ = ["List"]
Loading