Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ApplyCmd = &cobra.Command{ Use: "apply", Short: "Apply Aperture DynamicConfig to a Policy", Long: `Use this command to apply the Aperture DynamicConfig to a Policy.`, SilenceErrors: true, Example: `aperturectl cloud dynamic-config apply --policy=rate-limiting --file=dynamic-config.yaml`, PreRunE: func(cmd *cobra.Command, args []string) error { // read the dynamic config file var err error dynamicConfigBytes, err = utils.GetDynamicConfigBytes(policyName, dynamicConfigFile) if err != nil { return err } return nil }, RunE: func(_ *cobra.Command, _ []string) error { dynamicConfigYAML := make(map[string]interface{}) err := yaml.Unmarshal(dynamicConfigBytes, &dynamicConfigYAML) if err != nil { return fmt.Errorf("failed to parse DynamicConfig YAML: %w", err) } err = utils.ApplyDynamicConfigUsingAPI(client, dynamicConfigYAML, policyName) if err != nil { return err } log.Info().Str("policy", policyName).Msg("Updated DynamicConfig successfully") return nil }, }
ApplyCmd is the command to apply DynamicConfig to a Policy.
View Source
var (
Controller cloudutils.ControllerConn
)
View Source
var DelCmd = &cobra.Command{ Use: "delete POLICY_NAME", Short: "Delete Aperture DynamicConfig of a Policy.", Long: "Use this command to delete the Aperture DynamicConfig of a Policy.", Example: "aperture cloud dynamic-config delete rate-limiting", SilenceErrors: true, Args: cobra.ExactArgs(1), RunE: func(_ *cobra.Command, args []string) error { _, err := client.DeleteDynamicConfig(context.Background(), &languagev1.DeleteDynamicConfigRequest{ PolicyName: args[0], }) if err != nil { return err } fmt.Println("Deleted DynamicConfig successfully") return nil }, }
DelCmd is a command to delete a policy's dynamic config.
View Source
var DynamicConfigCmd = &cobra.Command{ Use: "dynamic-config", Short: "DynamicConfig of Aperture Policy related commands for the Cloud Controller", Long: ` Use this command to manage the DynamicConfig of the Aperture Policies to the Cloud Controller.`, SilenceErrors: true, PersistentPreRunE: func(cmd *cobra.Command, args []string) error { var err error err = Controller.PreRunE(cmd, args) if err != nil { return fmt.Errorf("failed to run controller pre-run: %w", err) } client, err = Controller.PolicyClient() if err != nil { return fmt.Errorf("failed to get controller client: %w", err) } return nil }, PersistentPostRun: Controller.PostRun, }
DynamicConfigCmd is the command to manage DynamicCOnfig of Policies in the Cloud Controller.
View Source
var GetCmd = &cobra.Command{ Use: "get POLICY_NAME", Short: "Get Aperture DynamicConfig for a Policy.", Long: "Use this command to get the Aperture DynamicConfig of a Policy.", Example: "aperture cloud dynamic-config get rate-limiting", SilenceErrors: true, Args: cobra.ExactArgs(1), RunE: func(_ *cobra.Command, args []string) error { policyName := args[0] err := utils.GetDynamicConfigUsingAPI(client, policyName) if err != nil { return fmt.Errorf("failed to get dynamic config using API: %w", err) } return nil }, }
GetCmd is a command to get a policy's dynamic config.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.