Skip to content
Merged
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
38 changes: 38 additions & 0 deletions internal/namespaces/cockpit/v1/cockpit_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func GetGeneratedCommands() *core.Commands {
cockpitDataSourceGet(),
cockpitDataSourceDelete(),
cockpitDataSourceList(),
cockpitDataSourceUpdate(),
cockpitUsageOverviewGet(),
cockpitTokenCreate(),
cockpitTokenList(),
Expand Down Expand Up @@ -684,6 +685,43 @@ You can list data sources by Project, type and origin.`,
}
}

func cockpitDataSourceUpdate() *core.Command {
return &core.Command{
Short: `Update a data source`,
Long: `Update a given data source name, specified by the data source ID.`,
Namespace: "cockpit",
Resource: "data-source",
Verb: "update",
// Deprecated: false,
ArgsType: reflect.TypeOf(cockpit.RegionalAPIUpdateDataSourceRequest{}),
ArgSpecs: core.ArgSpecs{
{
Name: "data-source-id",
Short: `ID of the data source to update`,
Required: true,
Deprecated: false,
Positional: false,
},
{
Name: "name",
Short: `Updated name of 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) {
request := args.(*cockpit.RegionalAPIUpdateDataSourceRequest)

client := core.ExtractClient(ctx)
api := cockpit.NewRegionalAPI(client)
return api.UpdateDataSource(request)

},
}
}

func cockpitUsageOverviewGet() *core.Command {
return &core.Command{
Short: `Get data source usage overview`,
Expand Down