brokerapi

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2017 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package brokerapi contains types that are used exclusively to talk to a backing open service broker API compatible API

Index

Constants

View Source
const (
	StateInProgress = "in progress"
	StateSucceeded  = "succeeded"
	StateFailed     = "failed"
)

Defines the possible states of an asynchronous request to a broker

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"
)

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(sID, bID string, req *BindingRequest) (*CreateServiceBindingResponse, error)

	// DeleteServiceBinding deletes an existing service binding in the respective
	// broker. This method handles all asynchronous request handling.
	DeleteServiceBinding(sID, bID 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 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"`
}

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 InstanceClient

type InstanceClient interface {

	// CreateServiceInstance creates a service instance in the respective broker.
	// This method handles all asynchronous request handling.
	CreateServiceInstance(ID string, req *CreateServiceInstanceRequest) (*CreateServiceInstanceResponse, error)

	// UpdateServiceInstance updates an existing service instance in the respective
	// broker. This method handles all asynchronous request handling.
	UpdateServiceInstance(ID string, req *CreateServiceInstanceRequest) (*ServiceInstance, error)

	// DeleteServiceInstance deletes an existing service instance in the respective
	// broker. This method handles all asynchronous request handling.
	DeleteServiceInstance(ID string, req *DeleteServiceInstanceRequest) 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 Schema

type Schema struct {
	Inputs  string `json:"inputs"`
	Outputs string `json:"outputs"`
}

Schema consists of the schema for inputs and the schema for outputs. Schemas are in the form of JSON Schema v4 (http://json-schema.org/).

type Schemas

type Schemas struct {
	Instance Schema `json:"instance"`
	Binding  Schema `json:"binding"`
}

Schemas represents a broker's schemas for both service instances and service bindings

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 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 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"`
	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

Directories

Path Synopsis
Package fake contains fake implementations of each of the CF broker APIs.
Package fake contains fake implementations of each of the CF broker APIs.

Jump to

Keyboard shortcuts

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