Documentation ¶
Overview ¶
Package mode is the parent directory for all steward mode implementations. This package contains common interfaces for all mode implementations as well as common data structures used across all modes
Index ¶
- Constants
- type BindRequest
- type BindResponse
- type Binder
- type Cataloger
- type DeprovisionRequest
- type DeprovisionResponse
- type Deprovisioner
- type ErrUnknownLastOperation
- type GetLastOperationResponse
- type JSONObject
- type LastOperationGetter
- type LastOperationState
- type Lifecycler
- type ProvisionRequest
- type ProvisionResponse
- type Provisioner
- type Service
- type ServiceInfo
- type ServiceList
- type ServicePlan
- type UnbindRequest
- type Unbinder
Constants ¶
const ( // TargetNamespaceKey is the required key for the target namespace value TargetNamespaceKey = "target_namespace" // TargetNameKey is the required key for the target name value TargetNameKey = "target_name" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BindRequest ¶
type BindRequest struct { ServiceID string `json:"service_id"` PlanID string `json:"plan_id"` Parameters JSONObject `json:"parameters"` }
BindRequest represents a request to bind to a service. It is marked with JSON struct tags so that it can be encoded to, and decoded from the CloudFoundry binding request body format. See https://docs.cloudfoundry.org/services/api.html#binding for more details
func (BindRequest) TargetName ¶
func (b BindRequest) TargetName() (string, error)
TargetName returns the target name in b.Parameters, or an error if it's missing
func (BindRequest) TargetNamespace ¶
func (b BindRequest) TargetNamespace() (string, error)
TargetNamespace returns the target namespace in b.Parameters, or an error if it's missing
type BindResponse ¶
type BindResponse struct {
Creds JSONObject `json:"credentials"`
}
BindResponse represents a response to a binding request. It is marked with JSON struct tags so that it can be encoded to, and decoded from the CloudFoundry binding response body format. See https://docs.cloudfoundry.org/services/api.html#binding for more details
type Binder ¶
type Binder interface {
Bind(instanceID, bindingID string, bindRequest *BindRequest) (*BindResponse, error)
}
Binder binds services to apps, according to the mode implementation
type DeprovisionRequest ¶
type DeprovisionRequest struct { ServiceID string `json:"service_id"` PlanID string `json:"plan_id"` AcceptsIncomplete bool `json:"accepts_incomplete"` Parameters JSONObject `json:parameters,omitempty` }
DeprovisionRequest represents a request to do a service deprovision operation. This struct is JSON-compatible with the request body detailed at https://docs.cloudfoundry.org/services/api.html#deprovisioning
type DeprovisionResponse ¶
DeprovisionResponse represents a response to a provisioning request. It is marked with JSON struct tags so that it can be encoded to, and decoded from the CloudFoundry deprovisioning response body format. See https://docs.cloudfoundry.org/services/api.html#deprovisioning for more details
type Deprovisioner ¶
type Deprovisioner interface {
Deprovision(instanceID string, req *DeprovisionRequest) (*DeprovisionResponse, error)
}
Deprovisioner deprovisions services, according to the mode implementation
type ErrUnknownLastOperation ¶
type ErrUnknownLastOperation string
ErrUnknownLastOperation is an error indicating that a string is not a valid known last operation
func (ErrUnknownLastOperation) Error ¶
func (e ErrUnknownLastOperation) Error() string
Error is the error interface implementation
type GetLastOperationResponse ¶
type GetLastOperationResponse struct {
State string `json:"state"`
}
GetLastOperationResponse is the response body from a get last operation call
func (*GetLastOperationResponse) GetState ¶
func (g *GetLastOperationResponse) GetState() (LastOperationState, error)
GetState returns the LastOperationState defined in g.State, or an error if g.State is not a valid LastOperationState
type JSONObject ¶
type JSONObject map[string]interface{}
JSONObject is a convenience wrapper around a Go type that represents a JSON object
func EmptyJSONObject ¶
func EmptyJSONObject() JSONObject
EmptyJSONObject returns an empty JSONObject
func JSONObjectFromString ¶
func JSONObjectFromString(str string) (JSONObject, error)
JSONObjectFromString decodes a string into a JSONObject. Returns a non-nil error if the string was not a valid JSONObject
func (JSONObject) EncodeToString ¶
func (j JSONObject) EncodeToString() string
MarshalText is the encoding.TextMarshaler implementation
type LastOperationGetter ¶
type LastOperationGetter interface {
GetLastOperation(serviceID, planID, operation, instanceID string) (*GetLastOperationResponse, error)
}
LastOperationGetter fetches the last operation performed after an async provision or deprovision response
type LastOperationState ¶
type LastOperationState string
LastOperationState represents the state returned in a "get last operation" call. This type implements fmt.Stringer
const ( // LastOperationStateSucceeded is the LastOperationState indicating that the operation has succeeded LastOperationStateSucceeded LastOperationState = "succeeded" // LastOperationStateFailed is the LastOperationState indicating that the operation has failed LastOperationStateFailed LastOperationState = "failed" // LastOperationStateInProgress is the LastOperationState indicating that the operation is still in progress LastOperationStateInProgress LastOperationState = "in progress" // LastOperationStateGone is the LastOperationState indicating that the broker has deleted the // instance in question. In the case of async deprovisioning, this is an indicator of success. LastOperationStateGone LastOperationState = "gone" )
func (LastOperationState) String ¶
func (l LastOperationState) String() string
String is the fmt.Stringer interface implementation
type Lifecycler ¶
type Lifecycler struct { Provisioner Deprovisioner Binder Unbinder LastOperationGetter }
Lifecycler is a composition of the provisioner, deprovisioner, binder and unbinder. It's intended for use in passing to functions that require all functionality
type ProvisionRequest ¶
type ProvisionRequest struct { OrganizationGUID string `json:"organization_guid"` PlanID string `json:"plan_id"` ServiceID string `json:"service_id"` SpaceGUID string `json:"space_guid"` AcceptsIncomplete bool `json:"accepts_incomplete"` Parameters JSONObject `json:"parameters"` }
ProvisionRequest represents a request to do a service provision operation. This struct is JSON-compatible with the request body detailed at https://docs.cloudfoundry.org/services/api.html#provisioning
type ProvisionResponse ¶
type ProvisionResponse struct { Operation string `json:"operation"` IsAsync bool `json:"-"` Extra JSONObject `json:"extra,omitempty"` }
ProvisionResponse represents a response to a provisioning request. It is marked with JSON struct tags so that it can be encoded to, and decoded from the CloudFoundry provisioning response body format. See https://docs.cloudfoundry.org/services/api.html#provisioning for more details
type Provisioner ¶
type Provisioner interface {
Provision(instanceID string, req *ProvisionRequest) (*ProvisionResponse, error)
}
Provisioner provisions services, according to the mode implementation
type Service ¶
type Service struct { ServiceInfo Plans []ServicePlan `json:"plans"` }
Service is the represntation of a steward service. It also is compatible with the CloudFoundry catalog API. See https://docs.cloudfoundry.org/services/api.html#catalog-mgmt for more detail
type ServiceInfo ¶
type ServiceInfo struct { Name string `json:"name"` ID string `json:"id"` Description string `json:"description"` // Tags []string `json:"tags"` // Requires []string `json:"requires"` // Bindable bool `json:"bindable"` // Metadata ServicesMetadata `json:"metadata"` PlanUpdatable bool `json:"plan_updateable"` }
ServiceInfo represents all of the information about a service except for its plans
type ServiceList ¶
type ServiceList struct {
Services []*Service `json:"services"`
}
ServiceList is a wrapper for a list of services and represents a response from a request to list services provided by a broker. It is marked with JSON struct tags so that it can be encoded to, and decoded from the CloudFoundry catalog list response body format. See https://docs.cloudfoundry.org/services/api.html#catalog-mgmt
type ServicePlan ¶
type ServicePlan struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` // Metadata ServiceMetadata `json:"metadata"` Free bool `json:"free"` }
ServicePlan is the steward representation of a service plan. It's also compatible with the CloudFoundtry service plan object. See https://docs.cloudfoundry.org/services/api.html#PObject for more detail
type UnbindRequest ¶
UnbindRequest represents a request to unbind from a service. It is marked with JSON struct tags so that it can be encoded to, and decoded from the CloudFoundry unbinding request body format. See https://docs.cloudfoundry.org/services/api.html#unbinding for more details
type Unbinder ¶
type Unbinder interface {
Unbind(instanceID, bindingID string, unbindRequest *UnbindRequest) error
}
Unbinder unbinds services from apps, according to the mode implementation
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package cf contains the CloudFoundry mode implementations and config
|
Package cf contains the CloudFoundry mode implementations and config |
Package cmd contains the cmd mode implementations and config
|
Package cmd contains the cmd mode implementations and config |
Package helm contains the Helm / Tiller mode implementations and config.
|
Package helm contains the Helm / Tiller mode implementations and config. |