Documentation
¶
Index ¶
- Constants
- type Broker
- func (b *Broker) AuthMiddleware() mux.MiddlewareFunc
- func (b Broker) Bind(ctx context.Context, instanceID string, bindingID string, ...) (spec domain.Binding, err error)
- func (b Broker) Deprovision(ctx context.Context, instanceID string, details domain.DeprovisionDetails, ...) (spec domain.DeprovisionServiceSpec, err error)
- func (b Broker) GetBinding(ctx context.Context, instanceID string, bindingID string) (spec domain.GetBindingSpec, err error)
- func (b *Broker) GetDashboardURL(groupID, clusterName string) string
- func (b Broker) GetInstance(ctx context.Context, instanceID string) (spec domain.GetInstanceDetailsSpec, err error)
- func (b Broker) LastBindingOperation(ctx context.Context, instanceID string, bindingID string, ...) (domain.LastOperation, error)
- func (b Broker) LastOperation(ctx context.Context, instanceID string, details domain.PollDetails) (resp domain.LastOperation, err error)
- func (b Broker) Provision(ctx context.Context, instanceID string, details domain.ProvisionDetails, ...) (spec domain.ProvisionedServiceSpec, err error)
- func (b *Broker) Services(ctx context.Context) ([]domain.Service, error)
- func (b Broker) Unbind(ctx context.Context, instanceID string, bindingID string, ...) (spec domain.UnbindSpec, err error)
- func (b Broker) Update(ctx context.Context, instanceID string, details domain.UpdateDetails, ...) (spec domain.UpdateServiceSpec, err error)
- type Config
- type ConnectionDetails
- type InstanceSize
- type Provider
- type StateStorage
Constants ¶
const ( ContextKeyAtlasClient contextKey = "atlas-client" ContextKeyGroupID contextKey = "group-id" )
ContextKeyAtlasClient is the key used to store the Atlas client in the request context.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Broker ¶
type Broker struct {
// contains filtered or unexported fields
}
Broker is responsible for translating OSB calls to Atlas API calls. Implements the domain.ServiceBroker interface making it easy to spin up an API server.
func New ¶
func New( logger *zap.SugaredLogger, credentials *credentials.Credentials, cfg Config, userAgent string, ) *Broker
New creates a new Broker with a logger.
func (*Broker) AuthMiddleware ¶
func (b *Broker) AuthMiddleware() mux.MiddlewareFunc
func (Broker) Bind ¶
func (b Broker) Bind(ctx context.Context, instanceID string, bindingID string, details domain.BindDetails, asyncAllowed bool) (spec domain.Binding, err error)
Bind will create a new database user with a username matching the binding ID and a randomly generated password. The user credentials will be returned back.
func (Broker) Deprovision ¶
func (b Broker) Deprovision(ctx context.Context, instanceID string, details domain.DeprovisionDetails, asyncAllowed bool) (spec domain.DeprovisionServiceSpec, err error)
Deprovision will destroy an Atlas cluster asynchronously.
func (Broker) GetBinding ¶
func (b Broker) GetBinding(ctx context.Context, instanceID string, bindingID string) (spec domain.GetBindingSpec, err error)
GetBinding is currently not supported as specified by the BindingsRetrievable setting in the service catalog.
func (*Broker) GetDashboardURL ¶
func (Broker) GetInstance ¶
func (b Broker) GetInstance(ctx context.Context, instanceID string) (spec domain.GetInstanceDetailsSpec, err error)
GetInstance should fetch the stored instance from state storage
func (Broker) LastBindingOperation ¶
func (b Broker) LastBindingOperation(ctx context.Context, instanceID string, bindingID string, details domain.PollDetails) (domain.LastOperation, error)
LastBindingOperation should fetch the status of the last creation/deletion of a database user.
func (Broker) LastOperation ¶
func (b Broker) LastOperation(ctx context.Context, instanceID string, details domain.PollDetails) (resp domain.LastOperation, err error)
LastOperation should fetch the state of the provision/deprovision of a cluster.
func (Broker) Provision ¶
func (b Broker) Provision(ctx context.Context, instanceID string, details domain.ProvisionDetails, asyncAllowed bool) (spec domain.ProvisionedServiceSpec, err error)
Provision will create a new Atlas cluster with the instance ID as its name. The process is always async.
func (*Broker) Services ¶
Services generates the service catalog which will be presented to consumers of the API.
func (Broker) Unbind ¶
func (b Broker) Unbind(ctx context.Context, instanceID string, bindingID string, details domain.UnbindDetails, asyncAllowed bool) (spec domain.UnbindSpec, err error)
Unbind will delete the database user for a specific binding. The database user should have the binding ID as its username.
type ConnectionDetails ¶
type ConnectionDetails struct { Username string `json:"username"` Password string `json:"password"` URI string `json:"uri"` ConnectionString string `json:"connectionString"` Database string `json:"database"` }
ConnectionDetails will be returned when a new binding is created.
type InstanceSize ¶
type InstanceSize struct {
Name string `json:"name"`
}
InstanceSize represents an available cluster size.
type Provider ¶
type Provider struct { Name string `json:"@provider"` InstanceSizes map[string]InstanceSize }
Provider represents a single cloud provider to which a cluster can be deployed.
type StateStorage ¶
type StateStorage interface { Put(ctx context.Context, key string, value *domain.GetInstanceDetailsSpec) error Get(ctx context.Context, key string) (*domain.GetInstanceDetailsSpec, error) Update(ctx context.Context, key string, value *domain.GetInstanceDetailsSpec) error Delete(ctx context.Context, key string) error }
func NewMongoStorage ¶
func NewMongoStorage(client *mongo.Client) StateStorage