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 #251

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.496255",
"spec_repo_commit": "6dc3341"
"regenerated": "2021-01-29 12:49:08.176509",
"spec_repo_commit": "bc876ff"
},
"v2": {
"apigentools_version": "1.4.1.dev2",
"regenerated": "2021-01-29 07:53:05.627056",
"spec_repo_commit": "6dc3341"
"regenerated": "2021-01-29 12:49:19.740192",
"spec_repo_commit": "bc876ff"
}
}
}
3 changes: 3 additions & 0 deletions docs/v1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ Class | Method | HTTP request | Description
*UsageMeteringApi* | [**get_usage_fargate**](UsageMeteringApi.md#get_usage_fargate) | **GET** /api/v1/usage/fargate | Get hourly usage for Fargate
*UsageMeteringApi* | [**get_usage_hosts**](UsageMeteringApi.md#get_usage_hosts) | **GET** /api/v1/usage/hosts | Get hourly usage for hosts and containers
*UsageMeteringApi* | [**get_usage_indexed_spans**](UsageMeteringApi.md#get_usage_indexed_spans) | **GET** /api/v1/usage/indexed-spans | Get hourly usage for indexed spans
*UsageMeteringApi* | [**get_usage_internet_of_things**](UsageMeteringApi.md#get_usage_internet_of_things) | **GET** /api/v1/usage/iot | Get hourly usage for IoT
*UsageMeteringApi* | [**get_usage_lambda**](UsageMeteringApi.md#get_usage_lambda) | **GET** /api/v1/usage/aws_lambda | Get hourly usage for Lambda
*UsageMeteringApi* | [**get_usage_logs**](UsageMeteringApi.md#get_usage_logs) | **GET** /api/v1/usage/logs | Get hourly usage for Logs
*UsageMeteringApi* | [**get_usage_logs_by_index**](UsageMeteringApi.md#get_usage_logs_by_index) | **GET** /api/v1/usage/logs_by_index | Get hourly usage for Logs by Index
Expand Down Expand Up @@ -669,6 +670,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
12 changes: 12 additions & 0 deletions docs/v1/UsageIoTHour.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# UsageIoTHour

IoT usage for a given organization for a given hour.
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**hour** | **datetime** | The hour for the usage. | [optional]
**iot_device_count** | **int** | The total number of IoT device hours from the start of the given hour's month until the given hour. | [optional]

[[Back to Model list]](README.md#documentation-for-models) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to README]](README.md)


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

Response containing the IoT usage for each hour for a given organization.
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**usage** | [**[UsageIoTHour]**](UsageIoTHour.md) | Get hourly usage for IoT. | [optional]

[[Back to Model list]](README.md#documentation-for-models) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to README]](README.md)


85 changes: 85 additions & 0 deletions docs/v1/UsageMeteringApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Method | HTTP request | Description
[**get_usage_fargate**](UsageMeteringApi.md#get_usage_fargate) | **GET** /api/v1/usage/fargate | Get hourly usage for Fargate
[**get_usage_hosts**](UsageMeteringApi.md#get_usage_hosts) | **GET** /api/v1/usage/hosts | Get hourly usage for hosts and containers
[**get_usage_indexed_spans**](UsageMeteringApi.md#get_usage_indexed_spans) | **GET** /api/v1/usage/indexed-spans | Get hourly usage for indexed spans
[**get_usage_internet_of_things**](UsageMeteringApi.md#get_usage_internet_of_things) | **GET** /api/v1/usage/iot | Get hourly usage for IoT
[**get_usage_lambda**](UsageMeteringApi.md#get_usage_lambda) | **GET** /api/v1/usage/aws_lambda | Get hourly usage for Lambda
[**get_usage_logs**](UsageMeteringApi.md#get_usage_logs) | **GET** /api/v1/usage/logs | Get hourly usage for Logs
[**get_usage_logs_by_index**](UsageMeteringApi.md#get_usage_logs_by_index) | **GET** /api/v1/usage/logs_by_index | Get hourly usage for Logs by Index
Expand Down Expand Up @@ -1095,6 +1096,90 @@ Name | Type | Description | Notes

[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)

# **get_usage_internet_of_things**
> UsageIoTResponse get_usage_internet_of_things(start_hr)

Get hourly usage for IoT

Get hourly usage for IoT.

### Example

* Api Key Authentication (apiKeyAuth):
* Api Key Authentication (appKeyAuth):
```python
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v1 import ApiClient, ApiException, Configuration
from datadog_api_client.v1.api import usage_metering_api
from datadog_api_client.v1.models import *
from pprint import pprint
# Defining the host is optional and defaults to https://api.datadoghq.com
# See configuration.py for a list of all supported configuration parameters.
configuration = datadog_api_client.v1.Configuration(
host="https://api.datadoghq.com"
)

# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY')

# Configure API key authorization: appKeyAuth
configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')

# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = usage_metering_api.UsageMeteringApi(api_client)
start_hr = dateutil_parser('1970-01-01T00:00:00.00Z') # datetime | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage beginning at this hour.
end_hr = dateutil_parser('1970-01-01T00:00:00.00Z') # datetime | Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage ending **before** this hour. (optional)

# example passing only required values which don't have defaults set
try:
# Get hourly usage for IoT
api_response = api_instance.get_usage_internet_of_things(start_hr)
pprint(api_response)
except ApiException as e:
print("Exception when calling UsageMeteringApi->get_usage_internet_of_things: %s\n" % e)

# example passing only required values which don't have defaults set
# and optional values
try:
# Get hourly usage for IoT
api_response = api_instance.get_usage_internet_of_things(start_hr, end_hr=end_hr)
pprint(api_response)
except ApiException as e:
print("Exception when calling UsageMeteringApi->get_usage_internet_of_things: %s\n" % e)
```

### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**start_hr** | **datetime**| Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage beginning at this hour. |
**end_hr** | **datetime**| Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` 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 | - |

[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)

# **get_usage_lambda**
> UsageLambdaResponse get_usage_lambda(start_hr)

Expand Down
2 changes: 2 additions & 0 deletions docs/v1/UsageSummaryDate.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Name | Type | Description | Notes
**indexed_events_count_sum** | **int** | Shows the sum of all log events indexed over all hours in the current date for all organizations. | [optional]
**infra_host_top99p** | **int** | Shows the 99th percentile of all distinct infrastructure hosts over all hours in the current date for all organizations. | [optional]
**ingested_events_bytes_sum** | **int** | Shows the sum of all log bytes ingested over all hours in the current date for all organizations. | [optional]
**iot_device_agg_sum** | **int** | Shows the sum of all IoT devices over all hours in the current date for all organizations. | [optional]
**iot_device_top99p_sum** | **int** | Shows the 99th percentile of all IoT devices over all hours in the current date all organizations. | [optional]
**mobile_rum_session_count_android_sum** | **int** | Shows the sum of all mobile RUM Sessions on Android over all hours in the current date for all organizations. | [optional]
**mobile_rum_session_count_ios_sum** | **int** | Shows the sum of all mobile RUM Sessions on iOS over all hours in the current date for all organizations. | [optional]
**mobile_rum_session_count_sum** | **int** | 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 docs/v1/UsageSummaryDateOrg.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Name | Type | Description | Notes
**indexed_events_count_sum** | **int** | Shows the sum of all log events indexed over all hours in the current date for the given org. | [optional]
**infra_host_top99p** | **int** | Shows the 99th percentile of all distinct infrastructure hosts over all hours in the current date for the given org. | [optional]
**ingested_events_bytes_sum** | **int** | Shows the sum of all log bytes ingested over all hours in the current date for the given org. | [optional]
**iot_device_agg_sum** | **int** | Shows the sum of all IoT devices over all hours in the current date for the given org. | [optional]
**iot_device_top99p_sum** | **int** | Shows the 99th percentile of all IoT devices over all hours in the current date for the given org. | [optional]
**mobile_rum_session_count_android_sum** | **int** | Shows the sum of all mobile RUM Sessions on Android over all hours in the current date for the given org. | [optional]
**mobile_rum_session_count_ios_sum** | **int** | Shows the sum of all mobile RUM Sessions on iOS over all hours in the current date for the given org. | [optional]
**mobile_rum_session_count_sum** | **int** | 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 docs/v1/UsageSummaryResponse.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Name | Type | Description | Notes
**indexed_events_count_agg_sum** | **int** | Shows the sum of all log events indexed over all hours in the current months for all organizations. | [optional]
**infra_host_top99p_sum** | **int** | Shows the 99th percentile of all distinct infrastructure hosts over all hours in the current months for all organizations. | [optional]
**ingested_events_bytes_agg_sum** | **int** | Shows the sum of all log bytes ingested over all hours in the current months for all organizations. | [optional]
**iot_device_agg_sum** | **int** | Shows the sum of all IoT devices over all hours in the current months for all organizations. | [optional]
**iot_device_top99p_sum** | **int** | Shows the 99th percentile of all IoT devices over all hours in the current months of all organizations. | [optional]
**last_updated** | **datetime** | Shows the the most recent hour in the current months for all organizations for which all usages were calculated. | [optional]
**live_indexed_events_agg_sum** | **int** | 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]
**live_ingested_bytes_agg_sum** | **int** | 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
127 changes: 127 additions & 0 deletions src/datadog_api_client/v1/api/usage_metering_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from datadog_api_client.v1.model.usage_incident_management_response import UsageIncidentManagementResponse
from datadog_api_client.v1.model.usage_indexed_spans_response import UsageIndexedSpansResponse
from datadog_api_client.v1.model.usage_ingested_spans_response import UsageIngestedSpansResponse
from datadog_api_client.v1.model.usage_io_t_response import UsageIoTResponse
from datadog_api_client.v1.model.usage_lambda_response import UsageLambdaResponse
from datadog_api_client.v1.model.usage_logs_by_index_response import UsageLogsByIndexResponse
from datadog_api_client.v1.model.usage_logs_response import UsageLogsResponse
Expand Down Expand Up @@ -1708,6 +1709,132 @@ def __get_usage_indexed_spans(
callable=__get_usage_indexed_spans
)

def __get_usage_internet_of_things(
self,
start_hr,
**kwargs
):
"""Get hourly usage for IoT # noqa: E501

Get hourly usage for IoT. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True

>>> thread = api.get_usage_internet_of_things(start_hr, async_req=True)
>>> result = thread.get()

Args:
start_hr (datetime): Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage beginning at this hour.

Keyword Args:
end_hr (datetime): Datetime in ISO-8601 format, UTC, precise to hour: `[YYYY-MM-DDThh]` for usage ending **before** this hour.. [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (float/tuple): timeout setting for this request. If one
number provided, it will be total request timeout. It can also
be a pair (tuple) of (connection, read) timeouts.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously

Returns:
UsageIoTResponse
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['start_hr'] = \
start_hr
return self.call_with_http_info(**kwargs)

self.get_usage_internet_of_things = _Endpoint(
settings={
'response_type': (UsageIoTResponse,),
'auth': [
'apiKeyAuth',
'appKeyAuth'
],
'endpoint_path': '/api/v1/usage/iot',
'operation_id': 'get_usage_internet_of_things',
'http_method': 'GET',
'servers': None,
},
params_map={
'all': [
'start_hr',
'end_hr',
],
'required': [
'start_hr',
],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'start_hr':
(datetime,),
'end_hr':
(datetime,),
},
'attribute_map': {
'start_hr': 'start_hr',
'end_hr': 'end_hr',
},
'location_map': {
'start_hr': 'query',
'end_hr': 'query',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'application/json;datetime-format=rfc3339'
],
'content_type': [],
},
api_client=api_client,
callable=__get_usage_internet_of_things
)

def __get_usage_lambda(
self,
start_hr,
Expand Down
Loading