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 Usage Attribution endpoint #161

Merged
merged 1 commit into from
Nov 19, 2020
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.3.0",
"regenerated": "2020-11-18 17:04:46.172436",
"spec_repo_commit": "e3c8008"
"regenerated": "2020-11-19 18:22:25.812062",
"spec_repo_commit": "171775a"
},
"v2": {
"apigentools_version": "1.3.0",
"regenerated": "2020-11-18 17:04:56.312456",
"spec_repo_commit": "e3c8008"
"regenerated": "2020-11-19 18:22:36.800055",
"spec_repo_commit": "171775a"
}
}
}
10 changes: 10 additions & 0 deletions docs/v1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ Class | Method | HTTP request | Description
*UsageMeteringApi* | [**get_specified_monthly_custom_reports**](UsageMeteringApi.md#get_specified_monthly_custom_reports) | **GET** /api/v1/monthly_custom_reports/{report_id} | Get specified monthly custom reports
*UsageMeteringApi* | [**get_tracing_without_limits**](UsageMeteringApi.md#get_tracing_without_limits) | **GET** /api/v1/usage/tracing-without-limits | Get hourly usage for tracing without limits
*UsageMeteringApi* | [**get_usage_analyzed_logs**](UsageMeteringApi.md#get_usage_analyzed_logs) | **GET** /api/v1/usage/analyzed_logs | Get hourly usage for analyzed logs
*UsageMeteringApi* | [**get_usage_attribution**](UsageMeteringApi.md#get_usage_attribution) | **GET** /api/v1/usage/attribution | Get Usage Attribution
*UsageMeteringApi* | [**get_usage_billable_summary**](UsageMeteringApi.md#get_usage_billable_summary) | **GET** /api/v1/usage/billable-summary | Get billable usage across your multi-org account
*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
Expand Down Expand Up @@ -598,6 +599,15 @@ Class | Method | HTTP request | Description
- [ToplistWidgetRequest](ToplistWidgetRequest.md)
- [UsageAnalyzedLogsHour](UsageAnalyzedLogsHour.md)
- [UsageAnalyzedLogsResponse](UsageAnalyzedLogsResponse.md)
- [UsageAttributionAggregates](UsageAttributionAggregates.md)
- [UsageAttributionAggregatesBody](UsageAttributionAggregatesBody.md)
- [UsageAttributionBody](UsageAttributionBody.md)
- [UsageAttributionMetadata](UsageAttributionMetadata.md)
- [UsageAttributionPagination](UsageAttributionPagination.md)
- [UsageAttributionResponse](UsageAttributionResponse.md)
- [UsageAttributionSort](UsageAttributionSort.md)
- [UsageAttributionTagNames](UsageAttributionTagNames.md)
- [UsageAttributionValues](UsageAttributionValues.md)
- [UsageBillableSummaryBody](UsageBillableSummaryBody.md)
- [UsageBillableSummaryHour](UsageBillableSummaryHour.md)
- [UsageBillableSummaryKeys](UsageBillableSummaryKeys.md)
Expand Down
11 changes: 11 additions & 0 deletions docs/v1/UsageAttributionAggregates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# UsageAttributionAggregates

An array of available aggregates.
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**value** | [**[UsageAttributionAggregatesBody]**](UsageAttributionAggregatesBody.md) | An array of available aggregates. |

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


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

The object containing the aggregates.
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**agg_type** | **str** | The aggregate type. | [optional]
**field** | **str** | The field. | [optional]
**value** | **float** | The value for a given field. | [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)


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

Usage Summary by tag for a given organization.
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**month** | **datetime** | Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM]. | [optional]
**public_id** | **str** | The organization public ID. | [optional]
**tags** | [**UsageAttributionTagNames**](UsageAttributionTagNames.md) | | [optional]
**updated_at** | **str** | Shows the the most recent hour in the current months for all organizations for which all usages were calculated. | [optional]
**values** | [**UsageAttributionValues**](UsageAttributionValues.md) | | [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)


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

The object containing document metadata.
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**aggregates** | [**UsageAttributionAggregates**](UsageAttributionAggregates.md) | | [optional]
**pagination** | [**UsageAttributionPagination**](UsageAttributionPagination.md) | | [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)


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

The page count for the current pagination.
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**limit** | **int** | Maximum amount of records to be returned. | [optional]
**offset** | **int** | Records to be skipped before beginning to return. | [optional]
**sort_direction** | **str** | Direction to sort by. | [optional]
**sort_name** | **str** | Field to sort by. | [optional]
**total_number_of_records** | **int** | Total number of records. | [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)


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

Response containing the Usage Summary by tag(s).
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**metadata** | [**UsageAttributionMetadata**](UsageAttributionMetadata.md) | | [optional]
**usage** | [**[UsageAttributionBody]**](UsageAttributionBody.md) | Get Usage Summary by tag(s). | [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/UsageAttributionSort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# UsageAttributionSort

The field to sort by.
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**value** | **str** | The field to sort by. | defaults to "custom_timeseries_usage", must be one of ["api_percentage", "snmp_usage", "lambda_percentage", "apm_host_usage", "api_usage", "container_usage", "custom_timeseries_percentage", "container_percentage", "lambda_usage", "apm_host_percentage", "npm_host_percentage", "browser_percentage", "browser_usage", "infra_host_percentage", "snmp_percentage", "npm_host_usage", "infra_host_usage", "custom_timeseries_usage", ]

[[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/UsageAttributionTagNames.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# UsageAttributionTagNames

Usage Summary by tag name.
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**any string name** | **[str]** | any string name can be used but the value must be the correct type | [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)


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

Fields in Usage Summary by tag(s).
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**api_percentage** | **float** | The percentage of synthetic API test usage by tag(s). | [optional]
**api_usage** | **float** | The synthetic API test usage by tag(s). | [optional]
**apm_host_percentage** | **float** | The percentage of APM host usage by tag(s). | [optional]
**apm_host_usage** | **float** | The APM host usage by tag(s). | [optional]
**browser_percentage** | **float** | The percentage of synthetic browser test usage by tag(s). | [optional]
**browser_usage** | **float** | The synthetic browser test usage by tag(s). | [optional]
**container_percentage** | **float** | The percentage of container usage by tag(s). | [optional]
**container_usage** | **float** | The container usage by tag(s). | [optional]
**custom_timeseries_percentage** | **float** | The percentage of custom metrics usage by tag(s). | [optional]
**custom_timeseries_usage** | **float** | The custom metrics usage by tag(s). | [optional]
**infra_host_percentage** | **float** | The percentage of infrastructure host usage by tag(s). | [optional]
**infra_host_usage** | **float** | The infrastructure host usage by tag(s). | [optional]
**lambda_percentage** | **float** | The percentage of lambda function usage by tag(s). | [optional]
**lambda_usage** | **float** | The lambda function usage by tag(s). | [optional]
**npm_host_percentage** | **float** | The percentage of network host usage by tag(s). | [optional]
**npm_host_usage** | **float** | The network host usage by tag(s). | [optional]
**snmp_percentage** | **float** | The percentage of network device usage by tag(s). | [optional]
**snmp_usage** | **float** | The network device usage by tag(s). | [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)


103 changes: 103 additions & 0 deletions docs/v1/UsageMeteringApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Method | HTTP request | Description
[**get_specified_monthly_custom_reports**](UsageMeteringApi.md#get_specified_monthly_custom_reports) | **GET** /api/v1/monthly_custom_reports/{report_id} | Get specified monthly custom reports
[**get_tracing_without_limits**](UsageMeteringApi.md#get_tracing_without_limits) | **GET** /api/v1/usage/tracing-without-limits | Get hourly usage for tracing without limits
[**get_usage_analyzed_logs**](UsageMeteringApi.md#get_usage_analyzed_logs) | **GET** /api/v1/usage/analyzed_logs | Get hourly usage for analyzed logs
[**get_usage_attribution**](UsageMeteringApi.md#get_usage_attribution) | **GET** /api/v1/usage/attribution | Get Usage Attribution
[**get_usage_billable_summary**](UsageMeteringApi.md#get_usage_billable_summary) | **GET** /api/v1/usage/billable-summary | Get billable usage across your multi-org account
[**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
Expand Down Expand Up @@ -762,6 +763,108 @@ 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_attribution**
> UsageAttributionResponse get_usage_attribution(start_month, fields)

Get Usage Attribution

Get Usage Attribution.

### Example

* Api Key Authentication (apiKeyAuth):
* Api Key Authentication (appKeyAuth):
```python
import os
from dateutil.parser import parse as dateutil_parser
import datadog_api_client.v1
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"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

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

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKeyAuth'] = 'Bearer'

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

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['appKeyAuth'] = 'Bearer'

# Enter a context with an instance of the API client
with datadog_api_client.v1.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = usage_metering_api.UsageMeteringApi(api_client)
start_month = dateutil_parser('1970-01-01T00:00:00.00Z') # datetime | Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for usage beginning in this month. Maximum of 15 months ago.
fields = "fields_example" # str | The specified field to search results for.
end_month = dateutil_parser('1970-01-01T00:00:00.00Z') # datetime | Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for usage ending this month. (optional)
org_id = 1 # int | Include usage summaries for each sub-org. (optional)
sort_direction = UsageSortDirection("desc") # UsageSortDirection | The direction to sort by: `[desc, asc]`. (optional)
sort_name = UsageAttributionSort("custom_timeseries_usage") # UsageAttributionSort | The field to sort by. (optional)

# example passing only required values which don't have defaults set
try:
# Get Usage Attribution
api_response = api_instance.get_usage_attribution(start_month, fields)
pprint(api_response)
except datadog_api_client.v1.ApiException as e:
print("Exception when calling UsageMeteringApi->get_usage_attribution: %s\n" % e)

# example passing only required values which don't have defaults set
# and optional values
try:
# Get Usage Attribution
api_response = api_instance.get_usage_attribution(start_month, fields, end_month=end_month, org_id=org_id, sort_direction=sort_direction, sort_name=sort_name)
pprint(api_response)
except datadog_api_client.v1.ApiException as e:
print("Exception when calling UsageMeteringApi->get_usage_attribution: %s\n" % e)
```

### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**start_month** | **datetime**| Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for usage beginning in this month. Maximum of 15 months ago. |
**fields** | **str**| The specified field to search results for. |
**end_month** | **datetime**| Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for usage ending this month. | [optional]
**org_id** | **int**| Include usage summaries for each sub-org. | [optional]
**sort_direction** | **UsageSortDirection**| The direction to sort by: `[desc, asc]`. | [optional]
**sort_name** | **UsageAttributionSort**| The field to sort by. | [optional]

### Return type

[**UsageAttributionResponse**](UsageAttributionResponse.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 | - |
**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_billable_summary**
> UsageBillableSummaryResponse get_usage_billable_summary()

Expand Down
Loading