update

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2024 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const (
	GlobalDefaultDenyKey                     = "global-default-deny"
	UseNetworkPoliciesInAccessGraphStatesKey = "use-network-policies-in-access-graph-states"
)

Variables

View Source
var UpdateClusterCmd = &cobra.Command{
	Use:          "update <cluster-id>",
	Short:        "Update a cluster",
	Args:         cobra.ExactArgs(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
		}

		id := args[0]

		var configuration cloudapi.ClusterConfigurationInput
		if viper.IsSet(GlobalDefaultDenyKey) {
			configuration.GlobalDefaultDeny = viper.GetBool(GlobalDefaultDenyKey)
		}

		if viper.IsSet(UseNetworkPoliciesInAccessGraphStatesKey) {
			configuration.UseNetworkPoliciesInAccessGraphStates = viper.GetBool(UseNetworkPoliciesInAccessGraphStatesKey)
		}

		r, err := c.UpdateClusterMutationWithResponse(ctxTimeout,
			id,
			cloudapi.UpdateClusterMutationJSONRequestBody{
				Configuration: &configuration,
			},
		)
		if err != nil {
			return err
		}

		prints.PrintCliStderr("Cluster updated")
		output.FormatClusters([]cloudapi.Cluster{lo.FromPtr(r.JSON200)})
		return nil
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL