cf

package
v0.0.0-...-bc175e6 Latest Latest
Warning

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

Go to latest
Published: May 25, 2015 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ApiRequest = func(method, endpoint string, response interface{}, timeout time.Duration, data ...string) {
	request := Cf(
		"curl",
		endpoint,
		"-X", method,
		"-d", strings.Join(data, ""),
	)

	runner.NewCmdRunner(request, timeout).Run()

	if response != nil {
		err := json.Unmarshal(request.Out.Contents(), response)
		Expect(err).ToNot(HaveOccurred())
	}
}
View Source
var AsUser = func(userContext UserContext, timeout time.Duration, actions func()) {
	originalCfHomeDir, currentCfHomeDir := InitiateUserContext(userContext, timeout)
	defer func() {
		RestoreUserContext(userContext, timeout, originalCfHomeDir, currentCfHomeDir)
	}()

	TargetSpace(userContext, timeout)

	actions()
}
View Source
var Cf = func(args ...string) *gexec.Session {
	return runner.Run("cf", args...)
}

Functions

func InitiateUserContext

func InitiateUserContext(userContext UserContext, timeout time.Duration) (originalCfHomeDir, currentCfHomeDir string)

func RestoreUserContext

func RestoreUserContext(_ UserContext, timeout time.Duration, originalCfHomeDir, currentCfHomeDir string)

func TargetSpace

func TargetSpace(userContext UserContext, timeout time.Duration)

Types

type GenericResource

type GenericResource struct {
	Metadata struct {
		Guid string `json:"guid"`
	} `json:"metadata"`
}

type QueryResponse

type QueryResponse struct {
	Resources []GenericResource `struct:"resources"`
}

type UserContext

type UserContext struct {
	ApiUrl   string
	Username string
	Password string
	Org      string
	Space    string

	SkipSSLValidation bool
}

func NewUserContext

func NewUserContext(apiUrl, username, password, org, space string, skipSSLValidation bool) UserContext

Jump to

Keyboard shortcuts

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