Documentation
¶
Index ¶
Constants ¶
View Source
const ( OutputLocationKey = "output" OutputLocationShorthand = "o" OutputTypeKey = "output-type" OutputWithDiffCommentsKey = "diff" OutputVersionKey = "output-version" OutputVersionShortHand = "v" OutputVersionV1 = "v1" OutputVersionV2 = "v2" )
View Source
const ( OutputTypeSingleFile = "single-file" OutputTypeDirectory = "dir" )
Variables ¶
View Source
var ExportClientIntentsCmd = &cobra.Command{ Use: "export [<service-id>]", Short: "Export client intents for a service", Args: cobra.MaximumNArgs(1), SilenceUsage: true, RunE: func(_ *cobra.Command, args []string) error { ctxTimeout, cancel := context.WithTimeout(context.Background(), config.DefaultTimeout) defer cancel() c, err := cloudclient.NewClient(ctxTimeout) if err != nil { return err } filter, err := servicesFilterFromFlags(ctxTimeout, c) if err != nil { return err } if len(args) == 1 { serviceID := args[0] filter.ServiceIds = lo.ToPtr(append(lo.FromPtr(filter.ServiceIds), serviceID)) } featureFlags := cloudapi.InputFeatureFlags{} if viper.GetString(OutputVersionKey) == OutputVersionV2 { featureFlags.UseClientIntentsV2 = lo.ToPtr(true) } r, err := c.ClientIntentsQueryWithResponse(ctxTimeout, cloudapi.ClientIntentsQueryJSONRequestBody{ ClusterIds: filter.ClusterIds, Filter: filter, LastSeenAfter: nil, FeatureFlags: &featureFlags, }) if err != nil { return err } outputLocation := viper.GetString(OutputLocationKey) outputType := viper.GetString(OutputTypeKey) withDiffComments := viper.GetBool(OutputWithDiffCommentsKey) writer := NewIntentsWriter(outputLocation, outputType, withDiffComments) return writer.WriteExportedIntents(lo.FromPtr(r.JSON200)) }, }
Functions ¶
This section is empty.
Types ¶
type IntentsWriter ¶ added in v1.0.13
func NewIntentsWriter ¶ added in v1.0.13
func NewIntentsWriter(outputLocation string, outputType string, withDiffComments bool) *IntentsWriter
func (*IntentsWriter) WriteExportedIntents ¶ added in v1.0.13
func (w *IntentsWriter) WriteExportedIntents(files []cloudapi.ClientIntentsFileRepresentation) error
Click to show internal directories.
Click to hide internal directories.