update

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const (
	NameKey       = "name"
	NameShorthand = "n"
	ImageURLKey   = "image-url"
)

Variables

View Source
var UpdateOrganizationCmd = &cobra.Command{
	Use:          "update <organization-id>",
	Short:        "Update an organization",
	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]
		r, err := c.UpdateOrganizationMutationWithResponse(ctxTimeout,
			id,
			cloudapi.UpdateOrganizationMutationJSONRequestBody{
				Name:     lo.Ternary(viper.IsSet(NameKey), lo.ToPtr(viper.GetString(NameKey)), nil),
				ImageURL: lo.Ternary(viper.IsSet(ImageURLKey), lo.ToPtr(viper.GetString(ImageURLKey)), nil),
			},
		)
		if err != nil {
			return err
		}

		prints.PrintCliStderr("Organization updated")
		output.FormatOrganizations([]cloudapi.Organization{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