Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DiscoveryCmd = &cobra.Command{ Use: "discovery", Short: "Discovery integrations", Long: `Use this command to query information about active Discovery integrations`, SilenceErrors: true, PersistentPreRunE: controller.PreRunE, PersistentPostRun: controller.PostRun, }
DiscoveryCmd is the command to observe AutoScale control points.
View Source
var EntitiesCmd = &cobra.Command{ Use: "entities", Short: "List AutoScale control points", Long: `List AutoScale control points`, SilenceErrors: true, Example: `aperturectl discovery entities aperturectl discovery entities --find-by="name=service1-demo-app-7dfdf9c698-4wmlt" aperturectl discovery entities --find-by=“ip=10.244.1.24”`, RunE: func(_ *cobra.Command, _ []string) error { client, err := controller.Client() if err != nil { return err } toPrint := "" if findBy != "" { find := strings.Split(findBy, "=") if len(find) != 2 { return fmt.Errorf("invalid findBy argument: %s", findBy) } switch find[0] { case "name": if find[1] == "" { return fmt.Errorf("must provide a name to find by: %s", findBy) } resp, err := client.ListDiscoveryEntity(context.Background(), &cmdv1.ListDiscoveryEntityRequest{By: &cmdv1.ListDiscoveryEntityRequest_Name{Name: find[1]}}) if err != nil { return err } entity, err := protojson.MarshalOptions{Multiline: true, Indent: " "}.Marshal(resp.Entity) if err != nil { return err } toPrint = string(entity) case "ip": if find[1] == "" { return fmt.Errorf("invalid findBy argument: %s", findBy) } resp, err := client.ListDiscoveryEntity(context.Background(), &cmdv1.ListDiscoveryEntityRequest{By: &cmdv1.ListDiscoveryEntityRequest_IpAddress{IpAddress: find[1]}}) if err != nil { return err } entity, err := protojson.MarshalOptions{Multiline: true, Indent: " "}.Marshal(resp.Entity) if err != nil { return err } toPrint = string(entity) default: return fmt.Errorf("invalid findBy argument: %s", findBy) } } else { resp, err := client.ListDiscoveryEntities(context.Background(), &cmdv1.ListDiscoveryEntitiesRequest{}) if err != nil { return err } if resp.ErrorsCount != 0 { fmt.Fprintf(os.Stderr, "Could not get answer from %d agents", resp.ErrorsCount) } entities, err := protojson.MarshalOptions{Multiline: true, Indent: " "}.Marshal(resp.Entities) if err != nil { return err } toPrint = string(entities) } fmt.Printf("%s\n", toPrint) return nil }, }
EntitiesCmd is the command to list control points.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.