Documentation
¶
Index ¶
- Variables
- func AddDetailedFlag(c *cobra.Command) error
- func AddPathPersistentFlag(c *cobra.Command) error
- func AddRpcOutputFlag(c *cobra.Command) error
- func AddTargetPersistentFlag(c *cobra.Command) error
- func ConvertSDCConfigToInternalIntent(ctx context.Context, cd *configdiff.ConfigDiff, sdcConfig *v1alpha1.Config) (*rawparams.ConfigLoadRaw, error)
- func EmitBashCompletionWithWordbreakMods(root *cobra.Command, out io.Writer) error
- func EnableFlagAndDisableFileCompletion(cmd *cobra.Command)
- func Execute()
- func LoadSDCConfigCR(configByte []byte) (*v1alpha1.Config, error)
- func RunFromRaw(ctx context.Context, opts config.ConfigOpts, optsP config.ConfigPersistentOpts, ...) (interfaces.Output, error)
- func WriteOutput(ctx context.Context, o interfaces.Output) (err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var SchemaListCmd = &cobra.Command{ Use: "list", Short: "list available schemas", SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { var err error var c *config.Config var cd *configdiff.ConfigDiff ctx := cmd.Context() opts := config.ConfigOpts{} c, err = config.NewConfig(opts...) if err != nil { return err } cd, err = configdiff.NewConfigDiff(ctx, c) if err != nil { return err } schemas, err := cd.SchemasList(ctx) if err != nil { return err } outputSchemas := output.NewSchemaOutputList(schemas) err = WriteOutput(ctx, outputSchemas) if err != nil { return err } return nil }, }
SchemaListCmd represents the list command
View Source
var SchemaLoadCmd = &cobra.Command{ Use: "load", Short: "load a schema", SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { var err error ctx := cmd.Context() rawParam := rawparams.NewSchemaLoadConfigRaw() rawParam.SetFile(schemaDefinitionFile) if rpcOutput { return pipeline.PipelineAppendStep(os.Stdout, rawParam) } opts := config.ConfigOpts{ config.WithSchemaPathCleanup(schemaPathCleanup), } optsP = append(optsP, config.WithTargetName(targetName)) out, err := RunFromRaw(ctx, opts, optsP, true, rawParam) if err != nil { return err } err = WriteOutput(ctx, out) if err != nil { return err } return nil }, }
SchemaLoadCmd represents the list command
View Source
var SchemaRemoveCmd = &cobra.Command{ Use: "remove", Short: "remove a certain schema", SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { var err error ctx := cmd.Context() opts := config.ConfigOpts{} c, err := config.NewConfigPersistent(opts, optsP) if err != nil { return err } log.Infof("Schema Remove") cd, err := configdiff.NewConfigDiffPersistence(ctx, c) if err != nil { return err } if schemaDefinitionFile != "" { schema, err := utils.GetSchemaConfig(schemaDefinitionFile) if err != nil { return err } schemaVendor = schema.Spec.Provider schemaVersion = schema.Spec.Version } err = cd.SchemaRemove(ctx, schemaVendor, schemaVersion) if err != nil { return err } log.Infof("Schema Vendor: %s, Version: %s - Removed Successful", schemaVendor, schemaVersion) return nil }, }
SchemaListCmd represents the list command
Functions ¶
func AddDetailedFlag ¶
func AddPathPersistentFlag ¶
func AddRpcOutputFlag ¶
func AddTargetPersistentFlag ¶
func ConvertSDCConfigToInternalIntent ¶
func ConvertSDCConfigToInternalIntent(ctx context.Context, cd *configdiff.ConfigDiff, sdcConfig *v1alpha1.Config) (*rawparams.ConfigLoadRaw, error)
func EmitBashCompletionWithWordbreakMods ¶
EmitBashCompletionWithWordbreakMods writes a bash completion script for root to out, but replaces the registration so a wrapper is used which temporarily modifies COMP_WORDBREAKS.
- `adds` is a slice of single-character strings to append to COMP_WORDBREAKS if not already present (e.g. []string{"/", ":"}).
- `removes` is a slice of single-character strings to remove from COMP_WORDBREAKS while completing (e.g. []string{"=", "[", "]", "/"}).
The wrapper restores the original COMP_WORDBREAKS after the underlying completion function returns.
func Execute ¶
func Execute()
Execute adds all child commands to the root command and sets flags appropriately.
func RunFromRaw ¶
func RunFromRaw(ctx context.Context, opts config.ConfigOpts, optsP config.ConfigPersistentOpts, persist bool, rpcParams ...rpc.RpcRawParams) (interfaces.Output, error)
func WriteOutput ¶
func WriteOutput(ctx context.Context, o interfaces.Output) (err error)
Types ¶
This section is empty.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.