shared

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GCPExperienceBase is the default management API URL for GCP Experience
	GCPExperienceBase = "https://apigee.googleapis.com"

	// LegacySaaSManagementBase is the default base for legacy SaaS management operations
	LegacySaaSManagementBase = "https://api.enterprise.apigee.com"

	// DefaultManagementBase is the base URL for GCE Experience management operations
	DefaultManagementBase = GCPExperienceBase

	// RuntimeBaseFormat is a format for base of the organization runtime URL (legacy SaaS and OPDK)
	RuntimeBaseFormat = "https://%s-%s.apigee.net"
)

Variables

This section is empty.

Functions

func AddCommandWithFlags

func AddCommandWithFlags(c *cobra.Command, rootArgs *RootArgs, cmds ...*cobra.Command)

AddCommandWithFlags adds to the root command with standard flags

func Errorf

func Errorf(format string, args ...interface{})

Errorf is a FormatFn that prints the formatted string to os.Stderr.

func FormatFnWriter

func FormatFnWriter(fn FormatFn) io.Writer

FormatFnWriter bridges io.Writer to FormatFn

func NoPrintf

func NoPrintf(format string, args ...interface{})

NoPrintf is a FormatFn that does nothing

func Printf

func Printf(format string, args ...interface{})

Printf is a FormatFn that prints the formatted string to os.Stdout.

Types

type BuildInfoType

type BuildInfoType struct {
	Version string
	Commit  string
	Date    string
}

BuildInfoType holds version information

var BuildInfo BuildInfoType

BuildInfo is populated by main init()

type FormatFn

type FormatFn func(format string, args ...interface{})

FormatFn formats the supplied arguments according to the format string provided and executes some set of operations with the result.

type OverrideEnv

type OverrideEnv struct {
	Name      string `yaml:"name"`
	HostAlias string `yaml:"hostAlias"`
}

OverrideEnv is subconfig of overrideConfig

type RootArgs

type RootArgs struct {
	RuntimeBase        string // "https://org-env.apigee.net"
	ManagementBase     string // "https://api.enterprise.apigee.com"
	Verbose            bool
	Org                string
	Env                string
	Username           string
	Password           string
	MFAToken           string
	Token              string
	NetrcPath          string
	IsOPDK             bool
	IsLegacySaaS       bool
	IsGCPManaged       bool
	ConfigPath         string
	InsecureSkipVerify bool
	Namespace          string
	TLSCAFile          string
	TLSCertFile        string
	TLSKeyFile         string

	ServerConfig *server.Config // config loaded from ConfigPath

	// the following is derived in Resolve()
	InternalProxyURL      string
	RemoteServiceProxyURL string
	RemoteTokenProxyURL   string
	ApigeeClient          *apigee.EdgeClient
	ClientOpts            *apigee.EdgeClientOptions
}

RootArgs is the base struct to hold all command arguments

func (*RootArgs) CreateJWKS

func (r *RootArgs) CreateJWKS(truncate int, verbosef FormatFn) (keyID string, pkBytes, jwksBytes []byte, err error)

CreateJWKS returns keyID, private key, jwks, error

func (*RootArgs) CreateNewKey

func (r *RootArgs) CreateNewKey() (keyID string, privateKey *rsa.PrivateKey, jwks jwk.Set, err error)

CreateNewKey returns keyID, private key, jwks, error

func (*RootArgs) GetCertsURL

func (r *RootArgs) GetCertsURL() string

func (*RootArgs) GetProductsURL

func (r *RootArgs) GetProductsURL() string

func (*RootArgs) GetQuotasURL

func (r *RootArgs) GetQuotasURL() string

func (*RootArgs) GetTokenURL

func (r *RootArgs) GetTokenURL() string

func (*RootArgs) GetVerifyAPIKeyURL

func (r *RootArgs) GetVerifyAPIKeyURL() string

func (*RootArgs) PrintMissingFlags

func (r *RootArgs) PrintMissingFlags(missingFlagNames []string) error

PrintMissingFlags will aggregate and print an error for the passed set of flags

func (*RootArgs) Resolve

func (r *RootArgs) Resolve(skipAuth, requireRuntime bool) error

Resolve is used to populate shared args, it's automatically called prior when creating the root command

func (*RootArgs) RotateJWKS

func (r *RootArgs) RotateJWKS(set jwk.Set, truncate int) (jwk.Set, error)

RotateJWKS returns a jwk.Set including passed keys and keys from existing endpoint, sorted by key ID and truncated per the truncate param.

Jump to

Keyboard shortcuts

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