catalog

package
v0.0.0-...-154e0e3 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2016 License: CC0-1.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoServiceFound represents the error to return when the service could not be found by its ID.
	ErrNoServiceFound = errors.New("No service found for given service id.")
	// ErrNoPlanFound represents the error to return when the plan could not be found by its ID.
	ErrNoPlanFound = errors.New("No plan found for given plan id.")
)

Functions

This section is empty.

Types

type Catalog

type Catalog struct {
	// Instances of Services
	RdsService RDSService `yaml:"rds" json:"-"`
	// contains filtered or unexported fields
}

Catalog struct holds a collections of services

func InitCatalog

func InitCatalog(path string) *Catalog

InitCatalog initializes a Catalog struct that contains services and plans defined in the catalog.yaml configuration file and returns a pointer to that catalog

func (*Catalog) GetResources

func (c *Catalog) GetResources() Resources

GetResources returns the resources wrapper for all the resources generated from the secrets. (e.g. Connection to shared dbs)

func (*Catalog) GetServices

func (c *Catalog) GetServices() []interface{}

GetServices returns the list of all the Services. In order to do this, it uses reflection to look for all the exported values of the catalog.

type Plan

type Plan struct {
	ID          string       `yaml:"id" json:"id" validate:"required"`
	Name        string       `yaml:"name" json:"name" validate:"required"`
	Description string       `yaml:"description" json:"description" validate:"required"`
	Metadata    PlanMetadata `yaml:"metadata" json:"metadata" validate:"required"`
	Free        bool         `yaml:"free" json:"free"`
}

Plan is a generic struct for a Cloud Foundry service plan http://docs.cloudfoundry.org/services/api.html

type PlanCost

type PlanCost struct {
	Amount map[string]float64 `yaml:"amount" json:"amount" validate:"required"`
	Unit   string             `yaml:"unit" json:"unit" validate:"required"`
}

PlanCost contains an array-of-objects that describes the costs of a service, in what currency, and the unit of measure.

type PlanMetadata

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

PlanMetadata contains the plan metadata fields listed in the Cloud Foundry docs: http://docs.cloudfoundry.org/services/catalog-metadata.html#plan-metadata-fields

type RDSDBSecret

type RDSDBSecret struct {
	common.DBConfig `yaml:",inline" validate:"required,dive,required"`
	PlanID          string `yaml:"plan_id" validate:"required"`
}

RDSDBSecret contains the config to connect to a database and the corresponding plan id.

type RDSPlan

type RDSPlan struct {
	Plan             `yaml:",inline" validate:"required"`
	Adapter          string            `yaml:"adapter" json:"-" validate:"required"`
	InstanceClass    string            `yaml:"instanceClass" json:"-"`
	DbType           string            `yaml:"dbType" json:"-" validate:"required"`
	Tags             map[string]string `yaml:"tags" json:"-" validate:"required"`
	Redundant        bool              `yaml:"redundant" json:"-"`
	Encrypted        bool              `yaml:"encrypted" json:"-"`
	AllocatedStorage int64             `yaml:"allocatedStorage" json:"-"`
	SubnetGroup      string            `yaml:"subnetGroup" json:"-" validate:"required"`
	SecurityGroup    string            `yaml:"securityGroup" json:"-" validate:"required"`
}

RDSPlan inherits from a Plan and adds fields specific to AWS. these fields are read from the catalog.yaml file, but are not rendered in the catalog API endpoint.

type RDSSecret

type RDSSecret struct {
	ServiceID    string        `yaml:"service_id" validate:"required"`
	RDSDBSecrets []RDSDBSecret `yaml:"plans" validate:"required,dive,required"`
}

RDSSecret is a wrapper for all the RDS Secrets. Only contains RDS database secrets as of now.

type RDSService

type RDSService struct {
	Service `yaml:",inline" validate:"required"`
	Plans   []RDSPlan `yaml:"plans" json:"plans" validate:"required,dive,required"`
}

RDSService describes the RDS Service. It contains the basic Service details as well as a list of RDS Plans

func (RDSService) FetchPlan

func (s RDSService) FetchPlan(planID string) (RDSPlan, response.Response)

FetchPlan will look for a specific RDS Plan based on the plan ID.

type RDSSetting

type RDSSetting struct {
	DB     *gorm.DB
	Config common.DBConfig
}

RDSSetting is the wrapper for

type RDSSettings

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

RDSSettings is a wrapper for all the resources loaded / instantiated.

func InitRDSSettings

func InitRDSSettings(secrets *Secrets) (*RDSSettings, error)

InitRDSSettings tries to construct all the RDSSettings based on the received secrets.

func (*RDSSettings) AddRDSSetting

func (s *RDSSettings) AddRDSSetting(rdsSetting *RDSSetting, planID string)

AddRDSSetting adds an RDSSetting to the map of RDSSettings with the planID being the key.

func (*RDSSettings) GetRDSSettingByPlan

func (s *RDSSettings) GetRDSSettingByPlan(planID string) (*RDSSetting, error)

GetRDSSettingByPlan retrieves the RDS setting based on its planID.

type Resources

type Resources struct {
	RdsSettings *RDSSettings
}

Resources contains all the secrets to be used for the catalog.

type Secrets

type Secrets struct {
	RdsSecret RDSSecret `yaml:"rds" validate:"required,dive,required"`
}

Secrets contains all the secrets for all the services.

func InitSecrets

func InitSecrets(path string) *Secrets

InitSecrets initializes the secrets struct based on the yaml file.

type Service

type Service struct {
	ID          string          `yaml:"id" json:"id" validate:"required"`
	Name        string          `yaml:"name" json:"name" validate:"required"`
	Description string          `yaml:"description" json:"description" validate:"required"`
	Bindable    bool            `yaml:"bindable" json:"bindable" validate:"required"`
	Tags        []string        `yaml:"tags" json:"tags" validate:"required"`
	Metadata    ServiceMetadata `yaml:"metadata" json:"metadata" validate:"required"`
}

Service struct contains data for the Cloud Foundry service http://docs.cloudfoundry.org/services/api.html

type ServiceMetadata

type ServiceMetadata struct {
	DisplayName         string `yaml:"displayName" json:"displayName"`
	ImageURL            string `yaml:"imageUrl" json:"imageUrl"`
	LongDescription     string `yaml:"longDescription" json:"longDescription"`
	ProviderDisplayName string `yaml:"providerDisplayName" json:"providerDisplayName"`
	DocumentationURL    string `yaml:"documentationUrl" json:"documentationUrl"`
	SupportURL          string `yaml:"supportUrl" json:"supportUrl"`
}

ServiceMetadata contains the service metadata fields listed in the Cloud Foundry docs: http://docs.cloudfoundry.org/services/catalog-metadata.html#services-metadata-fields

Jump to

Keyboard shortcuts

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