Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var TargetConfigCmd = &cobra.Command{ Use: "target-config", Short: "Manage target configs", Args: cobra.NoArgs, GroupID: util.SERVER_GROUP, Aliases: []string{"target-configs", "tc"}, }
View Source
var TargetConfigCreateCmd = &cobra.Command{ Use: "create", Short: "Create target config", Args: cobra.NoArgs, Aliases: cmd_common.GetAliases("create"), RunE: func(cmd *cobra.Command, args []string) error { ctx := context.Background() var input []byte var err error if pipeFile == "-" { input, err = io.ReadAll(os.Stdin) if err != nil { return fmt.Errorf("failed to read from stdin: %w", err) } return handleTargetConfigJSON(input) } else if pipeFile != "" { input, err = os.ReadFile(pipeFile) if err != nil { return fmt.Errorf("failed to read file %s: %w", pipeFile, err) } return handleTargetConfigJSON(input) } apiClient, err := apiclient_util.GetApiClient(nil) if err != nil { return err } c, err := config.GetConfig() if err != nil { return err } activeProfile, err := c.GetActiveProfile() if err != nil { return err } targetConfig, err := TargetConfigCreationFlow(ctx, apiClient, activeProfile.Name) if err != nil { return err } if targetConfig == nil { return nil } views.RenderInfoMessage(fmt.Sprintf("Target config '%s' created successfully", targetConfig.Name)) return nil }, }
Functions ¶
func TargetConfigCreationFlow ¶
func TargetConfigCreationFlow(ctx context.Context, apiClient *apiclient.APIClient, activeProfileName string) (*targetconfig.TargetConfigView, error)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.