Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add endpoint for IoT billing usage #631

Merged
merged 1 commit into from
Jan 29, 2021
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
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.4.1.dev2",
"regenerated": "2021-01-29 07:52:53.308581",
"spec_repo_commit": "6dc3341"
"regenerated": "2021-01-29 12:49:43.486193",
"spec_repo_commit": "bc876ff"
},
"v2": {
"apigentools_version": "1.4.1.dev2",
"regenerated": "2021-01-29 07:53:03.170641",
"spec_repo_commit": "6dc3341"
"regenerated": "2021-01-29 12:49:54.642406",
"spec_repo_commit": "bc876ff"
}
}
}
3 changes: 3 additions & 0 deletions api_docs/v1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ Class | Method | HTTP request | Description
*UsageMeteringApi* | [**getUsageFargate**](UsageMeteringApi.md#getUsageFargate) | **GET** /api/v1/usage/fargate | Get hourly usage for Fargate
*UsageMeteringApi* | [**getUsageHosts**](UsageMeteringApi.md#getUsageHosts) | **GET** /api/v1/usage/hosts | Get hourly usage for hosts and containers
*UsageMeteringApi* | [**getUsageIndexedSpans**](UsageMeteringApi.md#getUsageIndexedSpans) | **GET** /api/v1/usage/indexed-spans | Get hourly usage for indexed spans
*UsageMeteringApi* | [**getUsageInternetOfThings**](UsageMeteringApi.md#getUsageInternetOfThings) | **GET** /api/v1/usage/iot | Get hourly usage for IoT
*UsageMeteringApi* | [**getUsageLambda**](UsageMeteringApi.md#getUsageLambda) | **GET** /api/v1/usage/aws_lambda | Get hourly usage for Lambda
*UsageMeteringApi* | [**getUsageLogs**](UsageMeteringApi.md#getUsageLogs) | **GET** /api/v1/usage/logs | Get hourly usage for Logs
*UsageMeteringApi* | [**getUsageLogsByIndex**](UsageMeteringApi.md#getUsageLogsByIndex) | **GET** /api/v1/usage/logs_by_index | Get hourly usage for Logs by Index
Expand Down Expand Up @@ -563,6 +564,8 @@ Class | Method | HTTP request | Description
- [UsageIndexedSpansResponse](UsageIndexedSpansResponse.md)
- [UsageIngestedSpansHour](UsageIngestedSpansHour.md)
- [UsageIngestedSpansResponse](UsageIngestedSpansResponse.md)
- [UsageIoTHour](UsageIoTHour.md)
- [UsageIoTResponse](UsageIoTResponse.md)
- [UsageLambdaHour](UsageLambdaHour.md)
- [UsageLambdaResponse](UsageLambdaResponse.md)
- [UsageLogsByIndexHour](UsageLogsByIndexHour.md)
Expand Down
14 changes: 14 additions & 0 deletions api_docs/v1/UsageIoTHour.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@


# UsageIoTHour

IoT usage for a given organization for a given hour.
## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**hour** | **OffsetDateTime** | The hour for the usage. | [optional]
**iotDeviceCount** | **Long** | The total number of IoT device hours from the start of the given hour's month until the given hour. | [optional]



13 changes: 13 additions & 0 deletions api_docs/v1/UsageIoTResponse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@


# UsageIoTResponse

Response containing the IoT usage for each hour for a given organization.
## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**usage** | [**List<UsageIoTHour>**](UsageIoTHour.md) | Get hourly usage for IoT. | [optional]



87 changes: 87 additions & 0 deletions api_docs/v1/UsageMeteringApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Method | HTTP request | Description
[**getUsageFargate**](UsageMeteringApi.md#getUsageFargate) | **GET** /api/v1/usage/fargate | Get hourly usage for Fargate
[**getUsageHosts**](UsageMeteringApi.md#getUsageHosts) | **GET** /api/v1/usage/hosts | Get hourly usage for hosts and containers
[**getUsageIndexedSpans**](UsageMeteringApi.md#getUsageIndexedSpans) | **GET** /api/v1/usage/indexed-spans | Get hourly usage for indexed spans
[**getUsageInternetOfThings**](UsageMeteringApi.md#getUsageInternetOfThings) | **GET** /api/v1/usage/iot | Get hourly usage for IoT
[**getUsageLambda**](UsageMeteringApi.md#getUsageLambda) | **GET** /api/v1/usage/aws_lambda | Get hourly usage for Lambda
[**getUsageLogs**](UsageMeteringApi.md#getUsageLogs) | **GET** /api/v1/usage/logs | Get hourly usage for Logs
[**getUsageLogsByIndex**](UsageMeteringApi.md#getUsageLogsByIndex) | **GET** /api/v1/usage/logs_by_index | Get hourly usage for Logs by Index
Expand Down Expand Up @@ -1159,6 +1160,92 @@ Name | Type | Description | Notes
| **403** | Forbidden - User is not authorized | - |


## getUsageInternetOfThings

> UsageIoTResponse getUsageInternetOfThings().startHr(startHr).endHr(endHr).execute();

Get hourly usage for IoT

Get hourly usage for IoT.

### Example

```java
import java.time.OffsetDateTime;
// Import classes:
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.auth.*;
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();
// Configure the Datadog site to send API calls to
HashMap<String, String> serverVariables = new HashMap<String, String>();
String site = System.getenv("DD_SITE");
if (site != null) {
serverVariables.put("site", site);
defaultClient.setServerVariables(serverVariables);
}
// Configure API key authorization:
HashMap<String, String> secrets = new HashMap<String, String>();
secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
defaultClient.configureApiKeys(secrets);

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.
OffsetDateTime endHr = OffsetDateTime.now(); // OffsetDateTime | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage ending **before** this hour.
try {
UsageIoTResponse result = apiInstance.getUsageInternetOfThings()
.startHr(startHr)
.endHr(endHr)
.execute();
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling UsageMeteringApi#getUsageInternetOfThings");
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: &#x60;[YYYY-MM-DDThh]&#x60; for usage beginning at this hour. |
**endHr** | **OffsetDateTime**| Datetime in ISO-8601 format, UTC, precise to hour: &#x60;[YYYY-MM-DDThh]&#x60; for usage ending **before** this hour. | [optional]

### Return type

[**UsageIoTResponse**](UsageIoTResponse.md)

### Authorization

[apiKeyAuth](README.md#apiKeyAuth), [appKeyAuth](README.md#appKeyAuth)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json;datetime-format=rfc3339

### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | OK | - |
| **400** | Bad Request | - |
| **403** | Forbidden - User is not authorized | - |


## getUsageLambda

> UsageLambdaResponse getUsageLambda().startHr(startHr).endHr(endHr).execute();
Expand Down
2 changes: 2 additions & 0 deletions api_docs/v1/UsageSummaryDate.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Name | Type | Description | Notes
**indexedEventsCountSum** | **Long** | Shows the sum of all log events indexed over all hours in the current date for all organizations. | [optional]
**infraHostTop99p** | **Long** | Shows the 99th percentile of all distinct infrastructure hosts over all hours in the current date for all organizations. | [optional]
**ingestedEventsBytesSum** | **Long** | Shows the sum of all log bytes ingested over all hours in the current date for all organizations. | [optional]
**iotDeviceAggSum** | **Long** | Shows the sum of all IoT devices over all hours in the current date for all organizations. | [optional]
**iotDeviceTop99pSum** | **Long** | Shows the 99th percentile of all IoT devices over all hours in the current date all organizations. | [optional]
**mobileRumSessionCountAndroidSum** | **Long** | Shows the sum of all mobile RUM Sessions on Android over all hours in the current date for all organizations. | [optional]
**mobileRumSessionCountIosSum** | **Long** | Shows the sum of all mobile RUM Sessions on iOS over all hours in the current date for all organizations. | [optional]
**mobileRumSessionCountSum** | **Long** | Shows the sum of all mobile RUM Sessions over all hours in the current date for all organizations | [optional]
Expand Down
2 changes: 2 additions & 0 deletions api_docs/v1/UsageSummaryDateOrg.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Name | Type | Description | Notes
**indexedEventsCountSum** | **Long** | Shows the sum of all log events indexed over all hours in the current date for the given org. | [optional]
**infraHostTop99p** | **Long** | Shows the 99th percentile of all distinct infrastructure hosts over all hours in the current date for the given org. | [optional]
**ingestedEventsBytesSum** | **Long** | Shows the sum of all log bytes ingested over all hours in the current date for the given org. | [optional]
**iotDeviceAggSum** | **Long** | Shows the sum of all IoT devices over all hours in the current date for the given org. | [optional]
**iotDeviceTop99pSum** | **Long** | Shows the 99th percentile of all IoT devices over all hours in the current date for the given org. | [optional]
**mobileRumSessionCountAndroidSum** | **Long** | Shows the sum of all mobile RUM Sessions on Android over all hours in the current date for the given org. | [optional]
**mobileRumSessionCountIosSum** | **Long** | Shows the sum of all mobile RUM Sessions on iOS over all hours in the current date for the given org. | [optional]
**mobileRumSessionCountSum** | **Long** | Shows the sum of all mobile RUM Sessions over all hours in the current date for the given org. | [optional]
Expand Down
2 changes: 2 additions & 0 deletions api_docs/v1/UsageSummaryResponse.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Name | Type | Description | Notes
**indexedEventsCountAggSum** | **Long** | Shows the sum of all log events indexed over all hours in the current months for all organizations. | [optional]
**infraHostTop99pSum** | **Long** | Shows the 99th percentile of all distinct infrastructure hosts over all hours in the current months for all organizations. | [optional]
**ingestedEventsBytesAggSum** | **Long** | Shows the sum of all log bytes ingested over all hours in the current months for all organizations. | [optional]
**iotDeviceAggSum** | **Long** | Shows the sum of all IoT devices over all hours in the current months for all organizations. | [optional]
**iotDeviceTop99pSum** | **Long** | Shows the 99th percentile of all IoT devices over all hours in the current months of all organizations. | [optional]
**lastUpdated** | **OffsetDateTime** | Shows the the most recent hour in the current months for all organizations for which all usages were calculated. | [optional]
**liveIndexedEventsAggSum** | **Long** | Shows the sum of all live logs indexed over all hours in the current months for all organizations (data available as of December 1, 2020). | [optional]
**liveIngestedBytesAggSum** | **Long** | Shows the sum of all live logs bytes ingested over all hours in the current months for all organizations (data available as of December 1, 2020). | [optional]
Expand Down
121 changes: 121 additions & 0 deletions src/main/java/com/datadog/api/v1/client/api/UsageMeteringApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.datadog.api.v1.client.model.UsageIncidentManagementResponse;
import com.datadog.api.v1.client.model.UsageIndexedSpansResponse;
import com.datadog.api.v1.client.model.UsageIngestedSpansResponse;
import com.datadog.api.v1.client.model.UsageIoTResponse;
import com.datadog.api.v1.client.model.UsageLambdaResponse;
import com.datadog.api.v1.client.model.UsageLogsByIndexResponse;
import com.datadog.api.v1.client.model.UsageLogsResponse;
Expand Down Expand Up @@ -1686,6 +1687,126 @@ public APIgetUsageIndexedSpansRequest getUsageIndexedSpans() throws ApiException
return new APIgetUsageIndexedSpansRequest();
}

private ApiResponse<UsageIoTResponse> getUsageInternetOfThingsWithHttpInfo(OffsetDateTime startHr, OffsetDateTime endHr) 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 getUsageInternetOfThings");
}

// create path and map variables
String localVarPath = "/api/v1/usage/iot";

// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, String> localVarCookieParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();

localVarQueryParams.addAll(apiClient.parameterToPairs("", "start_hr", startHr));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_hr", endHr));

// Set Operation-ID header for telemetry
localVarHeaderParams.put("DD-OPERATION-ID", "getUsageInternetOfThings");




final String[] localVarAccepts = {
"application/json;datetime-format=rfc3339"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

final String[] localVarContentTypes = {

};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

String[] localVarAuthNames = new String[] { "apiKeyAuth", "appKeyAuth" };

GenericType<UsageIoTResponse> localVarReturnType = new GenericType<UsageIoTResponse>() {};

return apiClient.invokeAPI("UsageMeteringApi.getUsageInternetOfThings", localVarPath, "GET", localVarQueryParams, localVarPostBody,
localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType,
localVarAuthNames, localVarReturnType, false);
}

public class APIgetUsageInternetOfThingsRequest {
private OffsetDateTime startHr;
private OffsetDateTime endHr;

private APIgetUsageInternetOfThingsRequest() {
}

/**
* Set startHr
* @param startHr Datetime in ISO-8601 format, UTC, precise to hour: &#x60;[YYYY-MM-DDThh]&#x60; for usage beginning at this hour. (required)
* @return APIgetUsageInternetOfThingsRequest
*/
public APIgetUsageInternetOfThingsRequest startHr(OffsetDateTime startHr) {
this.startHr = startHr;
return this;
}

/**
* Set endHr
* @param endHr Datetime in ISO-8601 format, UTC, precise to hour: &#x60;[YYYY-MM-DDThh]&#x60; for usage ending **before** this hour. (optional)
* @return APIgetUsageInternetOfThingsRequest
*/
public APIgetUsageInternetOfThingsRequest endHr(OffsetDateTime endHr) {
this.endHr = endHr;
return this;
}

/**
* Execute getUsageInternetOfThings request
* @return UsageIoTResponse
* @throws ApiException if fails to make API call
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 200 </td><td> OK </td><td> - </td></tr>
<tr><td> 400 </td><td> Bad Request </td><td> - </td></tr>
<tr><td> 403 </td><td> Forbidden - User is not authorized </td><td> - </td></tr>
</table>

*/

public UsageIoTResponse execute() throws ApiException {
return this.executeWithHttpInfo().getData();
}

/**
* Execute getUsageInternetOfThings request with HTTP info returned
* @return ApiResponse&lt;UsageIoTResponse&gt;
* @throws ApiException if fails to make API call
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 200 </td><td> OK </td><td> - </td></tr>
<tr><td> 400 </td><td> Bad Request </td><td> - </td></tr>
<tr><td> 403 </td><td> Forbidden - User is not authorized </td><td> - </td></tr>
</table>

*/
public ApiResponse<UsageIoTResponse> executeWithHttpInfo() throws ApiException {
return getUsageInternetOfThingsWithHttpInfo(startHr, endHr);
}
}

/**
* Get hourly usage for IoT
* Get hourly usage for IoT.
* @return getUsageInternetOfThingsRequest
* @throws ApiException if fails to make API call


*/
public APIgetUsageInternetOfThingsRequest getUsageInternetOfThings() throws ApiException {
return new APIgetUsageInternetOfThingsRequest();
}

private ApiResponse<UsageLambdaResponse> getUsageLambdaWithHttpInfo(OffsetDateTime startHr, OffsetDateTime endHr) throws ApiException {
Object localVarPostBody = null;

Expand Down
Loading