Documentation ¶
Index ¶
- Constants
- Variables
- func BuildDashboardHandler(dispenserCreds handlers.DispenserCreds, collection cfmgo.Collection, ...) func(res http.ResponseWriter, req *http.Request)
- func Delete(collection cfmgo.Collection) func(http.ResponseWriter, *http.Request)
- func Get(collection cfmgo.Collection, dispenserCreds handlers.DispenserCreds) func(http.ResponseWriter, *http.Request)
- func GetDashboard(dispenserCreds handlers.DispenserCreds, collection cfmgo.Collection, ...) func(http.ResponseWriter, *http.Request)
- func Patch(collection cfmgo.Collection) func(http.ResponseWriter, *http.Request)
- func Put(collection cfmgo.Collection, dispenserCreds handlers.DispenserCreds, ...) func(http.ResponseWriter, *http.Request)
- type InstanceCreator
- type InstanceModel
Constants ¶
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 ¶
var ( //ServiceInstanceDash - ServiceInstanceDash = fmt.Sprintf("/show/{%s}", TaskGUIDVarName) //HandlerPath - path to normal instance handlers HandlerPath = fmt.Sprintf("/v2/service_instances/{%s}", InstanceIDVarName) //AsyncHandlerPath - path to async poller AsyncHandlerPath = "/v2/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") )
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
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) 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 (*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