broker

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProjectRoot

func ProjectRoot() string

func RunCommand

func RunCommand(bin string, args ...string)

Types

type AnsibleBroker

type AnsibleBroker struct {
	// contains filtered or unexported fields
}

func NewAnsibleBroker

func NewAnsibleBroker(
	dao *dao.Dao,
	log *logging.Logger,
	clusterConfig ansibleapp.ClusterConfig,
	registry ansibleapp.Registry,
) (*AnsibleBroker, error)

func (AnsibleBroker) Bind

func (a AnsibleBroker) Bind(instanceUUID uuid.UUID, bindingUUID uuid.UUID, req *BindRequest) (*BindResponse, error)

func (AnsibleBroker) Bootstrap

func (a AnsibleBroker) Bootstrap() (*BootstrapResponse, error)

Loads all known specs from a registry into local storage for reference Potentially a large download; on the order of 10s of thousands TODO: Response here? Async? TODO: How do we handle a large amount of data on this side as well? Pagination?

func (AnsibleBroker) Catalog

func (a AnsibleBroker) Catalog() (*CatalogResponse, error)

func (AnsibleBroker) Deprovision

func (a AnsibleBroker) Deprovision(instanceUUID uuid.UUID) (*DeprovisionResponse, error)

func (AnsibleBroker) Provision

func (a AnsibleBroker) Provision(instanceUUID uuid.UUID, req *ProvisionRequest) (*ProvisionResponse, error)

func (AnsibleBroker) Unbind

func (a AnsibleBroker) Unbind(instanceUUID uuid.UUID, bindingUUID uuid.UUID) error

func (AnsibleBroker) Update

func (a AnsibleBroker) Update(instanceUUID uuid.UUID, req *UpdateRequest) (*UpdateResponse, error)

type BindRequest

type BindRequest struct {
	ServiceID    uuid.UUID `json:"service_id"`
	PlanID       uuid.UUID `json:"plan_id"`
	AppID        uuid.UUID `json:"app_guid,omitempty"`
	BindResource struct {
		AppID uuid.UUID `json:"app_guid,omitempty"`
		Route string    `json:"route,omitempty"`
	} `json:"bind_resource,omitempty"`
	Parameters map[string]string `json:"parameters,omitempty"`
}

type BindResponse

type BindResponse struct {
	Credentials     map[string]interface{} `json:"credentials,omitempty"`
	SyslogDrainURL  string                 `json:"syslog_drain_url,omitempty"`
	RouteServiceURL string                 `json:"route_service_url,omitempty"`
	VolumeMounts    []interface{}          `json:"volume_mounts,omitempty"`
}

type BootstrapResponse

type BootstrapResponse struct {
	SpecCount int
}

TODO: What belongs on this thing?

type Broker

type Broker interface {
	Bootstrap() (*BootstrapResponse, error)
	Catalog() (*CatalogResponse, error)
	Provision(uuid.UUID, *ProvisionRequest) (*ProvisionResponse, error)
	Update(uuid.UUID, *UpdateRequest) (*UpdateResponse, error)
	Deprovision(uuid.UUID) (*DeprovisionResponse, error)
	Bind(uuid.UUID, uuid.UUID, *BindRequest) (*BindResponse, error)
	Unbind(uuid.UUID, uuid.UUID) error
}

type CatalogResponse

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

type DashboardClient

type DashboardClient struct {
	ID          string `json:"id"`
	Secret      string `json:"secret"`
	RedirectURI string `json:"redirect_uri"`
}

type DeprovisionResponse

type DeprovisionResponse struct {
	Operation string `json:"operation,omitempty"`
}

type ErrorResponse

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

type LastOperationRequest

type LastOperationRequest struct {
	ServiceID uuid.UUID `json:"service_id"`
	PlanID    uuid.UUID `json:"plan_id"`
	Operation string    `json:"operation"`
}

type LastOperationResponse

type LastOperationResponse struct {
	State       LastOperationState `json:"state"`
	Description string             `json:"description,omitempty"`
}

type LastOperationState

type LastOperationState string
const (
	LastOperationStateInProgress LastOperationState = "in progress"
	LastOperationStateSucceeded  LastOperationState = "succeeded"
	LastOperationStateFailed     LastOperationState = "failed"
)

type Plan

type Plan struct {
	ID          uuid.UUID              `json:"id"`
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
	Free        bool                   `json:"free,omitempty"`
}

type ProvisionRequest

type ProvisionRequest struct {
	OrganizationID    uuid.UUID         `json:"organization_guid"`
	PlanID            uuid.UUID         `json:"plan_id"`
	ServiceID         uuid.UUID         `json:"service_id"`
	SpaceID           uuid.UUID         `json:"space_guid"`
	Parameters        map[string]string `json:"parameters,omitempty"`
	AcceptsIncomplete bool              `json:"accepts_incomplete,omitempty"`
}

type ProvisionResponse

type ProvisionResponse struct {
	DashboardURL string `json:"dashboard_url,omitempty"`
	Operation    string `json:"operation,omitempty"`
}

type Service

type Service struct {
	Name            string                 `json:"name"`
	ID              uuid.UUID              `json:"id"`
	Description     string                 `json:"description"`
	Tags            []string               `json:"tags,omitempty"`
	Requires        []string               `json:"requires,omitempty"`
	Bindable        bool                   `json:"bindable"`
	Metadata        map[string]interface{} `json:"metadata,omitempty"`
	DashboardClient *DashboardClient       `json:"dashboard_client,omitempty"`
	PlanUpdatable   bool                   `json:"plan_updateable,omitempty"`
	Plans           []Plan                 `json:"plans"`
}

func SpecToService

func SpecToService(spec *ansibleapp.Spec) Service

TODO: This is going to have to be expanded much more to support things like parameters (will need to get passed through as metadata

type UpdateRequest

type UpdateRequest struct {
	ServiceID      uuid.UUID         `json:"service_id"`
	PlanID         uuid.UUID         `json:"plan_id,omitempty"`
	Parameters     map[string]string `json:"parameters,omitempty"`
	PreviousValues struct {
		PlanID         uuid.UUID `json:"plan_id,omitempty"`
		ServiceID      uuid.UUID `json:"service_id,omitempty"`
		OrganizationID uuid.UUID `json:"organization_id,omitempty"`
		SpaceID        uuid.UUID `json:"space_id,omitempty"`
	} `json:"previous_values,omitempty"`
	AcceptsIncomplete bool `json:"accepts_incomplete,omitempty"`
}

type UpdateResponse

type UpdateResponse struct {
	Operation string `json:"operation,omitempty"`
}

Jump to

Keyboard shortcuts

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