Skip to content

Commit 9f4de48

Browse files
added download_rate to openapi (#3177)
* added download_rate to openapi * fix lint * fix lint * added download retry fields * Update model/openapi.yml Co-authored-by: Craig MacKenzie <craig.mackenzie@elastic.co> * Update model/openapi.yml Co-authored-by: Craig MacKenzie <craig.mackenzie@elastic.co> * update generated files --------- Co-authored-by: Craig MacKenzie <craig.mackenzie@elastic.co>
1 parent a244bbe commit 9f4de48

File tree

5 files changed

+40
-5
lines changed

5 files changed

+40
-5
lines changed

NOTICE.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Elastic Beats
2-
Copyright 2014-2023 Elasticsearch BV
2+
Copyright 2014-2024 Elasticsearch BV
33

44
This product includes software developed by The Apache Software
55
Foundation (http://www.apache.org/).

internal/pkg/api/openapi.gen.go

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/pkg/api/openapi_spec_test.go

+9-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// or more contributor license agreements. Licensed under the Elastic License;
33
// you may not use this file except in compliance with the Elastic License.
44

5-
//nolint:dupl,goconst // don't care about repitition for tests
5+
//nolint:goconst // don't care about repitition for tests
66
package api
77

88
// Test json encoding/decoding for all req/resp items
@@ -190,6 +190,7 @@ func Test_UpgradeDetailsMetadata_Downloading(t *testing.T) {
190190
md *UpgradeDetails_Metadata
191191
err error
192192
pct float64
193+
rate float64
193194
}{{
194195
name: "empty object",
195196
md: &UpgradeDetails_Metadata{
@@ -200,10 +201,11 @@ func Test_UpgradeDetailsMetadata_Downloading(t *testing.T) {
200201
}, {
201202
name: "valid object",
202203
md: &UpgradeDetails_Metadata{
203-
union: json.RawMessage(`{"download_percent":1}`),
204+
union: json.RawMessage(`{"download_percent":1,"download_rate":1000}`),
204205
},
205-
err: nil,
206-
pct: 1,
206+
err: nil,
207+
pct: 1,
208+
rate: 1000,
207209
}, {
208210
name: "invalid object",
209211
md: &UpgradeDetails_Metadata{
@@ -232,6 +234,9 @@ func Test_UpgradeDetailsMetadata_Downloading(t *testing.T) {
232234
meta, err := tc.md.AsUpgradeMetadataDownloading()
233235
if tc.err == nil {
234236
assert.Equal(t, tc.pct, meta.DownloadPercent)
237+
if meta.DownloadRate != nil {
238+
assert.Equal(t, tc.rate, *meta.DownloadRate)
239+
}
235240
} else {
236241
assert.ErrorAsf(t, err, &tc.err, "error is %v", err)
237242
}

model/openapi.yml

+12
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,17 @@ components:
283283
description: The artifact download progress as a percentage.
284284
type: number
285285
format: double
286+
download_rate:
287+
description: The artifact download rate as bytes per second.
288+
type: number
289+
format: double
290+
retry_error_msg:
291+
description: The error message that is a result of a retryable upgrade download failure.
292+
type: string
293+
retry_until:
294+
description: The RFC3339 timestamp of the deadline the upgrade download is retried until.
295+
type: string
296+
format: date-time
286297
upgrade_metadata_failed:
287298
description: Upgrade metadata for an upgrade that has failed.
288299
required:
@@ -1301,6 +1312,7 @@ paths:
13011312
state: UPG_DOWNLOADING
13021313
metadata:
13031314
download_percent: 12.3
1315+
download_rate: 1024
13041316
responses:
13051317
"200":
13061318
description: Agent checkin successful. May include actions.

pkg/api/types.gen.go

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)