Documentation ¶
Index ¶
- Constants
- Variables
- func Delete(collection cfmgo.Collection) func(http.ResponseWriter, *http.Request)
- func Get(collection cfmgo.Collection, dispenserCreds handlers.DispenserCreds) 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 ¶
View Source
const ( //HandlerPath - path to normal instance handlers HandlerPath = "/v2/service_instances/{instance_id}" //AsyncHandlerPath - path to async poller AsyncHandlerPath = "/v2/service_instances/{instance_id}/last_operation" //TaskStatusComplete --- TaskStatusComplete = "complete" //AgentTaskStatusFailed --- TaskStatusFailed = "failed" //CollectionInstanceIDQueryField -- CollectionInstanceIDQueryField = "instanceid" //SuccessGetHandlerBody -- SuccessGetHandlerBody = `{ "state": "succeeded", "description": "%s" }` //FailureGetHandlerBody -- FailureGetHandlerBody = `{ "state": "failed", "description": "%s" }` //PendingGethandlerBody -- PendingGethandlerBody = `{ "state": "in progress", "description": "%s" }` )
Variables ¶
View Source
var (
ErrInvalidInstanceID = errors.New("invalid instance id while attempting to get taskid")
)
View Source
var GetTaskID = func(instanceID string, collection cfmgo.Collection) (taskID string, err error) { if instanceID == "" { err = ErrInvalidInstanceID } else { query := new(params.RequestParams) query.Q = bson.M{ CollectionInstanceIDQueryField: instanceID, } var result = make([]InstanceModel, 1) if _, err = collection.Find(query, &result); err == nil { taskID = result[0].TaskGUID } } return }
GetTaskID - get a task id from a instanceid on a given collection
Functions ¶
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 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) 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 }
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
Click to show internal directories.
Click to hide internal directories.