Skip to content

Commit 0a98967

Browse files
authored
feat(cockpit/v1): add datasource update command (#3985)
1 parent 55402d6 commit 0a98967

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

internal/namespaces/cockpit/v1/cockpit_cli.go

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ func GetGeneratedCommands() *core.Commands {
4646
cockpitDataSourceGet(),
4747
cockpitDataSourceDelete(),
4848
cockpitDataSourceList(),
49+
cockpitDataSourceUpdate(),
4950
cockpitUsageOverviewGet(),
5051
cockpitTokenCreate(),
5152
cockpitTokenList(),
@@ -684,6 +685,43 @@ You can list data sources by Project, type and origin.`,
684685
}
685686
}
686687

688+
func cockpitDataSourceUpdate() *core.Command {
689+
return &core.Command{
690+
Short: `Update a data source`,
691+
Long: `Update a given data source name, specified by the data source ID.`,
692+
Namespace: "cockpit",
693+
Resource: "data-source",
694+
Verb: "update",
695+
// Deprecated: false,
696+
ArgsType: reflect.TypeOf(cockpit.RegionalAPIUpdateDataSourceRequest{}),
697+
ArgSpecs: core.ArgSpecs{
698+
{
699+
Name: "data-source-id",
700+
Short: `ID of the data source to update`,
701+
Required: true,
702+
Deprecated: false,
703+
Positional: false,
704+
},
705+
{
706+
Name: "name",
707+
Short: `Updated name of the data source`,
708+
Required: false,
709+
Deprecated: false,
710+
Positional: false,
711+
},
712+
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms, scw.RegionPlWaw),
713+
},
714+
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
715+
request := args.(*cockpit.RegionalAPIUpdateDataSourceRequest)
716+
717+
client := core.ExtractClient(ctx)
718+
api := cockpit.NewRegionalAPI(client)
719+
return api.UpdateDataSource(request)
720+
721+
},
722+
}
723+
}
724+
687725
func cockpitUsageOverviewGet() *core.Command {
688726
return &core.Command{
689727
Short: `Get data source usage overview`,

0 commit comments

Comments
 (0)