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
9 changes: 9 additions & 0 deletions src/datadog/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

Release History
===============
3.1.0b1
+++++++
* Updated to API version 2025-12-26-preview
* Added command: az datadog activate-saas
* Added command: az datadog monitor link-saas
* Added command: az datadog monitor latest-linked-saas
* Added command: az datadog monitor get-default-application-key
* Added command: az datadog monitor manage-sre-agent-connector

3.0.0
++++++
* Added multi subscription support
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

@register_command_group(
"datadog",
is_preview=True,
)
class __CMDGroup(AAZCommandGroup):
"""Manage Datadog
Expand Down
1 change: 1 addition & 0 deletions src/datadog/azext_datadog/aaz/latest/datadog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
# flake8: noqa

from .__cmd_group import *
from ._activate_saas import *
314 changes: 314 additions & 0 deletions src/datadog/azext_datadog/aaz/latest/datadog/_activate_saas.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,314 @@
# --------------------------------------------------------------------------------------------
# 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 activate-saas",
is_preview=True,
)
class ActivateSaas(AAZCommand):
"""Resolve the token to get the SaaS resource ID and activate the SaaS resource

:example: SaaS_ActivateResource
az datadog activate-saas --saas-resource-id "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.SaaS/resources/mySaaSResource" --user-info name="Alice" email-address="alice@microsoft.com" phone-number="123-456-7890"
"""

_aaz_info = {
"version": "2025-12-26-preview",
"resources": [
["mgmt-plane", "/subscriptions/{}/providers/microsoft.datadog/activatesaas", "2025-12-26-preview"],
]
}

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 ""

# define Arg Group "Body"

_args_schema = cls._args_schema
_args_schema.datadog_organization_properties = AAZObjectArg(
options=["--datadog-organization-properties"],
arg_group="Body",
help="Datadog organization properties to link the Saas resource to.",
)
_args_schema.saas_resource_id = AAZStrArg(
options=["--saas-resource-id"],
arg_group="Body",
help="SaaS resource id of marketplace saas subscription to be activated.",
required=True,
)
_args_schema.user_info = AAZObjectArg(
options=["--user-info"],
arg_group="Body",
help="User information of the person activating the SaaS resource.",
)

datadog_organization_properties = cls._args_schema.datadog_organization_properties
datadog_organization_properties.api_key = AAZPasswordArg(
options=["api-key"],
help="Api key associated to the Datadog organization.",
blank=AAZPromptPasswordInput(
msg="Password:",
),
)
datadog_organization_properties.application_key = AAZPasswordArg(
options=["application-key"],
help="Application key associated to the Datadog organization.",
blank=AAZPromptPasswordInput(
msg="Password:",
),
)
datadog_organization_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.",
)
datadog_organization_properties.enterprise_app_id = AAZStrArg(
options=["enterprise-app-id"],
help="The Id of the Enterprise App used for Single sign on.",
)
datadog_organization_properties.id = AAZStrArg(
options=["id"],
help="Id of the Datadog organization.",
)
datadog_organization_properties.linking_auth_code = AAZPasswordArg(
options=["linking-auth-code"],
help="The auth code used to linking to an existing Datadog organization.",
blank=AAZPromptPasswordInput(
msg="Password:",
),
)
datadog_organization_properties.linking_client_id = AAZPasswordArg(
options=["linking-client-id"],
help="The client_id from an existing in exchange for an auth token to link organization.",
blank=AAZPromptPasswordInput(
msg="Password:",
),
)
datadog_organization_properties.name = AAZStrArg(
options=["name"],
help="Name of the Datadog organization.",
)
datadog_organization_properties.redirect_uri = AAZStrArg(
options=["redirect-uri"],
help="The redirect URI for linking.",
)
datadog_organization_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(
options=["email-address"],
help="Email of the user used by Datadog for contacting them if needed",
fmt=AAZStrArgFormat(
pattern="^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\\.)+[A-Za-z]{2,}$",
),
)
user_info.name = AAZStrArg(
options=["name"],
help="Name of the user",
fmt=AAZStrArgFormat(
max_length=50,
),
)
user_info.phone_number = AAZStrArg(
options=["phone-number"],
help="Phone number of the user used by Datadog for contacting them if needed",
fmt=AAZStrArgFormat(
max_length=40,
),
)
return cls._args_schema

def _execute_operations(self):
self.pre_operations()
self.SaaSOperationGroupActivateResource(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 SaaSOperationGroupActivateResource(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/activateSaaS",
**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(
"subscriptionId", self.ctx.subscription_id,
required=True,
),
}
return parameters

@property
def query_parameters(self):
parameters = {
**self.serialize_query_param(
"api-version", "2025-12-26-preview",
required=True,
),
}
return parameters

@property
def header_parameters(self):
parameters = {
**self.serialize_header_param(
"Content-Type", "application/json",
),
**self.serialize_header_param(
"Accept", "application/json",
),
}
return parameters

@property
def content(self):
_content_value, _builder = self.new_content_builder(
self.ctx.args,
typ=AAZObjectType,
typ_kwargs={"flags": {"required": True, "client_flatten": True}}
)
_builder.set_prop("datadogOrganizationProperties", AAZObjectType, ".datadog_organization_properties")
_builder.set_prop("saaSResourceId", AAZStrType, ".saas_resource_id", typ_kwargs={"flags": {"required": True}})
_builder.set_prop("userInfo", AAZObjectType, ".user_info")

datadog_organization_properties = _builder.get(".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")
datadog_organization_properties.set_prop("resourceCollection", AAZBoolType, ".resource_collection")

user_info = _builder.get(".userInfo")
if user_info is not None:
user_info.set_prop("emailAddress", AAZStrType, ".email_address")
user_info.set_prop("name", AAZStrType, ".name")
user_info.set_prop("phoneNumber", AAZStrType, ".phone_number")

return self.serialize_content(_content_value)

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.saa_s_id = AAZStrType(
serialized_name="saaSId",
)
_schema_on_200.system_data = AAZObjectType(
serialized_name="systemData",
flags={"read_only": True},
)
_schema_on_200.type = AAZStrType(
flags={"read_only": True},
)

system_data = cls._schema_on_200.system_data
system_data.created_at = AAZStrType(
serialized_name="createdAt",
)
system_data.created_by = AAZStrType(
serialized_name="createdBy",
)
system_data.created_by_type = AAZStrType(
serialized_name="createdByType",
)
system_data.last_modified_at = AAZStrType(
serialized_name="lastModifiedAt",
)
system_data.last_modified_by = AAZStrType(
serialized_name="lastModifiedBy",
)
system_data.last_modified_by_type = AAZStrType(
serialized_name="lastModifiedByType",
)

return cls._schema_on_200


class _ActivateSaasHelper:
"""Helper class for ActivateSaas"""


__all__ = ["ActivateSaas"]
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

@register_command_group(
"datadog monitor",
is_preview=True,
)
class __CMDGroup(AAZCommandGroup):
"""Provides a set of commands to manage Datadog monitor resources in your Azure subscription, enabling integration and observability of your Azure resources through Datadog.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@
from ._create import *
from ._delete import *
from ._get_billing_info import *
from ._get_default_application_key import *
from ._get_default_key import *
from ._latest_linked_saas import *
from ._link_saas import *
from ._list import *
from ._list_api_key import *
from ._list_host import *
from ._list_linked_resource import *
from ._list_monitored_resource import *
from ._manage_sre_agent_connector import *
from ._refresh_set_password_link import *
from ._set_default_key import *
from ._show import *
Expand Down
Loading
Loading