Skip to content

Commit b2dda44

Browse files
committed
feat: update generated APIs
1 parent 1464ded commit b2dda44

File tree

6 files changed

+93
-3
lines changed

6 files changed

+93
-3
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
2+
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
3+
Get the cockpit metrics with the given project ID.
4+
5+
USAGE:
6+
scw cockpit cockpit get-metrics [arg=value ...]
7+
8+
ARGS:
9+
[project-id] Project ID to use. If none is passed the default project ID will be used
10+
[start-date] Start date
11+
[end-date] End date
12+
[metric-name] Metric name
13+
14+
FLAGS:
15+
-h, --help help for get-metrics
16+
17+
GLOBAL FLAGS:
18+
-c, --config string The path to the config file
19+
-D, --debug Enable debug mode
20+
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
21+
-p, --profile string The config profile to use

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ AVAILABLE COMMANDS:
99
activate Activate a cockpit
1010
deactivate Deactivate a cockpit
1111
get Get cockpit
12+
get-metrics Get cockpit metrics
1213
reset-grafana Reset Grafana
1314

1415
WORKFLOW COMMANDS:

docs/commands/cockpit.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Cockpit API.
1010
- [Activate a cockpit](#activate-a-cockpit)
1111
- [Deactivate a cockpit](#deactivate-a-cockpit)
1212
- [Get cockpit](#get-cockpit)
13+
- [Get cockpit metrics](#get-cockpit-metrics)
1314
- [Reset Grafana](#reset-grafana)
1415
- [Wait for a cockpit to reach a stable state (installation)](#wait-for-a-cockpit-to-reach-a-stable-state-(installation))
1516
- [Contacts management commands](#contacts-management-commands)
@@ -152,6 +153,28 @@ scw cockpit cockpit get [arg=value ...]
152153

153154

154155

156+
### Get cockpit metrics
157+
158+
Get the cockpit metrics with the given project ID.
159+
160+
**Usage:**
161+
162+
```
163+
scw cockpit cockpit get-metrics [arg=value ...]
164+
```
165+
166+
167+
**Args:**
168+
169+
| Name | | Description |
170+
|------|---|-------------|
171+
| project-id | | Project ID to use. If none is passed the default project ID will be used |
172+
| start-date | | Start date |
173+
| end-date | | End date |
174+
| metric-name | | Metric name |
175+
176+
177+
155178
### Reset Grafana
156179

157180
Reset the Grafana of your cockpit associated with the given project ID.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ require (
2222
github.com/moby/buildkit v0.11.5
2323
github.com/opencontainers/go-digest v1.0.0
2424
github.com/pkg/errors v0.9.1
25-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.15.0.20230327160534-01e8b89ed721
25+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.15.0.20230328152143-e7dd9eaf36ab
2626
github.com/spf13/cobra v1.6.1
2727
github.com/spf13/pflag v1.0.5
2828
github.com/stretchr/testify v1.8.2

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,8 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
275275
github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY=
276276
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
277277
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
278-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.15.0.20230327160534-01e8b89ed721 h1:sH3/HWBjaFYFuWnmA2biULFcq6KTc1OP3cdz/OPMhAI=
279-
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.15.0.20230327160534-01e8b89ed721/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
278+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.15.0.20230328152143-e7dd9eaf36ab h1:VCye3DHBTXfYxCi014GkRliIOvKImUBySvyHwIROCaE=
279+
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.15.0.20230328152143-e7dd9eaf36ab/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
280280
github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg=
281281
github.com/secure-systems-lab/go-securesystemslib v0.4.0 h1:b23VGrQhTA8cN2CbBw7/FulN9fTtqYUdS5+Oxzt+DUE=
282282
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=

internal/namespaces/cockpit/v1beta1/cockpit_cli.go

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ func GetGeneratedCommands() *core.Commands {
2727
cockpitContact(),
2828
cockpitCockpitActivate(),
2929
cockpitCockpitGet(),
30+
cockpitCockpitGetMetrics(),
3031
cockpitCockpitDeactivate(),
3132
cockpitCockpitResetGrafana(),
3233
cockpitTokenCreate(),
@@ -144,6 +145,50 @@ func cockpitCockpitGet() *core.Command {
144145
}
145146
}
146147

148+
func cockpitCockpitGetMetrics() *core.Command {
149+
return &core.Command{
150+
Short: `Get cockpit metrics`,
151+
Long: `Get the cockpit metrics with the given project ID.`,
152+
Namespace: "cockpit",
153+
Resource: "cockpit",
154+
Verb: "get-metrics",
155+
// Deprecated: false,
156+
ArgsType: reflect.TypeOf(cockpit.GetCockpitMetricsRequest{}),
157+
ArgSpecs: core.ArgSpecs{
158+
core.ProjectIDArgSpec(),
159+
{
160+
Name: "start-date",
161+
Short: `Start date`,
162+
Required: false,
163+
Deprecated: false,
164+
Positional: false,
165+
},
166+
{
167+
Name: "end-date",
168+
Short: `End date`,
169+
Required: false,
170+
Deprecated: false,
171+
Positional: false,
172+
},
173+
{
174+
Name: "metric-name",
175+
Short: `Metric name`,
176+
Required: false,
177+
Deprecated: false,
178+
Positional: false,
179+
},
180+
},
181+
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
182+
request := args.(*cockpit.GetCockpitMetricsRequest)
183+
184+
client := core.ExtractClient(ctx)
185+
api := cockpit.NewAPI(client)
186+
return api.GetCockpitMetrics(request)
187+
188+
},
189+
}
190+
}
191+
147192
func cockpitCockpitDeactivate() *core.Command {
148193
return &core.Command{
149194
Short: `Deactivate a cockpit`,

0 commit comments

Comments
 (0)