brokerapi

package
v0.0.0-...-547fd59 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2020 License: Apache-2.0 Imports: 0 Imported by: 6

Documentation

Index

Constants

View Source
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"
)
View Source
const (
	StateInProgress = "in progress"
	StateSucceeded  = "succeeded"
	StateFailed     = "failed"
)

Defines the possible states of an asynchronous request to a broker

View Source
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 BindingLastOperationRequest

type BindingLastOperationRequest struct {
	// InstanceID is the instance of the service to query the last operation
	// for.
	InstanceID string `json:"instance_id"`
	// BindingID is the binding to query the last operation for.
	BindingID string `json:"binding_id"`
	// ServiceID is the ID of the service the instance is provisioned from.
	// Optional, but recommended.
	ServiceID string `json:"service_id,omitempty"`
	// PlanID is the ID of the plan the instance is provisioned from.
	// Optional, but recommended.
	PlanID string `json:"plan_id,omitempty"`
	// OperationKey is the operation key provided by the broker in the response
	// to the initial request. Optional, but must be sent if supplied in the
	// response to the original request.
	OperationKey string `json:"operation,omitempty"`
}

BindingLastOperationRequest represents a request to a broker to give the state of the action on a binding it is completing asynchronously.

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 BrokerErrorResponse

type BrokerErrorResponse struct {
	Error       string `json:"error"`
	Description string `json:"description"`
}

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 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 CreateServiceBindingResponse

type CreateServiceBindingResponse struct {
	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 GetBindingRequest

type GetBindingRequest struct {
	// InstanceID is the ID of the instance the binding is for.
	InstanceID string `json:"instance_id"`
	// BindingID is the ID of the binding to delete.
	BindingID string `json:"binding_id"`
}

GetBindingRequest represents a request to do a GET on a particular binding.

type GetBindingResponse

type GetBindingResponse struct {
	// Credentials is a free-form hash of credentials that can be used by
	// applications or users to access the service.
	Credentials Credential `json:"credentials,omitempty"`
	// SyslogDrainURl is a URL to which logs must be streamed. CF-specific. May
	// only be supplied by a service that declares a requirement for the
	// 'syslog_drain' permission.
	SyslogDrainURL *string `json:"syslog_drain_url,omitempty"`
	// RouteServiceURL is a URL to which the platform must proxy requests to the
	// application the binding is for. CF-specific. May only be supplied by a
	// service that declares a requirement for the 'route_service' permission.
	RouteServiceURL *string `json:"route_service_url,omitempty"`
	// VolumeMounts is an array of configuration string for mounting volumes.
	// CF-specific. May only be supplied by a service that declares a
	// requirement for the 'volume_mount' permission.
	VolumeMounts []interface{} `json:"volume_mounts,omitempty"`
	// Parameters is configuration parameters for the binding.
	Parameters map[string]interface{} `json:"parameters,omitempty"`
}

GetBindingResponse is sent as the response to doing a GET on a particular binding.

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 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 ParameterMapSchemas

type ParameterMapSchemas struct {
	Schema     string                       `json:"$schema"`
	Type       string                       `json:"type"`
	Properties map[string]ParameterProperty `json:"properties"`
}

ParameterMapSchemas describe the parameters information

type ParameterProperty

type ParameterProperty struct {
	Description string `json:"description"`
	Type        string `json:"type"`
}

ParameterProperty describe a parameter's information and type

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"`
	Tags            []string      `json:"tags,omitempty"`
	Requires        []string      `json:"requires,omitempty"`
	Bindable        bool          `json:"bindable"`
	Metadata        interface{}   `json:"metadata,omitempty"`
	DashboardClient interface{}   `json:"dashboard_client"`
	PlanUpdateable  bool          `json:"plan_updateable,omitempty"`
	Plans           []ServicePlan `json:"plans"`
}

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 ServiceBroker

type ServiceBroker interface {
	Catalog() (*Catalog, error)

	GetInstanceStatus(instanceID, serviceID, planID string, parameterIn map[string]interface{}) (bool, error)
	Provision(instanceID, serviceID, planID string, parameterIn map[string]interface{}) (map[string]interface{}, error)
	Deprovision(instanceID, serviceID, planID string, parameterIn map[string]interface{}) error

	GetBindingStatus(instanceID, serviceID, planID, bindingID string, parameterInstance, parameterIn map[string]interface{}) (bool, error)
	Bind(instanceID, serviceID, planID, bindingID string, parameterInstance, parameterIn map[string]interface{}) (map[string]interface{}, Credential, error)
	UnBind(instanceID, serviceID, planID, bindingID string, parameterInstance, parameterIn map[string]interface{}) error
}

ServiceBroker the standard interface of open service broker which each specific service provider must implement.

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

type Types

type Types struct {
	Instance string `json:"instance"`
	Binding  string `json:"binding"`
}

Types represents the types offered by a given service plan-- instances and/or bindings

type WorkerResponse

type WorkerResponse struct {
	Message interface{}
	Err     error
}

Jump to

Keyboard shortcuts

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