Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cockpit): add retention setup in datasource #4253

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ USAGE:
scw cockpit data-source create [arg=value ...]

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

FLAGS:
-h, --help help for create
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ARGS:
[order-by] Sort order for data sources in the response (created_at_asc | created_at_desc | name_asc | name_desc | type_asc | type_desc)
[project-id] Project ID to use. If none is passed the default project ID will be used
[origin] Origin to filter for, only data sources with matching origin will be returned (unknown_origin | scaleway | external)
[types.{index}] Types to filter for, only data sources with matching types will be returned (unknown_type | metrics | logs | traces | alerts)
[types.{index}] Types to filter for, only data sources with matching types will be returned (unknown_type | metrics | logs | traces)
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams | pl-waw | all)

FLAGS:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ USAGE:
scw cockpit data-source update [arg=value ...]

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

FLAGS:
-h, --help help for update
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Retrieve a pricing plan for the given Project, specified by the ID of the Project.
Deprecated, retention is now managed at the data source level.

USAGE:
scw cockpit plan get [arg=value ...]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Retrieve a list of available pricing plan types.
Deprecated, retention is now managed at the data source level.

USAGE:
scw cockpit plan list [arg=value ...]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
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.
Deprecated, retention is now managed at the data source level.

USAGE:
scw cockpit plan select [arg=value ...]
Expand Down
9 changes: 7 additions & 2 deletions docs/commands/cockpit.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ scw cockpit data-source create [arg=value ...]
|------|---|-------------|
| project-id | | Project ID to use. If none is passed the default project ID will be used |
| name | | Data source name |
| type | One of: `unknown_type`, `metrics`, `logs`, `traces`, `alerts` | Data source type |
| type | One of: `unknown_type`, `metrics`, `logs`, `traces` | Data source type |
| retention-days | | BETA - Duration for which the data will be retained in the data source |
| 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 |


Expand Down Expand Up @@ -270,7 +271,7 @@ scw cockpit data-source list [arg=value ...]
| 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 |
| project-id | | Project ID to use. If none is passed the default project ID will be used |
| origin | One of: `unknown_origin`, `scaleway`, `external` | Origin to filter for, only data sources with matching origin will be returned |
| types.{index} | One of: `unknown_type`, `metrics`, `logs`, `traces`, `alerts` | Types to filter for, only data sources with matching types will be returned |
| types.{index} | One of: `unknown_type`, `metrics`, `logs`, `traces` | Types to filter for, only data sources with matching types will be returned |
| 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 |


Expand All @@ -292,6 +293,7 @@ scw cockpit data-source update [arg=value ...]
|------|---|-------------|
| data-source-id | Required | ID of the data source to update |
| name | | Updated name of the data source |
| retention-days | | BETA - Duration for which the data will be retained in the data source |
| 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 |


Expand Down Expand Up @@ -481,6 +483,7 @@ Pricing plans management commands.
### Get current plan

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

**Usage:**

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

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

**Usage:**

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

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.
Deprecated, retention is now managed at the data source level.

**Usage:**

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
github.com/mattn/go-isatty v0.0.20
github.com/moby/buildkit v0.13.2
github.com/opencontainers/go-digest v1.0.0
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241029155651-7d2e04989bb6
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241031163826-ea7169024163
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,8 @@ github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUz
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241029155651-7d2e04989bb6 h1:wTLtvVjR/V+Rz34qp0JDMTkkPUZPY0NkiywtdqwGcPs=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241029155651-7d2e04989bb6/go.mod h1:3jrRJM7638J+P33hKy9MBvfOBxNo8pEGNQQoIv65Ihg=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241031163826-ea7169024163 h1:yO+2+sW3nnl8VIAvBXo0NJgUQRJpJkuG4MsMGoAGmW8=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30.0.20241031163826-ea7169024163/go.mod h1:3jrRJM7638J+P33hKy9MBvfOBxNo8pEGNQQoIv65Ihg=
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
github.com/sclevine/spec v1.4.0/go.mod h1:LvpgJaFyvQzRvc1kaDs0bulYwzC70PbiYjC4QnFHkOM=
github.com/secure-systems-lab/go-securesystemslib v0.8.0 h1:mr5An6X45Kb2nddcFlbmfHkLguCE9laoZCUzEEpIZXA=
Expand Down
39 changes: 28 additions & 11 deletions internal/namespaces/cockpit/v1/cockpit_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,12 +432,13 @@ func cockpitProductDashboardsGet() *core.Command {

func cockpitPlanList() *core.Command {
return &core.Command{
Short: `List plan types`,
Long: `Retrieve a list of available pricing plan types.`,
Short: `List plan types`,
Long: `Retrieve a list of available pricing plan types.
Deprecated, retention is now managed at the data source level.`,
Namespace: "cockpit",
Resource: "plan",
Verb: "list",
// Deprecated: false,
// Deprecated: true,
ArgsType: reflect.TypeOf(cockpit.GlobalAPIListPlansRequest{}),
ArgSpecs: core.ArgSpecs{
{
Expand Down Expand Up @@ -466,12 +467,13 @@ func cockpitPlanList() *core.Command {

func cockpitPlanSelect() *core.Command {
return &core.Command{
Short: `Apply a pricing plan`,
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.`,
Short: `Apply a pricing plan`,
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.
Deprecated, retention is now managed at the data source level.`,
Namespace: "cockpit",
Resource: "plan",
Verb: "select",
// Deprecated: false,
// Deprecated: true,
ArgsType: reflect.TypeOf(cockpit.GlobalAPISelectPlanRequest{}),
ArgSpecs: core.ArgSpecs{
core.ProjectIDArgSpec(),
Expand All @@ -497,12 +499,13 @@ func cockpitPlanSelect() *core.Command {

func cockpitPlanGet() *core.Command {
return &core.Command{
Short: `Get current plan`,
Long: `Retrieve a pricing plan for the given Project, specified by the ID of the Project.`,
Short: `Get current plan`,
Long: `Retrieve a pricing plan for the given Project, specified by the ID of the Project.
Deprecated, retention is now managed at the data source level.`,
Namespace: "cockpit",
Resource: "plan",
Verb: "get",
// Deprecated: false,
// Deprecated: true,
ArgsType: reflect.TypeOf(cockpit.GlobalAPIGetCurrentPlanRequest{}),
ArgSpecs: core.ArgSpecs{
core.ProjectIDArgSpec(),
Expand Down Expand Up @@ -546,7 +549,14 @@ The name of the data source will then be used as reference to name the associate
Required: false,
Deprecated: false,
Positional: false,
EnumValues: []string{"unknown_type", "metrics", "logs", "traces", "alerts"},
EnumValues: []string{"unknown_type", "metrics", "logs", "traces"},
},
{
Name: "retention-days",
Short: `BETA - Duration for which the data will be retained in the data source`,
Required: false,
Deprecated: false,
Positional: false,
},
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw),
},
Expand Down Expand Up @@ -661,7 +671,7 @@ You can list data sources by Project, type and origin.`,
Required: false,
Deprecated: false,
Positional: false,
EnumValues: []string{"unknown_type", "metrics", "logs", "traces", "alerts"},
EnumValues: []string{"unknown_type", "metrics", "logs", "traces"},
},
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw, scw.Region(core.AllLocalities)),
},
Expand Down Expand Up @@ -709,6 +719,13 @@ func cockpitDataSourceUpdate() *core.Command {
Deprecated: false,
Positional: false,
},
{
Name: "retention-days",
Short: `BETA - Duration for which the data will be retained in the data source`,
Required: false,
Deprecated: false,
Positional: false,
},
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Region fr-par
"sandbox": "unknown_sandbox",
"local_storage_limit": 0,
"scaling_option": null,
"health_check": null,
"created_at": null,
"updated_at": null,
"ready_at": null,
Expand Down
Loading