Skip to content

Commit 30cfe49

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-specjirikuncar
authored
Add include_descendants param to usage attribution API (#1062)
* Regenerate client from commit 7c70bbe of spec repo * retry * retry Co-authored-by: ci.datadog-api-spec <[email protected]> Co-authored-by: Jiri Kuncar <[email protected]>
1 parent fc572f3 commit 30cfe49

File tree

7 files changed

+49
-27
lines changed

7 files changed

+49
-27
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.4.1.dev11",
7-
"regenerated": "2021-08-02 07:15:34.076827",
8-
"spec_repo_commit": "7d1e126"
7+
"regenerated": "2021-08-04 10:38:35.199840",
8+
"spec_repo_commit": "7c70bbe"
99
},
1010
"v2": {
1111
"apigentools_version": "1.4.1.dev11",
12-
"regenerated": "2021-08-02 07:16:04.109193",
13-
"spec_repo_commit": "7d1e126"
12+
"regenerated": "2021-08-04 10:39:02.644774",
13+
"spec_repo_commit": "7c70bbe"
1414
}
1515
}
1616
}

api/v1/datadog/api/openapi.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8006,6 +8006,15 @@ paths:
80068006
schema:
80078007
$ref: '#/components/schemas/UsageAttributionSort'
80088008
style: form
8009+
- description: Include child org usage in the response. Defaults to false.
8010+
explode: true
8011+
in: query
8012+
name: include_descendants
8013+
required: false
8014+
schema:
8015+
default: false
8016+
type: boolean
8017+
style: form
80098018
responses:
80108019
"200":
80118020
content:

api/v1/datadog/api_usage_metering.go

Lines changed: 20 additions & 10 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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,10 +616,12 @@ func main() {
616616
endMonth := time.Now() // time.Time | Datetime in ISO-8601 format, UTC, precise to month: `[YYYY-MM]` for usage ending this month. (optional)
617617
sortDirection := datadog.UsageSortDirection("desc") // UsageSortDirection | The direction to sort by: `[desc, asc]`. (optional) (default to "desc")
618618
sortName := datadog.UsageAttributionSort("api_percentage") // UsageAttributionSort | The field to sort by. (optional) (default to "custom_timeseries_usage")
619+
includeDescendants := true // bool | Include child org usage in the response. Defaults to false. (optional) (default to false)
619620
optionalParams := datadog.GetUsageAttributionOptionalParameters{
620621
EndMonth: &endMonth,
621622
SortDirection: &sortDirection,
622623
SortName: &sortName,
624+
IncludeDescendants: &includeDescendants,
623625
}
624626

625627
configuration := datadog.NewConfiguration()
@@ -658,6 +660,7 @@ Name | Type | Description | Notes
658660
**endMonth** | **time.Time** | Datetime in ISO-8601 format, UTC, precise to month: &#x60;[YYYY-MM]&#x60; for usage ending this month. |
659661
**sortDirection** | [**UsageSortDirection**](UsageSortDirection.md) | The direction to sort by: &#x60;[desc, asc]&#x60;. | [default to &quot;desc&quot;]
660662
**sortName** | [**UsageAttributionSort**](UsageAttributionSort.md) | The field to sort by. | [default to &quot;custom_timeseries_usage&quot;]
663+
**includeDescendants** | **bool** | Include child org usage in the response. Defaults to false. | [default to false]
661664

662665
### Return type
663666

tests/api/v1/datadog/api_logs_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func TestLogsList(t *testing.T) {
6161
var logsResponse datadog.LogsListResponse
6262

6363
// Make sure that both log items are indexed
64-
err = tests.Retry(time.Duration(5)*time.Second, 30, func() bool {
64+
err = tests.Retry(time.Duration(15)*time.Second, 10, func() bool {
6565
logsResponse, httpresp, err = Client(ctx).LogsApi.ListLogs(ctx, logsRequest)
6666
if err != nil {
6767
t.Fatalf("Error listing logs: Response %s: %v", err.(datadog.GenericOpenAPIError).Body(), err)
@@ -75,7 +75,7 @@ func TestLogsList(t *testing.T) {
7575
// Find first log item
7676
logsRequest.SetLimit(1)
7777

78-
err = tests.Retry(time.Duration(5)*time.Second, 30, func() bool {
78+
err = tests.Retry(time.Duration(15)*time.Second, 10, func() bool {
7979
logsResponse, httpresp, err = Client(ctx).LogsApi.ListLogs(ctx, logsRequest)
8080
if err != nil {
8181
t.Fatalf("Error listing logs: Response %s: %v", err.(datadog.GenericOpenAPIError).Body(), err)
@@ -99,7 +99,7 @@ func TestLogsList(t *testing.T) {
9999
logsRequest.SetStartAt(logsResponse.GetNextLogId())
100100

101101
assert.Equal(200, httpresp.StatusCode)
102-
err = tests.Retry(time.Duration(5)*time.Second, 30, func() bool {
102+
err = tests.Retry(time.Duration(15)*time.Second, 10, func() bool {
103103
logsResponse, httpresp, err = Client(ctx).LogsApi.ListLogs(ctx, logsRequest)
104104
if err != nil {
105105
t.Fatalf("Error listing logs: Response %s: %v", err.(datadog.GenericOpenAPIError).Body(), err)

tests/api/v1/datadog/api_usage_metering_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ func TestUsageLogsByRetention(t *testing.T) {
369369

370370
usage, httpresp, err := Client(ctx).UsageMeteringApi.GetUsageLogsByRetention(ctx, startHr, *datadog.NewGetUsageLogsByRetentionOptionalParameters().WithEndHr(endHr))
371371
if err != nil {
372-
t.Errorf("Error getting logs uasge by retention: Response %s: %v", err.(datadog.GenericOpenAPIError).Body(), err)
372+
t.Errorf("Error getting logs usage by retention: Response %s: %v", err.(datadog.GenericOpenAPIError).Body(), err)
373373
}
374374
assert.Equal(200, httpresp.StatusCode)
375375
assert.True(usage.HasUsage())

tests/api/v2/datadog/api_logs_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func TestLogsList(t *testing.T) {
3939
request.SetFilter(*filter)
4040

4141
// Make sure both logs are indexed
42-
err = tests.Retry(time.Duration(5)*time.Second, 30, func() bool {
42+
err = tests.Retry(time.Duration(15)*time.Second, 10, func() bool {
4343
response, httpResp, err = client.LogsApi.ListLogs(ctx, *datadog.NewListLogsOptionalParameters().WithBody(*request))
4444
return err == nil && 200 == httpResp.StatusCode && 2 == len(response.GetData())
4545
})
@@ -50,7 +50,7 @@ func TestLogsList(t *testing.T) {
5050

5151
// Sort works correctly
5252
request.SetSort(datadog.LOGSSORT_TIMESTAMP_ASCENDING)
53-
err = tests.Retry(time.Duration(5)*time.Second, 30, func() bool {
53+
err = tests.Retry(time.Duration(15)*time.Second, 10, func() bool {
5454
response, httpResp, err = client.LogsApi.ListLogs(ctx, *datadog.NewListLogsOptionalParameters().WithBody(*request))
5555
if err != nil {
5656
t.Fatalf("Could not list logs: %v", err)
@@ -92,7 +92,7 @@ func TestLogsList(t *testing.T) {
9292
page := datadog.NewLogsListRequestPage()
9393
page.SetLimit(1)
9494
request.SetPage(*page)
95-
err = tests.Retry(time.Duration(5)*time.Second, 30, func() bool {
95+
err = tests.Retry(time.Duration(15)*time.Second, 10, func() bool {
9696
response, httpResp, err = client.LogsApi.ListLogs(ctx, *datadog.NewListLogsOptionalParameters().WithBody(*request))
9797
if err != nil {
9898
t.Fatalf("Could not list logs: %v", err)
@@ -111,7 +111,7 @@ func TestLogsList(t *testing.T) {
111111
firstID := response.GetData()[0].GetId()
112112

113113
request.Page.SetCursor(cursor)
114-
err = tests.Retry(time.Duration(5)*time.Second, 30, func() bool {
114+
err = tests.Retry(time.Duration(15)*time.Second, 10, func() bool {
115115
response, httpResp, err = client.LogsApi.ListLogs(ctx, *datadog.NewListLogsOptionalParameters().WithBody(*request))
116116
if err != nil {
117117
t.Fatalf("Could not list logs: %v", err)
@@ -168,7 +168,7 @@ func TestLogsListGet(t *testing.T) {
168168
to := now.Add(time.Duration(2) * time.Hour)
169169

170170
// Make sure both logs are indexed
171-
err = tests.Retry(time.Duration(5)*time.Second, 30, func() bool {
171+
err = tests.Retry(time.Duration(15)*time.Second, 10, func() bool {
172172
response, httpResp, err = client.LogsApi.ListLogsGet(ctx, *datadog.NewListLogsGetOptionalParameters().
173173
WithFilterQuery(*suffix).
174174
WithFilterFrom(from).
@@ -181,7 +181,7 @@ func TestLogsListGet(t *testing.T) {
181181
}
182182

183183
// Sort works correctly
184-
err = tests.Retry(time.Duration(5)*time.Second, 30, func() bool {
184+
err = tests.Retry(time.Duration(15)*time.Second, 10, func() bool {
185185
response, httpResp, err = client.LogsApi.ListLogsGet(ctx, *datadog.NewListLogsGetOptionalParameters().
186186
WithFilterQuery(*suffix).
187187
WithFilterFrom(from).
@@ -204,7 +204,7 @@ func TestLogsListGet(t *testing.T) {
204204
attributes = response.GetData()[1].GetAttributes()
205205
assert.Equal("test-log-list-2 "+*suffix, attributes.GetMessage())
206206

207-
err = tests.Retry(time.Duration(5)*time.Second, 30, func() bool {
207+
err = tests.Retry(time.Duration(15)*time.Second, 10, func() bool {
208208
response, httpResp, err = client.LogsApi.ListLogsGet(ctx, *datadog.NewListLogsGetOptionalParameters().
209209
WithFilterQuery(*suffix).
210210
WithFilterFrom(from).
@@ -228,7 +228,7 @@ func TestLogsListGet(t *testing.T) {
228228
assert.Equal("test-log-list-1 "+*suffix, attributes.GetMessage())
229229

230230
// Paging
231-
err = tests.Retry(time.Duration(5)*time.Second, 30, func() bool {
231+
err = tests.Retry(time.Duration(15)*time.Second, 10, func() bool {
232232
response, httpResp, err = client.LogsApi.ListLogsGet(ctx, *datadog.NewListLogsGetOptionalParameters().
233233
WithFilterQuery(*suffix).
234234
WithFilterFrom(from).
@@ -250,7 +250,7 @@ func TestLogsListGet(t *testing.T) {
250250
cursor := respPage.GetAfter()
251251
firstID := response.GetData()[0].GetId()
252252

253-
err = tests.Retry(time.Duration(5)*time.Second, 30, func() bool {
253+
err = tests.Retry(time.Duration(15)*time.Second, 10, func() bool {
254254
response, httpResp, err = client.LogsApi.ListLogsGet(ctx, *datadog.NewListLogsGetOptionalParameters().
255255
WithFilterQuery(*suffix).
256256
WithFilterFrom(from).

0 commit comments

Comments
 (0)