Skip to content

Commit 3716c5c

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 432578c of spec repo
1 parent bfc09fe commit 3716c5c

File tree

8 files changed

+108
-5
lines changed

8 files changed

+108
-5
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.5.1.dev2",
7-
"regenerated": "2022-01-11 14:01:05.792618",
8-
"spec_repo_commit": "0468fdc"
7+
"regenerated": "2022-01-11 16:59:50.649570",
8+
"spec_repo_commit": "432578c"
99
},
1010
"v2": {
1111
"apigentools_version": "1.5.1.dev2",
12-
"regenerated": "2022-01-11 14:01:05.810692",
13-
"spec_repo_commit": "0468fdc"
12+
"regenerated": "2022-01-11 16:59:50.681822",
13+
"spec_repo_commit": "432578c"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12116,6 +12116,11 @@ components:
1211612116
values:
1211712117
$ref: '#/components/schemas/UsageAttributionValues'
1211812118
type: object
12119+
UsageAttributionLimit:
12120+
default: 5000
12121+
description: Maximum number of records to be returned.
12122+
format: int64
12123+
type: integer
1211912124
UsageAttributionMetadata:
1212012125
description: The object containing document metadata.
1212112126
properties:
@@ -12124,6 +12129,11 @@ components:
1212412129
pagination:
1212512130
$ref: '#/components/schemas/UsageAttributionPagination'
1212612131
type: object
12132+
UsageAttributionOffset:
12133+
default: 0
12134+
description: Number of records to skip before beginning to return.
12135+
format: int64
12136+
type: integer
1212712137
UsageAttributionPagination:
1212812138
description: The metadata for the current pagination.
1212912139
properties:
@@ -24408,6 +24418,18 @@ paths:
2440824418
schema:
2440924419
default: false
2441024420
type: boolean
24421+
- description: Number of records to skip before beginning to return.
24422+
in: query
24423+
name: offset
24424+
required: false
24425+
schema:
24426+
$ref: '#/components/schemas/UsageAttributionOffset'
24427+
- description: Maximum number of records to be returned.
24428+
in: query
24429+
name: limit
24430+
required: false
24431+
schema:
24432+
$ref: '#/components/schemas/UsageAttributionLimit'
2441124433
responses:
2441224434
'200':
2441324435
content:

api/v1/datadog/api_usage_metering.go

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1/datadog/docs/UsageMeteringApi.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,11 +668,15 @@ func main() {
668668
sortDirection := datadog.UsageSortDirection("desc") // UsageSortDirection | The direction to sort by: `[desc, asc]`. (optional) (default to "desc")
669669
sortName := datadog.UsageAttributionSort("api_percentage") // UsageAttributionSort | The field to sort by. (optional) (default to "custom_timeseries_usage")
670670
includeDescendants := true // bool | Include child org usage in the response. Defaults to false. (optional) (default to false)
671+
offset := int64(789) // int64 | Number of records to skip before beginning to return. (optional) (default to 0)
672+
limit := int64(789) // int64 | Maximum number of records to be returned. (optional) (default to 5000)
671673
optionalParams := datadog.GetUsageAttributionOptionalParameters{
672674
EndMonth: &endMonth,
673675
SortDirection: &sortDirection,
674676
SortName: &sortName,
675677
IncludeDescendants: &includeDescendants,
678+
Offset: &offset,
679+
Limit: &limit,
676680
}
677681

678682
configuration := datadog.NewConfiguration()
@@ -708,6 +712,8 @@ Other parameters are passed through a pointer to a GetUsageAttributionOptionalPa
708712
| **sortDirection** | [**UsageSortDirection**](UsageSortDirection.md) | The direction to sort by: `[desc, asc]`. | [default to "desc"] |
709713
| **sortName** | [**UsageAttributionSort**](UsageAttributionSort.md) | The field to sort by. | [default to "custom_timeseries_usage"] |
710714
| **includeDescendants** | **bool** | Include child org usage in the response. Defaults to false. | [default to false] |
715+
| **offset** | **int64** | Number of records to skip before beginning to return. | [default to 0] |
716+
| **limit** | **int64** | Maximum number of records to be returned. | [default to 5000] |
711717

712718
### Return type
713719

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Get Usage Attribution returns "OK" response
2+
3+
package main
4+
5+
import (
6+
"context"
7+
"encoding/json"
8+
"fmt"
9+
"os"
10+
"time"
11+
12+
datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog"
13+
)
14+
15+
func main() {
16+
ctx := datadog.NewDefaultContext(context.Background())
17+
configuration := datadog.NewConfiguration()
18+
configuration.SetUnstableOperationEnabled("GetUsageAttribution", true)
19+
apiClient := datadog.NewAPIClient(configuration)
20+
resp, r, err := apiClient.UsageMeteringApi.GetUsageAttribution(ctx, time.Now().AddDate(0, 0, -3), datadog.USAGEATTRIBUTIONSUPPORTEDMETRICS_ALL, *datadog.NewGetUsageAttributionOptionalParameters().WithOffset(0).WithLimit(1))
21+
22+
if err != nil {
23+
fmt.Fprintf(os.Stderr, "Error when calling `UsageMeteringApi.GetUsageAttribution`: %v\n", err)
24+
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
25+
}
26+
27+
responseContent, _ := json.MarshalIndent(resp, "", " ")
28+
fmt.Fprintf(os.Stdout, "Response from `UsageMeteringApi.GetUsageAttribution`:\n%s\n", responseContent)
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2022-01-11T15:18:06.776Z
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
interactions:
2+
- request:
3+
body: ''
4+
form: {}
5+
headers:
6+
Accept:
7+
- application/json;datetime-format=rfc3339
8+
method: GET
9+
url: https://api.datadoghq.com/api/v1/usage/attribution?start_month=2022-01-08T15%3A18%3A06.776Z&fields=%2A&offset=0&limit=1
10+
response:
11+
body: '{"usage":[{"org_name":"DD Integration Tests (321813)","public_id":"fasjyydbcgwwc2uc","tag_config_source":"DD
12+
Integration Tests (321813):::project","tags":{"project":[]},"updated_at":"2022-01-10T14","month":"2022-01-01T00:00:00+00:00","values":{"lambda_percentage":0.0,"apm_host_usage":11,"api_usage":1524624,"dbm_hosts_percentage":0.0,"custom_timeseries_percentage":100.0,"fargate_usage":0.0,"cws_containers_usage":0.0,"profiled_host_percentage":0.0,"cws_hosts_usage":0,"cspm_hosts_percentage":0.0,"cws_hosts_percentage":0.0,"lambda_invocations_percentage":0.0,"infra_host_usage":5,"infra_host_percentage":27.78,"cspm_hosts_usage":0,"container_percentage":100.0,"profiled_host_usage":0,"dbm_queries_usage":0.0,"browser_usage":0,"snmp_percentage":0.0,"profiled_container_usage":0.0,"lambda_functions_usage":0.0,"snmp_usage":0,"api_percentage":100.0,"dbm_hosts_usage":0,"container_usage":1.02,"lambda_usage":0.0,"cspm_containers_usage":0.0,"cspm_containers_percentage":0.0,"npm_host_usage":0,"apm_host_percentage":100.0,"lambda_functions_percentage":0.0,"dbm_queries_percentage":0.0,"profiled_container_percentage":0.0,"npm_host_percentage":0.0,"lambda_invocations_usage":0,"fargate_percentage":0.0,"browser_percentage":0.0,"cws_containers_percentage":0.0,"custom_timeseries_usage":77.08}},{"org_name":"DD
13+
Integration Tests (321813)","public_id":"fasjyydbcgwwc2uc","tag_config_source":"DD
14+
Integration Tests (321813):::project","tags":{"project":["datadog-integrations-lab"]},"updated_at":"2022-01-10T14","month":"2022-01-01T00:00:00+00:00","values":{"lambda_percentage":0.0,"apm_host_usage":0,"api_usage":0,"dbm_hosts_percentage":0.0,"custom_timeseries_percentage":0.0,"fargate_usage":0.0,"cws_containers_usage":0.0,"profiled_host_percentage":0.0,"cws_hosts_usage":0,"cspm_hosts_percentage":0.0,"cws_hosts_percentage":0.0,"lambda_invocations_percentage":0.0,"infra_host_usage":13,"infra_host_percentage":72.22,"cspm_hosts_usage":0,"container_percentage":0.0,"profiled_host_usage":0,"dbm_queries_usage":0.0,"browser_usage":0,"snmp_percentage":0.0,"profiled_container_usage":0.0,"lambda_functions_usage":0.0,"snmp_usage":0,"api_percentage":0.0,"dbm_hosts_usage":0,"container_usage":0.0,"lambda_usage":0.0,"cspm_containers_usage":0.0,"cspm_containers_percentage":0.0,"npm_host_usage":0,"apm_host_percentage":0.0,"lambda_functions_percentage":0.0,"dbm_queries_percentage":0.0,"profiled_container_percentage":0.0,"npm_host_percentage":0.0,"lambda_invocations_usage":0,"fargate_percentage":0.0,"browser_percentage":0.0,"cws_containers_percentage":0.0,"custom_timeseries_usage":0.0}}],"metadata":{"pagination":{"sort_direction":"DESC","sort_name":"custom_timeseries_usage","limit":5000,"total_number_of_records":2,"offset":0},"aggregates":[{"field":"custom_timeseries_usage","value":77.08,"agg_type":"sum"},{"field":"container_usage","value":1.02,"agg_type":"sum"},{"field":"snmp_percentage","value":0.0,"agg_type":"sum"},{"field":"apm_host_usage","value":11.0,"agg_type":"sum"},{"field":"browser_usage","value":0.0,"agg_type":"sum"},{"field":"npm_host_percentage","value":0.0,"agg_type":"sum"},{"field":"infra_host_usage","value":18.0,"agg_type":"sum"},{"field":"custom_timeseries_percentage","value":100.0,"agg_type":"sum"},{"field":"container_percentage","value":100.0,"agg_type":"sum"},{"field":"lambda_usage","value":0.0,"agg_type":"sum"},{"field":"api_usage","value":1524624.0,"agg_type":"sum"},{"field":"apm_host_percentage","value":100.0,"agg_type":"sum"},{"field":"infra_host_percentage","value":100.0,"agg_type":"sum"},{"field":"snmp_usage","value":0.0,"agg_type":"sum"},{"field":"browser_percentage","value":0.0,"agg_type":"sum"},{"field":"api_percentage","value":100.0,"agg_type":"sum"},{"field":"lambda_percentage","value":0.0,"agg_type":"sum"},{"field":"npm_host_usage","value":0.0,"agg_type":"sum"},{"field":"lambda_functions_usage","value":0.0,"agg_type":"sum"},{"field":"lambda_functions_percentage","value":0.0,"agg_type":"sum"},{"field":"lambda_invocations_usage","value":0.0,"agg_type":"sum"},{"field":"lambda_invocations_percentage","value":0.0,"agg_type":"sum"},{"field":"fargate_usage","value":0.0,"agg_type":"sum"},{"field":"fargate_percentage","value":0.0,"agg_type":"sum"},{"field":"profiled_host_usage","value":0.0,"agg_type":"sum"},{"field":"profiled_host_percentage","value":0.0,"agg_type":"sum"},{"field":"profiled_container_usage","value":0.0,"agg_type":"sum"},{"field":"profiled_container_percentage","value":0.0,"agg_type":"sum"},{"field":"cws_hosts_usage","value":0.0,"agg_type":"sum"},{"field":"cws_hosts_percentage","value":0.0,"agg_type":"sum"},{"field":"cws_containers_usage","value":0.0,"agg_type":"sum"},{"field":"cws_containers_percentage","value":0.0,"agg_type":"sum"},{"field":"cspm_hosts_usage","value":0.0,"agg_type":"sum"},{"field":"cspm_hosts_percentage","value":0.0,"agg_type":"sum"},{"field":"cspm_containers_usage","value":0.0,"agg_type":"sum"},{"field":"cspm_containers_percentage","value":0.0,"agg_type":"sum"},{"field":"dbm_hosts_usage","value":0.0,"agg_type":"sum"},{"field":"dbm_hosts_percentage","value":0.0,"agg_type":"sum"},{"field":"dbm_queries_usage","value":0.0,"agg_type":"sum"},{"field":"dbm_queries_percentage","value":0.0,"agg_type":"sum"}]}}'
15+
code: 200
16+
duration: ''
17+
headers:
18+
Content-Type:
19+
- application/json
20+
status: 200 OK
21+
version: 1

tests/scenarios/features/v1/usage_metering.feature

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,14 @@ Feature: Usage Metering
3232
When the request is sent
3333
Then the response status is 200 OK
3434

35-
@generated @skip @team:DataDog/red-zone-revenue-query
35+
@team:DataDog/red-zone-revenue-query
3636
Scenario: Get Usage Attribution returns "OK" response
3737
Given operation "GetUsageAttribution" enabled
3838
And new "GetUsageAttribution" request
39+
And request contains "start_month" parameter with value "{{ timeISO('now - 3d') }}"
40+
And request contains "fields" parameter with value "*"
41+
And request contains "offset" parameter with value 0
42+
And request contains "limit" parameter with value 1
3943
When the request is sent
4044
Then the response status is 200 OK
4145

0 commit comments

Comments
 (0)