diff --git a/src/datadog/HISTORY.rst b/src/datadog/HISTORY.rst index 051c4fddde3..1c6d47b37f3 100644 --- a/src/datadog/HISTORY.rst +++ b/src/datadog/HISTORY.rst @@ -2,6 +2,10 @@ Release History =============== +2.0.1 +++++++ +* added api version 2025-06-11 + 2.0.0 ++++++ * Fix resource creation issue diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/__init__.py b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/__init__.py index 6faf365426e..62d56bf53a4 100644 --- a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/__init__.py +++ b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/__init__.py @@ -11,6 +11,7 @@ from .__cmd_group import * from ._create import * from ._delete import * +from ._get_billing_info import * from ._get_default_key import * from ._list import * from ._list_api_key import * diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_create.py b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_create.py index 0c3551abf46..c058f7ee97c 100644 --- a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_create.py +++ b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_create.py @@ -25,9 +25,9 @@ class Create(AAZCommand): """ _aaz_info = { - "version": "2023-10-20", + "version": "2025-06-11", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}", "2023-10-20"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}", "2025-06-11"], ] } @@ -52,6 +52,11 @@ def _build_arguments_schema(cls, *args, **kwargs): options=["-n", "--name", "--monitor-name"], help="Monitor resource name", required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9_][a-zA-Z0-9_-]+$", + max_length=32, + min_length=2, + ), ) _args_schema.resource_group = AAZResourceGroupNameArg( required=True, @@ -154,6 +159,10 @@ def _build_arguments_schema(cls, *args, **kwargs): options=["redirect-uri"], help="The redirect uri for linking.", ) + org_properties.resource_collection = AAZBoolArg( + options=["resource-collection"], + help="The configuration which describes the state of resource collection. This collects configuration information for all resources in a subscription.", + ) user_info = cls._args_schema.user_info user_info.email_address = AAZStrArg( @@ -260,7 +269,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2023-10-20", + "api-version", "2025-06-11", required=True, ), } @@ -312,6 +321,7 @@ def content(self): datadog_organization_properties.set_prop("linkingClientId", AAZStrType, ".linking_client_id", typ_kwargs={"flags": {"secret": True}}) datadog_organization_properties.set_prop("name", AAZStrType, ".name") datadog_organization_properties.set_prop("redirectUri", AAZStrType, ".redirect_uri") + datadog_organization_properties.set_prop("resourceCollection", AAZBoolType, ".resource_collection") user_info = _builder.get(".properties.userInfo") if user_info is not None: @@ -411,6 +421,9 @@ def _build_schema_on_200_201(cls): datadog_organization_properties.cspm = AAZBoolType() datadog_organization_properties.id = AAZStrType() datadog_organization_properties.name = AAZStrType() + datadog_organization_properties.resource_collection = AAZBoolType( + serialized_name="resourceCollection", + ) user_info = cls._schema_on_200_201.properties.user_info user_info.email_address = AAZStrType( diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_delete.py b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_delete.py index 97aa54e10c4..0972d01f5ea 100644 --- a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_delete.py +++ b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_delete.py @@ -23,9 +23,9 @@ class Delete(AAZCommand): """ _aaz_info = { - "version": "2023-10-20", + "version": "2025-06-11", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}", "2023-10-20"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}", "2025-06-11"], ] } @@ -51,6 +51,11 @@ def _build_arguments_schema(cls, *args, **kwargs): help="Monitor resource name", required=True, id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9_][a-zA-Z0-9_-]+$", + max_length=32, + min_length=2, + ), ) _args_schema.resource_group = AAZResourceGroupNameArg( required=True, @@ -143,7 +148,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2023-10-20", + "api-version", "2025-06-11", required=True, ), } diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_get_billing_info.py b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_get_billing_info.py new file mode 100644 index 00000000000..868c3a09032 --- /dev/null +++ b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_get_billing_info.py @@ -0,0 +1,194 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "datadog monitor get-billing-info", +) +class GetBillingInfo(AAZCommand): + """Get marketplace and organization info mapped to the given monitor. + """ + + _aaz_info = { + "version": "2025-06-11", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/getbillinginfo", "2025-06-11"], + ] + } + + 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.monitor_name = AAZStrArg( + options=["--monitor-name"], + help="Monitor resource name", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9_][a-zA-Z0-9_-]+$", + max_length=32, + min_length=2, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.BillingInfoGet(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 BillingInfoGet(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.Datadog/monitors/{monitorName}/getBillingInfo", + **self.url_parameters + ) + + @property + def method(self): + return "POST" + + @property + def error_format(self): + return "MgmtErrorFormat" + + @property + def url_parameters(self): + parameters = { + **self.serialize_url_param( + "monitorName", self.ctx.args.monitor_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", "2025-06-11", + 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.marketplace_saas_info = AAZObjectType( + serialized_name="marketplaceSaasInfo", + ) + _schema_on_200.partner_billing_entity = AAZObjectType( + serialized_name="partnerBillingEntity", + ) + + marketplace_saas_info = cls._schema_on_200.marketplace_saas_info + marketplace_saas_info.billed_azure_subscription_id = AAZStrType( + serialized_name="billedAzureSubscriptionId", + ) + marketplace_saas_info.marketplace_name = AAZStrType( + serialized_name="marketplaceName", + ) + marketplace_saas_info.marketplace_status = AAZStrType( + serialized_name="marketplaceStatus", + ) + marketplace_saas_info.marketplace_subscription_id = AAZStrType( + serialized_name="marketplaceSubscriptionId", + ) + marketplace_saas_info.subscribed = AAZBoolType() + + partner_billing_entity = cls._schema_on_200.partner_billing_entity + partner_billing_entity.id = AAZStrType() + partner_billing_entity.name = AAZStrType() + partner_billing_entity.partner_entity_uri = AAZStrType( + serialized_name="partnerEntityUri", + ) + + return cls._schema_on_200 + + +class _GetBillingInfoHelper: + """Helper class for GetBillingInfo""" + + +__all__ = ["GetBillingInfo"] diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_get_default_key.py b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_get_default_key.py index baa2114af72..8befbef8286 100644 --- a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_get_default_key.py +++ b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_get_default_key.py @@ -22,9 +22,9 @@ class GetDefaultKey(AAZCommand): """ _aaz_info = { - "version": "2021-03-01", + "version": "2025-06-11", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/getdefaultkey", "2021-03-01"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/getdefaultkey", "2025-06-11"], ] } @@ -49,6 +49,11 @@ def _build_arguments_schema(cls, *args, **kwargs): help="Monitor resource name", required=True, id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9_][a-zA-Z0-9_-]+$", + max_length=32, + min_length=2, + ), ) _args_schema.resource_group = AAZResourceGroupNameArg( required=True, @@ -120,7 +125,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2021-03-01", + "api-version", "2025-06-11", required=True, ), } diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_list.py b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_list.py index 57332ac04fa..a554b5697cd 100644 --- a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_list.py +++ b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_list.py @@ -22,10 +22,10 @@ class List(AAZCommand): """ _aaz_info = { - "version": "2021-03-01", + "version": "2025-06-11", "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.datadog/monitors", "2021-03-01"], - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors", "2021-03-01"], + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.datadog/monitors", "2025-06-11"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors", "2025-06-11"], ] } @@ -112,7 +112,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2021-03-01", + "api-version", "2025-06-11", required=True, ), } @@ -215,11 +215,11 @@ def _build_schema_on_200(cls): ) datadog_organization_properties = cls._schema_on_200.value.Element.properties.datadog_organization_properties - datadog_organization_properties.id = AAZStrType( - flags={"read_only": True}, - ) - datadog_organization_properties.name = AAZStrType( - flags={"read_only": True}, + datadog_organization_properties.cspm = AAZBoolType() + datadog_organization_properties.id = AAZStrType() + datadog_organization_properties.name = AAZStrType() + datadog_organization_properties.resource_collection = AAZBoolType( + serialized_name="resourceCollection", ) user_info = cls._schema_on_200.value.Element.properties.user_info @@ -305,7 +305,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2021-03-01", + "api-version", "2025-06-11", required=True, ), } @@ -408,11 +408,11 @@ def _build_schema_on_200(cls): ) datadog_organization_properties = cls._schema_on_200.value.Element.properties.datadog_organization_properties - datadog_organization_properties.id = AAZStrType( - flags={"read_only": True}, - ) - datadog_organization_properties.name = AAZStrType( - flags={"read_only": True}, + datadog_organization_properties.cspm = AAZBoolType() + datadog_organization_properties.id = AAZStrType() + datadog_organization_properties.name = AAZStrType() + datadog_organization_properties.resource_collection = AAZBoolType( + serialized_name="resourceCollection", ) user_info = cls._schema_on_200.value.Element.properties.user_info diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_list_api_key.py b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_list_api_key.py index 77672095b72..b87871ba039 100644 --- a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_list_api_key.py +++ b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_list_api_key.py @@ -22,9 +22,9 @@ class ListApiKey(AAZCommand): """ _aaz_info = { - "version": "2021-03-01", + "version": "2025-06-11", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/listapikeys", "2021-03-01"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/listapikeys", "2025-06-11"], ] } @@ -49,6 +49,11 @@ def _build_arguments_schema(cls, *args, **kwargs): options=["-n", "--name", "--monitor-name"], help="Monitor resource name", required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9_][a-zA-Z0-9_-]+$", + max_length=32, + min_length=2, + ), ) _args_schema.resource_group = AAZResourceGroupNameArg( required=True, @@ -121,7 +126,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2021-03-01", + "api-version", "2025-06-11", required=True, ), } diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_list_host.py b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_list_host.py index 6413fe88f4c..bc7933c2699 100644 --- a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_list_host.py +++ b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_list_host.py @@ -22,9 +22,9 @@ class ListHost(AAZCommand): """ _aaz_info = { - "version": "2021-03-01", + "version": "2025-06-11", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/listhosts", "2021-03-01"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/listhosts", "2025-06-11"], ] } @@ -49,6 +49,11 @@ def _build_arguments_schema(cls, *args, **kwargs): options=["-n", "--name", "--monitor-name"], help="Monitor resource name", required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9_][a-zA-Z0-9_-]+$", + max_length=32, + min_length=2, + ), ) _args_schema.resource_group = AAZResourceGroupNameArg( required=True, @@ -121,7 +126,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2021-03-01", + "api-version", "2025-06-11", required=True, ), } diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_list_linked_resource.py b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_list_linked_resource.py index d8bc9a8ef1a..32255c5a447 100644 --- a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_list_linked_resource.py +++ b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_list_linked_resource.py @@ -22,9 +22,9 @@ class ListLinkedResource(AAZCommand): """ _aaz_info = { - "version": "2021-03-01", + "version": "2025-06-11", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/listlinkedresources", "2021-03-01"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/listlinkedresources", "2025-06-11"], ] } @@ -49,6 +49,11 @@ def _build_arguments_schema(cls, *args, **kwargs): options=["-n", "--name", "--monitor-name"], help="Monitor resource name", required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9_][a-zA-Z0-9_-]+$", + max_length=32, + min_length=2, + ), ) _args_schema.resource_group = AAZResourceGroupNameArg( required=True, @@ -121,7 +126,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2021-03-01", + "api-version", "2025-06-11", required=True, ), } @@ -164,6 +169,7 @@ def _build_schema_on_200(cls): _element = cls._schema_on_200.value.Element _element.id = AAZStrType() + _element.location = AAZStrType() return cls._schema_on_200 diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_list_monitored_resource.py b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_list_monitored_resource.py index 031b940b913..207dcfc7d01 100644 --- a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_list_monitored_resource.py +++ b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_list_monitored_resource.py @@ -22,9 +22,9 @@ class ListMonitoredResource(AAZCommand): """ _aaz_info = { - "version": "2021-03-01", + "version": "2025-06-11", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/listmonitoredresources", "2021-03-01"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/listmonitoredresources", "2025-06-11"], ] } @@ -49,6 +49,11 @@ def _build_arguments_schema(cls, *args, **kwargs): options=["-n", "--name", "--monitor-name"], help="Monitor resource name", required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9_][a-zA-Z0-9_-]+$", + max_length=32, + min_length=2, + ), ) _args_schema.resource_group = AAZResourceGroupNameArg( required=True, @@ -121,7 +126,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2021-03-01", + "api-version", "2025-06-11", required=True, ), } diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_refresh_set_password_link.py b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_refresh_set_password_link.py index 6d5c98cecd2..f9632f61936 100644 --- a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_refresh_set_password_link.py +++ b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_refresh_set_password_link.py @@ -22,9 +22,9 @@ class RefreshSetPasswordLink(AAZCommand): """ _aaz_info = { - "version": "2021-03-01", + "version": "2025-06-11", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/refreshsetpasswordlink", "2021-03-01"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/refreshsetpasswordlink", "2025-06-11"], ] } @@ -49,6 +49,11 @@ def _build_arguments_schema(cls, *args, **kwargs): help="Monitor resource name", required=True, id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9_][a-zA-Z0-9_-]+$", + max_length=32, + min_length=2, + ), ) _args_schema.resource_group = AAZResourceGroupNameArg( required=True, @@ -120,7 +125,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2021-03-01", + "api-version", "2025-06-11", required=True, ), } diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_set_default_key.py b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_set_default_key.py index 1a46e089a4c..18285ed7168 100644 --- a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_set_default_key.py +++ b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_set_default_key.py @@ -22,9 +22,9 @@ class SetDefaultKey(AAZCommand): """ _aaz_info = { - "version": "2021-03-01", + "version": "2025-06-11", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/setdefaultkey", "2021-03-01"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/setdefaultkey", "2025-06-11"], ] } @@ -49,6 +49,11 @@ def _build_arguments_schema(cls, *args, **kwargs): help="Monitor resource name", required=True, id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9_][a-zA-Z0-9_-]+$", + max_length=32, + min_length=2, + ), ) _args_schema.resource_group = AAZResourceGroupNameArg( required=True, @@ -140,7 +145,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2021-03-01", + "api-version", "2025-06-11", required=True, ), } diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_show.py b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_show.py index a123b20e7e4..ae6796b6351 100644 --- a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_show.py +++ b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_show.py @@ -22,9 +22,9 @@ class Show(AAZCommand): """ _aaz_info = { - "version": "2023-10-20", + "version": "2025-06-11", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}", "2023-10-20"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}", "2025-06-11"], ] } @@ -49,6 +49,11 @@ def _build_arguments_schema(cls, *args, **kwargs): help="Monitor resource name", required=True, id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9_][a-zA-Z0-9_-]+$", + max_length=32, + min_length=2, + ), ) _args_schema.resource_group = AAZResourceGroupNameArg( required=True, @@ -120,7 +125,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2023-10-20", + "api-version", "2025-06-11", required=True, ), } @@ -217,6 +222,9 @@ def _build_schema_on_200(cls): datadog_organization_properties.cspm = AAZBoolType() datadog_organization_properties.id = AAZStrType() datadog_organization_properties.name = AAZStrType() + datadog_organization_properties.resource_collection = AAZBoolType( + serialized_name="resourceCollection", + ) user_info = cls._schema_on_200.properties.user_info user_info.email_address = AAZStrType( diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_update.py b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_update.py index ae27868fd5b..d22801889f8 100644 --- a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_update.py +++ b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_update.py @@ -22,9 +22,9 @@ class Update(AAZCommand): """ _aaz_info = { - "version": "2023-10-20", + "version": "2025-06-11", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}", "2023-10-20"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}", "2025-06-11"], ] } @@ -52,6 +52,11 @@ def _build_arguments_schema(cls, *args, **kwargs): help="Monitor resource name", required=True, id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9_][a-zA-Z0-9_-]+$", + max_length=32, + min_length=2, + ), ) _args_schema.resource_group = AAZResourceGroupNameArg( required=True, @@ -130,6 +135,11 @@ def _build_arguments_schema(cls, *args, **kwargs): help="The configuration which describes the state of cloud security posture management. This collects configuration information for all resources in a subscription and track conformance to industry benchmarks.", nullable=True, ) + org_properties.resource_collection = AAZBoolArg( + options=["resource-collection"], + help="The configuration which describes the state of resource collection. This collects configuration information for all resources in a subscription.", + nullable=True, + ) user_info = cls._args_schema.user_info user_info.email_address = AAZStrArg( @@ -236,7 +246,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2023-10-20", + "api-version", "2025-06-11", required=True, ), } @@ -335,7 +345,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2023-10-20", + "api-version", "2025-06-11", required=True, ), } @@ -412,6 +422,7 @@ def _update_instance(self, instance): datadog_organization_properties = _builder.get(".properties.datadogOrganizationProperties") if datadog_organization_properties is not None: datadog_organization_properties.set_prop("cspm", AAZBoolType, ".cspm") + datadog_organization_properties.set_prop("resourceCollection", AAZBoolType, ".resource_collection") user_info = _builder.get(".properties.userInfo") if user_info is not None: @@ -524,6 +535,9 @@ def _build_schema_datadog_monitor_resource_read(cls, _schema): datadog_organization_properties.cspm = AAZBoolType() datadog_organization_properties.id = AAZStrType() datadog_organization_properties.name = AAZStrType() + datadog_organization_properties.resource_collection = AAZBoolType( + serialized_name="resourceCollection", + ) user_info = _schema_datadog_monitor_resource_read.properties.user_info user_info.email_address = AAZStrType( diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_wait.py b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_wait.py index 1d4d7d35c1d..84207e4cf9c 100644 --- a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_wait.py +++ b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/_wait.py @@ -20,7 +20,7 @@ class Wait(AAZWaitCommand): _aaz_info = { "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}", "2023-10-20"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}", "2025-06-11"], ] } @@ -45,6 +45,11 @@ def _build_arguments_schema(cls, *args, **kwargs): help="Monitor resource name", required=True, id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9_][a-zA-Z0-9_-]+$", + max_length=32, + min_length=2, + ), ) _args_schema.resource_group = AAZResourceGroupNameArg( required=True, @@ -116,7 +121,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2023-10-20", + "api-version", "2025-06-11", required=True, ), } @@ -213,6 +218,9 @@ def _build_schema_on_200(cls): datadog_organization_properties.cspm = AAZBoolType() datadog_organization_properties.id = AAZStrType() datadog_organization_properties.name = AAZStrType() + datadog_organization_properties.resource_collection = AAZBoolType( + serialized_name="resourceCollection", + ) user_info = cls._schema_on_200.properties.user_info user_info.email_address = AAZStrType( diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/monitored_subscription/__cmd_group.py b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/monitored_subscription/__cmd_group.py new file mode 100644 index 00000000000..c5c9b9edff3 --- /dev/null +++ b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/monitored_subscription/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "datadog monitor monitored-subscription", +) +class __CMDGroup(AAZCommandGroup): + """Manage Monitored Subscription + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/monitored_subscription/__init__.py b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/monitored_subscription/__init__.py new file mode 100644 index 00000000000..c401f439385 --- /dev/null +++ b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/monitored_subscription/__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/datadog/azext_datadog/aaz/latest/datadog/monitor/monitored_subscription/_create.py b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/monitored_subscription/_create.py new file mode 100644 index 00000000000..5f6682dc7e6 --- /dev/null +++ b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/monitored_subscription/_create.py @@ -0,0 +1,508 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "datadog monitor monitored-subscription create", +) +class Create(AAZCommand): + """Create the subscriptions that should be monitored by the Datadog monitor resource. + """ + + _aaz_info = { + "version": "2025-06-11", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/monitoredsubscriptions/{}", "2025-06-11"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(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.configuration_name = AAZStrArg( + options=["-n", "--name", "--configuration-name"], + help="The configuration name. Only 'default' value is supported.", + required=True, + ) + _args_schema.monitor_name = AAZStrArg( + options=["--monitor-name"], + help="Monitor resource name", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9_][a-zA-Z0-9_-]+$", + max_length=32, + min_length=2, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.monitored_subscription_list = AAZListArg( + options=["--monitored-subscription-list"], + arg_group="Properties", + help="List of subscriptions and the state of the monitoring.", + ) + _args_schema.operation = AAZStrArg( + options=["--operation"], + arg_group="Properties", + help="The operation for the patch on the resource.", + enum={"Active": "Active", "AddBegin": "AddBegin", "AddComplete": "AddComplete", "DeleteBegin": "DeleteBegin", "DeleteComplete": "DeleteComplete"}, + ) + + monitored_subscription_list = cls._args_schema.monitored_subscription_list + monitored_subscription_list.Element = AAZObjectArg() + + _element = cls._args_schema.monitored_subscription_list.Element + _element.error = AAZStrArg( + options=["error"], + help="The reason of not monitoring the subscription.", + ) + _element.status = AAZStrArg( + options=["status"], + help="The state of monitoring.", + enum={"Active": "Active", "Deleting": "Deleting", "Failed": "Failed", "InProgress": "InProgress"}, + ) + _element.subscription_id = AAZStrArg( + options=["subscription-id"], + help="The subscriptionId to be monitored.", + ) + _element.tag_rules = AAZObjectArg( + options=["tag-rules"], + help="Definition of the properties for a TagRules resource.", + ) + + tag_rules = cls._args_schema.monitored_subscription_list.Element.tag_rules + tag_rules.agent_rules = AAZObjectArg( + options=["agent-rules"], + help="Set of rules for managing agents for the Monitor resource.", + ) + tag_rules.automuting = AAZBoolArg( + options=["automuting"], + help="Configuration to enable/disable auto-muting flag", + ) + tag_rules.custom_metrics = AAZBoolArg( + options=["custom-metrics"], + help="Configuration to enable/disable custom metrics. If enabled, custom metrics from app insights will be sent.", + ) + tag_rules.log_rules = AAZObjectArg( + options=["log-rules"], + help="Set of rules for sending logs for the Monitor resource.", + ) + tag_rules.metric_rules = AAZObjectArg( + options=["metric-rules"], + help="Set of rules for sending metrics for the Monitor resource.", + ) + + agent_rules = cls._args_schema.monitored_subscription_list.Element.tag_rules.agent_rules + agent_rules.enable_agent_monitoring = AAZBoolArg( + options=["enable-agent-monitoring"], + help="Flag specifying if agent monitoring should be enabled for the Monitor resource.", + ) + agent_rules.filtering_tags = AAZListArg( + options=["filtering-tags"], + help="List of filtering tags to be used for capturing metrics. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags.", + ) + + filtering_tags = cls._args_schema.monitored_subscription_list.Element.tag_rules.agent_rules.filtering_tags + filtering_tags.Element = AAZObjectArg() + cls._build_args_filtering_tag_create(filtering_tags.Element) + + log_rules = cls._args_schema.monitored_subscription_list.Element.tag_rules.log_rules + log_rules.filtering_tags = AAZListArg( + options=["filtering-tags"], + help="List of filtering tags to be used for capturing logs. This only takes effect if SendResourceLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags.", + ) + log_rules.send_aad_logs = AAZBoolArg( + options=["send-aad-logs"], + help="Flag specifying if AAD logs should be sent for the Monitor resource.", + ) + log_rules.send_resource_logs = AAZBoolArg( + options=["send-resource-logs"], + help="Flag specifying if Azure resource logs should be sent for the Monitor resource.", + ) + log_rules.send_subscription_logs = AAZBoolArg( + options=["send-subscription-logs"], + help="Flag specifying if Azure subscription logs should be sent for the Monitor resource.", + ) + + filtering_tags = cls._args_schema.monitored_subscription_list.Element.tag_rules.log_rules.filtering_tags + filtering_tags.Element = AAZObjectArg() + cls._build_args_filtering_tag_create(filtering_tags.Element) + + metric_rules = cls._args_schema.monitored_subscription_list.Element.tag_rules.metric_rules + metric_rules.filtering_tags = AAZListArg( + options=["filtering-tags"], + help="List of filtering tags to be used for capturing metrics. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags.", + ) + + filtering_tags = cls._args_schema.monitored_subscription_list.Element.tag_rules.metric_rules.filtering_tags + filtering_tags.Element = AAZObjectArg() + cls._build_args_filtering_tag_create(filtering_tags.Element) + return cls._args_schema + + _args_filtering_tag_create = None + + @classmethod + def _build_args_filtering_tag_create(cls, _schema): + if cls._args_filtering_tag_create is not None: + _schema.action = cls._args_filtering_tag_create.action + _schema.name = cls._args_filtering_tag_create.name + _schema.value = cls._args_filtering_tag_create.value + return + + cls._args_filtering_tag_create = AAZObjectArg() + + filtering_tag_create = cls._args_filtering_tag_create + filtering_tag_create.action = AAZStrArg( + options=["action"], + help="Valid actions for a filtering tag. Exclusion takes priority over inclusion.", + enum={"Exclude": "Exclude", "Include": "Include"}, + ) + filtering_tag_create.name = AAZStrArg( + options=["name"], + help="The name (also known as the key) of the tag.", + ) + filtering_tag_create.value = AAZStrArg( + options=["value"], + help="The value of the tag.", + ) + + _schema.action = cls._args_filtering_tag_create.action + _schema.name = cls._args_filtering_tag_create.name + _schema.value = cls._args_filtering_tag_create.value + + def _execute_operations(self): + self.pre_operations() + yield self.MonitoredSubscriptionsCreateorUpdate(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 MonitoredSubscriptionsCreateorUpdate(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 [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}", + **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( + "configurationName", self.ctx.args.configuration_name, + required=True, + ), + **self.serialize_url_param( + "monitorName", self.ctx.args.monitor_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", "2025-06-11", + 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": {"client_flatten": True}} + ) + _builder.set_prop("properties", AAZObjectType) + + properties = _builder.get(".properties") + if properties is not None: + properties.set_prop("monitoredSubscriptionList", AAZListType, ".monitored_subscription_list") + properties.set_prop("operation", AAZStrType, ".operation") + + monitored_subscription_list = _builder.get(".properties.monitoredSubscriptionList") + if monitored_subscription_list is not None: + monitored_subscription_list.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.monitoredSubscriptionList[]") + if _elements is not None: + _elements.set_prop("error", AAZStrType, ".error") + _elements.set_prop("status", AAZStrType, ".status") + _elements.set_prop("subscriptionId", AAZStrType, ".subscription_id") + _elements.set_prop("tagRules", AAZObjectType, ".tag_rules") + + tag_rules = _builder.get(".properties.monitoredSubscriptionList[].tagRules") + if tag_rules is not None: + tag_rules.set_prop("agentRules", AAZObjectType, ".agent_rules") + tag_rules.set_prop("automuting", AAZBoolType, ".automuting") + tag_rules.set_prop("customMetrics", AAZBoolType, ".custom_metrics") + tag_rules.set_prop("logRules", AAZObjectType, ".log_rules") + tag_rules.set_prop("metricRules", AAZObjectType, ".metric_rules") + + agent_rules = _builder.get(".properties.monitoredSubscriptionList[].tagRules.agentRules") + if agent_rules is not None: + agent_rules.set_prop("enableAgentMonitoring", AAZBoolType, ".enable_agent_monitoring") + agent_rules.set_prop("filteringTags", AAZListType, ".filtering_tags") + + filtering_tags = _builder.get(".properties.monitoredSubscriptionList[].tagRules.agentRules.filteringTags") + if filtering_tags is not None: + _CreateHelper._build_schema_filtering_tag_create(filtering_tags.set_elements(AAZObjectType, ".")) + + log_rules = _builder.get(".properties.monitoredSubscriptionList[].tagRules.logRules") + if log_rules is not None: + log_rules.set_prop("filteringTags", AAZListType, ".filtering_tags") + log_rules.set_prop("sendAadLogs", AAZBoolType, ".send_aad_logs") + log_rules.set_prop("sendResourceLogs", AAZBoolType, ".send_resource_logs") + log_rules.set_prop("sendSubscriptionLogs", AAZBoolType, ".send_subscription_logs") + + filtering_tags = _builder.get(".properties.monitoredSubscriptionList[].tagRules.logRules.filteringTags") + if filtering_tags is not None: + _CreateHelper._build_schema_filtering_tag_create(filtering_tags.set_elements(AAZObjectType, ".")) + + metric_rules = _builder.get(".properties.monitoredSubscriptionList[].tagRules.metricRules") + if metric_rules is not None: + metric_rules.set_prop("filteringTags", AAZListType, ".filtering_tags") + + filtering_tags = _builder.get(".properties.monitoredSubscriptionList[].tagRules.metricRules.filteringTags") + if filtering_tags is not None: + _CreateHelper._build_schema_filtering_tag_create(filtering_tags.set_elements(AAZObjectType, ".")) + + 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.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200_201.properties + properties.monitored_subscription_list = AAZListType( + serialized_name="monitoredSubscriptionList", + ) + + monitored_subscription_list = cls._schema_on_200_201.properties.monitored_subscription_list + monitored_subscription_list.Element = AAZObjectType() + + _element = cls._schema_on_200_201.properties.monitored_subscription_list.Element + _element.error = AAZStrType() + _element.status = AAZStrType() + _element.subscription_id = AAZStrType( + serialized_name="subscriptionId", + ) + _element.tag_rules = AAZObjectType( + serialized_name="tagRules", + ) + + tag_rules = cls._schema_on_200_201.properties.monitored_subscription_list.Element.tag_rules + tag_rules.agent_rules = AAZObjectType( + serialized_name="agentRules", + ) + tag_rules.automuting = AAZBoolType() + tag_rules.custom_metrics = AAZBoolType( + serialized_name="customMetrics", + ) + tag_rules.log_rules = AAZObjectType( + serialized_name="logRules", + ) + tag_rules.metric_rules = AAZObjectType( + serialized_name="metricRules", + ) + tag_rules.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + agent_rules = cls._schema_on_200_201.properties.monitored_subscription_list.Element.tag_rules.agent_rules + agent_rules.enable_agent_monitoring = AAZBoolType( + serialized_name="enableAgentMonitoring", + ) + agent_rules.filtering_tags = AAZListType( + serialized_name="filteringTags", + ) + + filtering_tags = cls._schema_on_200_201.properties.monitored_subscription_list.Element.tag_rules.agent_rules.filtering_tags + filtering_tags.Element = AAZObjectType() + _CreateHelper._build_schema_filtering_tag_read(filtering_tags.Element) + + log_rules = cls._schema_on_200_201.properties.monitored_subscription_list.Element.tag_rules.log_rules + log_rules.filtering_tags = AAZListType( + serialized_name="filteringTags", + ) + log_rules.send_aad_logs = AAZBoolType( + serialized_name="sendAadLogs", + ) + log_rules.send_resource_logs = AAZBoolType( + serialized_name="sendResourceLogs", + ) + log_rules.send_subscription_logs = AAZBoolType( + serialized_name="sendSubscriptionLogs", + ) + + filtering_tags = cls._schema_on_200_201.properties.monitored_subscription_list.Element.tag_rules.log_rules.filtering_tags + filtering_tags.Element = AAZObjectType() + _CreateHelper._build_schema_filtering_tag_read(filtering_tags.Element) + + metric_rules = cls._schema_on_200_201.properties.monitored_subscription_list.Element.tag_rules.metric_rules + metric_rules.filtering_tags = AAZListType( + serialized_name="filteringTags", + ) + + filtering_tags = cls._schema_on_200_201.properties.monitored_subscription_list.Element.tag_rules.metric_rules.filtering_tags + filtering_tags.Element = AAZObjectType() + _CreateHelper._build_schema_filtering_tag_read(filtering_tags.Element) + + return cls._schema_on_200_201 + + +class _CreateHelper: + """Helper class for Create""" + + @classmethod + def _build_schema_filtering_tag_create(cls, _builder): + if _builder is None: + return + _builder.set_prop("action", AAZStrType, ".action") + _builder.set_prop("name", AAZStrType, ".name") + _builder.set_prop("value", AAZStrType, ".value") + + _schema_filtering_tag_read = None + + @classmethod + def _build_schema_filtering_tag_read(cls, _schema): + if cls._schema_filtering_tag_read is not None: + _schema.action = cls._schema_filtering_tag_read.action + _schema.name = cls._schema_filtering_tag_read.name + _schema.value = cls._schema_filtering_tag_read.value + return + + cls._schema_filtering_tag_read = _schema_filtering_tag_read = AAZObjectType() + + filtering_tag_read = _schema_filtering_tag_read + filtering_tag_read.action = AAZStrType() + filtering_tag_read.name = AAZStrType() + filtering_tag_read.value = AAZStrType() + + _schema.action = cls._schema_filtering_tag_read.action + _schema.name = cls._schema_filtering_tag_read.name + _schema.value = cls._schema_filtering_tag_read.value + + +__all__ = ["Create"] diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/monitored_subscription/_delete.py b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/monitored_subscription/_delete.py new file mode 100644 index 00000000000..1879b46b204 --- /dev/null +++ b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/monitored_subscription/_delete.py @@ -0,0 +1,175 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "datadog monitor monitored-subscription delete", + confirmation="Are you sure you want to perform this operation?", +) +class Delete(AAZCommand): + """Delete the subscriptions that are being monitored by the Datadog monitor resource + """ + + _aaz_info = { + "version": "2025-06-11", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/monitoredsubscriptions/{}", "2025-06-11"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(self._execute_operations, 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.configuration_name = AAZStrArg( + options=["-n", "--name", "--configuration-name"], + help="Configuration name", + required=True, + id_part="child_name_1", + ) + _args_schema.monitor_name = AAZStrArg( + options=["--monitor-name"], + help="Monitor resource name", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9_][a-zA-Z0-9_-]+$", + max_length=32, + min_length=2, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + yield self.MonitoredSubscriptionsDelete(ctx=self.ctx)() + self.post_operations() + + @register_callback + def pre_operations(self): + pass + + @register_callback + def post_operations(self): + pass + + class MonitoredSubscriptionsDelete(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 [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [204]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_204, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}", + **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( + "configurationName", self.ctx.args.configuration_name, + required=True, + ), + **self.serialize_url_param( + "monitorName", self.ctx.args.monitor_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", "2025-06-11", + 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/datadog/azext_datadog/aaz/latest/datadog/monitor/monitored_subscription/_list.py b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/monitored_subscription/_list.py new file mode 100644 index 00000000000..44230f50254 --- /dev/null +++ b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/monitored_subscription/_list.py @@ -0,0 +1,283 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "datadog monitor monitored-subscription list", +) +class List(AAZCommand): + """List the subscriptions currently being monitored by the Datadog monitor resource. + """ + + _aaz_info = { + "version": "2025-06-11", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/monitoredsubscriptions", "2025-06-11"], + ] + } + + 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.monitor_name = AAZStrArg( + options=["--monitor-name"], + help="Monitor resource name", + required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9_][a-zA-Z0-9_-]+$", + max_length=32, + min_length=2, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.MonitoredSubscriptionsList(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 MonitoredSubscriptionsList(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.Datadog/monitors/{monitorName}/monitoredSubscriptions", + **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( + "monitorName", self.ctx.args.monitor_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", "2025-06-11", + 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() + + 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.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.value.Element.properties + properties.monitored_subscription_list = AAZListType( + serialized_name="monitoredSubscriptionList", + ) + + monitored_subscription_list = cls._schema_on_200.value.Element.properties.monitored_subscription_list + monitored_subscription_list.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element.properties.monitored_subscription_list.Element + _element.error = AAZStrType() + _element.status = AAZStrType() + _element.subscription_id = AAZStrType( + serialized_name="subscriptionId", + ) + _element.tag_rules = AAZObjectType( + serialized_name="tagRules", + ) + + tag_rules = cls._schema_on_200.value.Element.properties.monitored_subscription_list.Element.tag_rules + tag_rules.agent_rules = AAZObjectType( + serialized_name="agentRules", + ) + tag_rules.automuting = AAZBoolType() + tag_rules.custom_metrics = AAZBoolType( + serialized_name="customMetrics", + ) + tag_rules.log_rules = AAZObjectType( + serialized_name="logRules", + ) + tag_rules.metric_rules = AAZObjectType( + serialized_name="metricRules", + ) + tag_rules.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + agent_rules = cls._schema_on_200.value.Element.properties.monitored_subscription_list.Element.tag_rules.agent_rules + agent_rules.enable_agent_monitoring = AAZBoolType( + serialized_name="enableAgentMonitoring", + ) + agent_rules.filtering_tags = AAZListType( + serialized_name="filteringTags", + ) + + filtering_tags = cls._schema_on_200.value.Element.properties.monitored_subscription_list.Element.tag_rules.agent_rules.filtering_tags + filtering_tags.Element = AAZObjectType() + _ListHelper._build_schema_filtering_tag_read(filtering_tags.Element) + + log_rules = cls._schema_on_200.value.Element.properties.monitored_subscription_list.Element.tag_rules.log_rules + log_rules.filtering_tags = AAZListType( + serialized_name="filteringTags", + ) + log_rules.send_aad_logs = AAZBoolType( + serialized_name="sendAadLogs", + ) + log_rules.send_resource_logs = AAZBoolType( + serialized_name="sendResourceLogs", + ) + log_rules.send_subscription_logs = AAZBoolType( + serialized_name="sendSubscriptionLogs", + ) + + filtering_tags = cls._schema_on_200.value.Element.properties.monitored_subscription_list.Element.tag_rules.log_rules.filtering_tags + filtering_tags.Element = AAZObjectType() + _ListHelper._build_schema_filtering_tag_read(filtering_tags.Element) + + metric_rules = cls._schema_on_200.value.Element.properties.monitored_subscription_list.Element.tag_rules.metric_rules + metric_rules.filtering_tags = AAZListType( + serialized_name="filteringTags", + ) + + filtering_tags = cls._schema_on_200.value.Element.properties.monitored_subscription_list.Element.tag_rules.metric_rules.filtering_tags + filtering_tags.Element = AAZObjectType() + _ListHelper._build_schema_filtering_tag_read(filtering_tags.Element) + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + _schema_filtering_tag_read = None + + @classmethod + def _build_schema_filtering_tag_read(cls, _schema): + if cls._schema_filtering_tag_read is not None: + _schema.action = cls._schema_filtering_tag_read.action + _schema.name = cls._schema_filtering_tag_read.name + _schema.value = cls._schema_filtering_tag_read.value + return + + cls._schema_filtering_tag_read = _schema_filtering_tag_read = AAZObjectType() + + filtering_tag_read = _schema_filtering_tag_read + filtering_tag_read.action = AAZStrType() + filtering_tag_read.name = AAZStrType() + filtering_tag_read.value = AAZStrType() + + _schema.action = cls._schema_filtering_tag_read.action + _schema.name = cls._schema_filtering_tag_read.name + _schema.value = cls._schema_filtering_tag_read.value + + +__all__ = ["List"] diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/monitored_subscription/_show.py b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/monitored_subscription/_show.py new file mode 100644 index 00000000000..f785a843ae2 --- /dev/null +++ b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/monitored_subscription/_show.py @@ -0,0 +1,283 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "datadog monitor monitored-subscription show", +) +class Show(AAZCommand): + """Get the subscriptions currently being monitored by the Datadog monitor resource. + """ + + _aaz_info = { + "version": "2025-06-11", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/monitoredsubscriptions/{}", "2025-06-11"], + ] + } + + 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.configuration_name = AAZStrArg( + options=["-n", "--name", "--configuration-name"], + help="The configuration name. Only 'default' value is supported.", + required=True, + id_part="child_name_1", + ) + _args_schema.monitor_name = AAZStrArg( + options=["--monitor-name"], + help="Monitor resource name", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9_][a-zA-Z0-9_-]+$", + max_length=32, + min_length=2, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.MonitoredSubscriptionsGet(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 MonitoredSubscriptionsGet(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.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}", + **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( + "configurationName", self.ctx.args.configuration_name, + required=True, + ), + **self.serialize_url_param( + "monitorName", self.ctx.args.monitor_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", "2025-06-11", + 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.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = cls._schema_on_200.properties + properties.monitored_subscription_list = AAZListType( + serialized_name="monitoredSubscriptionList", + ) + + monitored_subscription_list = cls._schema_on_200.properties.monitored_subscription_list + monitored_subscription_list.Element = AAZObjectType() + + _element = cls._schema_on_200.properties.monitored_subscription_list.Element + _element.error = AAZStrType() + _element.status = AAZStrType() + _element.subscription_id = AAZStrType( + serialized_name="subscriptionId", + ) + _element.tag_rules = AAZObjectType( + serialized_name="tagRules", + ) + + tag_rules = cls._schema_on_200.properties.monitored_subscription_list.Element.tag_rules + tag_rules.agent_rules = AAZObjectType( + serialized_name="agentRules", + ) + tag_rules.automuting = AAZBoolType() + tag_rules.custom_metrics = AAZBoolType( + serialized_name="customMetrics", + ) + tag_rules.log_rules = AAZObjectType( + serialized_name="logRules", + ) + tag_rules.metric_rules = AAZObjectType( + serialized_name="metricRules", + ) + tag_rules.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + agent_rules = cls._schema_on_200.properties.monitored_subscription_list.Element.tag_rules.agent_rules + agent_rules.enable_agent_monitoring = AAZBoolType( + serialized_name="enableAgentMonitoring", + ) + agent_rules.filtering_tags = AAZListType( + serialized_name="filteringTags", + ) + + filtering_tags = cls._schema_on_200.properties.monitored_subscription_list.Element.tag_rules.agent_rules.filtering_tags + filtering_tags.Element = AAZObjectType() + _ShowHelper._build_schema_filtering_tag_read(filtering_tags.Element) + + log_rules = cls._schema_on_200.properties.monitored_subscription_list.Element.tag_rules.log_rules + log_rules.filtering_tags = AAZListType( + serialized_name="filteringTags", + ) + log_rules.send_aad_logs = AAZBoolType( + serialized_name="sendAadLogs", + ) + log_rules.send_resource_logs = AAZBoolType( + serialized_name="sendResourceLogs", + ) + log_rules.send_subscription_logs = AAZBoolType( + serialized_name="sendSubscriptionLogs", + ) + + filtering_tags = cls._schema_on_200.properties.monitored_subscription_list.Element.tag_rules.log_rules.filtering_tags + filtering_tags.Element = AAZObjectType() + _ShowHelper._build_schema_filtering_tag_read(filtering_tags.Element) + + metric_rules = cls._schema_on_200.properties.monitored_subscription_list.Element.tag_rules.metric_rules + metric_rules.filtering_tags = AAZListType( + serialized_name="filteringTags", + ) + + filtering_tags = cls._schema_on_200.properties.monitored_subscription_list.Element.tag_rules.metric_rules.filtering_tags + filtering_tags.Element = AAZObjectType() + _ShowHelper._build_schema_filtering_tag_read(filtering_tags.Element) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + _schema_filtering_tag_read = None + + @classmethod + def _build_schema_filtering_tag_read(cls, _schema): + if cls._schema_filtering_tag_read is not None: + _schema.action = cls._schema_filtering_tag_read.action + _schema.name = cls._schema_filtering_tag_read.name + _schema.value = cls._schema_filtering_tag_read.value + return + + cls._schema_filtering_tag_read = _schema_filtering_tag_read = AAZObjectType() + + filtering_tag_read = _schema_filtering_tag_read + filtering_tag_read.action = AAZStrType() + filtering_tag_read.name = AAZStrType() + filtering_tag_read.value = AAZStrType() + + _schema.action = cls._schema_filtering_tag_read.action + _schema.name = cls._schema_filtering_tag_read.name + _schema.value = cls._schema_filtering_tag_read.value + + +__all__ = ["Show"] diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/monitor/monitored_subscription/_update.py b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/monitored_subscription/_update.py new file mode 100644 index 00000000000..a975a23b935 --- /dev/null +++ b/src/datadog/azext_datadog/aaz/latest/datadog/monitor/monitored_subscription/_update.py @@ -0,0 +1,683 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "datadog monitor monitored-subscription update", +) +class Update(AAZCommand): + """Update the subscriptions that should be monitored by the Datadog monitor resource. + """ + + _aaz_info = { + "version": "2025-06-11", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/monitoredsubscriptions/{}", "2025-06-11"], + ] + } + + AZ_SUPPORT_NO_WAIT = True + + AZ_SUPPORT_GENERIC_UPDATE = True + + def _handler(self, command_args): + super()._handler(command_args) + return self.build_lro_poller(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.configuration_name = AAZStrArg( + options=["-n", "--name", "--configuration-name"], + help="The configuration name. Only 'default' value is supported.", + required=True, + id_part="child_name_1", + ) + _args_schema.monitor_name = AAZStrArg( + options=["--monitor-name"], + help="Monitor resource name", + required=True, + id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9_][a-zA-Z0-9_-]+$", + max_length=32, + min_length=2, + ), + ) + _args_schema.resource_group = AAZResourceGroupNameArg( + required=True, + ) + + # define Arg Group "Properties" + + _args_schema = cls._args_schema + _args_schema.monitored_subscription_list = AAZListArg( + options=["--monitored-subscription-list"], + arg_group="Properties", + help="List of subscriptions and the state of the monitoring.", + nullable=True, + ) + _args_schema.operation = AAZStrArg( + options=["--operation"], + arg_group="Properties", + help="The operation for the patch on the resource.", + nullable=True, + enum={"Active": "Active", "AddBegin": "AddBegin", "AddComplete": "AddComplete", "DeleteBegin": "DeleteBegin", "DeleteComplete": "DeleteComplete"}, + ) + + monitored_subscription_list = cls._args_schema.monitored_subscription_list + monitored_subscription_list.Element = AAZObjectArg( + nullable=True, + ) + + _element = cls._args_schema.monitored_subscription_list.Element + _element.error = AAZStrArg( + options=["error"], + help="The reason of not monitoring the subscription.", + nullable=True, + ) + _element.status = AAZStrArg( + options=["status"], + help="The state of monitoring.", + nullable=True, + enum={"Active": "Active", "Deleting": "Deleting", "Failed": "Failed", "InProgress": "InProgress"}, + ) + _element.subscription_id = AAZStrArg( + options=["subscription-id"], + help="The subscriptionId to be monitored.", + nullable=True, + ) + _element.tag_rules = AAZObjectArg( + options=["tag-rules"], + help="Definition of the properties for a TagRules resource.", + nullable=True, + ) + + tag_rules = cls._args_schema.monitored_subscription_list.Element.tag_rules + tag_rules.agent_rules = AAZObjectArg( + options=["agent-rules"], + help="Set of rules for managing agents for the Monitor resource.", + nullable=True, + ) + tag_rules.automuting = AAZBoolArg( + options=["automuting"], + help="Configuration to enable/disable auto-muting flag", + nullable=True, + ) + tag_rules.custom_metrics = AAZBoolArg( + options=["custom-metrics"], + help="Configuration to enable/disable custom metrics. If enabled, custom metrics from app insights will be sent.", + nullable=True, + ) + tag_rules.log_rules = AAZObjectArg( + options=["log-rules"], + help="Set of rules for sending logs for the Monitor resource.", + nullable=True, + ) + tag_rules.metric_rules = AAZObjectArg( + options=["metric-rules"], + help="Set of rules for sending metrics for the Monitor resource.", + nullable=True, + ) + + agent_rules = cls._args_schema.monitored_subscription_list.Element.tag_rules.agent_rules + agent_rules.enable_agent_monitoring = AAZBoolArg( + options=["enable-agent-monitoring"], + help="Flag specifying if agent monitoring should be enabled for the Monitor resource.", + nullable=True, + ) + agent_rules.filtering_tags = AAZListArg( + options=["filtering-tags"], + help="List of filtering tags to be used for capturing metrics. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags.", + nullable=True, + ) + + filtering_tags = cls._args_schema.monitored_subscription_list.Element.tag_rules.agent_rules.filtering_tags + filtering_tags.Element = AAZObjectArg( + nullable=True, + ) + cls._build_args_filtering_tag_update(filtering_tags.Element) + + log_rules = cls._args_schema.monitored_subscription_list.Element.tag_rules.log_rules + log_rules.filtering_tags = AAZListArg( + options=["filtering-tags"], + help="List of filtering tags to be used for capturing logs. This only takes effect if SendResourceLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags.", + nullable=True, + ) + log_rules.send_aad_logs = AAZBoolArg( + options=["send-aad-logs"], + help="Flag specifying if AAD logs should be sent for the Monitor resource.", + nullable=True, + ) + log_rules.send_resource_logs = AAZBoolArg( + options=["send-resource-logs"], + help="Flag specifying if Azure resource logs should be sent for the Monitor resource.", + nullable=True, + ) + log_rules.send_subscription_logs = AAZBoolArg( + options=["send-subscription-logs"], + help="Flag specifying if Azure subscription logs should be sent for the Monitor resource.", + nullable=True, + ) + + filtering_tags = cls._args_schema.monitored_subscription_list.Element.tag_rules.log_rules.filtering_tags + filtering_tags.Element = AAZObjectArg( + nullable=True, + ) + cls._build_args_filtering_tag_update(filtering_tags.Element) + + metric_rules = cls._args_schema.monitored_subscription_list.Element.tag_rules.metric_rules + metric_rules.filtering_tags = AAZListArg( + options=["filtering-tags"], + help="List of filtering tags to be used for capturing metrics. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags.", + nullable=True, + ) + + filtering_tags = cls._args_schema.monitored_subscription_list.Element.tag_rules.metric_rules.filtering_tags + filtering_tags.Element = AAZObjectArg( + nullable=True, + ) + cls._build_args_filtering_tag_update(filtering_tags.Element) + return cls._args_schema + + _args_filtering_tag_update = None + + @classmethod + def _build_args_filtering_tag_update(cls, _schema): + if cls._args_filtering_tag_update is not None: + _schema.action = cls._args_filtering_tag_update.action + _schema.name = cls._args_filtering_tag_update.name + _schema.value = cls._args_filtering_tag_update.value + return + + cls._args_filtering_tag_update = AAZObjectArg( + nullable=True, + ) + + filtering_tag_update = cls._args_filtering_tag_update + filtering_tag_update.action = AAZStrArg( + options=["action"], + help="Valid actions for a filtering tag. Exclusion takes priority over inclusion.", + nullable=True, + enum={"Exclude": "Exclude", "Include": "Include"}, + ) + filtering_tag_update.name = AAZStrArg( + options=["name"], + help="The name (also known as the key) of the tag.", + nullable=True, + ) + filtering_tag_update.value = AAZStrArg( + options=["value"], + help="The value of the tag.", + nullable=True, + ) + + _schema.action = cls._args_filtering_tag_update.action + _schema.name = cls._args_filtering_tag_update.name + _schema.value = cls._args_filtering_tag_update.value + + def _execute_operations(self): + self.pre_operations() + self.MonitoredSubscriptionsGet(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) + yield self.MonitoredSubscriptionsCreateorUpdate(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 MonitoredSubscriptionsGet(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.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}", + **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( + "configurationName", self.ctx.args.configuration_name, + required=True, + ), + **self.serialize_url_param( + "monitorName", self.ctx.args.monitor_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", "2025-06-11", + 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_monitored_subscription_properties_read(cls._schema_on_200) + + return cls._schema_on_200 + + class MonitoredSubscriptionsCreateorUpdate(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 [202]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + if session.http_response.status_code in [200, 201]: + return self.client.build_lro_polling( + self.ctx.args.no_wait, + session, + self.on_200_201, + self.on_error, + lro_options={"final-state-via": "azure-async-operation"}, + path_format_arguments=self.url_parameters, + ) + + return self.on_error(session.http_response) + + @property + def url(self): + return self.client.format_url( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Datadog/monitors/{monitorName}/monitoredSubscriptions/{configurationName}", + **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( + "configurationName", self.ctx.args.configuration_name, + required=True, + ), + **self.serialize_url_param( + "monitorName", self.ctx.args.monitor_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", "2025-06-11", + 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_monitored_subscription_properties_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("monitoredSubscriptionList", AAZListType, ".monitored_subscription_list") + properties.set_prop("operation", AAZStrType, ".operation") + + monitored_subscription_list = _builder.get(".properties.monitoredSubscriptionList") + if monitored_subscription_list is not None: + monitored_subscription_list.set_elements(AAZObjectType, ".") + + _elements = _builder.get(".properties.monitoredSubscriptionList[]") + if _elements is not None: + _elements.set_prop("error", AAZStrType, ".error") + _elements.set_prop("status", AAZStrType, ".status") + _elements.set_prop("subscriptionId", AAZStrType, ".subscription_id") + _elements.set_prop("tagRules", AAZObjectType, ".tag_rules") + + tag_rules = _builder.get(".properties.monitoredSubscriptionList[].tagRules") + if tag_rules is not None: + tag_rules.set_prop("agentRules", AAZObjectType, ".agent_rules") + tag_rules.set_prop("automuting", AAZBoolType, ".automuting") + tag_rules.set_prop("customMetrics", AAZBoolType, ".custom_metrics") + tag_rules.set_prop("logRules", AAZObjectType, ".log_rules") + tag_rules.set_prop("metricRules", AAZObjectType, ".metric_rules") + + agent_rules = _builder.get(".properties.monitoredSubscriptionList[].tagRules.agentRules") + if agent_rules is not None: + agent_rules.set_prop("enableAgentMonitoring", AAZBoolType, ".enable_agent_monitoring") + agent_rules.set_prop("filteringTags", AAZListType, ".filtering_tags") + + filtering_tags = _builder.get(".properties.monitoredSubscriptionList[].tagRules.agentRules.filteringTags") + if filtering_tags is not None: + _UpdateHelper._build_schema_filtering_tag_update(filtering_tags.set_elements(AAZObjectType, ".")) + + log_rules = _builder.get(".properties.monitoredSubscriptionList[].tagRules.logRules") + if log_rules is not None: + log_rules.set_prop("filteringTags", AAZListType, ".filtering_tags") + log_rules.set_prop("sendAadLogs", AAZBoolType, ".send_aad_logs") + log_rules.set_prop("sendResourceLogs", AAZBoolType, ".send_resource_logs") + log_rules.set_prop("sendSubscriptionLogs", AAZBoolType, ".send_subscription_logs") + + filtering_tags = _builder.get(".properties.monitoredSubscriptionList[].tagRules.logRules.filteringTags") + if filtering_tags is not None: + _UpdateHelper._build_schema_filtering_tag_update(filtering_tags.set_elements(AAZObjectType, ".")) + + metric_rules = _builder.get(".properties.monitoredSubscriptionList[].tagRules.metricRules") + if metric_rules is not None: + metric_rules.set_prop("filteringTags", AAZListType, ".filtering_tags") + + filtering_tags = _builder.get(".properties.monitoredSubscriptionList[].tagRules.metricRules.filteringTags") + if filtering_tags is not None: + _UpdateHelper._build_schema_filtering_tag_update(filtering_tags.set_elements(AAZObjectType, ".")) + + 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""" + + @classmethod + def _build_schema_filtering_tag_update(cls, _builder): + if _builder is None: + return + _builder.set_prop("action", AAZStrType, ".action") + _builder.set_prop("name", AAZStrType, ".name") + _builder.set_prop("value", AAZStrType, ".value") + + _schema_filtering_tag_read = None + + @classmethod + def _build_schema_filtering_tag_read(cls, _schema): + if cls._schema_filtering_tag_read is not None: + _schema.action = cls._schema_filtering_tag_read.action + _schema.name = cls._schema_filtering_tag_read.name + _schema.value = cls._schema_filtering_tag_read.value + return + + cls._schema_filtering_tag_read = _schema_filtering_tag_read = AAZObjectType() + + filtering_tag_read = _schema_filtering_tag_read + filtering_tag_read.action = AAZStrType() + filtering_tag_read.name = AAZStrType() + filtering_tag_read.value = AAZStrType() + + _schema.action = cls._schema_filtering_tag_read.action + _schema.name = cls._schema_filtering_tag_read.name + _schema.value = cls._schema_filtering_tag_read.value + + _schema_monitored_subscription_properties_read = None + + @classmethod + def _build_schema_monitored_subscription_properties_read(cls, _schema): + if cls._schema_monitored_subscription_properties_read is not None: + _schema.id = cls._schema_monitored_subscription_properties_read.id + _schema.name = cls._schema_monitored_subscription_properties_read.name + _schema.properties = cls._schema_monitored_subscription_properties_read.properties + _schema.type = cls._schema_monitored_subscription_properties_read.type + return + + cls._schema_monitored_subscription_properties_read = _schema_monitored_subscription_properties_read = AAZObjectType() + + monitored_subscription_properties_read = _schema_monitored_subscription_properties_read + monitored_subscription_properties_read.id = AAZStrType( + flags={"read_only": True}, + ) + monitored_subscription_properties_read.name = AAZStrType( + flags={"read_only": True}, + ) + monitored_subscription_properties_read.properties = AAZObjectType() + monitored_subscription_properties_read.type = AAZStrType( + flags={"read_only": True}, + ) + + properties = _schema_monitored_subscription_properties_read.properties + properties.monitored_subscription_list = AAZListType( + serialized_name="monitoredSubscriptionList", + ) + + monitored_subscription_list = _schema_monitored_subscription_properties_read.properties.monitored_subscription_list + monitored_subscription_list.Element = AAZObjectType() + + _element = _schema_monitored_subscription_properties_read.properties.monitored_subscription_list.Element + _element.error = AAZStrType() + _element.status = AAZStrType() + _element.subscription_id = AAZStrType( + serialized_name="subscriptionId", + ) + _element.tag_rules = AAZObjectType( + serialized_name="tagRules", + ) + + tag_rules = _schema_monitored_subscription_properties_read.properties.monitored_subscription_list.Element.tag_rules + tag_rules.agent_rules = AAZObjectType( + serialized_name="agentRules", + ) + tag_rules.automuting = AAZBoolType() + tag_rules.custom_metrics = AAZBoolType( + serialized_name="customMetrics", + ) + tag_rules.log_rules = AAZObjectType( + serialized_name="logRules", + ) + tag_rules.metric_rules = AAZObjectType( + serialized_name="metricRules", + ) + tag_rules.provisioning_state = AAZStrType( + serialized_name="provisioningState", + flags={"read_only": True}, + ) + + agent_rules = _schema_monitored_subscription_properties_read.properties.monitored_subscription_list.Element.tag_rules.agent_rules + agent_rules.enable_agent_monitoring = AAZBoolType( + serialized_name="enableAgentMonitoring", + ) + agent_rules.filtering_tags = AAZListType( + serialized_name="filteringTags", + ) + + filtering_tags = _schema_monitored_subscription_properties_read.properties.monitored_subscription_list.Element.tag_rules.agent_rules.filtering_tags + filtering_tags.Element = AAZObjectType() + cls._build_schema_filtering_tag_read(filtering_tags.Element) + + log_rules = _schema_monitored_subscription_properties_read.properties.monitored_subscription_list.Element.tag_rules.log_rules + log_rules.filtering_tags = AAZListType( + serialized_name="filteringTags", + ) + log_rules.send_aad_logs = AAZBoolType( + serialized_name="sendAadLogs", + ) + log_rules.send_resource_logs = AAZBoolType( + serialized_name="sendResourceLogs", + ) + log_rules.send_subscription_logs = AAZBoolType( + serialized_name="sendSubscriptionLogs", + ) + + filtering_tags = _schema_monitored_subscription_properties_read.properties.monitored_subscription_list.Element.tag_rules.log_rules.filtering_tags + filtering_tags.Element = AAZObjectType() + cls._build_schema_filtering_tag_read(filtering_tags.Element) + + metric_rules = _schema_monitored_subscription_properties_read.properties.monitored_subscription_list.Element.tag_rules.metric_rules + metric_rules.filtering_tags = AAZListType( + serialized_name="filteringTags", + ) + + filtering_tags = _schema_monitored_subscription_properties_read.properties.monitored_subscription_list.Element.tag_rules.metric_rules.filtering_tags + filtering_tags.Element = AAZObjectType() + cls._build_schema_filtering_tag_read(filtering_tags.Element) + + _schema.id = cls._schema_monitored_subscription_properties_read.id + _schema.name = cls._schema_monitored_subscription_properties_read.name + _schema.properties = cls._schema_monitored_subscription_properties_read.properties + _schema.type = cls._schema_monitored_subscription_properties_read.type + + +__all__ = ["Update"] diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/sso_config/_create.py b/src/datadog/azext_datadog/aaz/latest/datadog/sso_config/_create.py index 0e9cf85a33b..0123a6151c5 100644 --- a/src/datadog/azext_datadog/aaz/latest/datadog/sso_config/_create.py +++ b/src/datadog/azext_datadog/aaz/latest/datadog/sso_config/_create.py @@ -22,9 +22,9 @@ class Create(AAZCommand): """ _aaz_info = { - "version": "2021-03-01", + "version": "2025-06-11", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/singlesignonconfigurations/{}", "2021-03-01"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/singlesignonconfigurations/{}", "2025-06-11"], ] } @@ -54,6 +54,11 @@ def _build_arguments_schema(cls, *args, **kwargs): options=["-n", "--name", "--monitor-name"], help="Monitor resource name", required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9_][a-zA-Z0-9_-]+$", + max_length=32, + min_length=2, + ), ) _args_schema.resource_group = AAZResourceGroupNameArg( required=True, @@ -160,7 +165,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2021-03-01", + "api-version", "2025-06-11", required=True, ), } diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/sso_config/_list.py b/src/datadog/azext_datadog/aaz/latest/datadog/sso_config/_list.py index 05765570ffc..822a93e3bb6 100644 --- a/src/datadog/azext_datadog/aaz/latest/datadog/sso_config/_list.py +++ b/src/datadog/azext_datadog/aaz/latest/datadog/sso_config/_list.py @@ -22,9 +22,9 @@ class List(AAZCommand): """ _aaz_info = { - "version": "2021-03-01", + "version": "2025-06-11", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/singlesignonconfigurations", "2021-03-01"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/singlesignonconfigurations", "2025-06-11"], ] } @@ -49,6 +49,11 @@ def _build_arguments_schema(cls, *args, **kwargs): options=["-n", "--name", "--monitor-name"], help="Monitor resource name", required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9_][a-zA-Z0-9_-]+$", + max_length=32, + min_length=2, + ), ) _args_schema.resource_group = AAZResourceGroupNameArg( required=True, @@ -121,7 +126,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2021-03-01", + "api-version", "2025-06-11", required=True, ), } diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/sso_config/_show.py b/src/datadog/azext_datadog/aaz/latest/datadog/sso_config/_show.py index f2b55764e60..f59189afbdb 100644 --- a/src/datadog/azext_datadog/aaz/latest/datadog/sso_config/_show.py +++ b/src/datadog/azext_datadog/aaz/latest/datadog/sso_config/_show.py @@ -22,9 +22,9 @@ class Show(AAZCommand): """ _aaz_info = { - "version": "2021-03-01", + "version": "2025-06-11", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/singlesignonconfigurations/{}", "2021-03-01"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/singlesignonconfigurations/{}", "2025-06-11"], ] } @@ -55,6 +55,11 @@ def _build_arguments_schema(cls, *args, **kwargs): help="Monitor resource name", required=True, id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9_][a-zA-Z0-9_-]+$", + max_length=32, + min_length=2, + ), ) _args_schema.resource_group = AAZResourceGroupNameArg( required=True, @@ -130,7 +135,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2021-03-01", + "api-version", "2025-06-11", required=True, ), } diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/sso_config/_update.py b/src/datadog/azext_datadog/aaz/latest/datadog/sso_config/_update.py index f96a1a744ac..16f767d6565 100644 --- a/src/datadog/azext_datadog/aaz/latest/datadog/sso_config/_update.py +++ b/src/datadog/azext_datadog/aaz/latest/datadog/sso_config/_update.py @@ -22,9 +22,9 @@ class Update(AAZCommand): """ _aaz_info = { - "version": "2021-03-01", + "version": "2025-06-11", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/singlesignonconfigurations/{}", "2021-03-01"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/singlesignonconfigurations/{}", "2025-06-11"], ] } @@ -58,6 +58,11 @@ def _build_arguments_schema(cls, *args, **kwargs): help="Monitor resource name", required=True, id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9_][a-zA-Z0-9_-]+$", + max_length=32, + min_length=2, + ), ) _args_schema.resource_group = AAZResourceGroupNameArg( required=True, @@ -163,7 +168,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2021-03-01", + "api-version", "2025-06-11", required=True, ), } @@ -266,7 +271,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2021-03-01", + "api-version", "2025-06-11", required=True, ), } diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/sso_config/_wait.py b/src/datadog/azext_datadog/aaz/latest/datadog/sso_config/_wait.py index 6d00d432379..76710d38047 100644 --- a/src/datadog/azext_datadog/aaz/latest/datadog/sso_config/_wait.py +++ b/src/datadog/azext_datadog/aaz/latest/datadog/sso_config/_wait.py @@ -20,7 +20,7 @@ class Wait(AAZWaitCommand): _aaz_info = { "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/singlesignonconfigurations/{}", "2021-03-01"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/singlesignonconfigurations/{}", "2025-06-11"], ] } @@ -51,6 +51,11 @@ def _build_arguments_schema(cls, *args, **kwargs): help="Monitor resource name", required=True, id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9_][a-zA-Z0-9_-]+$", + max_length=32, + min_length=2, + ), ) _args_schema.resource_group = AAZResourceGroupNameArg( required=True, @@ -126,7 +131,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2021-03-01", + "api-version", "2025-06-11", required=True, ), } diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/subscription_status/__cmd_group.py b/src/datadog/azext_datadog/aaz/latest/datadog/subscription_status/__cmd_group.py new file mode 100644 index 00000000000..85640567c77 --- /dev/null +++ b/src/datadog/azext_datadog/aaz/latest/datadog/subscription_status/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "datadog subscription-status", +) +class __CMDGroup(AAZCommandGroup): + """Manage Subscription Status + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/subscription_status/__init__.py b/src/datadog/azext_datadog/aaz/latest/datadog/subscription_status/__init__.py new file mode 100644 index 00000000000..d63ae5a6fc9 --- /dev/null +++ b/src/datadog/azext_datadog/aaz/latest/datadog/subscription_status/__init__.py @@ -0,0 +1,12 @@ +# -------------------------------------------------------------------------------------------- +# 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 ._list import * diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/subscription_status/_list.py b/src/datadog/azext_datadog/aaz/latest/datadog/subscription_status/_list.py new file mode 100644 index 00000000000..a9295e72487 --- /dev/null +++ b/src/datadog/azext_datadog/aaz/latest/datadog/subscription_status/_list.py @@ -0,0 +1,174 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "datadog subscription-status list", +) +class List(AAZCommand): + """List if the current subscription is being already monitored for selected Datadog organization. + """ + + _aaz_info = { + "version": "2025-06-11", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.datadog/subscriptionstatuses", "2025-06-11"], + ] + } + + 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.datadog_organization_id = AAZStrArg( + options=["--datadog-organization-id"], + help="Datadog Organization Id", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.CreationSupportedList(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 CreationSupportedList(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}/providers/Microsoft.Datadog/subscriptionStatuses", + **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( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "datadogOrganizationId", self.ctx.args.datadog_organization_id, + required=True, + ), + **self.serialize_query_param( + "api-version", "2025-06-11", + 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() + + value = cls._schema_on_200.value + value.Element = AAZObjectType() + + _element = cls._schema_on_200.value.Element + _element.properties = AAZObjectType() + + properties = cls._schema_on_200.value.Element.properties + properties.creation_supported = AAZBoolType( + serialized_name="creationSupported", + flags={"read_only": True}, + ) + properties.name = AAZStrType( + flags={"read_only": True}, + ) + + return cls._schema_on_200 + + +class _ListHelper: + """Helper class for List""" + + +__all__ = ["List"] diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/subscription_status/default/__cmd_group.py b/src/datadog/azext_datadog/aaz/latest/datadog/subscription_status/default/__cmd_group.py new file mode 100644 index 00000000000..f91341cf7ed --- /dev/null +++ b/src/datadog/azext_datadog/aaz/latest/datadog/subscription_status/default/__cmd_group.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "datadog subscription-status default", +) +class __CMDGroup(AAZCommandGroup): + """Manage Default + """ + pass + + +__all__ = ["__CMDGroup"] diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/subscription_status/default/__init__.py b/src/datadog/azext_datadog/aaz/latest/datadog/subscription_status/default/__init__.py new file mode 100644 index 00000000000..28d5f355813 --- /dev/null +++ b/src/datadog/azext_datadog/aaz/latest/datadog/subscription_status/default/__init__.py @@ -0,0 +1,12 @@ +# -------------------------------------------------------------------------------------------- +# 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 ._show import * diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/subscription_status/default/_show.py b/src/datadog/azext_datadog/aaz/latest/datadog/subscription_status/default/_show.py new file mode 100644 index 00000000000..44faf9ceff5 --- /dev/null +++ b/src/datadog/azext_datadog/aaz/latest/datadog/subscription_status/default/_show.py @@ -0,0 +1,163 @@ +# -------------------------------------------------------------------------------------------- +# 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( + "datadog subscription-status default show", +) +class Show(AAZCommand): + """Get if the current subscription is being already monitored for selected Datadog organization. + """ + + _aaz_info = { + "version": "2025-06-11", + "resources": [ + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.datadog/subscriptionstatuses/default", "2025-06-11"], + ] + } + + 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.datadog_organization_id = AAZStrArg( + options=["--datadog-organization-id"], + help="Datadog Organization Id", + required=True, + ) + return cls._args_schema + + def _execute_operations(self): + self.pre_operations() + self.CreationSupportedGet(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 CreationSupportedGet(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}/providers/Microsoft.Datadog/subscriptionStatuses/default", + **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( + "subscriptionId", self.ctx.subscription_id, + required=True, + ), + } + return parameters + + @property + def query_parameters(self): + parameters = { + **self.serialize_query_param( + "datadogOrganizationId", self.ctx.args.datadog_organization_id, + required=True, + ), + **self.serialize_query_param( + "api-version", "2025-06-11", + 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.properties = AAZObjectType() + + properties = cls._schema_on_200.properties + properties.creation_supported = AAZBoolType( + serialized_name="creationSupported", + flags={"read_only": True}, + ) + properties.name = AAZStrType( + flags={"read_only": True}, + ) + + return cls._schema_on_200 + + +class _ShowHelper: + """Helper class for Show""" + + +__all__ = ["Show"] diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/tag_rule/_create.py b/src/datadog/azext_datadog/aaz/latest/datadog/tag_rule/_create.py index a80829957cc..2828abee197 100644 --- a/src/datadog/azext_datadog/aaz/latest/datadog/tag_rule/_create.py +++ b/src/datadog/azext_datadog/aaz/latest/datadog/tag_rule/_create.py @@ -22,9 +22,9 @@ class Create(AAZCommand): """ _aaz_info = { - "version": "2021-03-01", + "version": "2025-06-11", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/tagrules/{}", "2021-03-01"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/tagrules/{}", "2025-06-11"], ] } @@ -48,6 +48,11 @@ def _build_arguments_schema(cls, *args, **kwargs): options=["-n", "--name", "--monitor-name"], help="Monitor resource name", required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9_][a-zA-Z0-9_-]+$", + max_length=32, + min_length=2, + ), ) _args_schema.resource_group = AAZResourceGroupNameArg( required=True, @@ -61,6 +66,21 @@ def _build_arguments_schema(cls, *args, **kwargs): # define Arg Group "Properties" _args_schema = cls._args_schema + _args_schema.agent_rules = AAZObjectArg( + options=["--agent-rules"], + arg_group="Properties", + help="Set of rules for managing agents for the Monitor resource.", + ) + _args_schema.automuting = AAZBoolArg( + options=["--automuting"], + arg_group="Properties", + help="Configuration to enable/disable auto-muting flag", + ) + _args_schema.custom_metrics = AAZBoolArg( + options=["--custom-metrics"], + arg_group="Properties", + help="Configuration to enable/disable custom metrics. If enabled, custom metrics from app insights will be sent.", + ) _args_schema.log_rules = AAZObjectArg( options=["--log-rules"], arg_group="Properties", @@ -72,6 +92,20 @@ def _build_arguments_schema(cls, *args, **kwargs): help="Set of rules for sending metrics for the Monitor resource.", ) + agent_rules = cls._args_schema.agent_rules + agent_rules.enable_agent_monitoring = AAZBoolArg( + options=["enable-agent-monitoring"], + help="Flag specifying if agent monitoring should be enabled for the Monitor resource.", + ) + agent_rules.filtering_tags = AAZListArg( + options=["filtering-tags"], + help="List of filtering tags to be used for capturing metrics. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags.", + ) + + filtering_tags = cls._args_schema.agent_rules.filtering_tags + filtering_tags.Element = AAZObjectArg() + cls._build_args_filtering_tag_create(filtering_tags.Element) + log_rules = cls._args_schema.log_rules log_rules.filtering_tags = AAZListArg( options=["filtering-tags"], @@ -205,7 +239,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2021-03-01", + "api-version", "2025-06-11", required=True, ), } @@ -234,9 +268,21 @@ def content(self): properties = _builder.get(".properties") if properties is not None: + properties.set_prop("agentRules", AAZObjectType, ".agent_rules") + properties.set_prop("automuting", AAZBoolType, ".automuting") + properties.set_prop("customMetrics", AAZBoolType, ".custom_metrics") properties.set_prop("logRules", AAZObjectType, ".log_rules") properties.set_prop("metricRules", AAZObjectType, ".metric_rules") + agent_rules = _builder.get(".properties.agentRules") + if agent_rules is not None: + agent_rules.set_prop("enableAgentMonitoring", AAZBoolType, ".enable_agent_monitoring") + agent_rules.set_prop("filteringTags", AAZListType, ".filtering_tags") + + filtering_tags = _builder.get(".properties.agentRules.filteringTags") + if filtering_tags is not None: + _CreateHelper._build_schema_filtering_tag_create(filtering_tags.set_elements(AAZObjectType, ".")) + log_rules = _builder.get(".properties.logRules") if log_rules is not None: log_rules.set_prop("filteringTags", AAZListType, ".filtering_tags") @@ -292,6 +338,13 @@ def _build_schema_on_200(cls): ) properties = cls._schema_on_200.properties + properties.agent_rules = AAZObjectType( + serialized_name="agentRules", + ) + properties.automuting = AAZBoolType() + properties.custom_metrics = AAZBoolType( + serialized_name="customMetrics", + ) properties.log_rules = AAZObjectType( serialized_name="logRules", ) @@ -303,6 +356,18 @@ def _build_schema_on_200(cls): flags={"read_only": True}, ) + agent_rules = cls._schema_on_200.properties.agent_rules + agent_rules.enable_agent_monitoring = AAZBoolType( + serialized_name="enableAgentMonitoring", + ) + agent_rules.filtering_tags = AAZListType( + serialized_name="filteringTags", + ) + + filtering_tags = cls._schema_on_200.properties.agent_rules.filtering_tags + filtering_tags.Element = AAZObjectType() + _CreateHelper._build_schema_filtering_tag_read(filtering_tags.Element) + log_rules = cls._schema_on_200.properties.log_rules log_rules.filtering_tags = AAZListType( serialized_name="filteringTags", diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/tag_rule/_list.py b/src/datadog/azext_datadog/aaz/latest/datadog/tag_rule/_list.py index 2f2f6d709df..ccdf41c8344 100644 --- a/src/datadog/azext_datadog/aaz/latest/datadog/tag_rule/_list.py +++ b/src/datadog/azext_datadog/aaz/latest/datadog/tag_rule/_list.py @@ -22,9 +22,9 @@ class List(AAZCommand): """ _aaz_info = { - "version": "2021-03-01", + "version": "2025-06-11", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/tagrules", "2021-03-01"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/tagrules", "2025-06-11"], ] } @@ -49,6 +49,11 @@ def _build_arguments_schema(cls, *args, **kwargs): options=["-n", "--name", "--monitor-name"], help="Monitor resource name", required=True, + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9_][a-zA-Z0-9_-]+$", + max_length=32, + min_length=2, + ), ) _args_schema.resource_group = AAZResourceGroupNameArg( required=True, @@ -121,7 +126,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2021-03-01", + "api-version", "2025-06-11", required=True, ), } @@ -179,6 +184,13 @@ def _build_schema_on_200(cls): ) properties = cls._schema_on_200.value.Element.properties + properties.agent_rules = AAZObjectType( + serialized_name="agentRules", + ) + properties.automuting = AAZBoolType() + properties.custom_metrics = AAZBoolType( + serialized_name="customMetrics", + ) properties.log_rules = AAZObjectType( serialized_name="logRules", ) @@ -190,6 +202,18 @@ def _build_schema_on_200(cls): flags={"read_only": True}, ) + agent_rules = cls._schema_on_200.value.Element.properties.agent_rules + agent_rules.enable_agent_monitoring = AAZBoolType( + serialized_name="enableAgentMonitoring", + ) + agent_rules.filtering_tags = AAZListType( + serialized_name="filteringTags", + ) + + filtering_tags = cls._schema_on_200.value.Element.properties.agent_rules.filtering_tags + filtering_tags.Element = AAZObjectType() + _ListHelper._build_schema_filtering_tag_read(filtering_tags.Element) + log_rules = cls._schema_on_200.value.Element.properties.log_rules log_rules.filtering_tags = AAZListType( serialized_name="filteringTags", diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/tag_rule/_show.py b/src/datadog/azext_datadog/aaz/latest/datadog/tag_rule/_show.py index ce8c281d531..3aa9e05a02c 100644 --- a/src/datadog/azext_datadog/aaz/latest/datadog/tag_rule/_show.py +++ b/src/datadog/azext_datadog/aaz/latest/datadog/tag_rule/_show.py @@ -22,9 +22,9 @@ class Show(AAZCommand): """ _aaz_info = { - "version": "2021-03-01", + "version": "2025-06-11", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/tagrules/{}", "2021-03-01"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/tagrules/{}", "2025-06-11"], ] } @@ -49,6 +49,11 @@ def _build_arguments_schema(cls, *args, **kwargs): help="Monitor resource name", required=True, id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9_][a-zA-Z0-9_-]+$", + max_length=32, + min_length=2, + ), ) _args_schema.resource_group = AAZResourceGroupNameArg( required=True, @@ -130,7 +135,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2021-03-01", + "api-version", "2025-06-11", required=True, ), } @@ -179,6 +184,13 @@ def _build_schema_on_200(cls): ) properties = cls._schema_on_200.properties + properties.agent_rules = AAZObjectType( + serialized_name="agentRules", + ) + properties.automuting = AAZBoolType() + properties.custom_metrics = AAZBoolType( + serialized_name="customMetrics", + ) properties.log_rules = AAZObjectType( serialized_name="logRules", ) @@ -190,6 +202,18 @@ def _build_schema_on_200(cls): flags={"read_only": True}, ) + agent_rules = cls._schema_on_200.properties.agent_rules + agent_rules.enable_agent_monitoring = AAZBoolType( + serialized_name="enableAgentMonitoring", + ) + agent_rules.filtering_tags = AAZListType( + serialized_name="filteringTags", + ) + + filtering_tags = cls._schema_on_200.properties.agent_rules.filtering_tags + filtering_tags.Element = AAZObjectType() + _ShowHelper._build_schema_filtering_tag_read(filtering_tags.Element) + log_rules = cls._schema_on_200.properties.log_rules log_rules.filtering_tags = AAZListType( serialized_name="filteringTags", diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/tag_rule/_update.py b/src/datadog/azext_datadog/aaz/latest/datadog/tag_rule/_update.py index 625c91c81ff..86db7dbd3b3 100644 --- a/src/datadog/azext_datadog/aaz/latest/datadog/tag_rule/_update.py +++ b/src/datadog/azext_datadog/aaz/latest/datadog/tag_rule/_update.py @@ -22,9 +22,9 @@ class Update(AAZCommand): """ _aaz_info = { - "version": "2021-03-01", + "version": "2025-06-11", "resources": [ - ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/tagrules/{}", "2021-03-01"], + ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}/tagrules/{}", "2025-06-11"], ] } @@ -51,6 +51,11 @@ def _build_arguments_schema(cls, *args, **kwargs): help="Monitor resource name", required=True, id_part="name", + fmt=AAZStrArgFormat( + pattern="^[a-zA-Z0-9_][a-zA-Z0-9_-]+$", + max_length=32, + min_length=2, + ), ) _args_schema.resource_group = AAZResourceGroupNameArg( required=True, @@ -65,6 +70,24 @@ def _build_arguments_schema(cls, *args, **kwargs): # define Arg Group "Properties" _args_schema = cls._args_schema + _args_schema.agent_rules = AAZObjectArg( + options=["--agent-rules"], + arg_group="Properties", + help="Set of rules for managing agents for the Monitor resource.", + nullable=True, + ) + _args_schema.automuting = AAZBoolArg( + options=["--automuting"], + arg_group="Properties", + help="Configuration to enable/disable auto-muting flag", + nullable=True, + ) + _args_schema.custom_metrics = AAZBoolArg( + options=["--custom-metrics"], + arg_group="Properties", + help="Configuration to enable/disable custom metrics. If enabled, custom metrics from app insights will be sent.", + nullable=True, + ) _args_schema.log_rules = AAZObjectArg( options=["--log-rules"], arg_group="Properties", @@ -78,6 +101,24 @@ def _build_arguments_schema(cls, *args, **kwargs): nullable=True, ) + agent_rules = cls._args_schema.agent_rules + agent_rules.enable_agent_monitoring = AAZBoolArg( + options=["enable-agent-monitoring"], + help="Flag specifying if agent monitoring should be enabled for the Monitor resource.", + nullable=True, + ) + agent_rules.filtering_tags = AAZListArg( + options=["filtering-tags"], + help="List of filtering tags to be used for capturing metrics. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags.", + nullable=True, + ) + + filtering_tags = cls._args_schema.agent_rules.filtering_tags + filtering_tags.Element = AAZObjectArg( + nullable=True, + ) + cls._build_args_filtering_tag_update(filtering_tags.Element) + log_rules = cls._args_schema.log_rules log_rules.filtering_tags = AAZListArg( options=["filtering-tags"], @@ -238,7 +279,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2021-03-01", + "api-version", "2025-06-11", required=True, ), } @@ -325,7 +366,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2021-03-01", + "api-version", "2025-06-11", required=True, ), } @@ -387,9 +428,21 @@ def _update_instance(self, instance): properties = _builder.get(".properties") if properties is not None: + properties.set_prop("agentRules", AAZObjectType, ".agent_rules") + properties.set_prop("automuting", AAZBoolType, ".automuting") + properties.set_prop("customMetrics", AAZBoolType, ".custom_metrics") properties.set_prop("logRules", AAZObjectType, ".log_rules") properties.set_prop("metricRules", AAZObjectType, ".metric_rules") + agent_rules = _builder.get(".properties.agentRules") + if agent_rules is not None: + agent_rules.set_prop("enableAgentMonitoring", AAZBoolType, ".enable_agent_monitoring") + agent_rules.set_prop("filteringTags", AAZListType, ".filtering_tags") + + filtering_tags = _builder.get(".properties.agentRules.filteringTags") + if filtering_tags is not None: + _UpdateHelper._build_schema_filtering_tag_update(filtering_tags.set_elements(AAZObjectType, ".")) + log_rules = _builder.get(".properties.logRules") if log_rules is not None: log_rules.set_prop("filteringTags", AAZListType, ".filtering_tags") @@ -483,6 +536,13 @@ def _build_schema_monitoring_tag_rules_read(cls, _schema): ) properties = _schema_monitoring_tag_rules_read.properties + properties.agent_rules = AAZObjectType( + serialized_name="agentRules", + ) + properties.automuting = AAZBoolType() + properties.custom_metrics = AAZBoolType( + serialized_name="customMetrics", + ) properties.log_rules = AAZObjectType( serialized_name="logRules", ) @@ -494,6 +554,18 @@ def _build_schema_monitoring_tag_rules_read(cls, _schema): flags={"read_only": True}, ) + agent_rules = _schema_monitoring_tag_rules_read.properties.agent_rules + agent_rules.enable_agent_monitoring = AAZBoolType( + serialized_name="enableAgentMonitoring", + ) + agent_rules.filtering_tags = AAZListType( + serialized_name="filteringTags", + ) + + filtering_tags = _schema_monitoring_tag_rules_read.properties.agent_rules.filtering_tags + filtering_tags.Element = AAZObjectType() + cls._build_schema_filtering_tag_read(filtering_tags.Element) + log_rules = _schema_monitoring_tag_rules_read.properties.log_rules log_rules.filtering_tags = AAZListType( serialized_name="filteringTags", diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/terms/_create.py b/src/datadog/azext_datadog/aaz/latest/datadog/terms/_create.py index ad9cc8fbff0..13499f1a06d 100644 --- a/src/datadog/azext_datadog/aaz/latest/datadog/terms/_create.py +++ b/src/datadog/azext_datadog/aaz/latest/datadog/terms/_create.py @@ -23,9 +23,9 @@ class Create(AAZCommand): """ _aaz_info = { - "version": "2021-03-01", + "version": "2025-06-11", "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.datadog/agreements/default", "2021-03-01"], + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.datadog/agreements/default", "2025-06-11"], ] } @@ -81,6 +81,9 @@ def _build_arguments_schema(cls, *args, **kwargs): options=["--retrieve-datetime"], arg_group="Properties", help="Date and time in UTC of when the terms were accepted. This is empty if Accepted is false.", + fmt=AAZDateTimeFormat( + protocol="iso", + ), ) _args_schema.signature = AAZStrArg( options=["--signature"], @@ -146,7 +149,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2021-03-01", + "api-version", "2025-06-11", required=True, ), } diff --git a/src/datadog/azext_datadog/aaz/latest/datadog/terms/_list.py b/src/datadog/azext_datadog/aaz/latest/datadog/terms/_list.py index c920c64412e..dc2c2b56164 100644 --- a/src/datadog/azext_datadog/aaz/latest/datadog/terms/_list.py +++ b/src/datadog/azext_datadog/aaz/latest/datadog/terms/_list.py @@ -23,9 +23,9 @@ class List(AAZCommand): """ _aaz_info = { - "version": "2021-03-01", + "version": "2025-06-11", "resources": [ - ["mgmt-plane", "/subscriptions/{}/providers/microsoft.datadog/agreements", "2021-03-01"], + ["mgmt-plane", "/subscriptions/{}/providers/microsoft.datadog/agreements", "2025-06-11"], ] } @@ -104,7 +104,7 @@ def url_parameters(self): def query_parameters(self): parameters = { **self.serialize_query_param( - "api-version", "2021-03-01", + "api-version", "2025-06-11", required=True, ), } diff --git a/src/datadog/setup.py b/src/datadog/setup.py index f234f4397a9..f80cd28a88f 100644 --- a/src/datadog/setup.py +++ b/src/datadog/setup.py @@ -10,7 +10,7 @@ # HISTORY.rst entry. -VERSION = '2.0.0' +VERSION = '2.0.1' # The full list of classifiers is available at # https://pypi.python.org/pypi?%3Aaction=list_classifiers