visualize

package
v0.1.20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2023 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	NamespacesKey       = "namespaces"
	NamespacesShorthand = "n"
)

Variables

View Source
var VisualizeCmd = &cobra.Command{
	Use:   "visualize",
	Short: "Visualize an access graph for network mapper intents using go-graphviz",
	Args:  cobra.NoArgs,
	RunE: func(cmd *cobra.Command, args []string) error {
		return mapperclient.WithClient(func(c *mapperclient.Client) error {
			namespacesFilter := viper.GetStringSlice(NamespacesKey)

			servicesIntents, err := c.ServiceIntents(context.Background(), namespacesFilter)
			if err != nil {
				return err
			}

			visualizer, err := intentsvisualizer.NewVisualizer()
			if err != nil {
				return err
			}
			defer visualizer.Close()

			if err := visualizer.Build(intentsoutput.MapperIntentsToAPIIntents(servicesIntents)); err != nil {
				return err
			}

			if err := visualizer.RenderOutputToFile(); err != nil {
				return err
			}

			return nil
		})
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL