Documentation ¶
Index ¶
- Variables
- type Catalog
- type ElasticsearchDBSecret
- type ElasticsearchPlan
- type ElasticsearchSecret
- type ElasticsearchService
- type Plan
- type PlanCost
- type PlanMetadata
- type RDSDBSecret
- type RDSPlan
- type RDSSecret
- type RDSService
- type RDSSetting
- type RDSSettings
- type RedisDBSecret
- type RedisPlan
- type RedisSecret
- type RedisService
- type Resources
- type Secrets
- type Service
- type ServiceMetadata
Constants ¶
This section is empty.
Variables ¶
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:"-"` RedisService RedisService `yaml:"redis" json:"-"` ElasticsearchService ElasticsearchService `yaml:"elasticsearch" json:"-"` // contains filtered or unexported fields }
Catalog struct holds a collections of services
func InitCatalog ¶
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 ¶
GetResources returns the resources wrapper for all the resources generated from the secrets.
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 ElasticsearchDBSecret ¶
type ElasticsearchDBSecret struct { common.DBConfig `yaml:",inline" validate:"required,dive,required"` PlanID string `yaml:"plan_id" validate:"required"` }
ElasticsearchDBSecret contains the config to connect to a database and the corresponding plan id.
type ElasticsearchPlan ¶
type ElasticsearchPlan struct { Plan `yaml:",inline" validate:"required"` Tags map[string]string `yaml:"tags" json:"-" validate:"required" ` ElasticsearchVersion string `yaml:"elasticsearchVersion" json:"-" validate:"required"` MasterCount string `yaml:"masterCount" json:"-"` DataCount string `yaml:"dataCount" json:"-" validate:"required"` InstanceType string `yaml:"instanceType" json:"-" validate:"required"` MasterInstanceType string `yaml:"masterInstanceType" json:"-"` VolumeSize string `yaml:"volumeSize" json:"-" validate:"required"` VolumeType string `yaml:"volumeType" json:"-" validate:"required"` MasterEnabled bool `yaml:"masterEnabled" json:"-"` NodeToNodeEncryption bool `yaml:"nodeToNodeEncryption" json:"-"` EncryptAtRest bool `yaml:"encryptAtRest" json:"-"` AutomatedSnapshotStartHour string `yaml:"automatedSnapshotStartHour" json:"-"` SubnetID1AZ1 string `yaml:"subnetID1az1" json:"-" validate:"required"` SubnetID2AZ2 string `yaml:"subnetID2az2" json:"-" validate:"required"` SubnetID3AZ1 string `yaml:"subnetID3az1" json:"-" validate:"required"` SubnetID4AZ2 string `yaml:"subnetID4az2" json:"-" validate:"required"` SecurityGroup string `yaml:"securityGroup" json:"-" validate:"required"` ApprovedMajorVersions []string `yaml:"approvedMajorVersions" json:"-"` }
ElasticsearchPlan inherits from a plan and adds fields needed for AWS Redis.
func (ElasticsearchPlan) CheckVersion ¶
func (p ElasticsearchPlan) CheckVersion(version string) bool
CheckVersion verifies that a specific version chosen by the user for a new elasticsearch instances is valid and supported in the chosen plan.
type ElasticsearchSecret ¶
type ElasticsearchSecret struct { ServiceID string `yaml:"service_id" validate:"required"` RedisDBSecrets []RedisDBSecret `yaml:"plans" validate:"required,dive,required"` }
ElasticsearchSecret is a wrapper for all the Elasticsearch Secrets. Only contains RDS database secrets as of now.
type ElasticsearchService ¶
type ElasticsearchService struct { Service `yaml:",inline" validate:"required"` Plans []ElasticsearchPlan `yaml:"plans" json:"plans" validate:"required,dive,required"` }
ElasticsearchService describes the Elasticsearch Service. It contains the basic Service details as well as a list of Elasticsearch Plans
func (ElasticsearchService) FetchPlan ¶
func (s ElasticsearchService) FetchPlan(planID string) (ElasticsearchPlan, response.Response)
FetchPlan will look for a specific ElasticsearchSecret Plan based on the plan ID.
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"` PlanUpdateable bool `yaml:"plan_updateable" json:"plan_updateable"` }
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"` DbVersion string `yaml:"dbVersion" json:"-"` LicenseModel string `yaml:"licenseModel" json:"-"` Tags map[string]string `yaml:"tags" json:"-" validate:"required"` Redundant bool `yaml:"redundant" json:"-"` Encrypted bool `yaml:"encrypted" json:"-"` StorageType string `yaml:"storage_type" json:"-"` AllocatedStorage int64 `yaml:"allocatedStorage" json:"-"` BackupRetentionPeriod int64 `yaml:"backup_retention_period" json:"-" validate:"required"` SubnetGroup string `yaml:"subnetGroup" json:"-" validate:"required"` SecurityGroup string `yaml:"securityGroup" json:"-" validate:"required"` ApprovedMajorVersions []string `yaml:"approvedMajorVersions" json:"-"` }
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.
func (RDSPlan) CheckVersion ¶
CheckVersion verifies that a specific version chosen by the user for a new RDS instances is valid and supported in the chosen plan.
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
type RDSSetting ¶
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 RedisDBSecret ¶
type RedisDBSecret struct { common.DBConfig `yaml:",inline" validate:"required,dive,required"` PlanID string `yaml:"plan_id" validate:"required"` }
RedisDBSecret contains the config to connect to a database and the corresponding plan id.
type RedisPlan ¶
type RedisPlan struct { Plan `yaml:",inline" validate:"required"` Tags map[string]string `yaml:"tags" json:"-" validate:"required"` EngineVersion string `yaml:"engineVersion" json:"-"` SubnetGroup string `yaml:"subnetGroup" json:"-" validate:"required"` SecurityGroup string `yaml:"securityGroup" json:"-" validate:"required"` CacheNodeType string `yaml:"nodeType" json:"-" validate:"required"` NumCacheClusters int `yaml:"numberCluster" json:"-" validate:"required"` PreferredMaintenanceWindow string `yaml:"preferredMaintenanceWindow" json:"-" validate:"required"` SnapshotWindow string `yaml:"snapshotWindow" json:"-" validate:"required"` SnapshotRetentionLimit int `yaml:"snapshotRetentionLimit" json:"-"` AutomaticFailoverEnabled bool `yaml:"automaticFailoverEnabled" json:"-"` ApprovedMajorVersions []string `yaml:"approvedMajorVersions" json:"-"` }
RedisPlan inherits from a plan and adds fields needed for AWS Redis.
func (RedisPlan) CheckVersion ¶
CheckVersion verifies that a specific version chosen by the user for a new redis instances is valid and supported in the chosen plan.
type RedisSecret ¶
type RedisSecret struct { ServiceID string `yaml:"service_id" validate:"required"` RedisDBSecrets []RedisDBSecret `yaml:"plans" validate:"required,dive,required"` }
RedisSecret is a wrapper for all the Redis Secrets. Only contains RDS database secrets as of now.
type RedisService ¶
type RedisService struct { Service `yaml:",inline" validate:"required"` Plans []RedisPlan `yaml:"plans" json:"plans" validate:"required,dive,required"` }
RedisService describes the Redis Service. It contains the basic Service details as well as a list of Redis Plans
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"` RedisSecret RedisSecret `yaml:"redis" validate:"required,dive,required"` }
Secrets contains all the secrets for all the services.
func InitSecrets ¶
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