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
28 changes: 28 additions & 0 deletions src/main/java/com/datadog/api/client/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public class ApiClient {
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
protected String basePath = "https://api.datadoghq.com";
protected String userAgent;
private boolean isIaC = false;
private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;

protected List<ServerConfiguration> servers =
Expand Down Expand Up @@ -1937,6 +1938,33 @@ public ApiClient addDefaultHeader(String key, String value) {
return this;
}

/**
* Set whether this API client is managed by Infrastructure as Code (IaC) tooling. When enabled,
* the {@code X-Datadog-Managed-By: iac} header is sent on every request made through this client
* (by adding to the default header map).
*
* @param isIaC Whether calls made with this client originate from IaC tooling
* @return API client
*/
public ApiClient setIsIaC(boolean isIaC) {
this.isIaC = isIaC;
if (isIaC) {
addDefaultHeader("X-Datadog-Managed-By", "iac");
} else {
defaultHeaderMap.remove("X-Datadog-Managed-By");
}
return this;
}

/**
* Get whether this API client is managed by Infrastructure as Code (IaC) tooling.
*
* @return Whether this client is managed by IaC tooling
*/
public boolean getIsIaC() {
return isIaC;
}

/**
* Add a default cookie.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ Feature: Usage Metering
When the request is sent
Then the response status is 404 Not Found

@replay-only @team:DataDog/billing-hub
@replay-only @skip @team:DataDog/billing-hub
Scenario: Get specified daily custom reports returns "OK" response
Given new "GetSpecifiedDailyCustomReports" request
And request contains "report_id" parameter with value "2022-03-20"
Expand All @@ -666,7 +666,7 @@ Feature: Usage Metering
When the request is sent
Then the response status is 404 Not Found

@replay-only @team:DataDog/billing-hub
@replay-only @skip @team:DataDog/billing-hub
Scenario: Get specified monthly custom reports returns "OK" response
Given new "GetSpecifiedMonthlyCustomReports" request
And request contains "report_id" parameter with value "2021-05-01"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Feature: Usage Metering
When the request is sent
Then the response status is 400 Bad Request

@replay-only @team:DataDog/billing-hub
@replay-only @skip @team:DataDog/billing-hub
Scenario: Get cost across multi-org account returns "OK" response
Given new "GetCostByOrg" request
And request contains "start_month" parameter with value "{{ timeISO('now - 3d') }}"
Expand Down Expand Up @@ -139,23 +139,23 @@ Feature: Usage Metering
And the response "data[0].type" is equal to "usage_timeseries"
And the response "data[0].attributes.region" is equal to "us"

@team:DataDog/billing-hub
@skip @team:DataDog/billing-hub
Scenario: Get hourly usage for Application Security returns "Bad Request" response
Given new "GetUsageApplicationSecurityMonitoring" request
And request contains "start_hr" parameter with value "{{ timeISO('now - 3d') }}"
And request contains "end_hr" parameter with value "{{ timeISO('now - 5d') }}"
When the request is sent
Then the response status is 400 Bad Request

@team:DataDog/billing-hub
@skip @team:DataDog/billing-hub
Scenario: Get hourly usage for Lambda traced invocations returns "Bad Request" response
Given new "GetUsageLambdaTracedInvocations" request
And request contains "start_hr" parameter with value "{{ timeISO('now - 3d') }}"
And request contains "end_hr" parameter with value "{{ timeISO('now - 5d') }}"
When the request is sent
Then the response status is 400 Bad Request

@team:DataDog/billing-hub
@skip @team:DataDog/billing-hub
Scenario: Get hourly usage for Lambda traced invocations returns "OK" response
Given new "GetUsageLambdaTracedInvocations" request
And request contains "start_hr" parameter with value "{{ timeISO('now - 5d') }}"
Expand All @@ -165,7 +165,7 @@ Feature: Usage Metering
And the response "data[0].type" is equal to "usage_timeseries"
And the response "data[0].attributes.product_family" is equal to "lambda-traced-invocations"

@team:DataDog/billing-hub
@skip @team:DataDog/billing-hub
Scenario: Get hourly usage for Observability Pipelines returns "Bad Request" response
Given new "GetUsageObservabilityPipelines" request
And request contains "start_hr" parameter with value "{{ timeISO('now - 3d') }}"
Expand All @@ -180,7 +180,7 @@ Feature: Usage Metering
When the request is sent
Then the response status is 400 Bad Request

@team:DataDog/billing-hub
@skip @team:DataDog/billing-hub
Scenario: Get hourly usage for application security returns "OK" response
Given new "GetUsageApplicationSecurityMonitoring" request
And request contains "start_hr" parameter with value "{{ timeISO('now - 5d') }}"
Expand All @@ -197,7 +197,7 @@ Feature: Usage Metering
When the request is sent
Then the response status is 400 Bad Request

@team:DataDog/billing-hub
@skip @team:DataDog/billing-hub
Scenario: Get hourly usage for observability pipelines returns "OK" response
Given new "GetUsageObservabilityPipelines" request
And request contains "start_hr" parameter with value "{{ timeISO('now - 5d') }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2142,20 +2142,6 @@
"scenario": "Get monthly usage attribution returns \"OK\" response",
"version": "v1"
},
{
"feature": "Usage Metering",
"feature_file": "../../com/datadog/api/client/v1/api/usage_metering.feature",
"file": "v1/usage-metering/get-specified-daily-custom-reports-returns-ok-response.json",
"scenario": "Get specified daily custom reports returns \"OK\" response",
"version": "v1"
},
{
"feature": "Usage Metering",
"feature_file": "../../com/datadog/api/client/v1/api/usage_metering.feature",
"file": "v1/usage-metering/get-specified-monthly-custom-reports-returns-ok-response.json",
"scenario": "Get specified monthly custom reports returns \"OK\" response",
"version": "v1"
},
{
"feature": "Users",
"feature_file": "../../com/datadog/api/client/v1/api/users.feature",
Expand Down Expand Up @@ -11522,13 +11508,6 @@
"scenario": "Get billing dimension mapping for usage endpoints returns \"Bad Request\" response",
"version": "v2"
},
{
"feature": "Usage Metering",
"feature_file": "../../com/datadog/api/client/v2/api/usage_metering.feature",
"file": "v2/usage-metering/get-cost-across-multi-org-account-returns-ok-response.json",
"scenario": "Get cost across multi-org account returns \"OK\" response",
"version": "v2"
},
{
"feature": "Usage Metering",
"feature_file": "../../com/datadog/api/client/v2/api/usage_metering.feature",
Expand All @@ -11550,48 +11529,6 @@
"scenario": "Get hourly usage by product family returns \"OK\" response",
"version": "v2"
},
{
"feature": "Usage Metering",
"feature_file": "../../com/datadog/api/client/v2/api/usage_metering.feature",
"file": "v2/usage-metering/get-hourly-usage-for-application-security-returns-bad-request-response.json",
"scenario": "Get hourly usage for Application Security returns \"Bad Request\" response",
"version": "v2"
},
{
"feature": "Usage Metering",
"feature_file": "../../com/datadog/api/client/v2/api/usage_metering.feature",
"file": "v2/usage-metering/get-hourly-usage-for-lambda-traced-invocations-returns-bad-request-response.json",
"scenario": "Get hourly usage for Lambda traced invocations returns \"Bad Request\" response",
"version": "v2"
},
{
"feature": "Usage Metering",
"feature_file": "../../com/datadog/api/client/v2/api/usage_metering.feature",
"file": "v2/usage-metering/get-hourly-usage-for-lambda-traced-invocations-returns-ok-response.json",
"scenario": "Get hourly usage for Lambda traced invocations returns \"OK\" response",
"version": "v2"
},
{
"feature": "Usage Metering",
"feature_file": "../../com/datadog/api/client/v2/api/usage_metering.feature",
"file": "v2/usage-metering/get-hourly-usage-for-observability-pipelines-returns-bad-request-response.json",
"scenario": "Get hourly usage for Observability Pipelines returns \"Bad Request\" response",
"version": "v2"
},
{
"feature": "Usage Metering",
"feature_file": "../../com/datadog/api/client/v2/api/usage_metering.feature",
"file": "v2/usage-metering/get-hourly-usage-for-application-security-returns-ok-response.json",
"scenario": "Get hourly usage for application security returns \"OK\" response",
"version": "v2"
},
{
"feature": "Usage Metering",
"feature_file": "../../com/datadog/api/client/v2/api/usage_metering.feature",
"file": "v2/usage-metering/get-hourly-usage-for-observability-pipelines-returns-ok-response.json",
"scenario": "Get hourly usage for observability pipelines returns \"OK\" response",
"version": "v2"
},
{
"feature": "Usage Metering",
"feature_file": "../../com/datadog/api/client/v2/api/usage_metering.feature",
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading