Documentation
¶
Overview ¶
Package brokerapi contains types that are used exclusively to talk to a backing open service broker API compatible API
Index ¶
- Constants
- type BindingClient
- type BindingRequest
- type BrokerClient
- type Catalog
- type CatalogClient
- type ContextProfile
- type CreateFunc
- type CreateServiceBindingResponse
- type CreateServiceInstanceRequest
- type CreateServiceInstanceResponse
- type Credential
- type DeleteServiceInstanceRequest
- type DeleteServiceInstanceResponse
- type InputParameters
- type InstanceClient
- type LastOperationRequest
- type LastOperationResponse
- type Schemas
- type Service
- type ServiceBinding
- type ServiceBindingSchema
- type ServiceInstance
- type ServiceInstanceSchema
- type ServicePlan
- type Types
Constants ¶
const (
StateInProgress = "in progress"
StateSucceeded = "succeeded"
StateFailed = "failed"
)
Defines the possible states of an asynchronous request to a broker
const (
// InstanceType is a string constant representation of the instance type
InstanceType = "instanceType"
// BindingType is a string constant representation of the binding type
BindingType = "bindingType"
)
const ContextProfilePlatformKubernetes string = "kubernetes"
ContextProfilePlatformKubernetes is a constant to send when the client is representing a kubernetes style ecosystem.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BindingClient ¶
type BindingClient interface {
// CreateServiceBinding creates a service binding in the respective broker.
// This method handles all asynchronous request handling.
CreateServiceBinding(instanceID, bindingID string, req *BindingRequest) (*CreateServiceBindingResponse, error)
// DeleteServiceBinding deletes an existing service binding in the respective
// broker. This method handles all asynchronous request handling.
DeleteServiceBinding(instanceID, bindingID, serviceID, planID string) error
}
BindingClient defines the interface for managing service bindings with a broker.
type BindingRequest ¶
type BindingRequest struct {
AppGUID string `json:"app_guid,omitempty"`
PlanID string `json:"plan_id,omitempty"`
ServiceID string `json:"service_id,omitempty"`
BindResource map[string]interface{} `json:"bind_resource,omitempty"`
Parameters map[string]interface{} `json:"parameters,omitempty"`
}
BindingRequest represents a request to bind to a service instance
type BrokerClient ¶
type BrokerClient interface {
CatalogClient
InstanceClient
BindingClient
}
BrokerClient defines the interface for interacting with a broker for catalog retrieval, service instance management, and service binding management.
The broker client defines functions for the catalog, instance and binding APIs for the open service broker API (https://www.openservicebrokerapi.org/, based on the cloud foundry service broker API: https://docs.cloudfoundry.org/services/api.html).
Each function accepts and returns parameters that are unique to this package. For example, the catalog API function, GetCatalog, returns a *brokerapi.Catalog data type. Most callers will need to translate this data type into a kubernetes-native type such as a series of (./pkg/apis/servicecatalog).ServiceClass data types in that specific case.
type Catalog ¶
type Catalog struct {
Services []*Service `json:"services"`
}
Catalog is a JSON-compatible type to be used to decode the result from a /v2/catalog call to an open service broker compatible API
type CatalogClient ¶
type CatalogClient interface {
GetCatalog() (*Catalog, error)
}
CatalogClient defines the interface for catalog interaction with a broker.
type ContextProfile ¶
type ContextProfile struct {
// Platform is always `kubernetes`
Platform string `json:"platform,omitempty"`
// Namespace is the Kubernetes namespace in which the service instance will be visible.
Namespace string `json:"namespace,omitempty"`
}
ContextProfile implements the optional OSB field https://github.com/duglin/servicebroker/blob/CFisms/context-profiles.md#kubernetes
type CreateFunc ¶
type CreateFunc func(name, url, username, password string) BrokerClient
CreateFunc is a callback function that the controller uses to create a new broker client from a given broker object
type CreateServiceBindingResponse ¶
type CreateServiceBindingResponse struct {
// SyslogDrainURL string `json:"syslog_drain_url, omitempty"`
Credentials Credential `json:"credentials"`
}
CreateServiceBindingResponse represents a response to a service binding request
type CreateServiceInstanceRequest ¶
type CreateServiceInstanceRequest struct {
OrgID string `json:"organization_guid,omitempty"`
PlanID string `json:"plan_id,omitempty"`
ServiceID string `json:"service_id,omitempty"`
SpaceID string `json:"space_guid,omitempty"`
Parameters map[string]interface{} `json:"parameters,omitempty"`
AcceptsIncomplete bool `json:"accepts_incomplete,omitempty"`
ContextProfile ContextProfile `json:"context,omitempty"`
}
CreateServiceInstanceRequest represents a request to a broker to provision an instance of a service
type CreateServiceInstanceResponse ¶
type CreateServiceInstanceResponse struct {
DashboardURL string `json:"dashboard_url, omitempty"`
Operation string `json:"operation, omitempty"`
}
CreateServiceInstanceResponse represents the response from a broker after a request to provision an instance of a service
type Credential ¶
type Credential map[string]interface{}
Credential represents connection details, username, and password that are provisioned when a consumer binds to a service instance
type DeleteServiceInstanceRequest ¶
type DeleteServiceInstanceRequest struct {
ServiceID string `json:"service_id"`
PlanID string `json:"plan_id"`
AcceptsIncomplete bool `json:"accepts_incomplete,omitempty"`
}
DeleteServiceInstanceRequest represents a request to a broker to deprovision an instance of a service
type DeleteServiceInstanceResponse ¶
type DeleteServiceInstanceResponse struct {
Operation string `json:"operation,omitempty"`
}
DeleteServiceInstanceResponse represents the response from a broker after a request to deprovision an instance of a service
type InputParameters ¶
type InputParameters struct {
Parameters interface{} `json:"parameters,omitempty"`
}
InputParameters represents a schema for input parameters for creation or update of an API resource.
type InstanceClient ¶
type InstanceClient interface {
// CreateServiceInstance creates a service instance in the respective broker.
CreateServiceInstance(ID string, req *CreateServiceInstanceRequest) (*CreateServiceInstanceResponse, int, error)
// UpdateServiceInstance updates an existing service instance in the respective
// broker.
UpdateServiceInstance(ID string, req *CreateServiceInstanceRequest) (*ServiceInstance, int, error)
// DeleteServiceInstance deletes an existing service instance in the respective
// broker.
DeleteServiceInstance(ID string, req *DeleteServiceInstanceRequest) (*DeleteServiceInstanceResponse, int, error)
// PollServiceInstance polls a broker for a Service Instance Last Operation
PollServiceInstance(ID string, req *LastOperationRequest) (*LastOperationResponse, int, error)
}
InstanceClient defines the interface for managing service instances with a broker.
type LastOperationRequest ¶
type LastOperationRequest struct {
ServiceID string `json:"service_id,omitempty"`
PlanID string `json:"plan_id,omitempty"`
Operation string `json:"operation,omitempty"`
}
LastOperationRequest represents a request to a broker to give the state of the action it is completing asynchronously
type LastOperationResponse ¶
type LastOperationResponse struct {
State string `json:"state"`
Description string `json:"description,omitempty"`
}
LastOperationResponse represents the broker response with the state of a discrete action that the broker is completing asynchronously
type Schemas ¶
type Schemas struct {
ServiceInstances *ServiceInstanceSchema `json:"service_instance,omitempty"`
ServiceBindings *ServiceBindingSchema `json:"service_binding,omitempty"`
}
Schemas represents a plan's schemas for service instance and binding create and update.
type Service ¶
type Service struct {
Name string `json:"name"`
ID string `json:"id"`
Description string `json:"description"`
Bindable bool `json:"bindable"`
PlanUpdateable bool `json:"plan_updateable, omitempty"`
Tags []string `json:"tags, omitempty"`
Requires []string `json:"requires, omitempty"`
Metadata interface{} `json:"metadata, omitempty"`
Plans []ServicePlan `json:"plans"`
DashboardClient interface{} `json:"dashboard_client"`
}
Service represents a service (of which there may be many variants-- "plans") offered by a service broker
type ServiceBinding ¶
type ServiceBinding struct {
ID string `json:"id"`
ServiceID string `json:"service_id"`
AppID string `json:"app_id"`
ServicePlanID string `json:"service_plan_id"`
PrivateKey string `json:"private_key"`
ServiceInstanceID string `json:"service_instance_id"`
BindResource map[string]interface{} `json:"bind_resource,omitempty"`
Parameters map[string]interface{} `json:"parameters, omitempty"`
}
ServiceBinding represents a binding to a service instance
type ServiceBindingSchema ¶
type ServiceBindingSchema struct {
Create *InputParameters `json:"create,omitempty"`
}
ServiceBindingSchema represents a plan's schemas for the parameters accepted for binding creation.
type ServiceInstance ¶
type ServiceInstance struct {
ID string `json:"id"`
DashboardURL string `json:"dashboard_url"`
InternalID string `json:"internal_id, omitempty"`
ServiceID string `json:"service_id"`
PlanID string `json:"plan_id"`
OrganizationGUID string `json:"organization_guid"`
SpaceGUID string `json:"space_guid"`
LastOperation *LastOperationResponse `json:"last_operation, omitempty"`
Parameters map[string]interface{} `json:"parameters, omitempty"`
}
ServiceInstance represents an instance of a service
type ServiceInstanceSchema ¶
type ServiceInstanceSchema struct {
Create *InputParameters `json:"create,omitempty"`
Update *InputParameters `json:"update,omitempty"`
}
ServiceInstanceSchema represents a plan's schemas for a create and update of a service instance.
type ServicePlan ¶
type ServicePlan struct {
Name string `json:"name"`
ID string `json:"id"`
Description string `json:"description"`
Metadata interface{} `json:"metadata,omitempty"`
Free bool `json:"free,omitempty"`
Bindable *bool `json:"bindable,omitempty"`
Schemas *Schemas `json:"schemas,omitempty"`
}
ServicePlan is the Open Service API compatible struct for service plans. It comes with with JSON struct tags to match the API spec