diff --git a/.apigentools-info b/.apigentools-info index 92d1b5bbfe8..8791cdfafe7 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.5.1.dev2", - "regenerated": "2021-12-10 14:07:04.851334", - "spec_repo_commit": "3c4d6d2" + "regenerated": "2021-12-15 16:19:24.178557", + "spec_repo_commit": "24bd273" }, "v2": { "apigentools_version": "1.5.1.dev2", - "regenerated": "2021-12-10 14:07:05.618941", - "spec_repo_commit": "3c4d6d2" + "regenerated": "2021-12-15 16:19:25.079442", + "spec_repo_commit": "24bd273" } } } \ No newline at end of file diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index 7b06be4ad38..84ea00ab6b5 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -3365,6 +3365,128 @@ components: format: int64 type: integer type: object + HourlyUsageAttributionBody: + description: The usage for one set of tags for one hour. + properties: + hour: + description: The hour for the usage. + format: date-time + type: string + org_name: + description: The name of the organization. + type: string + public_id: + description: The organization public ID. + type: string + tag_config_source: + description: The source of the usage attribution tag configuration and the + selected tags in the format of `::://////`. + type: string + tags: + $ref: '#/components/schemas/UsageAttributionTagNames' + total_usage_sum: + description: Total product usage for the given tags within the hour. + format: double + type: number + updated_at: + description: Shows the most recent hour in the current month for all organizations + where usages are calculated. + type: string + usage_type: + $ref: '#/components/schemas/HourlyUsageAttributionResponseUsageType' + type: object + HourlyUsageAttributionMetadata: + description: The object containing document metadata. + properties: + pagination: + $ref: '#/components/schemas/HourlyUsageAttributionPagination' + type: object + HourlyUsageAttributionPagination: + description: The metadata for the current pagination. + properties: + next_record_id: + description: The cursor to get the next results (if any). To make the next + request, use the same parameters and add `next_record_id`. + type: string + type: object + HourlyUsageAttributionResponse: + description: Response containing the hourly usage attribution by tag(s). + properties: + metadata: + $ref: '#/components/schemas/HourlyUsageAttributionMetadata' + usage: + description: Get the hourly usage attribution by tag(s). + items: + $ref: '#/components/schemas/HourlyUsageAttributionBody' + type: array + type: object + HourlyUsageAttributionResponseUsageType: + description: The usage type in the response body. + enum: + - api_usage + - apm_host_usage + - browser_usage + - container_usage + - custom_timeseries_usage + - fargate_usage + - functions_usage + - indexed_logs_usage + - infra_host_usage + - invocations_usage + - npm_host_usage + - profiled_container_usage + - profiled_host_usage + - snmp_usage + type: string + x-enum-varnames: + - API_USAGE + - APM_HOST_USAGE + - BROWSER_USAGE + - CONTAINER_USAGE + - CUSTOM_TIMESERIES_USAGE + - FARGATE_USAGE + - FUNCTIONS_USAGE + - INDEXED_LOGS_USAGE + - INFRA_HOST_USAGE + - INVOCATIONS_USAGE + - NPM_HOST_USAGE + - PROFILED_CONTAINER_USAGE + - PROFILED_HOST_USAGE + - SNMP_USAGE + HourlyUsageAttributionUsageType: + description: Supported products for hourly usage attribution requests. + enum: + - api + - apm_host + - browser + - container + - custom_timeseries + - fargate + - functions + - indexed_logs + - infra_host + - invocations + - npm_host + - profiled_container + - profiled_host + - snmp + type: string + x-enum-varnames: + - API + - APM_HOST + - BROWSER + - CONTAINER + - CUSTOM_TIMESERIES + - FARGATE + - FUNCTIONS + - INDEXED_LOGS + - INFRA_HOST + - INVOCATIONS + - NPM_HOST + - PROFILED_CONTAINER + - PROFILED_HOST + - SNMP IFrameWidgetDefinition: description: The iframe widget allows you to embed a portion of any other web page on your dashboard. Only available on FREE layout dashboards. @@ -24077,7 +24199,7 @@ paths: summary: Get hourly usage for audit logs tags: - Usage Metering - x-menu-order: 31 + x-menu-order: 32 x-undo: type: safe /api/v1/usage/aws_lambda: @@ -24225,7 +24347,7 @@ paths: summary: Get hourly usage for CSPM tags: - Usage Metering - x-menu-order: 30 + x-menu-order: 31 x-undo: type: safe /api/v1/usage/cws: @@ -24280,7 +24402,7 @@ paths: summary: Get hourly usage for Cloud Workload Security tags: - Usage Metering - x-menu-order: 32 + x-menu-order: 33 x-undo: type: safe /api/v1/usage/dbm: @@ -24330,7 +24452,7 @@ paths: summary: Get hourly usage for Database Monitoring tags: - Usage Metering - x-menu-order: 33 + x-menu-order: 34 x-undo: type: safe /api/v1/usage/fargate: @@ -24439,6 +24561,77 @@ paths: x-menu-order: 1 x-undo: type: safe + /api/v1/usage/hourly-attribution: + get: + description: Get Hourly Usage Attribution. + operationId: GetHourlyUsageAttribution + parameters: + - description: 'Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` + for usage beginning at this hour.' + in: query + name: start_hr + required: true + schema: + format: date-time + type: string + - description: 'Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` + for usage ending + + **before** this hour.' + in: query + name: end_hr + required: false + schema: + format: date-time + type: string + - description: Usage type to retrieve. + in: query + name: usage_type + required: true + schema: + $ref: '#/components/schemas/HourlyUsageAttributionUsageType' + - description: List following results with a next_record_id provided in the + previous query. + in: query + name: next_record_id + required: false + schema: + type: string + - description: Comma separated list of tags used to group usage. + in: query + name: tag_breakdown_keys + required: false + schema: + type: string + responses: + '200': + content: + application/json;datetime-format=rfc3339: + schema: + $ref: '#/components/schemas/HourlyUsageAttributionResponse' + description: OK + '403': + content: + application/json;datetime-format=rfc3339: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden - User is not authorized + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - usage_read + summary: Get Hourly Usage Attribution + tags: + - Usage Metering + x-menu-order: 30 + x-undo: + type: safe + 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/incident-management: get: description: Get hourly usage for incident management. @@ -25034,7 +25227,7 @@ paths: summary: Get hourly usage for RUM Units tags: - Usage Metering - x-menu-order: 35 + x-menu-order: 36 x-undo: type: safe /api/v1/usage/rum_sessions: @@ -25144,7 +25337,7 @@ paths: summary: Get hourly usage for Sensitive Data Scanner tags: - Usage Metering - x-menu-order: 34 + x-menu-order: 35 x-undo: type: safe /api/v1/usage/snmp: diff --git a/api_docs/v1/HourlyUsageAttributionBody.md b/api_docs/v1/HourlyUsageAttributionBody.md new file mode 100644 index 00000000000..224b178c243 --- /dev/null +++ b/api_docs/v1/HourlyUsageAttributionBody.md @@ -0,0 +1,21 @@ + + +# HourlyUsageAttributionBody + +The usage for one set of tags for one hour. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**hour** | **OffsetDateTime** | The hour for the usage. | [optional] +**orgName** | **String** | The name of the organization. | [optional] +**publicId** | **String** | The organization public ID. | [optional] +**tagConfigSource** | **String** | The source of the usage attribution tag configuration and the selected tags in the format of `<source_org_name>:::<selected tag 1>///<selected tag 2>///<selected tag 3>`. | [optional] +**tags** | **Map<String, List<String>>** | Usage Summary by tag name. | [optional] +**totalUsageSum** | **Double** | Total product usage for the given tags within the hour. | [optional] +**updatedAt** | **String** | Shows the most recent hour in the current month for all organizations where usages are calculated. | [optional] +**usageType** | **HourlyUsageAttributionResponseUsageType** | | [optional] + + + diff --git a/api_docs/v1/HourlyUsageAttributionMetadata.md b/api_docs/v1/HourlyUsageAttributionMetadata.md new file mode 100644 index 00000000000..66e0e1ac500 --- /dev/null +++ b/api_docs/v1/HourlyUsageAttributionMetadata.md @@ -0,0 +1,14 @@ + + +# HourlyUsageAttributionMetadata + +The object containing document metadata. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**pagination** | [**HourlyUsageAttributionPagination**](HourlyUsageAttributionPagination.md) | | [optional] + + + diff --git a/api_docs/v1/HourlyUsageAttributionPagination.md b/api_docs/v1/HourlyUsageAttributionPagination.md new file mode 100644 index 00000000000..5ef077e40f2 --- /dev/null +++ b/api_docs/v1/HourlyUsageAttributionPagination.md @@ -0,0 +1,14 @@ + + +# HourlyUsageAttributionPagination + +The metadata for the current pagination. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**nextRecordId** | **String** | The cursor to get the next results (if any). To make the next request, use the same parameters and add `next_record_id`. | [optional] + + + diff --git a/api_docs/v1/HourlyUsageAttributionResponse.md b/api_docs/v1/HourlyUsageAttributionResponse.md new file mode 100644 index 00000000000..f65b2ed1651 --- /dev/null +++ b/api_docs/v1/HourlyUsageAttributionResponse.md @@ -0,0 +1,15 @@ + + +# HourlyUsageAttributionResponse + +Response containing the hourly usage attribution by tag(s). + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**metadata** | [**HourlyUsageAttributionMetadata**](HourlyUsageAttributionMetadata.md) | | [optional] +**usage** | [**List<HourlyUsageAttributionBody>**](HourlyUsageAttributionBody.md) | Get the hourly usage attribution by tag(s). | [optional] + + + diff --git a/api_docs/v1/HourlyUsageAttributionResponseUsageType.md b/api_docs/v1/HourlyUsageAttributionResponseUsageType.md new file mode 100644 index 00000000000..99361607e0b --- /dev/null +++ b/api_docs/v1/HourlyUsageAttributionResponseUsageType.md @@ -0,0 +1,37 @@ + + +# HourlyUsageAttributionResponseUsageType + +## Enum + + +* `API_USAGE` (value: `"api_usage"`) + +* `APM_HOST_USAGE` (value: `"apm_host_usage"`) + +* `BROWSER_USAGE` (value: `"browser_usage"`) + +* `CONTAINER_USAGE` (value: `"container_usage"`) + +* `CUSTOM_TIMESERIES_USAGE` (value: `"custom_timeseries_usage"`) + +* `FARGATE_USAGE` (value: `"fargate_usage"`) + +* `FUNCTIONS_USAGE` (value: `"functions_usage"`) + +* `INDEXED_LOGS_USAGE` (value: `"indexed_logs_usage"`) + +* `INFRA_HOST_USAGE` (value: `"infra_host_usage"`) + +* `INVOCATIONS_USAGE` (value: `"invocations_usage"`) + +* `NPM_HOST_USAGE` (value: `"npm_host_usage"`) + +* `PROFILED_CONTAINER_USAGE` (value: `"profiled_container_usage"`) + +* `PROFILED_HOST_USAGE` (value: `"profiled_host_usage"`) + +* `SNMP_USAGE` (value: `"snmp_usage"`) + + + diff --git a/api_docs/v1/HourlyUsageAttributionUsageType.md b/api_docs/v1/HourlyUsageAttributionUsageType.md new file mode 100644 index 00000000000..c6e8aa100a2 --- /dev/null +++ b/api_docs/v1/HourlyUsageAttributionUsageType.md @@ -0,0 +1,37 @@ + + +# HourlyUsageAttributionUsageType + +## Enum + + +* `API` (value: `"api"`) + +* `APM_HOST` (value: `"apm_host"`) + +* `BROWSER` (value: `"browser"`) + +* `CONTAINER` (value: `"container"`) + +* `CUSTOM_TIMESERIES` (value: `"custom_timeseries"`) + +* `FARGATE` (value: `"fargate"`) + +* `FUNCTIONS` (value: `"functions"`) + +* `INDEXED_LOGS` (value: `"indexed_logs"`) + +* `INFRA_HOST` (value: `"infra_host"`) + +* `INVOCATIONS` (value: `"invocations"`) + +* `NPM_HOST` (value: `"npm_host"`) + +* `PROFILED_CONTAINER` (value: `"profiled_container"`) + +* `PROFILED_HOST` (value: `"profiled_host"`) + +* `SNMP` (value: `"snmp"`) + + + diff --git a/api_docs/v1/README.md b/api_docs/v1/README.md index 28405238c3c..85094127059 100644 --- a/api_docs/v1/README.md +++ b/api_docs/v1/README.md @@ -165,6 +165,7 @@ All URIs are relative to *https://api.datadoghq.com* | _TagsApi_ | [**listHostTags**](TagsApi.md#listHostTags) | **GET** /api/v1/tags/hosts | Get Tags | | _TagsApi_ | [**updateHostTags**](TagsApi.md#updateHostTags) | **PUT** /api/v1/tags/hosts/{host_name} | Update host tags | | _UsageMeteringApi_ | [**getDailyCustomReports**](UsageMeteringApi.md#getDailyCustomReports) | **GET** /api/v1/daily_custom_reports | Get the list of available daily custom reports | +| _UsageMeteringApi_ | [**getHourlyUsageAttribution**](UsageMeteringApi.md#getHourlyUsageAttribution) | **GET** /api/v1/usage/hourly-attribution | Get Hourly Usage Attribution | | _UsageMeteringApi_ | [**getIncidentManagement**](UsageMeteringApi.md#getIncidentManagement) | **GET** /api/v1/usage/incident-management | Get hourly usage for incident management | | _UsageMeteringApi_ | [**getIngestedSpans**](UsageMeteringApi.md#getIngestedSpans) | **GET** /api/v1/usage/ingested-spans | Get hourly usage for ingested spans | | _UsageMeteringApi_ | [**getMonthlyCustomReports**](UsageMeteringApi.md#getMonthlyCustomReports) | **GET** /api/v1/monthly_custom_reports | Get the list of available monthly custom reports | @@ -353,6 +354,12 @@ All URIs are relative to *https://api.datadoghq.com* - [HostMuteSettings](HostMuteSettings.md) - [HostTags](HostTags.md) - [HostTotals](HostTotals.md) +- [HourlyUsageAttributionBody](HourlyUsageAttributionBody.md) +- [HourlyUsageAttributionMetadata](HourlyUsageAttributionMetadata.md) +- [HourlyUsageAttributionPagination](HourlyUsageAttributionPagination.md) +- [HourlyUsageAttributionResponse](HourlyUsageAttributionResponse.md) +- [HourlyUsageAttributionResponseUsageType](HourlyUsageAttributionResponseUsageType.md) +- [HourlyUsageAttributionUsageType](HourlyUsageAttributionUsageType.md) - [IFrameWidgetDefinition](IFrameWidgetDefinition.md) - [IFrameWidgetDefinitionType](IFrameWidgetDefinitionType.md) - [IPPrefixesAPI](IPPrefixesAPI.md) diff --git a/api_docs/v1/UsageMeteringApi.md b/api_docs/v1/UsageMeteringApi.md index 898caf1c0bd..e242841e50c 100644 --- a/api_docs/v1/UsageMeteringApi.md +++ b/api_docs/v1/UsageMeteringApi.md @@ -5,6 +5,7 @@ All URIs are relative to *https://api.datadoghq.com* | Method | HTTP request | Description | | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------- | ------------------------------------------------ | | [**getDailyCustomReports**](UsageMeteringApi.md#getDailyCustomReports) | **GET** /api/v1/daily_custom_reports | Get the list of available daily custom reports | +| [**getHourlyUsageAttribution**](UsageMeteringApi.md#getHourlyUsageAttribution) | **GET** /api/v1/usage/hourly-attribution | Get Hourly Usage Attribution | | [**getIncidentManagement**](UsageMeteringApi.md#getIncidentManagement) | **GET** /api/v1/usage/incident-management | Get hourly usage for incident management | | [**getIngestedSpans**](UsageMeteringApi.md#getIngestedSpans) | **GET** /api/v1/usage/ingested-spans | Get hourly usage for ingested spans | | [**getMonthlyCustomReports**](UsageMeteringApi.md#getMonthlyCustomReports) | **GET** /api/v1/monthly_custom_reports | Get the list of available monthly custom reports | @@ -112,6 +113,81 @@ public class Example { | **403** | Forbidden - User is not authorized | - | | **429** | Too many requests | - | +## getHourlyUsageAttribution + +> HourlyUsageAttributionResponse getHourlyUsageAttribution(startHr, usageType, parameters); + +Get Hourly Usage Attribution. + +### Example + +```java +import java.time.OffsetDateTime; +import java.util.*; +import com.datadog.api.v1.client.ApiClient; +import com.datadog.api.v1.client.ApiException; +import com.datadog.api.v1.client.Configuration; +import com.datadog.api.v1.client.model.*; +import com.datadog.api.v1.client.api.UsageMeteringApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + + UsageMeteringApi apiInstance = new UsageMeteringApi(defaultClient); + OffsetDateTime startHr = OffsetDateTime.now(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage beginning at this hour. + HourlyUsageAttributionUsageType usageType = HourlyUsageAttributionUsageType.fromValue("api"); // HourlyUsageAttributionUsageType | Usage type to retrieve. + OffsetDateTime endHr = OffsetDateTime.now(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage ending **before** this hour. + String nextRecordId = "nextRecordId_example"; // String | List following results with a next_record_id provided in the previous query. + String tagBreakdownKeys = "tagBreakdownKeys_example"; // String | Comma separated list of tags used to group usage. + try { + HourlyUsageAttributionResponse result = apiInstance.getHourlyUsageAttribution(startHr, usageType, new UsageMeteringApi.GetHourlyUsageAttributionOptionalParameters() + .endHr(endHr) + .nextRecordId(nextRecordId) + .tagBreakdownKeys(tagBreakdownKeys)); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UsageMeteringApi#getHourlyUsageAttribution"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| -------------------- | ----------------------------------- | --------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **startHr** | **OffsetDateTime** | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage beginning at this hour. | +| **usageType** | **HourlyUsageAttributionUsageType** | Usage type to retrieve. | [enum: api, apm_host, browser, container, custom_timeseries, fargate, functions, indexed_logs, infra_host, invocations, npm_host, profiled_container, profiled_host, snmp] | +| **endHr** | **OffsetDateTime** | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage ending **before** this hour. | [optional] | +| **nextRecordId** | **String** | List following results with a next_record_id provided in the previous query. | [optional] | +| **tagBreakdownKeys** | **String** | Comma separated list of tags used to group usage. | [optional] | + +### Return type + +[**HourlyUsageAttributionResponse**](HourlyUsageAttributionResponse.md) + +### Authorization + +[AuthZ](README.md#AuthZ), [apiKeyAuth](README.md#apiKeyAuth), [appKeyAuth](README.md#appKeyAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json;datetime-format=rfc3339, application/json + +### HTTP response details + +| Status code | Description | Response headers | +| ----------- | ---------------------------------- | ---------------- | +| **200** | OK | - | +| **403** | Forbidden - User is not authorized | - | +| **429** | Too many requests | - | + ## getIncidentManagement > UsageIncidentManagementResponse getIncidentManagement(startHr, parameters); diff --git a/src/main/java/com/datadog/api/v1/client/ApiClient.java b/src/main/java/com/datadog/api/v1/client/ApiClient.java index 9ff00154a48..524b1866242 100644 --- a/src/main/java/com/datadog/api/v1/client/ApiClient.java +++ b/src/main/java/com/datadog/api/v1/client/ApiClient.java @@ -292,6 +292,7 @@ public class ApiClient extends JavaTimeFormatter { put("getSLOCorrections", false); put("getSLOHistory", false); put("getDailyCustomReports", false); + put("getHourlyUsageAttribution", false); put("getMonthlyCustomReports", false); put("getSpecifiedDailyCustomReports", false); put("getSpecifiedMonthlyCustomReports", false); diff --git a/src/main/java/com/datadog/api/v1/client/api/UsageMeteringApi.java b/src/main/java/com/datadog/api/v1/client/api/UsageMeteringApi.java index 5f665ffc7a9..a1859fcc1f7 100644 --- a/src/main/java/com/datadog/api/v1/client/api/UsageMeteringApi.java +++ b/src/main/java/com/datadog/api/v1/client/api/UsageMeteringApi.java @@ -5,6 +5,8 @@ import com.datadog.api.v1.client.ApiResponse; import com.datadog.api.v1.client.Configuration; import com.datadog.api.v1.client.Pair; +import com.datadog.api.v1.client.model.HourlyUsageAttributionResponse; +import com.datadog.api.v1.client.model.HourlyUsageAttributionUsageType; import com.datadog.api.v1.client.model.UsageAnalyzedLogsResponse; import com.datadog.api.v1.client.model.UsageAttributionResponse; import com.datadog.api.v1.client.model.UsageAttributionSort; @@ -238,6 +240,183 @@ public ApiResponse getDailyCustomReportsWithHttpInfo false); } + /** Manage optional parameters to getHourlyUsageAttribution. */ + public static class GetHourlyUsageAttributionOptionalParameters { + private OffsetDateTime endHr; + private String nextRecordId; + private String tagBreakdownKeys; + + /** + * Set endHr + * + * @param endHr Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` + * for usage ending **before** this hour. (optional) + * @return GetHourlyUsageAttributionOptionalParameters + */ + public GetHourlyUsageAttributionOptionalParameters endHr(OffsetDateTime endHr) { + this.endHr = endHr; + return this; + } + + /** + * Set nextRecordId + * + * @param nextRecordId List following results with a next_record_id provided in the previous + * query. (optional) + * @return GetHourlyUsageAttributionOptionalParameters + */ + public GetHourlyUsageAttributionOptionalParameters nextRecordId(String nextRecordId) { + this.nextRecordId = nextRecordId; + return this; + } + + /** + * Set tagBreakdownKeys + * + * @param tagBreakdownKeys Comma separated list of tags used to group usage. (optional) + * @return GetHourlyUsageAttributionOptionalParameters + */ + public GetHourlyUsageAttributionOptionalParameters tagBreakdownKeys(String tagBreakdownKeys) { + this.tagBreakdownKeys = tagBreakdownKeys; + return this; + } + } + + /** + * Get Hourly Usage Attribution Get Hourly Usage Attribution. + * + * @param startHr Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` + * for usage beginning at this hour. (required) + * @param usageType Usage type to retrieve. (required) + * @return HourlyUsageAttributionResponse + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
403 Forbidden - User is not authorized -
429 Too many requests -
+ */ + public HourlyUsageAttributionResponse getHourlyUsageAttribution( + OffsetDateTime startHr, HourlyUsageAttributionUsageType usageType) throws ApiException { + return getHourlyUsageAttributionWithHttpInfo( + startHr, usageType, new GetHourlyUsageAttributionOptionalParameters()) + .getData(); + } + + /** + * Get Hourly Usage Attribution Get Hourly Usage Attribution. + * + * @param startHr Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` + * for usage beginning at this hour. (required) + * @param usageType Usage type to retrieve. (required) + * @param parameters Optional parameters for the request. + * @return HourlyUsageAttributionResponse + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
403 Forbidden - User is not authorized -
429 Too many requests -
+ */ + public HourlyUsageAttributionResponse getHourlyUsageAttribution( + OffsetDateTime startHr, + HourlyUsageAttributionUsageType usageType, + GetHourlyUsageAttributionOptionalParameters parameters) + throws ApiException { + return getHourlyUsageAttributionWithHttpInfo(startHr, usageType, parameters).getData(); + } + + /** + * Get Hourly Usage Attribution Get Hourly Usage Attribution. + * + * @param startHr Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` + * for usage beginning at this hour. (required) + * @param usageType Usage type to retrieve. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<HourlyUsageAttributionResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + *
Status Code Description Response Headers
200 OK -
403 Forbidden - User is not authorized -
429 Too many requests -
+ */ + public ApiResponse getHourlyUsageAttributionWithHttpInfo( + OffsetDateTime startHr, + HourlyUsageAttributionUsageType usageType, + GetHourlyUsageAttributionOptionalParameters parameters) + throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'startHr' is set + if (startHr == null) { + throw new ApiException( + 400, "Missing the required parameter 'startHr' when calling getHourlyUsageAttribution"); + } + + // verify the required parameter 'usageType' is set + if (usageType == null) { + throw new ApiException( + 400, "Missing the required parameter 'usageType' when calling getHourlyUsageAttribution"); + } + OffsetDateTime endHr = parameters.endHr; + String nextRecordId = parameters.nextRecordId; + String tagBreakdownKeys = parameters.tagBreakdownKeys; + // create path and map variables + String localVarPath = "/api/v1/usage/hourly-attribution"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "start_hr", startHr)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_hr", endHr)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "usage_type", usageType)); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "next_record_id", nextRecordId)); + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "tag_breakdown_keys", tagBreakdownKeys)); + + // Set Operation-ID header for telemetry + localVarHeaderParams.put("DD-OPERATION-ID", "getHourlyUsageAttribution"); + + final String[] localVarAccepts = { + "application/json;datetime-format=rfc3339", "application/json" + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = {}; + + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}; + + GenericType localVarReturnType = + new GenericType() {}; + + return apiClient.invokeAPI( + "UsageMeteringApi.getHourlyUsageAttribution", + localVarPath, + "GET", + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarCookieParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType, + false); + } + /** Manage optional parameters to getIncidentManagement. */ public static class GetIncidentManagementOptionalParameters { private OffsetDateTime endHr; diff --git a/src/main/java/com/datadog/api/v1/client/model/HourlyUsageAttributionBody.java b/src/main/java/com/datadog/api/v1/client/model/HourlyUsageAttributionBody.java new file mode 100644 index 00000000000..4de7baa9222 --- /dev/null +++ b/src/main/java/com/datadog/api/v1/client/model/HourlyUsageAttributionBody.java @@ -0,0 +1,313 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.datadog.api.v1.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** The usage for one set of tags for one hour. */ +@ApiModel(description = "The usage for one set of tags for one hour.") +@JsonPropertyOrder({ + HourlyUsageAttributionBody.JSON_PROPERTY_HOUR, + HourlyUsageAttributionBody.JSON_PROPERTY_ORG_NAME, + HourlyUsageAttributionBody.JSON_PROPERTY_PUBLIC_ID, + HourlyUsageAttributionBody.JSON_PROPERTY_TAG_CONFIG_SOURCE, + HourlyUsageAttributionBody.JSON_PROPERTY_TAGS, + HourlyUsageAttributionBody.JSON_PROPERTY_TOTAL_USAGE_SUM, + HourlyUsageAttributionBody.JSON_PROPERTY_UPDATED_AT, + HourlyUsageAttributionBody.JSON_PROPERTY_USAGE_TYPE +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class HourlyUsageAttributionBody { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_HOUR = "hour"; + private OffsetDateTime hour; + + public static final String JSON_PROPERTY_ORG_NAME = "org_name"; + private String orgName; + + public static final String JSON_PROPERTY_PUBLIC_ID = "public_id"; + private String publicId; + + public static final String JSON_PROPERTY_TAG_CONFIG_SOURCE = "tag_config_source"; + private String tagConfigSource; + + public static final String JSON_PROPERTY_TAGS = "tags"; + private Map> tags = null; + + public static final String JSON_PROPERTY_TOTAL_USAGE_SUM = "total_usage_sum"; + private Double totalUsageSum; + + public static final String JSON_PROPERTY_UPDATED_AT = "updated_at"; + private String updatedAt; + + public static final String JSON_PROPERTY_USAGE_TYPE = "usage_type"; + private HourlyUsageAttributionResponseUsageType usageType; + + public HourlyUsageAttributionBody hour(OffsetDateTime hour) { + this.hour = hour; + return this; + } + + /** + * The hour for the usage. + * + * @return hour + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "The hour for the usage.") + @JsonProperty(JSON_PROPERTY_HOUR) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getHour() { + return hour; + } + + public void setHour(OffsetDateTime hour) { + this.hour = hour; + } + + public HourlyUsageAttributionBody orgName(String orgName) { + this.orgName = orgName; + return this; + } + + /** + * The name of the organization. + * + * @return orgName + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "The name of the organization.") + @JsonProperty(JSON_PROPERTY_ORG_NAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getOrgName() { + return orgName; + } + + public void setOrgName(String orgName) { + this.orgName = orgName; + } + + public HourlyUsageAttributionBody publicId(String publicId) { + this.publicId = publicId; + return this; + } + + /** + * The organization public ID. + * + * @return publicId + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "The organization public ID.") + @JsonProperty(JSON_PROPERTY_PUBLIC_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getPublicId() { + return publicId; + } + + public void setPublicId(String publicId) { + this.publicId = publicId; + } + + public HourlyUsageAttributionBody tagConfigSource(String tagConfigSource) { + this.tagConfigSource = tagConfigSource; + return this; + } + + /** + * The source of the usage attribution tag configuration and the selected tags in the format of + * `<source_org_name>:::<selected tag 1>///<selected tag 2>///<selected + * tag 3>`. + * + * @return tagConfigSource + */ + @javax.annotation.Nullable + @ApiModelProperty( + value = + "The source of the usage attribution tag configuration and the selected tags in the" + + " format of `::://////`.") + @JsonProperty(JSON_PROPERTY_TAG_CONFIG_SOURCE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTagConfigSource() { + return tagConfigSource; + } + + public void setTagConfigSource(String tagConfigSource) { + this.tagConfigSource = tagConfigSource; + } + + public HourlyUsageAttributionBody tags(Map> tags) { + this.tags = tags; + return this; + } + + public HourlyUsageAttributionBody putTagsItem(String key, List tagsItem) { + if (this.tags == null) { + this.tags = new HashMap<>(); + } + this.tags.put(key, tagsItem); + return this; + } + + /** + * Usage Summary by tag name. + * + * @return tags + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "Usage Summary by tag name.") + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map> getTags() { + return tags; + } + + public void setTags(Map> tags) { + this.tags = tags; + } + + public HourlyUsageAttributionBody totalUsageSum(Double totalUsageSum) { + this.totalUsageSum = totalUsageSum; + return this; + } + + /** + * Total product usage for the given tags within the hour. + * + * @return totalUsageSum + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "Total product usage for the given tags within the hour.") + @JsonProperty(JSON_PROPERTY_TOTAL_USAGE_SUM) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Double getTotalUsageSum() { + return totalUsageSum; + } + + public void setTotalUsageSum(Double totalUsageSum) { + this.totalUsageSum = totalUsageSum; + } + + public HourlyUsageAttributionBody updatedAt(String updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * Shows the most recent hour in the current month for all organizations where usages are + * calculated. + * + * @return updatedAt + */ + @javax.annotation.Nullable + @ApiModelProperty( + value = + "Shows the most recent hour in the current month for all organizations where usages are" + + " calculated.") + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(String updatedAt) { + this.updatedAt = updatedAt; + } + + public HourlyUsageAttributionBody usageType(HourlyUsageAttributionResponseUsageType usageType) { + this.usageType = usageType; + this.unparsed |= !usageType.isValid(); + return this; + } + + /** + * Get usageType + * + * @return usageType + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_USAGE_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public HourlyUsageAttributionResponseUsageType getUsageType() { + return usageType; + } + + public void setUsageType(HourlyUsageAttributionResponseUsageType usageType) { + if (!usageType.isValid()) { + this.unparsed = true; + } + this.usageType = usageType; + } + + /** Return true if this HourlyUsageAttributionBody object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HourlyUsageAttributionBody hourlyUsageAttributionBody = (HourlyUsageAttributionBody) o; + return Objects.equals(this.hour, hourlyUsageAttributionBody.hour) + && Objects.equals(this.orgName, hourlyUsageAttributionBody.orgName) + && Objects.equals(this.publicId, hourlyUsageAttributionBody.publicId) + && Objects.equals(this.tagConfigSource, hourlyUsageAttributionBody.tagConfigSource) + && Objects.equals(this.tags, hourlyUsageAttributionBody.tags) + && Objects.equals(this.totalUsageSum, hourlyUsageAttributionBody.totalUsageSum) + && Objects.equals(this.updatedAt, hourlyUsageAttributionBody.updatedAt) + && Objects.equals(this.usageType, hourlyUsageAttributionBody.usageType); + } + + @Override + public int hashCode() { + return Objects.hash( + hour, orgName, publicId, tagConfigSource, tags, totalUsageSum, updatedAt, usageType); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HourlyUsageAttributionBody {\n"); + sb.append(" hour: ").append(toIndentedString(hour)).append("\n"); + sb.append(" orgName: ").append(toIndentedString(orgName)).append("\n"); + sb.append(" publicId: ").append(toIndentedString(publicId)).append("\n"); + sb.append(" tagConfigSource: ").append(toIndentedString(tagConfigSource)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" totalUsageSum: ").append(toIndentedString(totalUsageSum)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" usageType: ").append(toIndentedString(usageType)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/v1/client/model/HourlyUsageAttributionMetadata.java b/src/main/java/com/datadog/api/v1/client/model/HourlyUsageAttributionMetadata.java new file mode 100644 index 00000000000..e74ad634e49 --- /dev/null +++ b/src/main/java/com/datadog/api/v1/client/model/HourlyUsageAttributionMetadata.java @@ -0,0 +1,90 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.datadog.api.v1.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.Objects; + +/** The object containing document metadata. */ +@ApiModel(description = "The object containing document metadata.") +@JsonPropertyOrder({HourlyUsageAttributionMetadata.JSON_PROPERTY_PAGINATION}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class HourlyUsageAttributionMetadata { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_PAGINATION = "pagination"; + private HourlyUsageAttributionPagination pagination; + + public HourlyUsageAttributionMetadata pagination(HourlyUsageAttributionPagination pagination) { + this.pagination = pagination; + this.unparsed |= pagination.unparsed; + return this; + } + + /** + * Get pagination + * + * @return pagination + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_PAGINATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public HourlyUsageAttributionPagination getPagination() { + return pagination; + } + + public void setPagination(HourlyUsageAttributionPagination pagination) { + this.pagination = pagination; + } + + /** Return true if this HourlyUsageAttributionMetadata object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HourlyUsageAttributionMetadata hourlyUsageAttributionMetadata = + (HourlyUsageAttributionMetadata) o; + return Objects.equals(this.pagination, hourlyUsageAttributionMetadata.pagination); + } + + @Override + public int hashCode() { + return Objects.hash(pagination); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HourlyUsageAttributionMetadata {\n"); + sb.append(" pagination: ").append(toIndentedString(pagination)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/v1/client/model/HourlyUsageAttributionPagination.java b/src/main/java/com/datadog/api/v1/client/model/HourlyUsageAttributionPagination.java new file mode 100644 index 00000000000..e4e7164047e --- /dev/null +++ b/src/main/java/com/datadog/api/v1/client/model/HourlyUsageAttributionPagination.java @@ -0,0 +1,93 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.datadog.api.v1.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.Objects; + +/** The metadata for the current pagination. */ +@ApiModel(description = "The metadata for the current pagination.") +@JsonPropertyOrder({HourlyUsageAttributionPagination.JSON_PROPERTY_NEXT_RECORD_ID}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class HourlyUsageAttributionPagination { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_NEXT_RECORD_ID = "next_record_id"; + private String nextRecordId; + + public HourlyUsageAttributionPagination nextRecordId(String nextRecordId) { + this.nextRecordId = nextRecordId; + return this; + } + + /** + * The cursor to get the next results (if any). To make the next request, use the same parameters + * and add `next_record_id`. + * + * @return nextRecordId + */ + @javax.annotation.Nullable + @ApiModelProperty( + value = + "The cursor to get the next results (if any). To make the next request, use the same" + + " parameters and add `next_record_id`.") + @JsonProperty(JSON_PROPERTY_NEXT_RECORD_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getNextRecordId() { + return nextRecordId; + } + + public void setNextRecordId(String nextRecordId) { + this.nextRecordId = nextRecordId; + } + + /** Return true if this HourlyUsageAttributionPagination object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HourlyUsageAttributionPagination hourlyUsageAttributionPagination = + (HourlyUsageAttributionPagination) o; + return Objects.equals(this.nextRecordId, hourlyUsageAttributionPagination.nextRecordId); + } + + @Override + public int hashCode() { + return Objects.hash(nextRecordId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HourlyUsageAttributionPagination {\n"); + sb.append(" nextRecordId: ").append(toIndentedString(nextRecordId)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/v1/client/model/HourlyUsageAttributionResponse.java b/src/main/java/com/datadog/api/v1/client/model/HourlyUsageAttributionResponse.java new file mode 100644 index 00000000000..5d0332f1ab8 --- /dev/null +++ b/src/main/java/com/datadog/api/v1/client/model/HourlyUsageAttributionResponse.java @@ -0,0 +1,134 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.datadog.api.v1.client.model; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Response containing the hourly usage attribution by tag(s). */ +@ApiModel(description = "Response containing the hourly usage attribution by tag(s).") +@JsonPropertyOrder({ + HourlyUsageAttributionResponse.JSON_PROPERTY_METADATA, + HourlyUsageAttributionResponse.JSON_PROPERTY_USAGE +}) +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") +public class HourlyUsageAttributionResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_METADATA = "metadata"; + private HourlyUsageAttributionMetadata metadata; + + public static final String JSON_PROPERTY_USAGE = "usage"; + private List usage = null; + + public HourlyUsageAttributionResponse metadata(HourlyUsageAttributionMetadata metadata) { + this.metadata = metadata; + this.unparsed |= metadata.unparsed; + return this; + } + + /** + * Get metadata + * + * @return metadata + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "") + @JsonProperty(JSON_PROPERTY_METADATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public HourlyUsageAttributionMetadata getMetadata() { + return metadata; + } + + public void setMetadata(HourlyUsageAttributionMetadata metadata) { + this.metadata = metadata; + } + + public HourlyUsageAttributionResponse usage(List usage) { + this.usage = usage; + for (HourlyUsageAttributionBody item : usage) { + this.unparsed |= item.unparsed; + } + return this; + } + + public HourlyUsageAttributionResponse addUsageItem(HourlyUsageAttributionBody usageItem) { + if (this.usage == null) { + this.usage = new ArrayList<>(); + } + this.usage.add(usageItem); + this.unparsed |= usageItem.unparsed; + return this; + } + + /** + * Get the hourly usage attribution by tag(s). + * + * @return usage + */ + @javax.annotation.Nullable + @ApiModelProperty(value = "Get the hourly usage attribution by tag(s).") + @JsonProperty(JSON_PROPERTY_USAGE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getUsage() { + return usage; + } + + public void setUsage(List usage) { + this.usage = usage; + } + + /** Return true if this HourlyUsageAttributionResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HourlyUsageAttributionResponse hourlyUsageAttributionResponse = + (HourlyUsageAttributionResponse) o; + return Objects.equals(this.metadata, hourlyUsageAttributionResponse.metadata) + && Objects.equals(this.usage, hourlyUsageAttributionResponse.usage); + } + + @Override + public int hashCode() { + return Objects.hash(metadata, usage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HourlyUsageAttributionResponse {\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" usage: ").append(toIndentedString(usage)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/v1/client/model/HourlyUsageAttributionResponseUsageType.java b/src/main/java/com/datadog/api/v1/client/model/HourlyUsageAttributionResponseUsageType.java new file mode 100644 index 00000000000..1b668e43d46 --- /dev/null +++ b/src/main/java/com/datadog/api/v1/client/model/HourlyUsageAttributionResponseUsageType.java @@ -0,0 +1,146 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.datadog.api.v1.client.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import java.util.Set; + +/** The usage type in the response body. */ +@JsonSerialize( + using = + HourlyUsageAttributionResponseUsageType.HourlyUsageAttributionResponseUsageTypeSerializer + .class) +public class HourlyUsageAttributionResponseUsageType { + + public static final HourlyUsageAttributionResponseUsageType API_USAGE = + new HourlyUsageAttributionResponseUsageType("api_usage"); + public static final HourlyUsageAttributionResponseUsageType APM_HOST_USAGE = + new HourlyUsageAttributionResponseUsageType("apm_host_usage"); + public static final HourlyUsageAttributionResponseUsageType BROWSER_USAGE = + new HourlyUsageAttributionResponseUsageType("browser_usage"); + public static final HourlyUsageAttributionResponseUsageType CONTAINER_USAGE = + new HourlyUsageAttributionResponseUsageType("container_usage"); + public static final HourlyUsageAttributionResponseUsageType CUSTOM_TIMESERIES_USAGE = + new HourlyUsageAttributionResponseUsageType("custom_timeseries_usage"); + public static final HourlyUsageAttributionResponseUsageType FARGATE_USAGE = + new HourlyUsageAttributionResponseUsageType("fargate_usage"); + public static final HourlyUsageAttributionResponseUsageType FUNCTIONS_USAGE = + new HourlyUsageAttributionResponseUsageType("functions_usage"); + public static final HourlyUsageAttributionResponseUsageType INDEXED_LOGS_USAGE = + new HourlyUsageAttributionResponseUsageType("indexed_logs_usage"); + public static final HourlyUsageAttributionResponseUsageType INFRA_HOST_USAGE = + new HourlyUsageAttributionResponseUsageType("infra_host_usage"); + public static final HourlyUsageAttributionResponseUsageType INVOCATIONS_USAGE = + new HourlyUsageAttributionResponseUsageType("invocations_usage"); + public static final HourlyUsageAttributionResponseUsageType NPM_HOST_USAGE = + new HourlyUsageAttributionResponseUsageType("npm_host_usage"); + public static final HourlyUsageAttributionResponseUsageType PROFILED_CONTAINER_USAGE = + new HourlyUsageAttributionResponseUsageType("profiled_container_usage"); + public static final HourlyUsageAttributionResponseUsageType PROFILED_HOST_USAGE = + new HourlyUsageAttributionResponseUsageType("profiled_host_usage"); + public static final HourlyUsageAttributionResponseUsageType SNMP_USAGE = + new HourlyUsageAttributionResponseUsageType("snmp_usage"); + + private static final Set allowedValues = + new HashSet( + Arrays.asList( + "api_usage", + "apm_host_usage", + "browser_usage", + "container_usage", + "custom_timeseries_usage", + "fargate_usage", + "functions_usage", + "indexed_logs_usage", + "infra_host_usage", + "invocations_usage", + "npm_host_usage", + "profiled_container_usage", + "profiled_host_usage", + "snmp_usage")); + + private String value; + + public boolean isValid() { + return allowedValues.contains(this.value); + } + + HourlyUsageAttributionResponseUsageType(String value) { + this.value = value; + } + + public static class HourlyUsageAttributionResponseUsageTypeSerializer + extends StdSerializer { + public HourlyUsageAttributionResponseUsageTypeSerializer( + Class t) { + super(t); + } + + public HourlyUsageAttributionResponseUsageTypeSerializer() { + this(null); + } + + @Override + public void serialize( + HourlyUsageAttributionResponseUsageType value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonValue + public String getValue() { + return this.value; + } + + public void setValue(String value) { + this.value = value; + } + + /** Return true if this HourlyUsageAttributionResponseUsageType object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return this.value.equals(((HourlyUsageAttributionResponseUsageType) o).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static HourlyUsageAttributionResponseUsageType fromValue(String value) { + return new HourlyUsageAttributionResponseUsageType(value); + } +} diff --git a/src/main/java/com/datadog/api/v1/client/model/HourlyUsageAttributionUsageType.java b/src/main/java/com/datadog/api/v1/client/model/HourlyUsageAttributionUsageType.java new file mode 100644 index 00000000000..1c37f92c893 --- /dev/null +++ b/src/main/java/com/datadog/api/v1/client/model/HourlyUsageAttributionUsageType.java @@ -0,0 +1,141 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.datadog.api.v1.client.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Objects; +import java.util.Set; + +/** Supported products for hourly usage attribution requests. */ +@JsonSerialize( + using = HourlyUsageAttributionUsageType.HourlyUsageAttributionUsageTypeSerializer.class) +public class HourlyUsageAttributionUsageType { + + public static final HourlyUsageAttributionUsageType API = + new HourlyUsageAttributionUsageType("api"); + public static final HourlyUsageAttributionUsageType APM_HOST = + new HourlyUsageAttributionUsageType("apm_host"); + public static final HourlyUsageAttributionUsageType BROWSER = + new HourlyUsageAttributionUsageType("browser"); + public static final HourlyUsageAttributionUsageType CONTAINER = + new HourlyUsageAttributionUsageType("container"); + public static final HourlyUsageAttributionUsageType CUSTOM_TIMESERIES = + new HourlyUsageAttributionUsageType("custom_timeseries"); + public static final HourlyUsageAttributionUsageType FARGATE = + new HourlyUsageAttributionUsageType("fargate"); + public static final HourlyUsageAttributionUsageType FUNCTIONS = + new HourlyUsageAttributionUsageType("functions"); + public static final HourlyUsageAttributionUsageType INDEXED_LOGS = + new HourlyUsageAttributionUsageType("indexed_logs"); + public static final HourlyUsageAttributionUsageType INFRA_HOST = + new HourlyUsageAttributionUsageType("infra_host"); + public static final HourlyUsageAttributionUsageType INVOCATIONS = + new HourlyUsageAttributionUsageType("invocations"); + public static final HourlyUsageAttributionUsageType NPM_HOST = + new HourlyUsageAttributionUsageType("npm_host"); + public static final HourlyUsageAttributionUsageType PROFILED_CONTAINER = + new HourlyUsageAttributionUsageType("profiled_container"); + public static final HourlyUsageAttributionUsageType PROFILED_HOST = + new HourlyUsageAttributionUsageType("profiled_host"); + public static final HourlyUsageAttributionUsageType SNMP = + new HourlyUsageAttributionUsageType("snmp"); + + private static final Set allowedValues = + new HashSet( + Arrays.asList( + "api", + "apm_host", + "browser", + "container", + "custom_timeseries", + "fargate", + "functions", + "indexed_logs", + "infra_host", + "invocations", + "npm_host", + "profiled_container", + "profiled_host", + "snmp")); + + private String value; + + public boolean isValid() { + return allowedValues.contains(this.value); + } + + HourlyUsageAttributionUsageType(String value) { + this.value = value; + } + + public static class HourlyUsageAttributionUsageTypeSerializer + extends StdSerializer { + public HourlyUsageAttributionUsageTypeSerializer(Class t) { + super(t); + } + + public HourlyUsageAttributionUsageTypeSerializer() { + this(null); + } + + @Override + public void serialize( + HourlyUsageAttributionUsageType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonValue + public String getValue() { + return this.value; + } + + public void setValue(String value) { + this.value = value; + } + + /** Return true if this HourlyUsageAttributionUsageType object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return this.value.equals(((HourlyUsageAttributionUsageType) o).value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static HourlyUsageAttributionUsageType fromValue(String value) { + return new HourlyUsageAttributionUsageType(value); + } +} diff --git a/src/test/resources/com/datadog/api/v1/client/api/undo.json b/src/test/resources/com/datadog/api/v1/client/api/undo.json index bb7164b2f13..9db6aacbddb 100644 --- a/src/test/resources/com/datadog/api/v1/client/api/undo.json +++ b/src/test/resources/com/datadog/api/v1/client/api/undo.json @@ -1224,6 +1224,12 @@ "type": "safe" } }, + "GetHourlyUsageAttribution": { + "tag": "Usage Metering", + "undo": { + "type": "safe" + } + }, "GetIncidentManagement": { "tag": "Usage Metering", "undo": { diff --git a/src/test/resources/com/datadog/api/v1/client/api/usage_metering.feature b/src/test/resources/com/datadog/api/v1/client/api/usage_metering.feature index 55d9c65669f..a735bcaf9e5 100644 --- a/src/test/resources/com/datadog/api/v1/client/api/usage_metering.feature +++ b/src/test/resources/com/datadog/api/v1/client/api/usage_metering.feature @@ -14,6 +14,13 @@ Feature: Usage Metering And a valid "appKeyAuth" key in the system And an instance of "UsageMetering" API + @generated @skip @team:DataDog/red-zone-revenue-query + Scenario: Get Hourly Usage Attribution returns "OK" response + Given operation "GetHourlyUsageAttribution" enabled + And new "GetHourlyUsageAttribution" request + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/red-zone-revenue-query Scenario: Get Usage Attribution returns "OK" response Given operation "GetUsageAttribution" enabled