version

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: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var APIVersionCmd = &cobra.Command{
	Use:          "api-version",
	Short:        "Get the Otterize API version",
	Args:         cobra.NoArgs,
	SilenceUsage: true,
	RunE: func(_ *cobra.Command, args []string) error {
		ctxTimeout, cancel := context.WithTimeout(context.Background(), config.DefaultTimeout)
		defer cancel()

		localAPIVersion, err := cloudclient.GetLocalAPIVersion()
		if err != nil {
			return err
		}

		c, err := cloudclient.NewClient(ctxTimeout)
		if err != nil {
			return err
		}

		cloudAPIVersion, err := c.GetAPIVersion()
		if err != nil {
			return err
		}

		prints.PrintCliOutput(
			`Current Cloud API: 
    version: %s 
    revision: %s 
This CLI was built against: 
    version: %s 
    revision: %s`,
			cloudAPIVersion.Version, cloudAPIVersion.Revision,
			localAPIVersion.Version, localAPIVersion.Revision)

		if cloudAPIVersion != localAPIVersion {
			prints.PrintCliStderr(`
Caution: this CLI was built with a different version/revision of the Otterize Cloud API. 
Some Cloud CLI commands may fail. 
Upgrade your CLI to the latest build to resolve this issue. 
For upgrade instructions, see https://docs.otterize.com/getting-started/oss-installation#install-the-otterize-cli
`)
		} else {
			prints.PrintCliOutput(`
This CLI was built using the latest version & revision of the Otterize Cloud API.`)
		}

		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