instance

package
v0.0.48 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2016 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//PendingResponse -
	PendingResponse = `HaaS Instance not ready. Please try again in a few seconds.`
	//FailureResponse -
	FailureResponse = `HaaS Instance could not be provisioned. Sorry.`
	//InstanceIDVarName --
	InstanceIDVarName = "instance_id"
	//TaskGUIVarName --
	TaskGUIDVarName = "taskguid"
	//TaskStatusComplete ---
	TaskStatusComplete = "complete"
	//AgentTaskStatusFailed ---
	TaskStatusFailed = "failed"
	//CollectionInstanceIDQueryField --
	CollectionInstanceIDQueryField = "instanceid"
	//RequestIDMetadataFieldname -- fieldname for the metadata requestid
	RequestIDMetadataFieldname = "requestid"
	//SuccessGetHandlerBody --
	SuccessGetHandlerBody = `{
		"state": "succeeded",
		"description": "%s"
	}`
	//FailureGetHandlerBody --
	FailureGetHandlerBody = `{
		"state": "failed",
		"description": "%s"
	}`
	//PendingGethandlerBody --
	PendingGethandlerBody = `{
		"state": "in progress",
		"description": "%s"
	}`
)

Variables

View Source
var (
	//SSOPathPrefix -
	SSOPathPrefix = "/sso"
	//ServiceInstanceDash -
	ServiceInstanceDash = fmt.Sprintf("/dashboard/{%s}", TaskGUIDVarName)
	//HandlerPath - path to normal instance handlers
	HandlerPath = fmt.Sprintf("/service_instances/{%s}", InstanceIDVarName)
	//AsyncHandlerPath - path to async poller
	AsyncHandlerPath = "/service_instances/{instance_id}/last_operation"

	ErrInvalidInstanceID = errors.New("invalid instance id while attempting to get taskid")
	//ErrNoRecordsInResult - empty result set
	ErrNoRecordsInResult = errors.New("no records found in result set")
)
View Source
var GetRequestID = func(instanceID string, collection cfmgo.Collection) (requestID string, err error) {
	var instance InstanceModel

	if instance, err = getInstance(instanceID, collection); err == nil {
		requestID = instance.RequestID
	}
	return
}

GetRequestID - get a request id from a instanceid on a given collection

View Source
var GetTaskID = func(instanceID string, collection cfmgo.Collection) (taskID string, err error) {
	var instance InstanceModel

	if instance, err = getInstance(instanceID, collection); err == nil {
		taskID = instance.TaskGUID
	}
	return
}

GetTaskID - get a task id from a instanceid on a given collection

Functions

func BuildDashboardHandler added in v0.0.19

func BuildDashboardHandler(dispenserCreds handlers.DispenserCreds, collection cfmgo.Collection, renderer *render.Render, httpDoer clientDoer) func(res http.ResponseWriter, req *http.Request)

BuildDashboardHandler - build an initialized get handler for the dashboard

func Delete

func Delete(collection cfmgo.Collection, dispenserCreds handlers.DispenserCreds) func(http.ResponseWriter, *http.Request)

Delete - handler function for delete calls

func Get

func Get(collection cfmgo.Collection, dispenserCreds handlers.DispenserCreds) func(http.ResponseWriter, *http.Request)

Get - handler function for get calls

func GetDashboard added in v0.0.19

func GetDashboard(dispenserCreds handlers.DispenserCreds, collection cfmgo.Collection, renderer *render.Render) func(http.ResponseWriter, *http.Request)

GetDashboard - get handler for dashboard with a http.Client

func Patch

func Patch(collection cfmgo.Collection) func(http.ResponseWriter, *http.Request)

Patch - handler function for patch calls

func Put

func Put(collection cfmgo.Collection, dispenserCreds handlers.DispenserCreds, vcapApp *cfenv.App) func(http.ResponseWriter, *http.Request)

Put - handler function for put calls

Types

type InstanceCreator added in v0.0.3

type InstanceCreator struct {
	Collection cfmgo.Collection
	Dispenser  handlers.DispenserCreds
	ClientDoer clientDoer
	Model      InstanceModel
}

InstanceCreator - a type which can handle creating service instance requests

func NewInstanceCreator added in v0.0.34

func NewInstanceCreator(collection cfmgo.Collection, dispenserCreds handlers.DispenserCreds) (instanceCreator *InstanceCreator)

NewInstanceCreator - construct a new instanceCreator object

func (*InstanceCreator) DeleteHandler added in v0.0.25

func (s *InstanceCreator) DeleteHandler(w http.ResponseWriter, req *http.Request)

DeleteHandler - this is the handler that will be used when a user deletes a service instance

func (*InstanceCreator) GetHandler added in v0.0.11

func (s *InstanceCreator) GetHandler(w http.ResponseWriter, req *http.Request)

GetHandler - this is the handler that will be used for polling async provisioning status by the service broker

func (*InstanceCreator) PutHandler added in v0.0.3

func (s *InstanceCreator) PutHandler(w http.ResponseWriter, req *http.Request)

PutHandler - this is the actual handler method that will be used for the incoming request

type InstanceModel added in v0.0.3

type InstanceModel struct {
	InstanceID       string
	OrganizationGUID string                 `json:"organization_guid"`
	PlanID           string                 `json:"plan_id"`
	ServiceID        string                 `json:"service_id"`
	SpaceGUID        string                 `json:"space_guid"`
	Parameters       map[string]interface{} `json:"parameters"`
	TaskGUID         string
	RequestID        string
}

InstanceModel - persistence model struct

func (InstanceModel) Save added in v0.0.3

func (s InstanceModel) Save(col cfmgo.Collection)

Save - saves the model to the given collection

func (InstanceModel) UpdateField added in v0.0.29

func (s InstanceModel) UpdateField(col cfmgo.Collection, fieldname string, fieldvalue interface{})

UpdateField - updates the existing record

Jump to

Keyboard shortcuts

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