Skip to content

Commit

Permalink
Mark Usage Attribution endpoint as public beta (#553)
Browse files Browse the repository at this point in the history
* setUnstableOperationEnabled for Usage Attribution

* Unstable Operation for Errors Test

* Regenerate client from commit 7af099d of spec repo

Co-authored-by: anthony.palmeira <anthony.palmeira@datadoghq.com>
Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
  • Loading branch information
3 people committed Nov 24, 2020
1 parent c7be9aa commit 32b5bb1
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.3.0",
"regenerated": "2020-11-24 16:06:21.399417",
"spec_repo_commit": "212ac1e"
"regenerated": "2020-11-24 16:52:32.741185",
"spec_repo_commit": "7af099d"
},
"v2": {
"apigentools_version": "1.3.0",
"regenerated": "2020-11-24 16:06:30.059277",
"spec_repo_commit": "212ac1e"
"regenerated": "2020-11-24 16:52:43.757881",
"spec_repo_commit": "7af099d"
}
}
}
1 change: 1 addition & 0 deletions src/main/java/com/datadog/api/v1/client/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ public class ApiClient extends JavaTimeFormatter {
put("getMonthlyCustomReports", false);
put("getSpecifiedDailyCustomReports", false);
put("getSpecifiedMonthlyCustomReports", false);
put("getUsageAttribution", false);
}};
protected static final java.util.logging.Logger logger = java.util.logging.Logger.getLogger(ApiClient.class.getName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,12 @@ public ApiResponse<UsageAttributionResponse> executeWithHttpInfo() throws ApiExc
*/
public APIgetUsageAttributionRequest getUsageAttribution() throws ApiException {
String operationId = "getUsageAttribution";
if (apiClient.isUnstableOperationEnabled(operationId)) {
apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId));
} else {
throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId));
}
return new APIgetUsageAttributionRequest();
}

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/datadog/api/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15195,6 +15195,9 @@ paths:
summary: Get Usage Attribution
tags:
- Usage Metering
x-unstable: '**Note**: This endpoint is in public beta.

If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
/api/v1/usage/aws_lambda:
get:
description: Get hourly usage for lambda.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ public void getUsageLambdaTest() throws ApiException {

@Test
public void getUsageAttributionTest() throws ApiException {
generalApiClient.setUnstableOperationEnabled("getUsageAttribution", true);
UsageAttributionResponse usage = api.getUsageAttribution()
.startMonth(startMonth)
.fields("*")
Expand Down Expand Up @@ -983,6 +984,7 @@ public void getUsageIncidentManagementErrorsTest()throws IOException {
@Test
public void getUsageAttributionErrorsTest() throws IOException {
try {
generalFakeAuthApiClient.setUnstableOperationEnabled("getUsageAttribution", true);
fakeAuthApi.getUsageAttribution().startMonth(startMonth).fields("*").execute();
fail("Expected ApiException not thrown");
} catch (ApiException e) {
Expand Down

0 comments on commit 32b5bb1

Please sign in to comment.