helper

package
v0.0.0-...-675a61e Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FlagAutoClone = &cli.BoolFlag{
	Name:  "autoclone",
	Usage: "If the selected service version is not editable, clone it and use the clone",
}

FlagAutoClone is a commonly used flag.

View Source
var FlagCustomerID = &cli.StringFlag{
	Name:  "customer-id",
	Usage: fmt.Sprintf("Alphanumeric string identifying the customer (falls back to %s)", env.CustomerID),
}

FlagCustomerID is a commonly used flag.

View Source
var FlagServiceID = &cli.StringFlag{
	Name:  "service-id",
	Usage: fmt.Sprintf("Service ID (falls back to %s, then fastly.toml)", env.ServiceID),
}

FlagServiceID is a commonly used flag.

View Source
var FlagServiceName = &cli.StringFlag{
	Name:  "service-name",
	Usage: "The name of the service",
}

FlagServiceName is a commonly used flag.

View Source
var FlagServiceVersion = &cli.StringFlag{
	Name:  "service-version",
	Usage: "'latest', 'active', or the number of a specific Fastly service version",
}

FlagServiceVersion is a commonly used flag.

Functions

func AutoClone

func AutoClone(ctx *cli.Context, g global.Data, sid string, v *fastly.Version) (sv int, err error)

AutoClone returns either the provided Service Version or an updated version. It will clone the service if the current version is either active or locked.

func GetActiveVersion

func GetActiveVersion(vs []*fastly.Version) (*fastly.Version, error)

GetActiveVersion returns the active service version.

func GetSpecifiedVersion

func GetSpecifiedVersion(vs []*fastly.Version, version string) (*fastly.Version, error)

GetSpecifiedVersion returns the specified service version.

func MergeFlagsWithGlobal

func MergeFlagsWithGlobal(flags []cli.Flag) []cli.Flag

MergeFlagsWithGlobal merges command local flags with global flags. This is necessary as we can't create global flags with urfave/cli. So we provide a helper to make it easy to expose flags defined as global.

func NewCreateCmd

func NewCreateCmd(category string) *cli.Command

NewCreateCmd returns a create action command with predefined settings.

func NewDeleteCmd

func NewDeleteCmd(category string) *cli.Command

NewDeleteCmd returns a delete action command with predefined settings.

func NewListCmd

func NewListCmd(category string) *cli.Command

NewListCmd returns a read action command with predefined settings.

func NewReadCmd

func NewReadCmd(category string) *cli.Command

NewReadCmd returns a read action command with predefined settings.

func NewUpdateCmd

func NewUpdateCmd(category string) *cli.Command

NewUpdateCmd returns a update action command with predefined settings.

func ServiceDetails

func ServiceDetails(ctx *cli.Context, g global.Data) (sid string, sv int, err error)

ServiceDetails returns the Service ID and the version that should be used.

func ServiceID

func ServiceID(ctx *cli.Context, g global.Data) (sid string, err error)

ServiceID returns the ServiceID. It first checks the --service-id flag. Next it checks an environment variable. Next it checks the --service-name flag.

func ServiceVersion

func ServiceVersion(ctx *cli.Context, g global.Data, sid string) (sv *fastly.Version, err error)

ServiceVersion returns the Service Version.

Types

This section is empty.

Jump to

Keyboard shortcuts

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