diff --git a/src/azure-cli/azure/cli/command_modules/storage/aaz/latest/storage/advanced_platform_metric/__cmd_group.py b/src/azure-cli/azure/cli/command_modules/storage/aaz/latest/storage/advanced_platform_metric/__cmd_group.py new file mode 100644 index 00000000000..bca790ba948 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/storage/aaz/latest/storage/advanced_platform_metric/__cmd_group.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command_group( + "storage advanced-platform-metric", + is_preview=True, +) +class __CMDGroup(AAZCommandGroup): + """Manage Advanced Platform Metric + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/azure-cli/azure/cli/command_modules/storage/aaz/latest/storage/advanced_platform_metric/__init__.py b/src/azure-cli/azure/cli/command_modules/storage/aaz/latest/storage/advanced_platform_metric/__init__.py new file mode 100644 index 00000000000..c401f439385 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/storage/aaz/latest/storage/advanced_platform_metric/__init__.py @@ -0,0 +1,16 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from .__cmd_group import * +from ._create import * +from ._delete import * +from ._list import * +from ._show import * +from ._update import * diff --git a/src/azure-cli/azure/cli/command_modules/storage/aaz/latest/storage/advanced_platform_metric/_create.py b/src/azure-cli/azure/cli/command_modules/storage/aaz/latest/storage/advanced_platform_metric/_create.py new file mode 100644 index 00000000000..3f4e019b0ac --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/storage/aaz/latest/storage/advanced_platform_metric/_create.py @@ -0,0 +1,310 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "storage advanced-platform-metric create", + is_preview=True, +) +class Create(AAZCommand): + """Create the advanced platform metrics rule for the storage account. + + :example: Create AllContainersFilter AdvancedPlatformMetric + az storage advanced-platform-metric create -g resource_group_name --account-name storage_account_name --enabled --rule-config-filter-type AllContainersFilter + + :example: Create ContainerPrefixFilter AdvancedPlatformMetric + az storage advanced-platform-metric create -g resource_group_name --account-name storage_account_name --enabled --rule-config-filter-type ContainerPrefixFilter --rule-config-filter-values logsprefix dataprefix + + :example: Create ContainerListFilter AdvancedPlatformMetric + az storage advanced-platform-metric create -g resource_group_name --account-name storage_account_name --enabled --rule-config-filter-type ContainerListFilter --rule-config-filter-values logs data + """ + + _aaz_info = { + "version": "2026-04-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.storage/storageaccounts/{}/advancedplatformmetrics/{}", "2026-04-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.account_name = AAZStrArg( + options=["--account-name"], + help="The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-z0-9]+$", + max_length=24, + min_length=3, + ), + ) + _args_schema.advanced_platform_metrics_rule_type = AAZStrArg( + options=["-n", "--name", "--advanced-platform-metrics-rule-type"], + help="The type of the advanced platform metrics rule.", + required=True, + default="ContainerLevelCapacityMetrics", + enum={"ContainerLevelCapacityMetrics": "ContainerLevelCapacityMetrics"}, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.enabled = AAZBoolArg( + options=["--enabled"], + arg_group="Properties", + help="A boolean flag which enables the advanced platform metrics rule.", + ) + + # define Arg Group "RuleConfig" + + _args_schema = cls._args_schema + _args_schema.rule_config_filter_type = AAZStrArg( + options=["--filter-type", "--rule-config-filter-type"], + arg_group="RuleConfig", + help="The type of filter applied to the rule. Possible values include: AllContainersFilter, ContainerPrefixFilter, ContainerListFilter.", + enum={"AllContainersFilter": "AllContainersFilter", "ContainerListFilter": "ContainerListFilter", "ContainerPrefixFilter": "ContainerPrefixFilter"}, + ) + _args_schema.rule_config_filter_values = AAZListArg( + options=["--filter-values", "--rule-config-filter-values"], + arg_group="RuleConfig", + help="The values for the filter applied to the rule. If filter type is AllContainersFilter, filter values should be empty. If filter type is ContainerPrefixFilter, filter values should contain a list of container prefixes. If filter type is ContainerListFilter, filter values should contain a list of container names.", + ) + + rule_config_filter_values = cls._args_schema.rule_config_filter_values + rule_config_filter_values.Element = AAZStrArg() + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AdvancedPlatformMetricsCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class AdvancedPlatformMetricsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/advancedPlatformMetrics/{advancedPlatformMetricsRuleType}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "accountName", self.ctx.args.account_name, + required=True, + ), + **self.serialize_url_param( + "advancedPlatformMetricsRuleType", self.ctx.args.advanced_platform_metrics_rule_type, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-04-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + typ=AAZObjectType, + typ_kwargs={"flags": {"required": True, "client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("enabled", AAZBoolType, ".enabled", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("ruleConfig", AAZObjectType, ".", typ_kwargs={"flags": {"required": True}}) + + rule_config = _builder.get(".properties.ruleConfig") + if rule_config is not None: + rule_config.set_prop("filterType", AAZStrType, ".rule_config_filter_type") + rule_config.set_prop("filterValues", AAZListType, ".rule_config_filter_values") + + filter_values = _builder.get(".properties.ruleConfig.filterValues") + if filter_values is not None: + filter_values.set_elements(AAZStrType, ".") + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + + _schema_on_200_201 = cls._schema_on_200_201 + _schema_on_200_201.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200_201.properties = AAZObjectType() + _schema_on_200_201.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200_201.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.enabled = AAZBoolType( + flags={"required": True}, + ) + properties.last_modified_time = AAZStrType( + serialized_name="lastModifiedTime", + flags={"read_only": True}, + ) + properties.metrics_emitted = AAZListType( + serialized_name="metricsEmitted", + flags={"read_only": True}, + ) + properties.rule_config = AAZObjectType( + serialized_name="ruleConfig", + flags={"required": True}, + ) + properties.rule_type = AAZStrType( + serialized_name="ruleType", + flags={"read_only": True}, + ) + + metrics_emitted = cls._schema_on_200_201.properties.metrics_emitted + metrics_emitted.Element = AAZStrType() + + rule_config = cls._schema_on_200_201.properties.rule_config + rule_config.filter_type = AAZStrType( + serialized_name="filterType", + ) + rule_config.filter_values = AAZListType( + serialized_name="filterValues", + ) + + filter_values = cls._schema_on_200_201.properties.rule_config.filter_values + filter_values.Element = AAZStrType() + + system_data = cls._schema_on_200_201.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + +__all__ = ["Create"] diff --git a/src/azure-cli/azure/cli/command_modules/storage/aaz/latest/storage/advanced_platform_metric/_delete.py b/src/azure-cli/azure/cli/command_modules/storage/aaz/latest/storage/advanced_platform_metric/_delete.py new file mode 100644 index 00000000000..cd387ae6044 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/storage/aaz/latest/storage/advanced_platform_metric/_delete.py @@ -0,0 +1,157 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "storage advanced-platform-metric delete", + is_preview=True, + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete the advanced platform metrics rule for the storage account by rule type. + + :example: Delete advanced platform metrics rule + az storage advanced-platform-metric delete -g resource_group_name --account-name storage_account_name + """ + + _aaz_info = { + "version": "2026-04-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.storage/storageaccounts/{}/advancedplatformmetrics/{}", "2026-04-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return None + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.account_name = AAZStrArg( + options=["--account-name"], + help="The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-z0-9]+$", + max_length=24, + min_length=3, + ), + ) + _args_schema.advanced_platform_metrics_rule_type = AAZStrArg( + options=["-n", "--name", "--advanced-platform-metrics-rule-type"], + help="The type of the advanced platform metrics rule.", + required=True, + id_part="child_name_1", + default="ContainerLevelCapacityMetrics", + enum={"ContainerLevelCapacityMetrics": "ContainerLevelCapacityMetrics"}, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AdvancedPlatformMetricsDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class AdvancedPlatformMetricsDelete(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + if session.http_response.status_code in [204]: + return self.on_204(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/advancedPlatformMetrics/{advancedPlatformMetricsRuleType}", + **self.url_parameters + ) + + @property + def method(self): + return "DELETE" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "accountName", self.ctx.args.account_name, + required=True, + ), + **self.serialize_url_param( + "advancedPlatformMetricsRuleType", self.ctx.args.advanced_platform_metrics_rule_type, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-04-01", + required=True, + ), + } + return parameters + + def on_200(self, session): + pass + + def on_204(self, session): + pass + + +class _DeleteHelper: + """Helper class for Delete""" + + +__all__ = ["Delete"] diff --git a/src/azure-cli/azure/cli/command_modules/storage/aaz/latest/storage/advanced_platform_metric/_list.py b/src/azure-cli/azure/cli/command_modules/storage/aaz/latest/storage/advanced_platform_metric/_list.py new file mode 100644 index 00000000000..e30e1fc9de9 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/storage/aaz/latest/storage/advanced_platform_metric/_list.py @@ -0,0 +1,251 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "storage advanced-platform-metric list", + is_preview=True, +) +class List(AAZCommand): + """List the advanced platform metrics rules associated with the storage account. + + :example: List advanced platform metrics rules + az storage advanced-platform-metric list -g resource_group_name --account-name storage_account_name + """ + + _aaz_info = { + "version": "2026-04-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.storage/storageaccounts/{}/advancedplatformmetrics", "2026-04-01"], + ] + } + + AZ_SUPPORT_PAGINATION = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_paging(self._execute_operations, self._output) + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.account_name = AAZStrArg( + options=["--account-name"], + help="The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-z0-9]+$", + max_length=24, + min_length=3, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AdvancedPlatformMetricsList(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance.value, client_flatten=True) + next_link = self.deserialize_output(self.ctx.vars.instance.next_link) + return result, next_link + + class AdvancedPlatformMetricsList(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/advancedPlatformMetrics", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "accountName", self.ctx.args.account_name, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-04-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.next_link = AAZStrType( + serialized_name="nextLink", + ) + _schema_on_200.value = AAZListType( + flags={"required": True}, + ) + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.id = AAZStrType( + flags={"read_only": True}, + ) + _element.name = AAZStrType( + flags={"read_only": True}, + ) + _element.properties = AAZObjectType() + _element.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _element.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.enabled = AAZBoolType( + flags={"required": True}, + ) + properties.last_modified_time = AAZStrType( + serialized_name="lastModifiedTime", + flags={"read_only": True}, + ) + properties.metrics_emitted = AAZListType( + serialized_name="metricsEmitted", + flags={"read_only": True}, + ) + properties.rule_config = AAZObjectType( + serialized_name="ruleConfig", + flags={"required": True}, + ) + properties.rule_type = AAZStrType( + serialized_name="ruleType", + flags={"read_only": True}, + ) + + metrics_emitted = cls._schema_on_200.value.Element.properties.metrics_emitted + metrics_emitted.Element = AAZStrType() + + rule_config = cls._schema_on_200.value.Element.properties.rule_config + rule_config.filter_type = AAZStrType( + serialized_name="filterType", + ) + rule_config.filter_values = AAZListType( + serialized_name="filterValues", + ) + + filter_values = cls._schema_on_200.value.Element.properties.rule_config.filter_values + filter_values.Element = AAZStrType() + + system_data = cls._schema_on_200.value.Element.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/azure-cli/azure/cli/command_modules/storage/aaz/latest/storage/advanced_platform_metric/_show.py b/src/azure-cli/azure/cli/command_modules/storage/aaz/latest/storage/advanced_platform_metric/_show.py new file mode 100644 index 00000000000..b7472611387 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/storage/aaz/latest/storage/advanced_platform_metric/_show.py @@ -0,0 +1,251 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "storage advanced-platform-metric show", + is_preview=True, +) +class Show(AAZCommand): + """Get the advanced platform metrics rule for the storage account by rule type. + + :example: Get advanced platform metrics rule + az storage advanced-platform-metric show -g resource_group_name --account-name storage_account_name + """ + + _aaz_info = { + "version": "2026-04-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.storage/storageaccounts/{}/advancedplatformmetrics/{}", "2026-04-01"], + ] + } + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.account_name = AAZStrArg( + options=["--account-name"], + help="The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-z0-9]+$", + max_length=24, + min_length=3, + ), + ) + _args_schema.advanced_platform_metrics_rule_type = AAZStrArg( + options=["-n", "--name", "--advanced-platform-metrics-rule-type"], + help="The type of the advanced platform metrics rule.", + required=True, + id_part="child_name_1", + default="ContainerLevelCapacityMetrics", + enum={"ContainerLevelCapacityMetrics": "ContainerLevelCapacityMetrics"}, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AdvancedPlatformMetricsGet(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class AdvancedPlatformMetricsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/advancedPlatformMetrics/{advancedPlatformMetricsRuleType}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "accountName", self.ctx.args.account_name, + required=True, + ), + **self.serialize_url_param( + "advancedPlatformMetricsRuleType", self.ctx.args.advanced_platform_metrics_rule_type, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-04-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + + _schema_on_200 = cls._schema_on_200 + _schema_on_200.id = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.name = AAZStrType( + flags={"read_only": True}, + ) + _schema_on_200.properties = AAZObjectType() + _schema_on_200.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + _schema_on_200.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.enabled = AAZBoolType( + flags={"required": True}, + ) + properties.last_modified_time = AAZStrType( + serialized_name="lastModifiedTime", + flags={"read_only": True}, + ) + properties.metrics_emitted = AAZListType( + serialized_name="metricsEmitted", + flags={"read_only": True}, + ) + properties.rule_config = AAZObjectType( + serialized_name="ruleConfig", + flags={"required": True}, + ) + properties.rule_type = AAZStrType( + serialized_name="ruleType", + flags={"read_only": True}, + ) + + metrics_emitted = cls._schema_on_200.properties.metrics_emitted + metrics_emitted.Element = AAZStrType() + + rule_config = cls._schema_on_200.properties.rule_config + rule_config.filter_type = AAZStrType( + serialized_name="filterType", + ) + rule_config.filter_values = AAZListType( + serialized_name="filterValues", + ) + + filter_values = cls._schema_on_200.properties.rule_config.filter_values + filter_values.Element = AAZStrType() + + system_data = cls._schema_on_200.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/azure-cli/azure/cli/command_modules/storage/aaz/latest/storage/advanced_platform_metric/_update.py b/src/azure-cli/azure/cli/command_modules/storage/aaz/latest/storage/advanced_platform_metric/_update.py new file mode 100644 index 00000000000..e2acb2b1362 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/storage/aaz/latest/storage/advanced_platform_metric/_update.py @@ -0,0 +1,453 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# +# Code generated by aaz-dev-tools +# -------------------------------------------------------------------------------------------- + +# pylint: skip-file +# flake8: noqa + +from azure.cli.core.aaz import * + + +@register_command( + "storage advanced-platform-metric update", + is_preview=True, +) +class Update(AAZCommand): + """Update the advanced platform metrics rule for the storage account. + + :example: Update advanced platform metrics rule + az storage advanced-platform-metric update -g resource_group_name --account-name storage_account_name --enabled --rule-config-filter-type AllContainersFilter + """ + + _aaz_info = { + "version": "2026-04-01", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.storage/storageaccounts/{}/advancedplatformmetrics/{}", "2026-04-01"], + ] + } + + AZ_SUPPORT_GENERIC_UPDATE = True + + def _handler(self, command_args): + super()._handler(command_args) + self._execute_operations() + return self._output() + + _args_schema = None + + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + if cls._args_schema is not None: + return cls._args_schema + cls._args_schema = super()._build_arguments_schema(*args, **kwargs) + + # define Arg Group "" + + _args_schema = cls._args_schema + _args_schema.account_name = AAZStrArg( + options=["--account-name"], + help="The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-z0-9]+$", + max_length=24, + min_length=3, + ), + ) + _args_schema.advanced_platform_metrics_rule_type = AAZStrArg( + options=["-n", "--name", "--advanced-platform-metrics-rule-type"], + help="The type of the advanced platform metrics rule.", + required=True, + id_part="child_name_1", + enum={"ContainerLevelCapacityMetrics": "ContainerLevelCapacityMetrics"}, + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.enabled = AAZBoolArg( + options=["--enabled"], + arg_group="Properties", + help="A boolean flag which enables the advanced platform metrics rule.", + ) + + # define Arg Group "RuleConfig" + + _args_schema = cls._args_schema + _args_schema.rule_config_filter_type = AAZStrArg( + options=["--filter-type", "--rule-config-filter-type"], + arg_group="RuleConfig", + help="The type of filter applied to the rule. Possible values include: AllContainersFilter, ContainerPrefixFilter, ContainerListFilter.", + nullable=True, + enum={"AllContainersFilter": "AllContainersFilter", "ContainerListFilter": "ContainerListFilter", "ContainerPrefixFilter": "ContainerPrefixFilter"}, + ) + _args_schema.rule_config_filter_values = AAZListArg( + options=["--filter-values", "--rule-config-filter-values"], + arg_group="RuleConfig", + help="The values for the filter applied to the rule. If filter type is AllContainersFilter, filter values should be empty. If filter type is ContainerPrefixFilter, filter values should contain a list of container prefixes. If filter type is ContainerListFilter, filter values should contain a list of container names.", + nullable=True, + ) + + rule_config_filter_values = cls._args_schema.rule_config_filter_values + rule_config_filter_values.Element = AAZStrArg( + nullable=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.AdvancedPlatformMetricsGet(ctx=self.ctx)() + self.pre_instance_update(self.ctx.vars.instance) + self.InstanceUpdateByJson(ctx=self.ctx)() + self.InstanceUpdateByGeneric(ctx=self.ctx)() + self.post_instance_update(self.ctx.vars.instance) + self.AdvancedPlatformMetricsCreateOrUpdate(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + @register_callback + def pre_instance_update(self, instance): + pass + + @register_callback + def post_instance_update(self, instance): + pass + + def _output(self, *args, **kwargs): + result = self.deserialize_output(self.ctx.vars.instance, client_flatten=True) + return result + + class AdvancedPlatformMetricsGet(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200]: + return self.on_200(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/advancedPlatformMetrics/{advancedPlatformMetricsRuleType}", + **self.url_parameters + ) + + @property + def method(self): + return "GET" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "accountName", self.ctx.args.account_name, + required=True, + ), + **self.serialize_url_param( + "advancedPlatformMetricsRuleType", self.ctx.args.advanced_platform_metrics_rule_type, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-04-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + def on_200(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200 + ) + + _schema_on_200 = None + + @classmethod + def _build_schema_on_200(cls): + if cls._schema_on_200 is not None: + return cls._schema_on_200 + + cls._schema_on_200 = AAZObjectType() + _UpdateHelper._build_schema_advanced_platform_metrics_rule_read(cls._schema_on_200) + + return cls._schema_on_200 + + class AdvancedPlatformMetricsCreateOrUpdate(AAZHttpOperation): + CLIENT_TYPE = "MgmtClient" + + def __call__(self, *args, **kwargs): + request = self.make_request() + session = self.client.send_request(request=request, stream=False, **kwargs) + if session.http_response.status_code in [200, 201]: + return self.on_200_201(session) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/advancedPlatformMetrics/{advancedPlatformMetricsRuleType}", + **self.url_parameters + ) + + @property + def method(self): + return "PUT" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "accountName", self.ctx.args.account_name, + required=True, + ), + **self.serialize_url_param( + "advancedPlatformMetricsRuleType", self.ctx.args.advanced_platform_metrics_rule_type, + required=True, + ), + **self.serialize_url_param( + "resourceGroupName", self.ctx.args.resource_group, + required=True, + ), + **self.serialize_url_param( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "api-version", "2026-04-01", + required=True, + ), + } + return parameters + + @property + def header_parameters(self): + parameters = { + **self.serialize_header_param( + "Content-Type", "application/json", + ), + **self.serialize_header_param( + "Accept", "application/json", + ), + } + return parameters + + @property + def content(self): + _content_value, _builder = self.new_content_builder( + self.ctx.args, + value=self.ctx.vars.instance, + ) + + return self.serialize_content(_content_value) + + def on_200_201(self, session): + data = self.deserialize_http_content(session) + self.ctx.set_var( + "instance", + data, + schema_builder=self._build_schema_on_200_201 + ) + + _schema_on_200_201 = None + + @classmethod + def _build_schema_on_200_201(cls): + if cls._schema_on_200_201 is not None: + return cls._schema_on_200_201 + + cls._schema_on_200_201 = AAZObjectType() + _UpdateHelper._build_schema_advanced_platform_metrics_rule_read(cls._schema_on_200_201) + + return cls._schema_on_200_201 + + class InstanceUpdateByJson(AAZJsonInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance(self.ctx.vars.instance) + + def _update_instance(self, instance): + _instance_value, _builder = self.new_content_builder( + self.ctx.args, + value=instance, + typ=AAZObjectType + ) + _builder.set_prop("properties", AAZObjectType) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("enabled", AAZBoolType, ".enabled", typ_kwargs={"flags": {"required": True}}) + properties.set_prop("ruleConfig", AAZObjectType, ".", typ_kwargs={"flags": {"required": True}}) + + rule_config = _builder.get(".properties.ruleConfig") + if rule_config is not None: + rule_config.set_prop("filterType", AAZStrType, ".rule_config_filter_type") + rule_config.set_prop("filterValues", AAZListType, ".rule_config_filter_values") + + filter_values = _builder.get(".properties.ruleConfig.filterValues") + if filter_values is not None: + filter_values.set_elements(AAZStrType, ".") + + return _instance_value + + class InstanceUpdateByGeneric(AAZGenericInstanceUpdateOperation): + + def __call__(self, *args, **kwargs): + self._update_instance_by_generic( + self.ctx.vars.instance, + self.ctx.generic_update_args + ) + + +class _UpdateHelper: + """Helper class for Update""" + + _schema_advanced_platform_metrics_rule_read = None + + @classmethod + def _build_schema_advanced_platform_metrics_rule_read(cls, _schema): + if cls._schema_advanced_platform_metrics_rule_read is not None: + _schema.id = cls._schema_advanced_platform_metrics_rule_read.id + _schema.name = cls._schema_advanced_platform_metrics_rule_read.name + _schema.properties = cls._schema_advanced_platform_metrics_rule_read.properties + _schema.system_data = cls._schema_advanced_platform_metrics_rule_read.system_data + _schema.type = cls._schema_advanced_platform_metrics_rule_read.type + return + + cls._schema_advanced_platform_metrics_rule_read = _schema_advanced_platform_metrics_rule_read = AAZObjectType() + + advanced_platform_metrics_rule_read = _schema_advanced_platform_metrics_rule_read + advanced_platform_metrics_rule_read.id = AAZStrType( + flags={"read_only": True}, + ) + advanced_platform_metrics_rule_read.name = AAZStrType( + flags={"read_only": True}, + ) + advanced_platform_metrics_rule_read.properties = AAZObjectType() + advanced_platform_metrics_rule_read.system_data = AAZObjectType( + serialized_name="systemData", + flags={"read_only": True}, + ) + advanced_platform_metrics_rule_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_advanced_platform_metrics_rule_read.properties + properties.enabled = AAZBoolType( + flags={"required": True}, + ) + properties.last_modified_time = AAZStrType( + serialized_name="lastModifiedTime", + flags={"read_only": True}, + ) + properties.metrics_emitted = AAZListType( + serialized_name="metricsEmitted", + flags={"read_only": True}, + ) + properties.rule_config = AAZObjectType( + serialized_name="ruleConfig", + flags={"required": True}, + ) + properties.rule_type = AAZStrType( + serialized_name="ruleType", + flags={"read_only": True}, + ) + + metrics_emitted = _schema_advanced_platform_metrics_rule_read.properties.metrics_emitted + metrics_emitted.Element = AAZStrType() + + rule_config = _schema_advanced_platform_metrics_rule_read.properties.rule_config + rule_config.filter_type = AAZStrType( + serialized_name="filterType", + ) + rule_config.filter_values = AAZListType( + serialized_name="filterValues", + ) + + filter_values = _schema_advanced_platform_metrics_rule_read.properties.rule_config.filter_values + filter_values.Element = AAZStrType() + + system_data = _schema_advanced_platform_metrics_rule_read.system_data + system_data.created_at = AAZStrType( + serialized_name="createdAt", + ) + system_data.created_by = AAZStrType( + serialized_name="createdBy", + ) + system_data.created_by_type = AAZStrType( + serialized_name="createdByType", + ) + system_data.last_modified_at = AAZStrType( + serialized_name="lastModifiedAt", + ) + system_data.last_modified_by = AAZStrType( + serialized_name="lastModifiedBy", + ) + system_data.last_modified_by_type = AAZStrType( + serialized_name="lastModifiedByType", + ) + + _schema.id = cls._schema_advanced_platform_metrics_rule_read.id + _schema.name = cls._schema_advanced_platform_metrics_rule_read.name + _schema.properties = cls._schema_advanced_platform_metrics_rule_read.properties + _schema.system_data = cls._schema_advanced_platform_metrics_rule_read.system_data + _schema.type = cls._schema_advanced_platform_metrics_rule_read.type + + +__all__ = ["Update"] diff --git a/src/azure-cli/azure/cli/command_modules/storage/commands.py b/src/azure-cli/azure/cli/command_modules/storage/commands.py index 681bd258753..23049434981 100644 --- a/src/azure-cli/azure/cli/command_modules/storage/commands.py +++ b/src/azure-cli/azure/cli/command_modules/storage/commands.py @@ -943,3 +943,7 @@ def get_custom_sdk(custom_module, client_factory, resource_type=ResourceType.MGM with self.command_group('storage account'): from .operations.account import FileServiceUsage self.command_table['storage account file-service-usage'] = FileServiceUsage(loader=self) + + with self.command_group('storage advanced-platform-metric'): + from .operations.advanced_platform_metric import AdvancedPlatformMetricUpdate + self.command_table['storage advanced-platform-metric update'] = AdvancedPlatformMetricUpdate(loader=self) diff --git a/src/azure-cli/azure/cli/command_modules/storage/operations/advanced_platform_metric.py b/src/azure-cli/azure/cli/command_modules/storage/operations/advanced_platform_metric.py new file mode 100644 index 00000000000..fd4c3524d06 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/storage/operations/advanced_platform_metric.py @@ -0,0 +1,24 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from ..aaz.latest.storage.advanced_platform_metric import Update as _AdvancedPlatformMetricUpdate +from knack.log import get_logger + +logger = get_logger(__name__) + + +class AdvancedPlatformMetricUpdate(_AdvancedPlatformMetricUpdate): + @classmethod + def _build_arguments_schema(cls, *args, **kwargs): + args_schema = super()._build_arguments_schema(*args, **kwargs) + args_schema.advanced_platform_metrics_rule_type._required = False # pylint: disable=protected-access + return args_schema + + def pre_operations(self): + args = self.ctx.args + if not args.advanced_platform_metrics_rule_type: + args.advanced_platform_metrics_rule_type = 'ContainerLevelCapacityMetrics' + if args.rule_config_filter_type == 'AllContainersFilter': + args.rule_config_filter_values = [] diff --git a/src/azure-cli/azure/cli/command_modules/storage/tests/latest/recordings/test_storage_advanced_platform_metric.yaml b/src/azure-cli/azure/cli/command_modules/storage/tests/latest/recordings/test_storage_advanced_platform_metric.yaml new file mode 100644 index 00000000000..f2b8a2f1284 --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/storage/tests/latest/recordings/test_storage_advanced_platform_metric.yaml @@ -0,0 +1,649 @@ +interactions: +- request: + body: '{"properties": {"enabled": true, "ruleConfig": {"filterType": "AllContainersFilter"}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - storage advanced-platform-metric create + Connection: + - keep-alive + Content-Length: + - '86' + Content-Type: + - application/json + ParameterSetName: + - -g --account-name --enabled --rule-config-filter-type + User-Agent: + - AZURECLI/2.85.0 azsdk-python-core/1.39.0 Python/3.12.10 (Windows-10-10.0.19045-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_storage_advanced_platform_metric000001/providers/Microsoft.Storage/storageAccounts/clitest000002/advancedPlatformMetrics/ContainerLevelCapacityMetrics?api-version=2026-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_storage_advanced_platform_metric000001/providers/Microsoft.Storage/storageAccounts/clitest000002/advancedPlatformMetrics/ContainerLevelCapacityMetrics","name":"DefaultAdvancedPlatformMetricsRule","type":"Microsoft.Storage/storageAccounts/advancedPlatformMetrics","properties":{"ruleType":"ContainerLevelCapacityMetrics","metricsEmitted":["ContainerUsedSize","ContainerBlobCount"],"enabled":true,"lastModifiedTime":"2026-04-24T03:06:45.8450813Z","ruleConfig":{"filterType":"AllContainersFilter"}}}' + headers: + cache-control: + - no-cache + content-length: + - '579' + content-type: + - application/json + date: + - Fri, 24 Apr 2026 03:06:45 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-operation-identifier: + - tenantId=ed94de55-1f87-4278-9651-525e7ba467d6,objectId=9189af77-1924-4997-8bea-dc08f6bf83e0/eastus2euap/efc3b067-3f45-425f-8a6a-f6083b951e1c + x-ms-ratelimit-remaining-subscription-writes: + - '0' + x-ms-throttling-version: + - v2 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - storage advanced-platform-metric show + Connection: + - keep-alive + ParameterSetName: + - -g --account-name + User-Agent: + - AZURECLI/2.85.0 azsdk-python-core/1.39.0 Python/3.12.10 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_storage_advanced_platform_metric000001/providers/Microsoft.Storage/storageAccounts/clitest000002/advancedPlatformMetrics/ContainerLevelCapacityMetrics?api-version=2026-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_storage_advanced_platform_metric000001/providers/Microsoft.Storage/storageAccounts/clitest000002/advancedPlatformMetrics/ContainerLevelCapacityMetrics","name":"DefaultAdvancedPlatformMetricsRule","type":"Microsoft.Storage/storageAccounts/advancedPlatformMetrics","properties":{"ruleType":"ContainerLevelCapacityMetrics","metricsEmitted":["ContainerUsedSize","ContainerBlobCount"],"enabled":true,"lastModifiedTime":"2026-04-24T03:06:45.8450813Z","ruleConfig":{"filterType":"AllContainersFilter"}}}' + headers: + cache-control: + - no-cache + content-length: + - '579' + content-type: + - application/json + date: + - Fri, 24 Apr 2026 03:06:48 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-operation-identifier: + - tenantId=ed94de55-1f87-4278-9651-525e7ba467d6,objectId=9189af77-1924-4997-8bea-dc08f6bf83e0/eastus2euap/59e68b73-f9d5-46c0-bbac-d1452600e170 + x-ms-throttling-version: + - v2 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - storage advanced-platform-metric update + Connection: + - keep-alive + ParameterSetName: + - -g --account-name --enabled --rule-config-filter-type --rule-config-filter-values + User-Agent: + - AZURECLI/2.85.0 azsdk-python-core/1.39.0 Python/3.12.10 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_storage_advanced_platform_metric000001/providers/Microsoft.Storage/storageAccounts/clitest000002/advancedPlatformMetrics/ContainerLevelCapacityMetrics?api-version=2026-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_storage_advanced_platform_metric000001/providers/Microsoft.Storage/storageAccounts/clitest000002/advancedPlatformMetrics/ContainerLevelCapacityMetrics","name":"DefaultAdvancedPlatformMetricsRule","type":"Microsoft.Storage/storageAccounts/advancedPlatformMetrics","properties":{"ruleType":"ContainerLevelCapacityMetrics","metricsEmitted":["ContainerUsedSize","ContainerBlobCount"],"enabled":true,"lastModifiedTime":"2026-04-24T03:06:45.8450813Z","ruleConfig":{"filterType":"AllContainersFilter"}}}' + headers: + cache-control: + - no-cache + content-length: + - '579' + content-type: + - application/json + date: + - Fri, 24 Apr 2026 03:06:51 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-operation-identifier: + - tenantId=ed94de55-1f87-4278-9651-525e7ba467d6,objectId=9189af77-1924-4997-8bea-dc08f6bf83e0/eastus2euap/688c41be-aa01-4657-9881-e9d3d34aaf1f + x-ms-throttling-version: + - v2 + status: + code: 200 + message: OK +- request: + body: '{"properties": {"enabled": true, "ruleConfig": {"filterType": "ContainerPrefixFilter", + "filterValues": ["logs", "data"]}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - storage advanced-platform-metric update + Connection: + - keep-alive + Content-Length: + - '122' + Content-Type: + - application/json + ParameterSetName: + - -g --account-name --enabled --rule-config-filter-type --rule-config-filter-values + User-Agent: + - AZURECLI/2.85.0 azsdk-python-core/1.39.0 Python/3.12.10 (Windows-10-10.0.19045-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_storage_advanced_platform_metric000001/providers/Microsoft.Storage/storageAccounts/clitest000002/advancedPlatformMetrics/ContainerLevelCapacityMetrics?api-version=2026-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_storage_advanced_platform_metric000001/providers/Microsoft.Storage/storageAccounts/clitest000002/advancedPlatformMetrics/ContainerLevelCapacityMetrics","name":"DefaultAdvancedPlatformMetricsRule","type":"Microsoft.Storage/storageAccounts/advancedPlatformMetrics","properties":{"ruleType":"ContainerLevelCapacityMetrics","metricsEmitted":["ContainerUsedSize","ContainerBlobCount"],"enabled":true,"lastModifiedTime":"2026-04-24T03:06:55.1000117Z","ruleConfig":{"filterType":"ContainerPrefixFilter","filterValues":["logs","data"]}}}' + headers: + cache-control: + - no-cache + content-length: + - '612' + content-type: + - application/json + date: + - Fri, 24 Apr 2026 03:06:55 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-operation-identifier: + - tenantId=ed94de55-1f87-4278-9651-525e7ba467d6,objectId=9189af77-1924-4997-8bea-dc08f6bf83e0/eastus2euap/d65d1c8d-fe33-40b0-9bfc-dd7734562807 + x-ms-ratelimit-remaining-subscription-writes: + - '0' + x-ms-throttling-version: + - v2 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - storage advanced-platform-metric list + Connection: + - keep-alive + ParameterSetName: + - -g --account-name + User-Agent: + - AZURECLI/2.85.0 azsdk-python-core/1.39.0 Python/3.12.10 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_storage_advanced_platform_metric000001/providers/Microsoft.Storage/storageAccounts/clitest000002/advancedPlatformMetrics?api-version=2026-04-01 + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_storage_advanced_platform_metric000001/providers/Microsoft.Storage/storageAccounts/clitest000002/advancedPlatformMetrics/ContainerLevelCapacityMetrics","name":"DefaultAdvancedPlatformMetricsRule","type":"Microsoft.Storage/storageAccounts/advancedPlatformMetrics","properties":{"ruleType":"ContainerLevelCapacityMetrics","metricsEmitted":["ContainerUsedSize","ContainerBlobCount"],"enabled":true,"lastModifiedTime":"2026-04-24T03:06:55.1000117Z","ruleConfig":{"filterType":"ContainerPrefixFilter","filterValues":["logs","data"]}}}]}' + headers: + cache-control: + - no-cache + content-length: + - '624' + content-type: + - application/json + date: + - Fri, 24 Apr 2026 03:06:57 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-operation-identifier: + - tenantId=ed94de55-1f87-4278-9651-525e7ba467d6,objectId=9189af77-1924-4997-8bea-dc08f6bf83e0/eastus2euap/a44eb6e4-5817-4f87-9220-ac108d932ec8 + x-ms-throttling-version: + - v2 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - storage advanced-platform-metric delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -g --account-name --yes + User-Agent: + - AZURECLI/2.85.0 azsdk-python-core/1.39.0 Python/3.12.10 (Windows-10-10.0.19045-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_storage_advanced_platform_metric000001/providers/Microsoft.Storage/storageAccounts/clitest000002/advancedPlatformMetrics/ContainerLevelCapacityMetrics?api-version=2026-04-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + content-type: + - text/plain; charset=utf-8 + date: + - Fri, 24 Apr 2026 03:07:02 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-operation-identifier: + - tenantId=ed94de55-1f87-4278-9651-525e7ba467d6,objectId=9189af77-1924-4997-8bea-dc08f6bf83e0/eastus2euap/e0fb2f7d-322c-4943-a528-c9cdc4b1a183 + x-ms-ratelimit-remaining-subscription-deletes: + - '0' + x-ms-throttling-version: + - v2 + status: + code: 200 + message: OK +- request: + body: '{"properties": {"enabled": true, "ruleConfig": {"filterType": "ContainerPrefixFilter", + "filterValues": ["logs", "data"]}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - storage advanced-platform-metric create + Connection: + - keep-alive + Content-Length: + - '122' + Content-Type: + - application/json + ParameterSetName: + - -g --account-name --enabled --rule-config-filter-type --rule-config-filter-values + User-Agent: + - AZURECLI/2.85.0 azsdk-python-core/1.39.0 Python/3.12.10 (Windows-10-10.0.19045-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_storage_advanced_platform_metric000001/providers/Microsoft.Storage/storageAccounts/clitest000002/advancedPlatformMetrics/ContainerLevelCapacityMetrics?api-version=2026-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_storage_advanced_platform_metric000001/providers/Microsoft.Storage/storageAccounts/clitest000002/advancedPlatformMetrics/ContainerLevelCapacityMetrics","name":"DefaultAdvancedPlatformMetricsRule","type":"Microsoft.Storage/storageAccounts/advancedPlatformMetrics","properties":{"ruleType":"ContainerLevelCapacityMetrics","metricsEmitted":["ContainerUsedSize","ContainerBlobCount"],"enabled":true,"lastModifiedTime":"2026-04-24T03:07:05.5573798Z","ruleConfig":{"filterType":"ContainerPrefixFilter","filterValues":["logs","data"]}}}' + headers: + cache-control: + - no-cache + content-length: + - '612' + content-type: + - application/json + date: + - Fri, 24 Apr 2026 03:07:05 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-operation-identifier: + - tenantId=ed94de55-1f87-4278-9651-525e7ba467d6,objectId=9189af77-1924-4997-8bea-dc08f6bf83e0/eastus2euap/e011ec18-93ca-40f9-aadd-e618300b6b8c + x-ms-ratelimit-remaining-subscription-writes: + - '0' + x-ms-throttling-version: + - v2 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - storage advanced-platform-metric update + Connection: + - keep-alive + ParameterSetName: + - -g --account-name --enabled --rule-config-filter-type --rule-config-filter-values + User-Agent: + - AZURECLI/2.85.0 azsdk-python-core/1.39.0 Python/3.12.10 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_storage_advanced_platform_metric000001/providers/Microsoft.Storage/storageAccounts/clitest000002/advancedPlatformMetrics/ContainerLevelCapacityMetrics?api-version=2026-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_storage_advanced_platform_metric000001/providers/Microsoft.Storage/storageAccounts/clitest000002/advancedPlatformMetrics/ContainerLevelCapacityMetrics","name":"DefaultAdvancedPlatformMetricsRule","type":"Microsoft.Storage/storageAccounts/advancedPlatformMetrics","properties":{"ruleType":"ContainerLevelCapacityMetrics","metricsEmitted":["ContainerUsedSize","ContainerBlobCount"],"enabled":true,"lastModifiedTime":"2026-04-24T03:07:05.5573798Z","ruleConfig":{"filterType":"ContainerPrefixFilter","filterValues":["logs","data"]}}}' + headers: + cache-control: + - no-cache + content-length: + - '612' + content-type: + - application/json + date: + - Fri, 24 Apr 2026 03:07:07 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-operation-identifier: + - tenantId=ed94de55-1f87-4278-9651-525e7ba467d6,objectId=9189af77-1924-4997-8bea-dc08f6bf83e0/eastus2euap/7e18142b-ed34-485a-b96c-f5017c43ec09 + x-ms-throttling-version: + - v2 + status: + code: 200 + message: OK +- request: + body: '{"properties": {"enabled": true, "ruleConfig": {"filterType": "ContainerListFilter", + "filterValues": ["logs1", "data1"]}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - storage advanced-platform-metric update + Connection: + - keep-alive + Content-Length: + - '122' + Content-Type: + - application/json + ParameterSetName: + - -g --account-name --enabled --rule-config-filter-type --rule-config-filter-values + User-Agent: + - AZURECLI/2.85.0 azsdk-python-core/1.39.0 Python/3.12.10 (Windows-10-10.0.19045-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_storage_advanced_platform_metric000001/providers/Microsoft.Storage/storageAccounts/clitest000002/advancedPlatformMetrics/ContainerLevelCapacityMetrics?api-version=2026-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_storage_advanced_platform_metric000001/providers/Microsoft.Storage/storageAccounts/clitest000002/advancedPlatformMetrics/ContainerLevelCapacityMetrics","name":"DefaultAdvancedPlatformMetricsRule","type":"Microsoft.Storage/storageAccounts/advancedPlatformMetrics","properties":{"ruleType":"ContainerLevelCapacityMetrics","metricsEmitted":["ContainerUsedSize","ContainerBlobCount"],"enabled":true,"lastModifiedTime":"2026-04-24T03:07:10.0924508Z","ruleConfig":{"filterType":"ContainerListFilter","filterValues":["logs1","data1"]}}}' + headers: + cache-control: + - no-cache + content-length: + - '612' + content-type: + - application/json + date: + - Fri, 24 Apr 2026 03:07:10 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-operation-identifier: + - tenantId=ed94de55-1f87-4278-9651-525e7ba467d6,objectId=9189af77-1924-4997-8bea-dc08f6bf83e0/eastus2euap/1c93280f-aff1-41f5-93ad-81999df31b21 + x-ms-ratelimit-remaining-subscription-writes: + - '0' + x-ms-throttling-version: + - v2 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + CommandName: + - storage advanced-platform-metric delete + Connection: + - keep-alive + Content-Length: + - '0' + ParameterSetName: + - -g --account-name --yes + User-Agent: + - AZURECLI/2.85.0 azsdk-python-core/1.39.0 Python/3.12.10 (Windows-10-10.0.19045-SP0) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_storage_advanced_platform_metric000001/providers/Microsoft.Storage/storageAccounts/clitest000002/advancedPlatformMetrics/ContainerLevelCapacityMetrics?api-version=2026-04-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + content-type: + - text/plain; charset=utf-8 + date: + - Fri, 24 Apr 2026 03:07:12 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-operation-identifier: + - tenantId=ed94de55-1f87-4278-9651-525e7ba467d6,objectId=9189af77-1924-4997-8bea-dc08f6bf83e0/eastus2euap/23cdd61e-5715-4f62-8e71-b4baf960c984 + x-ms-ratelimit-remaining-subscription-deletes: + - '0' + x-ms-throttling-version: + - v2 + status: + code: 200 + message: OK +- request: + body: '{"properties": {"enabled": true, "ruleConfig": {"filterType": "ContainerListFilter", + "filterValues": ["logs", "data"]}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - storage advanced-platform-metric create + Connection: + - keep-alive + Content-Length: + - '120' + Content-Type: + - application/json + ParameterSetName: + - -g --account-name --enabled --rule-config-filter-type --rule-config-filter-values + User-Agent: + - AZURECLI/2.85.0 azsdk-python-core/1.39.0 Python/3.12.10 (Windows-10-10.0.19045-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_storage_advanced_platform_metric000001/providers/Microsoft.Storage/storageAccounts/clitest000002/advancedPlatformMetrics/ContainerLevelCapacityMetrics?api-version=2026-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_storage_advanced_platform_metric000001/providers/Microsoft.Storage/storageAccounts/clitest000002/advancedPlatformMetrics/ContainerLevelCapacityMetrics","name":"DefaultAdvancedPlatformMetricsRule","type":"Microsoft.Storage/storageAccounts/advancedPlatformMetrics","properties":{"ruleType":"ContainerLevelCapacityMetrics","metricsEmitted":["ContainerUsedSize","ContainerBlobCount"],"enabled":true,"lastModifiedTime":"2026-04-24T03:07:15.5766907Z","ruleConfig":{"filterType":"ContainerListFilter","filterValues":["logs","data"]}}}' + headers: + cache-control: + - no-cache + content-length: + - '610' + content-type: + - application/json + date: + - Fri, 24 Apr 2026 03:07:15 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-operation-identifier: + - tenantId=ed94de55-1f87-4278-9651-525e7ba467d6,objectId=9189af77-1924-4997-8bea-dc08f6bf83e0/eastus2euap/9d9498df-f673-4701-9daa-57ed35e4462b + x-ms-ratelimit-remaining-subscription-writes: + - '0' + x-ms-throttling-version: + - v2 + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - storage advanced-platform-metric update + Connection: + - keep-alive + ParameterSetName: + - -g --account-name --enabled --rule-config-filter-type + User-Agent: + - AZURECLI/2.85.0 azsdk-python-core/1.39.0 Python/3.12.10 (Windows-10-10.0.19045-SP0) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_storage_advanced_platform_metric000001/providers/Microsoft.Storage/storageAccounts/clitest000002/advancedPlatformMetrics/ContainerLevelCapacityMetrics?api-version=2026-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_storage_advanced_platform_metric000001/providers/Microsoft.Storage/storageAccounts/clitest000002/advancedPlatformMetrics/ContainerLevelCapacityMetrics","name":"DefaultAdvancedPlatformMetricsRule","type":"Microsoft.Storage/storageAccounts/advancedPlatformMetrics","properties":{"ruleType":"ContainerLevelCapacityMetrics","metricsEmitted":["ContainerUsedSize","ContainerBlobCount"],"enabled":true,"lastModifiedTime":"2026-04-24T03:07:15.5766907Z","ruleConfig":{"filterType":"ContainerListFilter","filterValues":["logs","data"]}}}' + headers: + cache-control: + - no-cache + content-length: + - '610' + content-type: + - application/json + date: + - Fri, 24 Apr 2026 03:07:17 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-operation-identifier: + - tenantId=ed94de55-1f87-4278-9651-525e7ba467d6,objectId=9189af77-1924-4997-8bea-dc08f6bf83e0/eastus2euap/0724b82c-38ba-4306-8832-82d0e20afd7f + x-ms-throttling-version: + - v2 + status: + code: 200 + message: OK +- request: + body: '{"properties": {"enabled": true, "ruleConfig": {"filterType": "AllContainersFilter", + "filterValues": []}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + CommandName: + - storage advanced-platform-metric update + Connection: + - keep-alive + Content-Length: + - '106' + Content-Type: + - application/json + ParameterSetName: + - -g --account-name --enabled --rule-config-filter-type + User-Agent: + - AZURECLI/2.85.0 azsdk-python-core/1.39.0 Python/3.12.10 (Windows-10-10.0.19045-SP0) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_storage_advanced_platform_metric000001/providers/Microsoft.Storage/storageAccounts/clitest000002/advancedPlatformMetrics/ContainerLevelCapacityMetrics?api-version=2026-04-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_test_storage_advanced_platform_metric000001/providers/Microsoft.Storage/storageAccounts/clitest000002/advancedPlatformMetrics/ContainerLevelCapacityMetrics","name":"DefaultAdvancedPlatformMetricsRule","type":"Microsoft.Storage/storageAccounts/advancedPlatformMetrics","properties":{"ruleType":"ContainerLevelCapacityMetrics","metricsEmitted":["ContainerUsedSize","ContainerBlobCount"],"enabled":true,"lastModifiedTime":"2026-04-24T03:07:21.1417731Z","ruleConfig":{"filterType":"AllContainersFilter","filterValues":[]}}}' + headers: + cache-control: + - no-cache + content-length: + - '597' + content-type: + - application/json + date: + - Fri, 24 Apr 2026 03:07:21 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-Azure-Storage-Resource-Provider/1.0,Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-content-type-options: + - nosniff + x-ms-operation-identifier: + - tenantId=ed94de55-1f87-4278-9651-525e7ba467d6,objectId=9189af77-1924-4997-8bea-dc08f6bf83e0/eastus2euap/624e604a-4624-4304-9506-478c62d9b9b0 + x-ms-ratelimit-remaining-subscription-writes: + - '0' + x-ms-throttling-version: + - v2 + status: + code: 200 + message: OK +version: 1 diff --git a/src/azure-cli/azure/cli/command_modules/storage/tests/latest/test_storage_advanced_platform_metric_scenarios.py b/src/azure-cli/azure/cli/command_modules/storage/tests/latest/test_storage_advanced_platform_metric_scenarios.py new file mode 100644 index 00000000000..308f8f1d5ab --- /dev/null +++ b/src/azure-cli/azure/cli/command_modules/storage/tests/latest/test_storage_advanced_platform_metric_scenarios.py @@ -0,0 +1,65 @@ +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + +from azure.cli.testsdk import (ScenarioTest, JMESPathCheck, ResourceGroupPreparer, + StorageAccountPreparer) +from ..storage_test_util import StorageScenarioMixin + + +class StorageAdvancedPlatformMetricTests(StorageScenarioMixin, ScenarioTest): + @ResourceGroupPreparer(name_prefix='cli_test_storage_advanced_platform_metric') + @StorageAccountPreparer() + def test_storage_advanced_platform_metric(self, resource_group, storage_account): + kwargs = { + 'rg': resource_group, + 'sa': storage_account + } + self.cmd('storage advanced-platform-metric create -g {rg} --account-name {sa} --enabled ' + '--rule-config-filter-type AllContainersFilter'.format(**kwargs), + checks=[ + JMESPathCheck('properties.ruleConfig.filterType', 'AllContainersFilter'), + JMESPathCheck('properties.enabled', True)]) + + self.cmd('storage advanced-platform-metric show -g {rg} --account-name {sa}') + + self.cmd('storage advanced-platform-metric update -g {rg} --account-name {sa} --enabled ' + '--rule-config-filter-type ContainerPrefixFilter ' + '--rule-config-filter-values logs data'.format(**kwargs), + checks=[ + JMESPathCheck('properties.ruleConfig.filterType', 'ContainerPrefixFilter'), + JMESPathCheck('properties.ruleConfig.filterValues', ['logs', 'data'])]) + + self.cmd('storage advanced-platform-metric list -g {rg} --account-name {sa}', + checks=JMESPathCheck('length(@)', 1)) + + self.cmd('storage advanced-platform-metric delete -g {rg} --account-name {sa} --yes') + + self.cmd('storage advanced-platform-metric create -g {rg} --account-name {sa} --enabled ' + '--rule-config-filter-type ContainerPrefixFilter ' + '--rule-config-filter-values logs data'.format(**kwargs), + checks=[ + JMESPathCheck('properties.ruleConfig.filterType', 'ContainerPrefixFilter'), + JMESPathCheck('properties.ruleConfig.filterValues', ['logs', 'data'])]) + + self.cmd('storage advanced-platform-metric update -g {rg} --account-name {sa} --enabled ' + '--rule-config-filter-type ContainerListFilter ' + '--rule-config-filter-values logs1 data1'.format(**kwargs), + checks=[ + JMESPathCheck('properties.ruleConfig.filterType', 'ContainerListFilter'), + JMESPathCheck('properties.ruleConfig.filterValues', ['logs1', 'data1'])]) + + self.cmd('storage advanced-platform-metric delete -g {rg} --account-name {sa} --yes') + + self.cmd('storage advanced-platform-metric create -g {rg} --account-name {sa} --enabled ' + '--rule-config-filter-type ContainerListFilter ' + '--rule-config-filter-values logs data'.format(**kwargs), + checks=[ + JMESPathCheck('properties.ruleConfig.filterType', 'ContainerListFilter'), + JMESPathCheck('properties.ruleConfig.filterValues', ['logs', 'data'])]) + + self.cmd('storage advanced-platform-metric update -g {rg} --account-name {sa} --enabled ' + '--rule-config-filter-type AllContainersFilter'.format(**kwargs), + checks=[ + JMESPathCheck('properties.ruleConfig.filterType', 'AllContainersFilter')])