Skip to content

Commit caad7eb

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Regenerate client from commit f43ab25 of spec repo (#1285)
Co-authored-by: ci.datadog-api-spec <[email protected]> Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
1 parent ee6da81 commit caad7eb

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 16:18:43.023024",
8-
"spec_repo_commit": "cc7ebbe"
7+
"regenerated": "2022-01-11 17:17:23.769645",
8+
"spec_repo_commit": "f43ab25"
99
},
1010
"v2": {
1111
"apigentools_version": "1.5.1.dev2",
12-
"regenerated": "2022-01-11 16:18:43.045110",
13-
"spec_repo_commit": "cc7ebbe"
12+
"regenerated": "2022-01-11 17:17:23.787982",
13+
"spec_repo_commit": "f43ab25"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12349,6 +12349,11 @@ components:
1234912349
values:
1235012350
$ref: '#/components/schemas/UsageAttributionValues'
1235112351
type: object
12352+
UsageAttributionLimit:
12353+
default: 5000
12354+
description: Maximum number of records to be returned.
12355+
format: int64
12356+
type: integer
1235212357
UsageAttributionMetadata:
1235312358
description: The object containing document metadata.
1235412359
properties:
@@ -12357,6 +12362,11 @@ components:
1235712362
pagination:
1235812363
$ref: '#/components/schemas/UsageAttributionPagination'
1235912364
type: object
12365+
UsageAttributionOffset:
12366+
default: 0
12367+
description: Number of records to skip before beginning to return.
12368+
format: int64
12369+
type: integer
1236012370
UsageAttributionPagination:
1236112371
description: The metadata for the current pagination.
1236212372
properties:
@@ -24661,6 +24671,18 @@ paths:
2466124671
schema:
2466224672
default: false
2466324673
type: boolean
24674+
- description: Number of records to skip before beginning to return.
24675+
in: query
24676+
name: offset
24677+
required: false
24678+
schema:
24679+
$ref: '#/components/schemas/UsageAttributionOffset'
24680+
- description: Maximum number of records to be returned.
24681+
in: query
24682+
name: limit
24683+
required: false
24684+
schema:
24685+
$ref: '#/components/schemas/UsageAttributionLimit'
2466424686
responses:
2466524687
'200':
2466624688
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
@@ -759,11 +759,15 @@ func main() {
759759
sortDirection := datadog.UsageSortDirection("desc") // UsageSortDirection | The direction to sort by: `[desc, asc]`. (optional) (default to "desc")
760760
sortName := datadog.UsageAttributionSort("api_percentage") // UsageAttributionSort | The field to sort by. (optional) (default to "custom_timeseries_usage")
761761
includeDescendants := true // bool | Include child org usage in the response. Defaults to false. (optional) (default to false)
762+
offset := int64(789) // int64 | Number of records to skip before beginning to return. (optional) (default to 0)
763+
limit := int64(789) // int64 | Maximum number of records to be returned. (optional) (default to 5000)
762764
optionalParams := datadog.GetUsageAttributionOptionalParameters{
763765
EndMonth: &endMonth,
764766
SortDirection: &sortDirection,
765767
SortName: &sortName,
766768
IncludeDescendants: &includeDescendants,
769+
Offset: &offset,
770+
Limit: &limit,
767771
}
768772

769773
configuration := datadog.NewConfiguration()
@@ -799,6 +803,8 @@ Other parameters are passed through a pointer to a GetUsageAttributionOptionalPa
799803
| **sortDirection** | [**UsageSortDirection**](UsageSortDirection.md) | The direction to sort by: &#x60;[desc, asc]&#x60;. | [default to &quot;desc&quot;] |
800804
| **sortName** | [**UsageAttributionSort**](UsageAttributionSort.md) | The field to sort by. | [default to &quot;custom_timeseries_usage&quot;] |
801805
| **includeDescendants** | **bool** | Include child org usage in the response. Defaults to false. | [default to false] |
806+
| **offset** | **int64** | Number of records to skip before beginning to return. | [default to 0] |
807+
| **limit** | **int64** | Maximum number of records to be returned. | [default to 5000] |
802808

803809
### Return type
804810

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
@@ -50,10 +50,14 @@ Feature: Usage Metering
5050
When the request is sent
5151
Then the response status is 200 OK
5252

53-
@generated @skip @team:DataDog/red-zone-revenue-query
53+
@team:DataDog/red-zone-revenue-query
5454
Scenario: Get Usage Attribution returns "OK" response
5555
Given operation "GetUsageAttribution" enabled
5656
And new "GetUsageAttribution" request
57+
And request contains "start_month" parameter with value "{{ timeISO('now - 3d') }}"
58+
And request contains "fields" parameter with value "*"
59+
And request contains "offset" parameter with value 0
60+
And request contains "limit" parameter with value 1
5761
When the request is sent
5862
Then the response status is 200 OK
5963

0 commit comments

Comments
 (0)