version

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 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 {
		localApiVersion, err := restapi.GetLocalApiVersion()
		if err != nil {
			return err
		}

		cloudApiVersion, err := restapi.GetCloudApiVersion(viper.GetString(config.OtterizeAPIAddressKey))
		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