Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var BlueprintsApplyCmd = &cobra.Command{ Use: "apply", Short: "Cloud Blueprints Apply", Long: `Apply cloud blueprint.`, SilenceErrors: true, Example: `aperturectl cloud blueprints apply --value-file=values.yaml`, PreRunE: func(cmd *cobra.Command, args []string) error { if valuesFile == "" && valuesDir == "" { return fmt.Errorf("either --values-file or --dir is required") } return nil }, RunE: func(cmd *cobra.Command, args []string) error { if valuesDir != "" { err := filepath.Walk(valuesDir, func(path string, info os.FileInfo, err error) error { if !info.IsDir() { if err := applyBlueprint(path); err != nil { return err } } return nil }) if err != nil { return fmt.Errorf("failed to apply blueprints: %w", err) } return nil } if err := applyBlueprint(valuesFile); err != nil { return fmt.Errorf("failed to apply blueprint: %w", err) } return nil }, }
BlueprintsApplyCmd is the command to apply a blueprint from the Cloud Controller.
View Source
var BlueprintsArchiveCmd = &cobra.Command{ Use: "archive POLICY_NAME", Short: "Cloud Blueprints Archive for the given Policy Name", Long: `Archive cloud blueprint.`, SilenceErrors: true, Args: cobra.ExactArgs(1), Example: `aperturectl cloud blueprints archive rate-limiting`, RunE: func(cmd *cobra.Command, args []string) error { _, err := client.Archive(context.Background(), &cloudv1.DeleteRequest{ PolicyName: args[0], }) if err != nil { return err } log.Info().Str("policy-name", args[0]).Msg("Successfully archived blueprint for Policy") return nil }, }
BlueprintsArchiveCmd is the command to archive a blueprint from the Cloud Controller.
View Source
var BlueprintsCmd = &cobra.Command{ Use: "blueprints", Short: "Cloud Blueprints", Long: `Interact with cloud blueprints.`, SilenceErrors: true, PersistentPreRunE: func(cmd *cobra.Command, args []string) error { err := controller.PreRunE(cmd, args) if err != nil { return fmt.Errorf("failed to cloud controller setup: %w", err) } client, err = controller.CloudBlueprintsClient() if err != nil { return fmt.Errorf("failed to get cloud controller client: %w", err) } return nil }, PersistentPostRun: controller.PostRun, }
BlueprintsCmd is the command to apply a policy to the Cloud Controller.
View Source
var BlueprintsDeleteCmd = &cobra.Command{ Use: "delete POLICY_NAME", Short: "Cloud Blueprints Delete for the given Policy Name", Long: `Delete cloud blueprint.`, SilenceErrors: true, Args: cobra.ExactArgs(1), Example: `aperturectl cloud blueprints delete rate-limiting`, RunE: func(cmd *cobra.Command, args []string) error { _, err := client.Delete(context.Background(), &cloudv1.DeleteRequest{ PolicyName: args[0], }) if err != nil { return err } log.Info().Str("policy-name", args[0]).Msg("Successfully deleted blueprint for Policy") return nil }, }
BlueprintsDeleteCmd is the command to delete a blueprint from the Cloud Controller.
View Source
var BlueprintsGetCmd = &cobra.Command{ Use: "get POLICY_NAME", Short: "Cloud Blueprints Get", Long: `Get cloud blueprint.`, SilenceErrors: true, Args: cobra.ExactArgs(1), Example: `aperturectl cloud blueprints get rate-limiting`, RunE: func(cmd *cobra.Command, args []string) error { getResponse, err := client.Get(context.Background(), &cloudv1.GetRequest{ PolicyName: args[0], }) if err != nil { return err } fmt.Printf("Name: %s\n", getResponse.GetBlueprint().GetBlueprintsName()) fmt.Printf("Version: %s\n", getResponse.GetBlueprint().GetVersion()) fmt.Printf("Policy Name: %s\n", getResponse.GetBlueprint().GetPolicyName()) yamlString, err := utils.GetYAMLString(getResponse.GetBlueprint().GetValues()) if err != nil { return err } yamlString = strings.ReplaceAll(yamlString, "\n", "\n\t") fmt.Printf("Values: \n\t%s\n", yamlString) return nil }, }
BlueprintsGetCmd is the command to get a blueprint from the Cloud Controller.
View Source
var BlueprintsListCmd = &cobra.Command{ Use: "list", Short: "Cloud Blueprints List", Long: `List cloud blueprints.`, SilenceErrors: true, Example: `aperturectl cloud blueprints list`, RunE: func(cmd *cobra.Command, args []string) error { listResponse, err := client.List(context.Background(), &emptypb.Empty{}) if err != nil { return fmt.Errorf("failed to list blueprints: %w", err) } w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', tabwriter.Debug) for _, blueprint := range listResponse.GetBlueprints() { fmt.Fprintf(w, "%s\n", blueprint.GetPolicyName()) } if err := w.Flush(); err != nil { return fmt.Errorf("failed to flush writer: %w", err) } return nil }, }
BlueprintsListCmd is the command to list blueprints from the Cloud Controller.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.