Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Command = cli.Command{ Name: "instance", ShortName: "i", Usage: "Instance related sub-command", Subcommands: cli.Commands{ ListCommand, SearchCommand, }, }
View Source
var ListCommand = cli.Command{ Name: "list", ShortName: "ls", Usage: "List all available instance by given --service-id or --service-name parameter", Flags: append(flags.DurationFlags, flags.InstanceServiceIDFlags...), Before: interceptor.BeforeChain([]cli.BeforeFunc{ interceptor.DurationInterceptor, }), Action: func(ctx *cli.Context) error { serviceID := verifyAndSwitchServiceParameter(ctx) end := ctx.String("end") start := ctx.String("start") step := ctx.Generic("step") instances := client.Instances(ctx, serviceID, schema.Duration{ Start: start, End: end, Step: step.(*model.StepEnumValue).Selected, }) return display.Display(ctx, instances) }, }
View Source
var SearchCommand = cli.Command{ Name: "search", Usage: "Filter the instance from the existing service instance list", Flags: append(flags.DurationFlags, append(flags.SearchRegexFlags, flags.InstanceServiceIDFlags...)...), Before: interceptor.BeforeChain([]cli.BeforeFunc{ interceptor.DurationInterceptor, }), Action: func(ctx *cli.Context) error { serviceID := verifyAndSwitchServiceParameter(ctx) end := ctx.String("end") start := ctx.String("start") step := ctx.Generic("step") regex := ctx.String("regex") instances := client.Instances(ctx, serviceID, schema.Duration{ Start: start, End: end, Step: step.(*model.StepEnumValue).Selected, }) var result []schema.ServiceInstance if len(instances) > 0 { for _, instance := range instances { if ok, _ := regexp.Match(regex, []byte(instance.Name)); ok { result = append(result, instance) } } } return display.Display(ctx, result) }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.