Skip to content
Closed
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
2 changes: 2 additions & 0 deletions src/datadog_api_client/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ def __init__(self, configuration: Configuration):
self.default_headers = {}
if self.configuration.compress:
self.default_headers["Accept-Encoding"] = "gzip"
if self.configuration.is_iac:
self.default_headers["X-Datadog-Managed-By"] = "iac"
# Set default User-Agent.
self.user_agent = user_agent()

Expand Down
9 changes: 9 additions & 0 deletions src/datadog_api_client/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ class Configuration:
:type delegated_auth_provider: str
:param delegated_auth_org_uuid: The organization UUID for delegated authentication.
:type delegated_auth_org_uuid: str
:param is_iac: Set to True to indicate that requests made through this client originate from
infrastructure-as-code or other automation tooling. When set, the client sends the
``X-Datadog-Managed-By: iac`` header on every request.
:type is_iac: bool
"""

def __init__(
Expand Down Expand Up @@ -180,6 +184,7 @@ def __init__(
retry_policy=None,
delegated_auth_provider=None,
delegated_auth_org_uuid=None,
is_iac=False,
):
"""Constructor."""
self._base_path = "https://api.datadoghq.com" if host is None else host
Expand Down Expand Up @@ -231,6 +236,10 @@ def __init__(
# Will translate to a Accept-Encoding header
self.compress = compress

# Set to True to indicate that requests are made from infrastructure-as-code tooling.
# Will translate to a X-Datadog-Managed-By header.
self.is_iac = is_iac

self.return_http_data_only = return_http_data_only
self.preload_content = preload_content
self.request_timeout = request_timeout
Expand Down
Loading