helpers

package
v6.39.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2018 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DebugCommandPrefix = "\nCMD>"
	DebugOutPrefix     = "OUT: "
	DebugErrPrefix     = "ERR: "
)
View Source
const (
	GUIDRegex                       = "[\\da-f]{8}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{12}"
	ISO8601Regex                    = "\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}.\\d{1,3}[+-]\\d{4}"
	StaticfileBuildpackStartCommand = "\\$HOME/boot.sh|sh boot.sh"
	UserFriendlyDateRegex           = "[A-Z][a-z]{2} \\d{2} [A-Z][a-z]{2} \\d{2}:\\d{2}:\\d{2} [A-Z]+ \\d{4}"
)
View Source
const (
	DefaultV2Version string = "2.100.0"
	DefaultV3Version string = "3.33.3"
)
View Source
const (
	DefaultMemoryLimit = "256M"
	DefaultDiskLimit   = "1G"
)
View Source
const MaxTestPort = 1034

MaxTestPort should be defined by the CF router group for integration tests.

View Source
const MinTestPort = 1024

MinTestPort should be defined by the CF router group for integration tests.

Variables

This section is empty.

Functions

func AddOrReplaceEnvironment

func AddOrReplaceEnvironment(env []string, newEnvName string, newEnvVal string) []string

func AppGUID

func AppGUID(appName string) string

AppGUID returns the GUID for an app in the currently targeted space.

func BuildConfigurablePlugin

func BuildConfigurablePlugin(pluginType string, name string, version string, pluginCommands []PluginCommand) string

func BuildpackWithStack

func BuildpackWithStack(f func(buildpackArchive string), stackName string)

func BuildpackWithoutStack

func BuildpackWithoutStack(f func(buildpackArchive string))

func BuildpacksOutputRegex

func BuildpacksOutputRegex(fields BuildpackFields) string

func CF

func CF(args ...string) *Session

func CFWithEnv

func CFWithEnv(envVars map[string]string, args ...string) *Session

func CFWithStdin

func CFWithStdin(stdin io.Reader, args ...string) *Session

func CheckEnvironmentTargetedCorrectly

func CheckEnvironmentTargetedCorrectly(targetedOrganizationRequired bool, targetedSpaceRequired bool, testOrg string, command ...string)

CheckEnvironmentTargetedCorrectly will confirm if the command requires an API to be targeted and logged in to run. It can optionally check if the command requires org and space to be targeted.

func ClearTarget

func ClearTarget()

func ConfirmStagingLogs

func ConfirmStagingLogs(session *Session)

func ConvertPathToRegularExpression

func ConvertPathToRegularExpression(path string) string

ConvertPathToRegularExpression converts a windows file path into a string which may be embedded in a ginkgo-compatible regular expression.

func CreateCCV2Client

func CreateCCV2Client() (*ccv2.Client, error)

func CreateOrg

func CreateOrg(org string)

func CreateOrgAndSpace

func CreateOrgAndSpace(org string, space string)

func CreateSpace

func CreateSpace(space string)

func CreateStack

func CreateStack(names ...string) string

func Curl

func Curl(obj interface{}, url string, props ...interface{})

func CustomCF

func CustomCF(cfEnv CFEnv, args ...string) *Session

func DebugCustomCF

func DebugCustomCF(cfEnv CFEnv, args ...string) *Session

func DefaultSharedDomain

func DefaultSharedDomain() string

func DeleteStack

func DeleteStack(name string)

func DestroyHomeDir

func DestroyHomeDir(homeDir string)

func DisableFeatureFlag

func DisableFeatureFlag(flagName string)

func DomainName

func DomainName(prefix ...string) string

func EnableFeatureFlag

func EnableFeatureFlag(flagName string)

func EnsureMinimumNumberOfStacks

func EnsureMinimumNumberOfStacks(num int) []string

func FetchStacks

func FetchStacks() []string

func FindOrCreateTCPRouterGroup

func FindOrCreateTCPRouterGroup(node int) string

func GenerateHigherName

func GenerateHigherName(randomNameGenerator func() string, names ...string) string

TODO: Is this working???

func GenerateLowerName

func GenerateLowerName(randomNameGenerator func() string, names ...string) string

TODO: Is this working???

func GetAPI

func GetAPI() string

func GetAPIVersionV2

func GetAPIVersionV2() string

func GetCredentials

func GetCredentials() (string, string)

GetCredentials returns back the username and the password.

func GetIsolationSegmentGUID

func GetIsolationSegmentGUID(name string) string

func GetOIDCCredentials

func GetOIDCCredentials() (string, string)

GetOIDCCredentials returns back the username and the password for OIDC origin.

func GetOrgGUID

func GetOrgGUID(orgName string) string

func GetSpaceGUID

func GetSpaceGUID(spaceName string) string

func InstallConfigurablePlugin

func InstallConfigurablePlugin(name string, version string, pluginCommands []PluginCommand)

func InstallConfigurablePluginFailsUninstall

func InstallConfigurablePluginFailsUninstall(name string, version string, pluginCommands []PluginCommand)

func InvalidAccessToken

func InvalidAccessToken() string

func IsUAAVersionAtLeast

func IsUAAVersionAtLeast(minVersion string) bool

func IsVersionMet

func IsVersionMet(minVersion string) bool

func LoginCF

func LoginCF() string

func LoginCFWithClientCredentials

func LoginCFWithClientCredentials() string

func LogoutCF

func LogoutCF()

func MakeBuildpackArchive

func MakeBuildpackArchive(stackName string) string

func ManagedServiceInstanceGUID

func ManagedServiceInstanceGUID(managedServiceInstanceName string) string

ManagedServiceInstanceGUID returns the GUID for a managed service instance.

func MapRouteToApplication

func MapRouteToApplication(app string, domain string, host string, path string)

func NewAppName

func NewAppName() string

func NewBuildpackName

func NewBuildpackName() string

func NewIsolationSegmentName

func NewIsolationSegmentName(infix ...string) string

func NewOrgName

func NewOrgName() string

func NewPassword

func NewPassword() string

func NewPlanName

func NewPlanName() string

func NewPluginRepositoryServer

func NewPluginRepositoryServer(pluginRepo PluginRepository) *Server

func NewPluginRepositoryTLSServer

func NewPluginRepositoryTLSServer(pluginRepo PluginRepository) *Server

func NewSecurityGroupName

func NewSecurityGroupName(infix ...string) string

func NewServiceBrokerName

func NewServiceBrokerName() string

func NewSpaceName

func NewSpaceName() string

func NewStackName

func NewStackName() string

func NewUsername

func NewUsername() string

func PluginPlatform

func PluginPlatform() string

func PollLastOperationUntilSuccess

func PollLastOperationUntilSuccess(client *ccv2.Client, appName string, serviceInstanceName string)

func PrefixedRandomName

func PrefixedRandomName(namePrefix string) string

func QuickDeleteOrg

func QuickDeleteOrg(orgName string)

func QuickDeleteOrgIfExists

func QuickDeleteOrgIfExists(orgName string)

func QuickDeleteSpace

func QuickDeleteSpace(spaceName string)

func QuotaName

func QuotaName(name ...string) string

func RandomName

func RandomName() string

func RandomPort

func RandomPort() int

func SetAPI

func SetAPI() (string, string)

func SetConfig

func SetConfig(cb func(conf *configv3.Config))

func SetConfigContent

func SetConfigContent(dir string, rawConfig string)

func SetHomeDir

func SetHomeDir() string

func SetupBuildpackWithStack

func SetupBuildpackWithStack(buildpackName, stack string)

func SetupBuildpackWithoutStack

func SetupBuildpackWithoutStack(buildpackName string)

func SetupCF

func SetupCF(org string, space string)

func SetupReadOnlyOrgAndSpace

func SetupReadOnlyOrgAndSpace() (string, string)

func SetupSynchronizedSuite

func SetupSynchronizedSuite(setup func())

func Sha1Sum

func Sha1Sum(path string) string

Sha1Sum calculates the SHA1 sum of a file.

func SkipIfClientCredentialsNotSet

func SkipIfClientCredentialsNotSet() (string, string)

func SkipIfPrivateDockerInfoNotSet

func SkipIfPrivateDockerInfoNotSet() (string, string, string)

func SkipIfUAAVersionAtLeast

func SkipIfUAAVersionAtLeast(version string)

func SkipIfUAAVersionLessThan

func SkipIfUAAVersionLessThan(version string)

func SkipIfVersionAtLeast

func SkipIfVersionAtLeast(maxVersion string)

func SkipIfVersionLessThan

func SkipIfVersionLessThan(minVersion string)

func StartAndTargetServerWithAPIVersions

func StartAndTargetServerWithAPIVersions(v2Version string, v3Version string) *Server

func StartAndTargetServerWithoutV3API

func StartAndTargetServerWithoutV3API() *Server

func TargetOrg

func TargetOrg(org string)

func TargetOrgAndSpace

func TargetOrgAndSpace(org string, space string)

func TurnOffColors

func TurnOffColors()

func TurnOffExperimental

func TurnOffExperimental()

func TurnOnExperimental

func TurnOnExperimental()

func UnmapRouteFromApplication

func UnmapRouteFromApplication(app string, domain string, host string, path string)

func UnrefactoredCheckEnvironmentTargetedCorrectly

func UnrefactoredCheckEnvironmentTargetedCorrectly(targetedOrganizationRequired bool, targetedSpaceRequired bool, testOrg string, command ...string)

func UnsetAPI

func UnsetAPI()

func UserProvidedServiceInstanceGUID

func UserProvidedServiceInstanceGUID(userProvidedServiceInstanceName string) string

UserProvidedServiceInstanceGUID returns the GUID for a user provided service instance.

func VerifyAppPackageContentsV2

func VerifyAppPackageContentsV2(appName string, files ...string)

func VerifyAppPackageContentsV3

func VerifyAppPackageContentsV3(appName string, files ...string)

func WithBananaPantsApp

func WithBananaPantsApp(f func(dir string))

WithBananaPantsApp creates a simple application to use with your CLI command (typically CF Push). When pushing, be aware of specifying '-b staticfile_buildpack" so that your app will correctly start up with the proper buildpack.

func WithCrashingApp

func WithCrashingApp(f func(dir string))

func WithHelloWorldApp

func WithHelloWorldApp(f func(dir string))

WithHelloWorldApp creates a simple application to use with your CLI command (typically CF Push). When pushing, be aware of specifying '-b staticfile_buildpack" so that your app will correctly start up with the proper buildpack.

func WithManifest

func WithManifest(manifest map[string]interface{}, f func(manifestDir string))

func WithMultiBuildpackApp

func WithMultiBuildpackApp(f func(dir string))

func WithNoResourceMatchedApp

func WithNoResourceMatchedApp(f func(dir string))

WithNoResourceMatchedApp creates a simple application to use with your CLI command (typically CF Push). When pushing, be aware of specifying '-b staticfile_buildpack" so that your app will correctly start up with the proper buildpack.

func WithProcfileApp

func WithProcfileApp(f func(dir string))

WithProcfileApp creates an application to use with your CLI command that contains Procfile defining web and worker processes.

func WriteCommand

func WriteCommand(env map[string]string, args []string)

func WriteManifest

func WriteManifest(path string, manifest map[string]interface{})

func Zipit

func Zipit(source, target, prefix string) error

Zipit zips the source into a .zip file in the target dir

Types

type AppInstanceRow

type AppInstanceRow struct {
	Index  string
	State  string
	Since  string
	CPU    string
	Memory string
	Disk   string
}

type AppProcessTable

type AppProcessTable struct {
	Type          string
	InstanceCount string
	MemUsage      string
	Instances     []AppInstanceRow
}

type AppTable

type AppTable struct {
	Processes []AppProcessTable
}

func ParseV3AppProcessTable

func ParseV3AppProcessTable(input []byte) AppTable

type Assets

type Assets struct {
	ServiceBroker string
}

func NewAssets

func NewAssets() Assets

type Binary

type Binary struct {
	Checksum string `json:"checksum"`
	Platform string `json:"platform"`
	URL      string `json:"url"`
}

type BuildpackFields

type BuildpackFields struct {
	Name     string
	Position string
	Enabled  string
	Locked   string
	Filename string
	Stack    string
}

type CFEnv

type CFEnv struct {
	WorkingDirectory string
	EnvVars          map[string]string
	// contains filtered or unexported fields
}

type Domain

type Domain struct {
	Org  string
	Name string
}

func NewDomain

func NewDomain(org string, name string) Domain

func (Domain) Create

func (d Domain) Create()

func (Domain) CreateShared

func (d Domain) CreateShared()

func (Domain) CreateWithRouterGroup

func (d Domain) CreateWithRouterGroup(routerGroup string)

func (Domain) Delete

func (d Domain) Delete()

func (Domain) DeleteShared

func (d Domain) DeleteShared()

func (Domain) Share

func (d Domain) Share()

type Package

type Package struct {
	Checksum string
}

func (*Package) UnmarshalJSON

func (p *Package) UnmarshalJSON(data []byte) error

type Plan

type Plan struct {
	Name    string      `json:"name"`
	ID      string      `json:"id"`
	Schemas PlanSchemas `json:"schemas"`
}

type PlanSchemas

type PlanSchemas struct {
	ServiceInstance struct {
		Create struct {
			Parameters map[string]interface{} `json:"parameters"`
		} `json:"create"`
		Update struct {
			Parameters map[string]interface{} `json:"parameters"`
		} `json:"update"`
	} `json:"service_instance"`
	ServiceBinding struct {
		Create struct {
			Parameters map[string]interface{} `json:"parameters"`
		} `json:"create"`
	} `json:"service_binding"`
}

type Plugin

type Plugin struct {
	Name     string   `json:"name"`
	Version  string   `json:"version"`
	Binaries []Binary `json:"binaries"`
}

type PluginCommand

type PluginCommand struct {
	Name  string
	Alias string
	Help  string
}

type PluginRepository

type PluginRepository struct {
	Plugins []Plugin `json:"plugins"`
}

type PluginRepositoryServerWithPlugin

type PluginRepositoryServerWithPlugin struct {
	// contains filtered or unexported fields
}

func NewPluginRepositoryServerWithPlugin

func NewPluginRepositoryServerWithPlugin(pluginName string, version string, platform string, shouldCalculateChecksum bool) *PluginRepositoryServerWithPlugin

func (*PluginRepositoryServerWithPlugin) Cleanup

func (pluginRepoServer *PluginRepositoryServerWithPlugin) Cleanup()

func (*PluginRepositoryServerWithPlugin) Init

func (pluginRepoServer *PluginRepositoryServerWithPlugin) Init(pluginName string, version string, platform string, shouldCalculateChecksum bool)

func (*PluginRepositoryServerWithPlugin) PluginSize

func (pluginRepoServer *PluginRepositoryServerWithPlugin) PluginSize() int64

func (*PluginRepositoryServerWithPlugin) URL

func (pluginRepoServer *PluginRepositoryServerWithPlugin) URL() string

type Route

type Route struct {
	Domain string
	Host   string
	Path   string
	Port   int
	Space  string
}

func NewRoute

func NewRoute(space string, domain string, hostname string, path string) Route

func NewTCPRoute

func NewTCPRoute(space string, domain string, port int) Route

func (Route) Create

func (r Route) Create()

func (Route) Delete

func (r Route) Delete()

func (Route) String

func (r Route) String() string

type SecurityGroup

type SecurityGroup struct {
	Name        string `json:"-"`
	Protocol    string `json:"protocol"`
	Destination string `json:"destination"`
	Ports       string `json:"ports"`
	Description string `json:"description"`
}

func NewSecurityGroup

func NewSecurityGroup(name string, protocol string, destination string, ports string, description string) SecurityGroup

func (SecurityGroup) Create

func (s SecurityGroup) Create()

type ServiceBroker

type ServiceBroker struct {
	Name       string
	Path       string
	AppsDomain string
	Service    struct {
		Name            string `json:"name"`
		ID              string `json:"id"`
		DashboardClient struct {
			ID          string `json:"id"`
			Secret      string `json:"secret"`
			RedirectUri string `json:"redirect_uri"`
		}
	}
	SyncPlans  []Plan
	AsyncPlans []Plan
}

func NewAsynchServiceBroker

func NewAsynchServiceBroker(name string, path string, appsDomain string, serviceName string, planName string) ServiceBroker

func NewServiceBroker

func NewServiceBroker(name string, path string, appsDomain string, serviceName string, planName string) ServiceBroker

func (ServiceBroker) Configure

func (b ServiceBroker) Configure(shareable bool)

func (ServiceBroker) Create

func (b ServiceBroker) Create()

func (ServiceBroker) Delete

func (b ServiceBroker) Delete()

func (ServiceBroker) Destroy

func (b ServiceBroker) Destroy()

func (ServiceBroker) Push

func (b ServiceBroker) Push()

func (ServiceBroker) ToJSON

func (b ServiceBroker) ToJSON(shareable bool) string

func (ServiceBroker) Update

func (b ServiceBroker) Update()

type ServiceInstanceGUID

type ServiceInstanceGUID struct {
	Resources []struct {
		Metadata struct {
			GUID string `json:"guid"`
		} `json:"metadata"`
	} `json:"resources"`
}

type UAAVersion

type UAAVersion struct {
	App struct {
		Version string `json:"version"`
	} `json:"app"`
}

func (UAAVersion) Version

func (v UAAVersion) Version() string

type User

type User struct {
	GUID      string
	Username  string
	CreatedAt time.Time
}

func GetUsers

func GetUsers() []User

GetUsers returns all the users in the targeted environment

Jump to

Keyboard shortcuts

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