cf

package module
v0.0.0-...-72ad36d Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2018 License: MIT Imports: 1 Imported by: 12

README

types-cf

Common Cloud Foundry Go types compatible with the CF v2 API. Nothing but the structs. How many times can you copy the same code, right?

Note, some of the more advanced uses of Service Plans and Meta-data have not been fully tested.

Documentation

Index

Constants

View Source
const (
	// ErrorServiceExists raised if instance already exists
	ErrorInstanceExists = 409

	// ErrorInstanceNotFound raised if instance not found
	ErrorInstanceNotFound = 410

	// ErrorServerException raised on server side error
	ErrorServerException = 500
)

Variables

View Source
var GetServiceProviderErrorCode = map[string]int{
	"ErrorInstanceExists":   409,
	"ErrorInstanceNotFound": 410,
	"ErrorServerException":  500,
}

GetErrorCode resolves error name to its code

View Source
var GetServiceProviderErrorCodeName = map[int]string{
	409: "ErrorInstanceExists",
	410: "ErrorInstanceNotFound",
	500: "ErrorServerException",
}

GetErrorCodeName resolves error code to its string value

Functions

This section is empty.

Types

type Amount

type Amount struct {
	Usd float32 `json:"usd"`
}

Amount describers Cloud Foundry cost amount

type BrokerError

type BrokerError struct {
	Description string `json:"description"`
}

BrokerError describes Cloud Foundry broker error

type Catalog

type Catalog struct {
	Services []*Service `json:"services"`
}

Catalog describes Cloud Foundry catalog

type Cost

type Cost struct {
	Amount *Amount `json:"amount"`
	Unit   string  `json:"unit"`
}

Cost describers Cloud Foundry plan Cost

type Dashboard

type Dashboard struct {
	ID     string `json:"id"`
	Secret string `json:"secret"`
	URI    string `json:"redirect_uri"`
}

Dashboard describes Cloud Foundry dashboard

type Plan

type Plan struct {
	ID          string    `json:"id"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
	Free        bool      `json:"free,omitempty"`
	Bindable    bool      `json:"bindable,omitempty"`
	Metadata    *PlanMeta `json:"metadata,omitempty"`
}

Plan describes Cloud Foundry plan structure

type PlanMeta

type PlanMeta struct {
	Bullets     []string `json:"bullets"`
	Costs       string   `json:"costs"`
	DisplayName string   `json:"displayName"`
}

PlanMeta describers Cloud Foundry plan meta-data

type Service

type Service struct {
	ID                   string       `json:"id"`
	Name                 string       `json:"name"`
	Description          string       `json:"description"`
	Bindable             bool         `json:"bindable"`
	InstancesRetrievable bool         `json:"instances_retrievable"`
	BindingsRetrievable  bool         `json:"bindings_retrievable"`
	Tags                 []string     `json:"tags,omitempty"`
	PlanUpdatable        bool         `json:"plan_updateable"`
	Plans                []*Plan      `json:"plans"`
	Requires             []string     `json:"requires,omitempty"`
	Metadata             *ServiceMeta `json:"metadata,omitempty"`
	Dashboard            *Dashboard   `json:"dashboard_client,omitempty"`
}

Service describes Cloud Foundry service

type ServiceBindingRequest

type ServiceBindingRequest struct {
	InstanceID string `json:"-"`
	BindingID  string `json:"-"`
	ServiceID  string `json:"service_id"`
	PlanID     string `json:"plan_id"`
	AppGUID    string `json:"app_guid"`
}

ServiceBindingRequest describes Cloud Foundry service binding request

type ServiceBindingResponse

type ServiceBindingResponse struct {
	Credentials    map[string]string `json:"credentials"`
	SyslogDrainURL string            `json:"syslog_drain_url,omitempty"`
}

ServiceBindingResponse describes Cloud Foundry service binding response

type ServiceCreationRequest

type ServiceCreationRequest struct {
	InstanceID       string            `json:"-"`
	ServiceID        string            `json:"service_id"`
	PlanID           string            `json:"plan_id"`
	OrganizationGUID string            `json:"organization_guid"`
	SpaceGUID        string            `json:"space_guid"`
	Parameters       map[string]string `json:parameters`
}

ServiceCreationRequest describes Cloud Foundry service provisioning request

type ServiceCreationResponse

type ServiceCreationResponse struct {
	DashboardURL string `json:"dashboard_url"`
}

ServiceCreationResponse describes Cloud Foundry service provisioning response

type ServiceLastOperationResponse

type ServiceLastOperationResponse struct {
	State       string `json:"-"`
	Description string `json:"-"`
}

type ServiceMeta

type ServiceMeta struct {
	DisplayName         string `json:"displayName"`
	ImageURL            string `json:"imageUrl"`
	Description         string `json:"longDescription"`
	ProviderDisplayName string `json:"providerDisplayName"`
	DocURL              string `json:"documentationUrl"`
	SupportURL          string `json:"supportUrl"`
}

ServiceMeta describers Cloud Foundry service meta-data

type ServiceProvider

type ServiceProvider interface {

	// GetCatalog returns the catalog of services managed by this broker
	GetCatalog() (*Catalog, *ServiceProviderError)

	// CreateService creates a service instance for specific plan
	CreateService(r *ServiceCreationRequest) (*ServiceCreationResponse, *ServiceProviderError)

	// DeleteService deletes previously created service instance
	DeleteService(instanceID string) *ServiceProviderError

	// BindService binds to specified service instance and
	// Returns credentials necessary to establish connection to that service
	BindService(r *ServiceBindingRequest) (*ServiceBindingResponse, *ServiceProviderError)

	// UnbindService removes previously created binding
	UnbindService(instanceID, bindingID string) *ServiceProviderError

	LastOperation(instanceID string) (*ServiceLastOperationResponse, *ServiceProviderError)
}

ServiceProvider defines the required provider functionality

type ServiceProviderError

type ServiceProviderError struct {
	Code   int
	Detail error
}

ServiceProviderError describes service provider error

func NewServiceProviderError

func NewServiceProviderError(code int, err error) *ServiceProviderError

NewServiceProviderError factory for ServiceProviderError

func (*ServiceProviderError) String

func (e *ServiceProviderError) String() string

String returns string representation of the error

Jump to

Keyboard shortcuts

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