Documentation
¶
Index ¶
- Constants
- Variables
- type AppInstanceKiller
- type AppKill
- type BindingProvisioner
- type GormDB
- type InstanceProvisioner
- type Maestro
- type Model
- type Orchestrator
- type ServiceBinding
- func (s *ServiceBinding) FindAllMatches() (results []ServiceBinding, err error)
- func (*ServiceBinding) GetCName() string
- func (s *ServiceBinding) SetActive(active bool)
- func (s *ServiceBinding) SetBindDetails(dt brokerapi.BindDetails)
- func (s *ServiceBinding) SetBindingID(id string)
- func (s *ServiceBinding) SetInstanceID(id string)
- type ServiceBroker
- func (s *ServiceBroker) Bind(instanceID, bindingID string, details brokerapi.BindDetails) (brokerapi.Binding, error)
- func (s *ServiceBroker) Deprovision(instanceID string, details brokerapi.DeprovisionDetails, asyncAllowed bool) (brokerapi.IsAsync, error)
- func (s *ServiceBroker) LastOperation(instanceID string) (brokerapi.LastOperation, error)
- func (s *ServiceBroker) Provision(instanceID string, details brokerapi.ProvisionDetails, asyncAllowed bool) (brokerapi.ProvisionedServiceSpec, error)
- func (*ServiceBroker) Services() (services []brokerapi.Service)
- func (s *ServiceBroker) Unbind(instanceID, bindingID string, details brokerapi.UnbindDetails) error
- func (s *ServiceBroker) Update(instanceID string, details brokerapi.UpdateDetails, asyncAllowed bool) (brokerapi.IsAsync, error)
- type ServiceInstance
Constants ¶
const ( ChaosPeddlerServiceID = "e6fcd6aa-047e-42be-bcfc-c8a2b426d707" CrazyChaosPlanID = "f5b828db-dd86-4223-a190-628626c46585" AnnoyingChaosPlanID = "f3c31f5d-e14f-4c69-a67a-9894a58fa417" MickeyMouseChaosPlanID = "0bd1dee2-ea35-4088-bf11-019cd0947fff" NoChaosPlanID = "10eeaa82-2193-4a59-84b2-0340cfdd9e43" KillPercentCrazy = 20 KillPercentAnnoying = 10 KillPercentMickeyMouse = 5 KillGroupPercentSelector = 5 KillAIMaxPercentage = 25 )
Package constants
Variables ¶
var FindAllMatches = func(db GormDB, planID, serviceID string) (serviceBindings []ServiceBinding, err error) { db.Raw("SELECT * FROM service_binding WHERE plan_id = ? and service_id = ? and deleted_at is NULL", planID, serviceID).Scan(&serviceBindings) if len(serviceBindings) == 0 { err = errors.New(fmt.Sprintf("so plan/serviceid matches found for: PlanID: %s and ServiceID: %s ", planID, serviceID)) } return }
FindAllMatches - finds all matches for the given arguments
var FindInstanceBindings = func(db GormDB, instanceID, bindingID string) (serviceBindings []ServiceBinding, err error) { db.Raw("SELECT * FROM service_binding WHERE instance_id = ? and binding_id = ? and deleted_at is NULL", instanceID, bindingID).Scan(&serviceBindings) if len(serviceBindings) == 0 { err = errors.New(fmt.Sprintf("so plan/serviceid matches found for: PlanID: %s and ServiceID: %s ", instanceID, bindingID)) } return }
FindInstanceBindings ---
var NewMaestro = func(username, password, loginurl, ccurl string, db GormDB) (m *Maestro) { m = new(Maestro) m.db = db m.AppKiller = NewAppKill(username, password, loginurl, ccurl) return }
NewMaestro - constructor for a maestro object
var NewServiceBinding = func() BindingProvisioner { model := new(ServiceBinding) return model }
NewServiceBinding - constructor for a servicebinding object
var NewServiceInstance = func() InstanceProvisioner { model := new(ServiceInstance) return model }
NewServiceInstance - constructor for a serviceinstance object
Functions ¶
This section is empty.
Types ¶
type AppInstanceKiller ¶
type AppInstanceKiller interface {
KillPercent(ServiceBinding, int) (map[string]int, error)
}
AppInstanceKiller - an interface which kills app instances
type AppKill ¶
type AppKill struct { CloudController *ccclient.Client HTTPClient *http.Client CloudControllerAPIURL string }
AppKill - implements AppInstanceKiller to kill apps
func NewAppKill ¶
NewAppKill - construct a new app kill object
func (*AppKill) KillPercent ¶
func (s *AppKill) KillPercent(binding ServiceBinding, percentKill int) (killRatio map[string]int, err error)
KillPercent - kills a given app by the given percentage
type BindingProvisioner ¶
type BindingProvisioner interface { SetInstanceID(string) SetBindingID(string) SetBindDetails(brokerapi.BindDetails) SetActive(bool) }
BindingProvisioner - interface defining a object which can provision and unprovision a service binding
type GormDB ¶
type GormDB interface { Close() error Create(value interface{}) *gorm.DB DB() *sql.DB Find(out interface{}, where ...interface{}) *gorm.DB Save(value interface{}) *gorm.DB Raw(sql string, values ...interface{}) *gorm.DB Scan(dest interface{}) *gorm.DB Delete(value interface{}, where ...interface{}) *gorm.DB }
GormDB the public interface of a gorm.DB
type InstanceProvisioner ¶
type InstanceProvisioner interface { SetInstanceID(string) SetProvisionDetails(brokerapi.ProvisionDetails) SetActive(bool) }
InstanceProvisioner - interface defining a object which can provision and unprovision a service instance
type Maestro ¶
type Maestro struct { AppKiller AppInstanceKiller // contains filtered or unexported fields }
Maestro - implements the chaosOrchestrater interface for real use in the service
func (*Maestro) DB ¶
Db - allows maestro to implement the orachestrator interface, returns the db connection
func (*Maestro) PollMickeyMousePlans ¶
func (s *Maestro) PollMickeyMousePlans()
PollMickeyMousePlans -
type Model ¶
type Model struct { ID uint `gorm:"primary_key"` CreatedAt time.Time UpdatedAt time.Time DeletedAt *time.Time }
Model - base model fields
type Orchestrator ¶
type Orchestrator interface { DB() GormDB Start() }
Orchestrator - it's chaos but it's organized. implement this interface to run the chaos show.
type ServiceBinding ¶
type ServiceBinding struct { Model InstanceID string `json:"InstanceId,omitempty"` Active bool `json:"Active,omitempty"` AppGUID string `json:"app_guid"` PlanID string `json:"plan_id"` ServiceID string `json:"service_id"` Parameters string `json:"parameters,omitempty"` BindingID string `json:"InstanceId,omitempty"` }
ServiceBinding - model to persist service binding information
func (*ServiceBinding) FindAllMatches ¶
func (s *ServiceBinding) FindAllMatches() (results []ServiceBinding, err error)
FindAllMatches - find all bindings meeting the given binding signature
func (*ServiceBinding) GetCName ¶
func (*ServiceBinding) GetCName() string
GetCName - gives collection name to object when saved
func (*ServiceBinding) SetActive ¶
func (s *ServiceBinding) SetActive(active bool)
SetActive - setter
func (*ServiceBinding) SetBindDetails ¶
func (s *ServiceBinding) SetBindDetails(dt brokerapi.BindDetails)
SetBindDetails - setter
func (*ServiceBinding) SetBindingID ¶
func (s *ServiceBinding) SetBindingID(id string)
SetBindingID - setter
func (*ServiceBinding) SetInstanceID ¶
func (s *ServiceBinding) SetInstanceID(id string)
SetInstanceID - setter
type ServiceBroker ¶
type ServiceBroker struct {
Orchestrator
}
ServiceBroker - this is the struct containing chaos peddler logic
func NewServiceBroker ¶
func NewServiceBroker(orch Orchestrator) *ServiceBroker
NewServiceBroker - service broker constructor
func (*ServiceBroker) Bind ¶
func (s *ServiceBroker) Bind(instanceID, bindingID string, details brokerapi.BindDetails) (brokerapi.Binding, error)
Bind to instances here Return a binding which contains a credentials object that can be marshalled to JSON, and (optionally) a syslog drain URL.
func (*ServiceBroker) Deprovision ¶
func (s *ServiceBroker) Deprovision(instanceID string, details brokerapi.DeprovisionDetails, asyncAllowed bool) (brokerapi.IsAsync, error)
Deprovision a new instance here. If async is allowed, the broker can still chose to deprovision the instance synchronously, hence the first return value.
func (*ServiceBroker) LastOperation ¶
func (s *ServiceBroker) LastOperation(instanceID string) (brokerapi.LastOperation, error)
LastOperation If the broker provisions asynchronously, the Cloud Controller will poll this endpoint for the status of the provisioning operation. This also applies to deprovisioning (work in progress).
func (*ServiceBroker) Provision ¶
func (s *ServiceBroker) Provision(instanceID string, details brokerapi.ProvisionDetails, asyncAllowed bool) (brokerapi.ProvisionedServiceSpec, error)
Provision a new instance here. If async is allowed, the broker can still chose to provision the instance synchronously.
func (*ServiceBroker) Services ¶
func (*ServiceBroker) Services() (services []brokerapi.Service)
Services - returns out chaos peddler service meta data.
func (*ServiceBroker) Unbind ¶
func (s *ServiceBroker) Unbind(instanceID, bindingID string, details brokerapi.UnbindDetails) error
Unbind from instances here
func (*ServiceBroker) Update ¶
func (s *ServiceBroker) Update(instanceID string, details brokerapi.UpdateDetails, asyncAllowed bool) (brokerapi.IsAsync, error)
type ServiceInstance ¶
type ServiceInstance struct { Model ServiceID string `json:"service_id"` PlanID string `json:"plan_id"` OrganizationGUID string `json:"organization_guid"` SpaceGUID string `json:"space_guid"` Parameters string `json:"parameters,omitempty"` InstanceID string `json:"InstanceId,omitempty"` Active bool `json:"Active,omitempty"` }
ServiceInstance - model to persist service instance information
func (*ServiceInstance) GetCName ¶
func (*ServiceInstance) GetCName() string
GetCName - gives collection name to object when saved
func (*ServiceInstance) SetActive ¶
func (s *ServiceInstance) SetActive(active bool)
SetActive - setter
func (*ServiceInstance) SetInstanceID ¶
func (s *ServiceInstance) SetInstanceID(id string)
SetInstanceID - setter
func (*ServiceInstance) SetProvisionDetails ¶
func (s *ServiceInstance) SetProvisionDetails(dt brokerapi.ProvisionDetails)
SetProvisionDetails - setter
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter
|
This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter |