broker

package
v0.0.0-...-4a06855 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2019 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OperationDeprovision = "deprovision"
	OperationProvision   = "provision"
	OperationBind        = "bind"
	OperationUnbind      = "unbind"

	StateIDLE      = "IDLE"
	StateCREATING  = "CREATING"
	StateUPDATING  = "UPDATING"
	StateDELETING  = "DELETING"
	StateDELETED   = "DELETED"
	StateREPAIRING = "REPAIRING"

	ErrorCode404 = "CLUSTER_NOT_FOUND"

	UserDatabaseStore = "admin"
	UserRoleDatabase  = "admin"
	UserRoleName      = "readWriteAnyDatabase"
)

const

Variables

This section is empty.

Functions

func DoDELETE

func DoDELETE(argURI string) ([]byte, error)

DoDELETE using the MongoDB Atlas REST API -- TODO move to client

func DoGET

func DoGET(argURI string) ([]byte, error)

DoGET using the MongoDB Atlas REST API -- TODO move to client

func DoPOST

func DoPOST(argURI string, argPostBody []byte) ([]byte, error)

DoPOST using the MongoDB Atlas REST API -- TODO move to client

func ValidateConfig

func ValidateConfig(config ServiceConfiguration) error

Types

type AtlasBroker

type AtlasBroker struct {
}

AtlasBroker - MongoDB Atlas Service Broker

func (AtlasBroker) Bind

func (a AtlasBroker) Bind(ctx context.Context, instanceID, bindingID string, details brokerapi.BindDetails, asyncAllowed bool) (brokerapi.Binding, error)

Bind - MongoDB Atlas Broker - Creates a readWriteAnyDatabse user in the Atlas project

func (AtlasBroker) Deprovision

func (a AtlasBroker) Deprovision(ctx context.Context, instanceID string, details brokerapi.DeprovisionDetails, asyncAllowed bool) (brokerapi.DeprovisionServiceSpec, error)

Deprovision - MongoDB Atlas Broker

func (AtlasBroker) GetBinding

func (a AtlasBroker) GetBinding(ctx context.Context, instanceID, bindingID string) (brokerapi.GetBindingSpec, error)

GetBinding - MongoDB Atlas Broker

func (AtlasBroker) LastBindingOperation

func (a AtlasBroker) LastBindingOperation(ctx context.Context, instanceID, bindingID string, details brokerapi.PollDetails) (brokerapi.LastOperation, error)

LastBindingOperation - MongoDB Atlas Broker

func (AtlasBroker) LastOperation

func (a AtlasBroker) LastOperation(ctx context.Context, instanceID string, details brokerapi.PollDetails) (brokerapi.LastOperation, error)

LastOperation - MongoDB Atlas Broker

func (AtlasBroker) Provision

func (a AtlasBroker) Provision(ctx context.Context, instanceID string, details brokerapi.ProvisionDetails, asyncAllowed bool) (brokerapi.ProvisionedServiceSpec, error)

Provision - MongoDB Atlas Broker

func (AtlasBroker) Services

func (a AtlasBroker) Services(ctx context.Context) ([]brokerapi.Service, error)

Services - MongoDB Atlas Broker

func (AtlasBroker) Unbind

func (a AtlasBroker) Unbind(ctx context.Context, instanceID, bindingID string, details brokerapi.UnbindDetails, asyncAllowed bool) (brokerapi.UnbindSpec, error)

Unbind - MongoDB Atlas Broker

func (AtlasBroker) Update

func (a AtlasBroker) Update(ctx context.Context, instanceID string, details brokerapi.UpdateDetails, asyncAllowed bool) (brokerapi.UpdateServiceSpec, error)

Update - MongoDB Atlas Broker --- TODO

type AuthConfiguration

type AuthConfiguration struct {
	Password string `yaml:"password"`
	Username string `yaml:"username"`
}

type AutoScaling

type AutoScaling struct {
	DiskGBEnabled bool `json:"diskGBEnabled"`
}

AutoScaling - Provision Setting

type BiConnector

type BiConnector struct {
	Enabled        bool   `json:"enabled"`
	ReadPreference string `json:"readPreference"`
}

BiConnector -

type BindRequest

type BindRequest struct {
	DatabaseName    string  `json:"databaseName"`
	Password        string  `json:"password"`
	Roles           []Roles `json:"roles"`
	Username        string  `json:"username"`
	DeleteAfterDate string  `json:"deleteAfterDate,omitempty"`
	GroupID         string  `json:"groupId"`
}

BindRequest struct - Bind Settings

type BindResponse

type BindResponse struct {
	DatabaseName    string  `json:"databaseName"`
	DeleteAfterDate string  `json:"deleteAfterDate,omitempty"`
	GroupID         string  `json:"groupId"`
	Links           []Links `json:"links"`
	Roles           []Roles `json:"roles"`
	Username        string  `json:"username"`
}

BindResponse struct - Bind Settings

func NewUser

func NewUser(argPostBody []byte) (BindResponse, error)

NewUser in MongoDB Atlas

type Config

type Config struct {
	AtlasConfiguration              ServiceConfiguration `yaml:"atlas"`
	AuthConfiguration               AuthConfiguration    `yaml:"auth"`
	Host                            string               `yaml:"backend_host"`
	Port                            string               `yaml:"backend_port"`
	MonitExecutablePath             string               `yaml:"monit_executable_path"`
	AtlasServerExecutablePath       string               `yaml:"atlas_server_executable_path"`
	AgentPort                       string               `yaml:"agent_port"`
	ConsistencyVerificationInterval int                  `yaml:"consistency_check_interval_seconds"`
}

func ParseConfig

func ParseConfig(path string) (Config, error)

func (*Config) DedicatedEnabled

func (config *Config) DedicatedEnabled() bool

func (*Config) SharedEnabled

func (config *Config) SharedEnabled() bool

type Dedicated

type Dedicated struct {
	Nodes         []string `yaml:"nodes"`
	Port          int      `yaml:"port"`
	StatefilePath string   `yaml:"statefile_path"`
}

type DeprovisionResponse

type DeprovisionResponse struct {
}

DeprovisionResponse struct

func TerminateCluster

func TerminateCluster(instanceID string) (DeprovisionResponse, error)

TerminateCluster in MongoDB Atlas

type LastBindingOperationResponse

type LastBindingOperationResponse struct {
	DatabaseName    string  `json:"databaseName"`
	DeleteAfterDate string  `json:"deleteAfterDate,omitempty"`
	GroupID         string  `json:"groupId"`
	Links           []Links `json:"links"`
	Roles           []Roles `json:"roles"`
	Username        string  `json:"username"`
}

LastBindingOperationResponse struct -- Gets a single databse user

func GetUser

func GetUser(instanceID string, bindingID string) (LastBindingOperationResponse, error)

GetUser in MongoDB Atlas

type LastOperationResponse

type LastOperationResponse struct {
	AutoScaling              AutoScaling      `json:"autoScaling,omitempty"`
	BackupEnabled            bool             `json:"backupEnabled,omitempty"`
	BiConnector              BiConnector      `json:"biConnector,omitempty"`
	ClusterType              string           `json:"clusterType,omitempty"`
	DiskSizeGB               float32          `json:"diskSizeGB,omitempty"`
	EncryptionAtRestProvider string           `json:"encryptionAtRestProvider,omitempty"`
	GroupID                  string           `json:"groupId,omitempty"`
	MongoDBVersion           string           `json:"mongoDBVersion,omitempty"`
	MongoURI                 string           `json:"mongoURI,omitempty,omitempty"`
	MongoURIUpdated          string           `json:"mongoURIUpdated,omitempty,omitempty"`
	MongoURIWithOptions      string           `json:"mongoURIWithOptions,omitempty"`
	Name                     string           `json:"name,omitempty"`
	NumShards                int              `json:"numShards,omitempty"`
	Paused                   bool             `json:"paused,omitempty"`
	ProviderSettings         ProviderSettings `json:"providerSetting,omitemptys"`
	ReplicationFactor        int              `json:"replicationFactor,omitempty"`
	StateName                string           `json:"stateName"`

	// deal with error json response
	Detail     string   `json:"detail,omitempty"`
	Error      int      `json:"error,omitempty"`
	ErrorCode  string   `json:"errorCode"`
	Parameters []string `json:"parameters,omitempty"`
	Reason     string   `json:"reason,omitempty"`
}

LastOperationResponse struct

func GetCluster

func GetCluster(instanceID string) (LastOperationResponse, error)

GetCluster in MongoDB Atlas

type Links struct {
	Href string `json:"href"`
	Rel  string `json:"rel"`
}

Links --

type ProviderSettings

type ProviderSettings struct {
	DiskIOPS         int    `json:"diskIOPS"`
	EncryptEBSVolume bool   `json:"encryptEBSVolume"`
	InstanceSizeName string `json:"instanceSizeName"`
	ProviderName     string `json:"providerName"`
	RegionName       string `json:"regionName"`
}

ProviderSettings - Provision Setting

type Provision

type Provision struct {
	AutoScaling              AutoScaling      `json:"autoScaling"`
	BackupEnabled            bool             `json:"backupEnabled"`
	DiskSizeGB               float32          `json:"diskSizeGB"`
	EncryptionAtRestProvider string           `json:"encryptionAtRestProvider"`
	Name                     string           `json:"name"`
	NumShards                int              `json:"numShards"`
	ReplicationFactor        int              `json:"replicationFactor"`
	ProviderSettings         ProviderSettings `json:"providerSettings"`
}

Provision Setting

type ProvisionResponse

type ProvisionResponse struct {
	AutoScaling              AutoScaling      `json:"autoScaling,omitempty"`
	BackupEnabled            bool             `json:"backupEnabled,omitempty"`
	BiConnector              BiConnector      `json:"biConnector,omitempty"`
	ClusterType              string           `json:"clusterType,omitempty"`
	DiskSizeGB               float32          `json:"diskSizeGB,omitempty"`
	EncryptionAtRestProvider string           `json:"encryptionAtRestProvider,omitempty"`
	GroupID                  string           `json:"groupId,omitempty"`
	ID                       string           `json:"id,omitempty"`
	Links                    []Links          `json:"links,omitempty"`
	MongoDBMajorVersion      string           `json:"mongoDBMajorVersion,omitempty"`
	MongoDBVersion           string           `json:"mongoDBVersion,omitempty"`
	MongoURI                 string           `json:"mongoURI,omitempty"`
	MongoURIUpdated          time.Time        `json:"mongoURIUpdated,omitempty"`
	MongoURIWithOptions      string           `json:"mongoURIWithOptions,omitempty"`
	Name                     string           `json:"name,omitempty"`
	NumShards                int              `json:"numShards,omitempty"`
	Paused                   bool             `json:"paused,omitempty"`
	ProviderBackupEnabled    bool             `json:"providerBackupEnabled,omitempty"`
	ProviderSettings         ProviderSettings `json:"providerSettings,omitempty"`
	ReplicationFactor        int              `json:"replicationFactor,omitempty"`
	StateName                string           `json:"stateName,omitempty"`

	// deal with error json response
	Detail     string   `json:"detail,omitempty"`
	Error      int      `json:"error,omitempty"`
	ErrorCode  string   `json:"errorCode"`
	Parameters []string `json:"parameters,omitempty"`
	Reason     string   `json:"reason,omitempty"`
}

ProvisionResponse struct

func NewCluster

func NewCluster(argPostBody []byte) (ProvisionResponse, error)

NewCluster in MongoDB Atlas

type Roles

type Roles struct {
	CollectionName string `json:"collectionName,omitempty"`
	DatabaseName   string `json:"databaseName"`
	RoleName       string `json:"roleName"`
}

Roles --

type ServiceConfiguration

type ServiceConfiguration struct {
	ServiceName                 string    `yaml:"service_name"`
	ServiceID                   string    `yaml:"service_id"`
	DedicatedVMPlanID           string    `yaml:"dedicated_vm_plan_id"`
	SharedVMPlanID              string    `yaml:"shared_vm_plan_id"`
	Host                        string    `yaml:"host"`
	DefaultConfigPath           string    `yaml:"atlas_conf_path"`
	ProcessCheckIntervalSeconds int       `yaml:"process_check_interval"`
	StartAtlasTimeoutSeconds    int       `yaml:"start_atlas_timeout"`
	InstanceDataDirectory       string    `yaml:"data_directory"`
	PidfileDirectory            string    `yaml:"pidfile_directory"`
	InstanceLogDirectory        string    `yaml:"log_directory"`
	ServiceInstanceLimit        int       `yaml:"service_instance_limit"`
	Dedicated                   Dedicated `yaml:"dedicated"`
	Description                 string    `yaml:"description"`
	LongDescription             string    `yaml:"long_description"`
	ProviderDisplayName         string    `yaml:"provider_display_name"`
	DocumentationURL            string    `yaml:"documentation_url"`
	SupportURL                  string    `yaml:"support_url"`
	DisplayName                 string    `yaml:"display_name"`
	IconImage                   string    `yaml:"icon_image"`
}

type UnbindResponse

type UnbindResponse struct {
}

UnbindResponse struct

func DeleteUser

func DeleteUser(instanceID string, bindingID string) (UnbindResponse, error)

DeleteUser in MongoDB Atlas

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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