Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/datadog/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

Release History
===============
2.0.0
++++++
* Fix resource creation issue

1.0.0
++++++
Expand Down
54 changes: 33 additions & 21 deletions src/datadog/azext_datadog/aaz/latest/datadog/monitor/_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ class Create(AAZCommand):
"""Creates a new Datadog monitor resource in your Azure subscription. This sets up the integration between Azure and your Datadog account, enabling observability and monitoring of your Azure resources through Datadog.

:example: Monitors_Create
az datadog monitor create --name "myMonitor" --resource-group "myResourceGroup" --location "West US 2" --tags Environment="Dev" --user-info name="Alice" email-address="[email protected]" phone-number="123-456-7890" --type "SystemAssigned" --sku-name "payg_v2_Monthly"
az datadog monitor create --name "myMonitor" --resource-group "myResourceGroup" --location "West US 2" --org-properties name="myResourceGroup" --tags Environment="Dev" --user-info name="Alice" email-address="[email protected]" phone-number="123-456-7890" --sku name="payg_v3_Monthly" --identity type="SystemAssigned" --monitoring-status "Enabled"
Copy link

Copilot AI Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The example uses --org-properties name=\"myResourceGroup\" which sets the Datadog organization name to the same value as the resource group name. This may be confusing as it suggests the organization name should match the resource group, which is typically not the case. Consider using a more descriptive example like name=\"MyDatadogOrg\".

Copilot uses AI. Check for mistakes.

:example: Monitors creation with linking to Datadog organization.
az datadog monitor create --name "myMonitor" --resource-group "myResourceGroup" --location "West US 2" --datadog-organization-properties api-key=XX application-key=XX --tags Environment="Dev" --user-info name="Alice" email-address="[email protected]" phone-number="123-456-7890" --type "SystemAssigned" --sku-name "Linked"
az datadog monitor create --name "myMonitor-link" --resource-group "myResourceGroup" --location "West US 2" --org-properties api-key=XX application-key=XX --tags Environment="Dev" --user-info name="Alice" email-address="[email protected]" phone-number="123-456-7890" --identity type="SystemAssigned" --sku name="Linked"
"""

_aaz_info = {
"version": "2021-03-01",
"version": "2023-10-20",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}", "2021-03-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}", "2023-10-20"],
]
}

Expand Down Expand Up @@ -99,8 +99,8 @@ def _build_arguments_schema(cls, *args, **kwargs):
# define Arg Group "Properties"

_args_schema = cls._args_schema
_args_schema.datadog_organization_properties = AAZObjectArg(
options=["--datadog-organization-properties"],
_args_schema.org_properties = AAZObjectArg(
options=["--org-properties"],
arg_group="Properties",
help="Datadog organization properties",
)
Expand All @@ -117,28 +117,40 @@ def _build_arguments_schema(cls, *args, **kwargs):
help="User info",
)

datadog_organization_properties = cls._args_schema.datadog_organization_properties
datadog_organization_properties.api_key = AAZStrArg(
org_properties = cls._args_schema.org_properties
org_properties.api_key = AAZStrArg(
options=["api-key"],
help="Api key associated to the Datadog organization.",
)
datadog_organization_properties.application_key = AAZStrArg(
org_properties.application_key = AAZStrArg(
options=["application-key"],
help="Application key associated to the Datadog organization.",
)
datadog_organization_properties.enterprise_app_id = AAZStrArg(
org_properties.cspm = AAZBoolArg(
options=["cspm"],
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.",
)
org_properties.enterprise_app_id = AAZStrArg(
options=["enterprise-app-id"],
help="The Id of the Enterprise App used for Single sign on.",
)
datadog_organization_properties.linking_auth_code = AAZStrArg(
org_properties.id = AAZStrArg(
options=["id"],
help="Id of the Datadog organization.",
)
org_properties.linking_auth_code = AAZStrArg(
options=["linking-auth-code"],
help="The auth code used to linking to an existing datadog organization.",
)
datadog_organization_properties.linking_client_id = AAZStrArg(
org_properties.linking_client_id = AAZStrArg(
options=["linking-client-id"],
help="The client_id from an existing in exchange for an auth token to link organization.",
)
datadog_organization_properties.redirect_uri = AAZStrArg(
org_properties.name = AAZStrArg(
options=["name"],
help="Name of the Datadog organization.",
)
org_properties.redirect_uri = AAZStrArg(
options=["redirect-uri"],
help="The redirect uri for linking.",
)
Expand Down Expand Up @@ -248,7 +260,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2021-03-01",
"api-version", "2023-10-20",
required=True,
),
}
Expand Down Expand Up @@ -285,17 +297,20 @@ def content(self):

properties = _builder.get(".properties")
if properties is not None:
properties.set_prop("datadogOrganizationProperties", AAZObjectType, ".datadog_organization_properties")
properties.set_prop("datadogOrganizationProperties", AAZObjectType, ".org_properties")
properties.set_prop("monitoringStatus", AAZStrType, ".monitoring_status")
properties.set_prop("userInfo", AAZObjectType, ".user_info", typ_kwargs={"flags": {"secret": True}})

datadog_organization_properties = _builder.get(".properties.datadogOrganizationProperties")
if datadog_organization_properties is not None:
datadog_organization_properties.set_prop("apiKey", AAZStrType, ".api_key", typ_kwargs={"flags": {"secret": True}})
datadog_organization_properties.set_prop("applicationKey", AAZStrType, ".application_key", typ_kwargs={"flags": {"secret": True}})
datadog_organization_properties.set_prop("cspm", AAZBoolType, ".cspm")
datadog_organization_properties.set_prop("enterpriseAppId", AAZStrType, ".enterprise_app_id")
datadog_organization_properties.set_prop("id", AAZStrType, ".id")
datadog_organization_properties.set_prop("linkingAuthCode", AAZStrType, ".linking_auth_code", typ_kwargs={"flags": {"secret": True}})
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")

user_info = _builder.get(".properties.userInfo")
Expand Down Expand Up @@ -393,12 +408,9 @@ def _build_schema_on_200_201(cls):
)

datadog_organization_properties = cls._schema_on_200_201.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()

user_info = cls._schema_on_200_201.properties.user_info
user_info.email_address = AAZStrType(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class Delete(AAZCommand):
"""

_aaz_info = {
"version": "2021-03-01",
"version": "2023-10-20",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}", "2021-03-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}", "2023-10-20"],
]
}

Expand Down Expand Up @@ -143,7 +143,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2021-03-01",
"api-version", "2023-10-20",
required=True,
),
}
Expand Down
15 changes: 6 additions & 9 deletions src/datadog/azext_datadog/aaz/latest/datadog/monitor/_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class Show(AAZCommand):
"""

_aaz_info = {
"version": "2021-03-01",
"version": "2023-10-20",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}", "2021-03-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}", "2023-10-20"],
]
}

Expand Down Expand Up @@ -120,7 +120,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2021-03-01",
"api-version", "2023-10-20",
required=True,
),
}
Expand Down Expand Up @@ -214,12 +214,9 @@ def _build_schema_on_200(cls):
)

datadog_organization_properties = cls._schema_on_200.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()

user_info = cls._schema_on_200.properties.user_info
user_info.email_address = AAZStrType(
Expand Down
35 changes: 25 additions & 10 deletions src/datadog/azext_datadog/aaz/latest/datadog/monitor/_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ class Update(AAZCommand):
"""

_aaz_info = {
"version": "2021-03-01",
"version": "2023-10-20",
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}", "2021-03-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}", "2023-10-20"],
]
}

Expand Down Expand Up @@ -104,6 +104,12 @@ def _build_arguments_schema(cls, *args, **kwargs):
# define Arg Group "Properties"

_args_schema = cls._args_schema
_args_schema.org_properties = AAZObjectArg(
options=["--org-properties"],
arg_group="Properties",
help="Specify the Datadog organization name. In the case of linking to existing organizations, Id, ApiKey, and Applicationkey is required as well.",
nullable=True,
)
_args_schema.monitoring_status = AAZStrArg(
options=["--monitoring-status"],
arg_group="Properties",
Expand All @@ -118,6 +124,13 @@ def _build_arguments_schema(cls, *args, **kwargs):
nullable=True,
)

org_properties = cls._args_schema.org_properties
org_properties.cspm = AAZBoolArg(
options=["cspm"],
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,
)

user_info = cls._args_schema.user_info
user_info.email_address = AAZStrArg(
options=["email-address"],
Expand Down Expand Up @@ -223,7 +236,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2021-03-01",
"api-version", "2023-10-20",
required=True,
),
}
Expand Down Expand Up @@ -322,7 +335,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2021-03-01",
"api-version", "2023-10-20",
required=True,
),
}
Expand Down Expand Up @@ -392,9 +405,14 @@ def _update_instance(self, instance):

properties = _builder.get(".properties")
if properties is not None:
properties.set_prop("datadogOrganizationProperties", AAZObjectType, ".org_properties")
properties.set_prop("monitoringStatus", AAZStrType, ".monitoring_status")
properties.set_prop("userInfo", AAZObjectType, ".user_info", typ_kwargs={"flags": {"secret": True}})

datadog_organization_properties = _builder.get(".properties.datadogOrganizationProperties")
if datadog_organization_properties is not None:
datadog_organization_properties.set_prop("cspm", AAZBoolType, ".cspm")

user_info = _builder.get(".properties.userInfo")
if user_info is not None:
user_info.set_prop("emailAddress", AAZStrType, ".email_address")
Expand Down Expand Up @@ -503,12 +521,9 @@ def _build_schema_datadog_monitor_resource_read(cls, _schema):
)

datadog_organization_properties = _schema_datadog_monitor_resource_read.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()

user_info = _schema_datadog_monitor_resource_read.properties.user_info
user_info.email_address = AAZStrType(
Expand Down
13 changes: 5 additions & 8 deletions src/datadog/azext_datadog/aaz/latest/datadog/monitor/_wait.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Wait(AAZWaitCommand):

_aaz_info = {
"resources": [
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}", "2021-03-01"],
["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.datadog/monitors/{}", "2023-10-20"],
]
}

Expand Down Expand Up @@ -116,7 +116,7 @@ def url_parameters(self):
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2021-03-01",
"api-version", "2023-10-20",
required=True,
),
}
Expand Down Expand Up @@ -210,12 +210,9 @@ def _build_schema_on_200(cls):
)

datadog_organization_properties = cls._schema_on_200.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()

user_info = cls._schema_on_200.properties.user_info
user_info.email_address = AAZStrType(
Expand Down
2 changes: 1 addition & 1 deletion src/datadog/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


# HISTORY.rst entry.
VERSION = '1.0.0'
VERSION = '2.0.0'

# The full list of classifiers is available at
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
Expand Down
Loading