internal

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Assert added in v1.0.7

func Assert(t *testing.T, what string, want, got any)

Assert asserts that two values are equal.

func AssertError added in v1.0.7

func AssertError(t *testing.T, wantErr string, err error)

AssertError asserts that an error matches the expected error string. If wantErr is empty, it expects no error. Otherwise, it expects the error message to exactly match wantErr.

func CheckForUpdates

func CheckForUpdates(
	ctx context.Context,
	debugLog *log.Logger,
	g ContainerAPIMetadataGetter,
	inUse Semver,
)
Example
defer func(w io.Writer, flags int, p string) {
	log.SetOutput(w)
	log.SetFlags(flags)
	log.SetPrefix(p)
}(log.Writer(), log.Flags(), log.Prefix())

log.SetOutput(os.Stdout)
log.SetFlags(0)
log.SetPrefix("[logger] ")
debugLog := log.New(log.Writer(), log.Prefix(), log.Flags())

ctx := context.Background()

CheckForUpdates(ctx, debugLog, fakeContainerAPIMetadataGetter("1.4.33"), "v1.4.33")
CheckForUpdates(ctx, debugLog, fakeContainerAPIMetadataGetter("very bad error occurred"), "v1.4.33")

fmt.Println("now we should get warnings")
CheckForUpdates(ctx, debugLog, fakeContainerAPIMetadataGetter("v1.6.11"), "v1.4.33")
CheckForUpdates(ctx, debugLog, fakeContainerAPIMetadataGetter("v2.7.3"), "v2.7.3-beta")
Output:

[logger] could not get latest lightsailctl version: very bad error occurred
now we should get warnings
[logger] WARNING: You are using lightsailctl v1.4.33, but v1.6.11 is available.
To download, visit https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-install-software
[logger] WARNING: You are using lightsailctl v2.7.3-beta, but v2.7.3 is available.
To download, visit https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-install-software

Types

type ContainerAPIMetadataGetter

type ContainerAPIMetadataGetter interface {
	GetContainerAPIMetadata(
		context.Context,
		*lightsail.GetContainerAPIMetadataInput,
		...func(*lightsail.Options),
	) (*lightsail.GetContainerAPIMetadataOutput, error)
}

type Semver

type Semver string
const Version Semver = "v1.0.7"

func (Semver) IsValid

func (v Semver) IsValid() bool

func (Semver) Less

func (v Semver) Less(other Semver) bool

func (Semver) String

func (v Semver) String() string

Directories

Path Synopsis
Package cs implements features related to Lightsail (C)ontainer (S)ervice.
Package cs implements features related to Lightsail (C)ontainer (S)ervice.
Package plugin implements extensions for AWS CLI's lightsail subcommand.
Package plugin implements extensions for AWS CLI's lightsail subcommand.

Jump to

Keyboard shortcuts

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