Documentation ¶
Index ¶
- Variables
- func InitiateUserContext(userContext UserContext, timeout time.Duration) (originalCfHomeDir, currentCfHomeDir string)
- func RestoreUserContext(_ UserContext, timeout time.Duration, ...)
- func TargetSpace(userContext UserContext, timeout time.Duration)
- type GenericResource
- type QueryResponse
- type UserContext
Constants ¶
This section is empty.
Variables ¶
View Source
var ApiRequest = func(method, endpoint string, response interface{}, timeout time.Duration, data ...string) { args := []string{ "curl", endpoint, "-X", method, } dataArg := strings.Join(data, "") if len(dataArg) > 0 { args = append(args, "-d", dataArg) } request := Cf(args...).Wait(timeout) Expect(request).To(Exit(0)) 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 CfAuth = func(user, password string) *gexec.Session { cmdStarter := runner.NewCommandStarterWithReporter(&sanitizedReporter{}) return cmdStarter.Start("cf", "auth", user, password) }
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
Click to show internal directories.
Click to hide internal directories.