Skip to content
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
19 changes: 19 additions & 0 deletions cmd/scw/testdata/test-all-usage-rdb-log-get-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Get specific logs of a given instance.

USAGE:
scw rdb log get <instance-log-id ...> [arg=value ...]

ARGS:
instance-log-id UUID of the instance_log you want
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams)

FLAGS:
-h, --help help for get

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
4 changes: 2 additions & 2 deletions cmd/scw/testdata/test-all-usage-rdb-log-list-usage.golden
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ USAGE:
scw rdb log list <instance-id ...> [arg=value ...]

ARGS:
instance-id
[order-by] (created_at_asc | created_at_desc)
instance-id UUID of the instance you want logs of
[order-by] Criteria to use when ordering instance logs listing (created_at_asc | created_at_desc)
[region=fr-par] Region to target. If none is passed will use default region from the config (fr-par | nl-ams)

FLAGS:
Expand Down
1 change: 1 addition & 0 deletions cmd/scw/testdata/test-all-usage-rdb-log-usage.golden
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ USAGE:
scw rdb log <command>

AVAILABLE COMMANDS:
get Get specific logs of a given instance
list List available logs of a given instance
prepare Prepare logs of a given instance

Expand Down
31 changes: 31 additions & 0 deletions internal/namespaces/rdb/v1/rdb_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func GetGeneratedCommands() *core.Commands {
rdbInstanceGetCertificate(),
rdbLogPrepare(),
rdbLogList(),
rdbLogGet(),
rdbInstanceGetMetrics(),
rdbSettingsAdd(),
rdbSettingsDelete(),
Expand Down Expand Up @@ -887,11 +888,13 @@ func rdbLogList() *core.Command {
ArgSpecs: core.ArgSpecs{
{
Name: "instance-id",
Short: `UUID of the instance you want logs of`,
Required: true,
Positional: true,
},
{
Name: "order-by",
Short: `Criteria to use when ordering instance logs listing`,
Required: false,
Positional: false,
EnumValues: []string{"created_at_asc", "created_at_desc"},
Expand All @@ -909,6 +912,34 @@ func rdbLogList() *core.Command {
}
}

func rdbLogGet() *core.Command {
return &core.Command{
Short: `Get specific logs of a given instance`,
Long: `Get specific logs of a given instance.`,
Namespace: "rdb",
Resource: "log",
Verb: "get",
ArgsType: reflect.TypeOf(rdb.GetInstanceLogRequest{}),
ArgSpecs: core.ArgSpecs{
{
Name: "instance-log-id",
Short: `UUID of the instance_log you want`,
Required: true,
Positional: true,
},
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*rdb.GetInstanceLogRequest)

client := core.ExtractClient(ctx)
api := rdb.NewAPI(client)
return api.GetInstanceLog(request)

},
}
}

func rdbInstanceGetMetrics() *core.Command {
return &core.Command{
Short: `Get instance metrics`,
Expand Down