Skip to content

Commit da70077

Browse files
authored
feat(cockpit): add retention setup in datasource (#4253)
1 parent f4fb6a6 commit da70077

11 files changed

+52
-24
lines changed

cmd/scw/testdata/test-all-usage-cockpit-data-source-create-usage.golden

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ USAGE:
1010
scw cockpit data-source create [arg=value ...]
1111

1212
ARGS:
13-
[project-id] Project ID to use. If none is passed the default project ID will be used
14-
[name] Data source name
15-
[type] Data source type (unknown_type | metrics | logs | traces | alerts)
16-
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
13+
[project-id] Project ID to use. If none is passed the default project ID will be used
14+
[name] Data source name
15+
[type] Data source type (unknown_type | metrics | logs | traces)
16+
[retention-days] BETA - Duration for which the data will be retained in the data source
17+
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
1718

1819
FLAGS:
1920
-h, --help help for create

cmd/scw/testdata/test-all-usage-cockpit-data-source-list-usage.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ARGS:
1010
[order-by] Sort order for data sources in the response (created_at_asc | created_at_desc | name_asc | name_desc | type_asc | type_desc)
1111
[project-id] Project ID to use. If none is passed the default project ID will be used
1212
[origin] Origin to filter for, only data sources with matching origin will be returned (unknown_origin | scaleway | external)
13-
[types.{index}] Types to filter for, only data sources with matching types will be returned (unknown_type | metrics | logs | traces | alerts)
13+
[types.{index}] Types to filter for, only data sources with matching types will be returned (unknown_type | metrics | logs | traces)
1414
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw | all)
1515

1616
FLAGS:

cmd/scw/testdata/test-all-usage-cockpit-data-source-update-usage.golden

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ USAGE:
66
scw cockpit data-source update [arg=value ...]
77

88
ARGS:
9-
data-source-id ID of the data source to update
10-
[name] Updated name of the data source
11-
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
9+
data-source-id ID of the data source to update
10+
[name] Updated name of the data source
11+
[retention-days] BETA - Duration for which the data will be retained in the data source
12+
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw)
1213

1314
FLAGS:
1415
-h, --help help for update

cmd/scw/testdata/test-all-usage-cockpit-plan-get-usage.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
22
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
33
Retrieve a pricing plan for the given Project, specified by the ID of the Project.
4+
Deprecated, retention is now managed at the data source level.
45

56
USAGE:
67
scw cockpit plan get [arg=value ...]

cmd/scw/testdata/test-all-usage-cockpit-plan-list-usage.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
22
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
33
Retrieve a list of available pricing plan types.
4+
Deprecated, retention is now managed at the data source level.
45

56
USAGE:
67
scw cockpit plan list [arg=value ...]

cmd/scw/testdata/test-all-usage-cockpit-plan-select-usage.golden

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
22
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
33
Apply a pricing plan on a given Project. You must specify the ID of the pricing plan type. Note that you will be billed for the plan you apply.
4+
Deprecated, retention is now managed at the data source level.
45

56
USAGE:
67
scw cockpit plan select [arg=value ...]

docs/commands/cockpit.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ scw cockpit data-source create [arg=value ...]
206206
|------|---|-------------|
207207
| project-id | | Project ID to use. If none is passed the default project ID will be used |
208208
| name | | Data source name |
209-
| type | One of: `unknown_type`, `metrics`, `logs`, `traces`, `alerts` | Data source type |
209+
| type | One of: `unknown_type`, `metrics`, `logs`, `traces` | Data source type |
210+
| retention-days | | BETA - Duration for which the data will be retained in the data source |
210211
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config |
211212

212213

@@ -270,7 +271,7 @@ scw cockpit data-source list [arg=value ...]
270271
| order-by | One of: `created_at_asc`, `created_at_desc`, `name_asc`, `name_desc`, `type_asc`, `type_desc` | Sort order for data sources in the response |
271272
| project-id | | Project ID to use. If none is passed the default project ID will be used |
272273
| origin | One of: `unknown_origin`, `scaleway`, `external` | Origin to filter for, only data sources with matching origin will be returned |
273-
| types.{index} | One of: `unknown_type`, `metrics`, `logs`, `traces`, `alerts` | Types to filter for, only data sources with matching types will be returned |
274+
| types.{index} | One of: `unknown_type`, `metrics`, `logs`, `traces` | Types to filter for, only data sources with matching types will be returned |
274275
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw`, `all` | Region to target. If none is passed will use default region from the config |
275276

276277

@@ -292,6 +293,7 @@ scw cockpit data-source update [arg=value ...]
292293
|------|---|-------------|
293294
| data-source-id | Required | ID of the data source to update |
294295
| name | | Updated name of the data source |
296+
| retention-days | | BETA - Duration for which the data will be retained in the data source |
295297
| region | Default: `fr-par`<br />One of: `fr-par`, `nl-ams`, `pl-waw` | Region to target. If none is passed will use default region from the config |
296298

297299

@@ -481,6 +483,7 @@ Pricing plans management commands.
481483
### Get current plan
482484

483485
Retrieve a pricing plan for the given Project, specified by the ID of the Project.
486+
Deprecated, retention is now managed at the data source level.
484487

485488
**Usage:**
486489

@@ -500,6 +503,7 @@ scw cockpit plan get [arg=value ...]
500503
### List plan types
501504

502505
Retrieve a list of available pricing plan types.
506+
Deprecated, retention is now managed at the data source level.
503507

504508
**Usage:**
505509

@@ -519,6 +523,7 @@ scw cockpit plan list [arg=value ...]
519523
### Apply a pricing plan
520524

521525
Apply a pricing plan on a given Project. You must specify the ID of the pricing plan type. Note that you will be billed for the plan you apply.
526+
Deprecated, retention is now managed at the data source level.
522527

523528
**Usage:**
524529

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ require (
2626
github.com/mattn/go-isatty v0.0.20
2727
github.com/moby/buildkit v0.13.2
2828
github.com/opencontainers/go-digest v1.0.0
29-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241029155651-7d2e04989bb6
29+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241031163826-ea7169024163
3030
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
3131
github.com/spf13/cobra v1.8.1
3232
github.com/spf13/pflag v1.0.5

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,8 @@ github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUz
465465
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
466466
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
467467
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs=
468-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241029155651-7d2e04989bb6 h1:wTLtvVjR/V+Rz34qp0JDMTkkPUZPY0NkiywtdqwGcPs=
469-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241029155651-7d2e04989bb6/go.mod h1:3jrRJM7638J+P33hKy9MBvfOBxNo8pEGNQQoIv65Ihg=
468+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241031163826-ea7169024163 h1:yO+2+sW3nnl8VIAvBXo0NJgUQRJpJkuG4MsMGoAGmW8=
469+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241031163826-ea7169024163/go.mod h1:3jrRJM7638J+P33hKy9MBvfOBxNo8pEGNQQoIv65Ihg=
470470
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
471471
github.com/sclevine/spec v1.4.0/go.mod h1:LvpgJaFyvQzRvc1kaDs0bulYwzC70PbiYjC4QnFHkOM=
472472
github.com/secure-systems-lab/go-securesystemslib v0.8.0 h1:mr5An6X45Kb2nddcFlbmfHkLguCE9laoZCUzEEpIZXA=

internal/namespaces/cockpit/v1/cockpit_cli.go

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -432,12 +432,13 @@ func cockpitProductDashboardsGet() *core.Command {
432432

433433
func cockpitPlanList() *core.Command {
434434
return &core.Command{
435-
Short: `List plan types`,
436-
Long: `Retrieve a list of available pricing plan types.`,
435+
Short: `List plan types`,
436+
Long: `Retrieve a list of available pricing plan types.
437+
Deprecated, retention is now managed at the data source level.`,
437438
Namespace: "cockpit",
438439
Resource: "plan",
439440
Verb: "list",
440-
// Deprecated: false,
441+
// Deprecated: true,
441442
ArgsType: reflect.TypeOf(cockpit.GlobalAPIListPlansRequest{}),
442443
ArgSpecs: core.ArgSpecs{
443444
{
@@ -466,12 +467,13 @@ func cockpitPlanList() *core.Command {
466467

467468
func cockpitPlanSelect() *core.Command {
468469
return &core.Command{
469-
Short: `Apply a pricing plan`,
470-
Long: `Apply a pricing plan on a given Project. You must specify the ID of the pricing plan type. Note that you will be billed for the plan you apply.`,
470+
Short: `Apply a pricing plan`,
471+
Long: `Apply a pricing plan on a given Project. You must specify the ID of the pricing plan type. Note that you will be billed for the plan you apply.
472+
Deprecated, retention is now managed at the data source level.`,
471473
Namespace: "cockpit",
472474
Resource: "plan",
473475
Verb: "select",
474-
// Deprecated: false,
476+
// Deprecated: true,
475477
ArgsType: reflect.TypeOf(cockpit.GlobalAPISelectPlanRequest{}),
476478
ArgSpecs: core.ArgSpecs{
477479
core.ProjectIDArgSpec(),
@@ -497,12 +499,13 @@ func cockpitPlanSelect() *core.Command {
497499

498500
func cockpitPlanGet() *core.Command {
499501
return &core.Command{
500-
Short: `Get current plan`,
501-
Long: `Retrieve a pricing plan for the given Project, specified by the ID of the Project.`,
502+
Short: `Get current plan`,
503+
Long: `Retrieve a pricing plan for the given Project, specified by the ID of the Project.
504+
Deprecated, retention is now managed at the data source level.`,
502505
Namespace: "cockpit",
503506
Resource: "plan",
504507
Verb: "get",
505-
// Deprecated: false,
508+
// Deprecated: true,
506509
ArgsType: reflect.TypeOf(cockpit.GlobalAPIGetCurrentPlanRequest{}),
507510
ArgSpecs: core.ArgSpecs{
508511
core.ProjectIDArgSpec(),
@@ -546,7 +549,14 @@ The name of the data source will then be used as reference to name the associate
546549
Required: false,
547550
Deprecated: false,
548551
Positional: false,
549-
EnumValues: []string{"unknown_type", "metrics", "logs", "traces", "alerts"},
552+
EnumValues: []string{"unknown_type", "metrics", "logs", "traces"},
553+
},
554+
{
555+
Name: "retention-days",
556+
Short: `BETA - Duration for which the data will be retained in the data source`,
557+
Required: false,
558+
Deprecated: false,
559+
Positional: false,
550560
},
551561
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw),
552562
},
@@ -661,7 +671,7 @@ You can list data sources by Project, type and origin.`,
661671
Required: false,
662672
Deprecated: false,
663673
Positional: false,
664-
EnumValues: []string{"unknown_type", "metrics", "logs", "traces", "alerts"},
674+
EnumValues: []string{"unknown_type", "metrics", "logs", "traces"},
665675
},
666676
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw, scw.Region(core.AllLocalities)),
667677
},
@@ -709,6 +719,13 @@ func cockpitDataSourceUpdate() *core.Command {
709719
Deprecated: false,
710720
Positional: false,
711721
},
722+
{
723+
Name: "retention-days",
724+
Short: `BETA - Duration for which the data will be retained in the data source`,
725+
Required: false,
726+
Deprecated: false,
727+
Positional: false,
728+
},
712729
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw),
713730
},
714731
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {

0 commit comments

Comments
 (0)