ndb_api

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ComputeOOBProfileResolver = func(p ProfileResponse) bool {
	return p.Type == common.PROFILE_TYPE_COMPUTE && p.SystemProfile &&
		strings.EqualFold(p.Name, common.PROFILE_DEFAULT_OOB_SMALL_COMPUTE)
}
View Source
var DbParamInstanceOOBProfileResolver = func(p ProfileResponse) bool {

	return p.SystemProfile && p.Type == common.PROFILE_TYPE_DATABASE_PARAMETER && p.Topology == common.TOPOLOGY_INSTANCE
}
View Source
var DbParamOOBProfileResolver = func(p ProfileResponse) bool {
	return p.SystemProfile && p.Type == common.PROFILE_TYPE_DATABASE_PARAMETER
}
View Source
var NetworkOOBProfileResolver = func(p ProfileResponse) bool {
	return p.Type == common.PROFILE_TYPE_NETWORK
}
View Source
var SoftwareOOBProfileResolverForSingleInstance = func(p ProfileResponse) bool {
	return p.Type == common.PROFILE_TYPE_SOFTWARE && p.SystemProfile && p.Topology == common.TOPOLOGY_SINGLE
}

Functions

func GetDatabaseEngineName

func GetDatabaseEngineName(dbType string) string

func GetDatabasePortByType

func GetDatabasePortByType(dbType string) int32

func ResolveProfiles

func ResolveProfiles(ctx context.Context, ndb_client *ndb_client.NDBClient, databaseType string, profileResolvers ProfileResolvers) (profilesMap map[string]ProfileResponse, err error)

Fetches all the profiles and returns a map of profiles Returns an error if any profile is not found

Types

type ActionArgument

type ActionArgument struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type ContinuousSchedule added in v0.0.6

type ContinuousSchedule struct {
	Enabled           bool `json:"enabled"`
	LogBackupInterval int  `json:"logBackupInterval"`
	SnapshotsPerDay   int  `json:"snapshotsPerDay"`
}

type DBProvisionRequestAppender

type DBProvisionRequestAppender interface {
	// contains filtered or unexported methods
}

Appends request based on database type

func GetDbProvRequestAppender

func GetDbProvRequestAppender(databaseType string) (requestAppender DBProvisionRequestAppender, err error)

Get specific implementation of the DBProvisionRequestAppender interface based on the provided databaseType

type DatabaseDeprovisionRequest

type DatabaseDeprovisionRequest struct {
	Delete               bool `json:"delete"`
	Remove               bool `json:"remove"`
	SoftRemove           bool `json:"softRemove"`
	Forced               bool `json:"forced"`
	DeleteTimeMachine    bool `json:"deleteTimeMachine"`
	DeleteLogicalCluster bool `json:"deleteLogicalCluster"`
}

func GenerateDeprovisionDatabaseRequest

func GenerateDeprovisionDatabaseRequest() (req *DatabaseDeprovisionRequest)

Returns a request to delete a database instance

type DatabaseInterface

type DatabaseInterface interface {
	GetDBInstanceName() string
	GetDBInstanceType() string
	GetDBInstanceDatabaseNames() string
	GetDBInstanceTimeZone() string
	GetDBInstanceSize() int
	GetNDBClusterId() string
	GetProfileResolvers() ProfileResolvers
	GetTMDetails() (string, string, string)
	GetTMSchedule() (Schedule, error)
}

type DatabaseNode

type DatabaseNode struct {
	Id               string         `json:"id"`
	Name             string         `json:"name"`
	DatabaseServerId string         `json:"dbServerId"`
	DbServer         DatabaseServer `json:"dbserver"`
}

type DatabaseProvisionRequest

type DatabaseProvisionRequest struct {
	DatabaseType             string           `json:"databaseType"`
	Name                     string           `json:"name"`
	DatabaseDescription      string           `json:"databaseDescription"`
	SoftwareProfileId        string           `json:"softwareProfileId"`
	SoftwareProfileVersionId string           `json:"softwareProfileVersionId"`
	ComputeProfileId         string           `json:"computeProfileId"`
	NetworkProfileId         string           `json:"networkProfileId"`
	DbParameterProfileId     string           `json:"dbParameterProfileId"`
	NewDbServerTimeZone      string           `json:"newDbServerTimeZone"`
	CreateDbServer           bool             `json:"createDbserver"`
	NodeCount                int              `json:"nodeCount"`
	NxClusterId              string           `json:"nxClusterId"`
	SSHPublicKey             string           `json:"sshPublicKey,omitempty"`
	Clustered                bool             `json:"clustered"`
	AutoTuneStagingDrive     bool             `json:"autoTuneStagingDrive"`
	TimeMachineInfo          TimeMachineInfo  `json:"timeMachineInfo"`
	ActionArguments          []ActionArgument `json:"actionArguments"`
	Nodes                    []Node           `json:"nodes"`
	DatabaseName             string           `json:"databaseName,omitempty"`
}

func GenerateProvisioningRequest

func GenerateProvisioningRequest(ctx context.Context, ndb_client *ndb_client.NDBClient, database DatabaseInterface, reqData map[string]interface{}) (requestBody *DatabaseProvisionRequest, err error)

This function generates and returns a request for provisioning a database (and a dbserver vm) on NDB The database provisioned has a NONE time machine SLA attached to it, and uses the default OOB profiles

type DatabaseResponse

type DatabaseResponse struct {
	Id            string         `json:"id"`
	Name          string         `json:"name"`
	Status        string         `json:"status"`
	DatabaseNodes []DatabaseNode `json:"databaseNodes"`
	Properties    []Property     `json:"properties"`
}

func GetAllDatabases

func GetAllDatabases(ctx context.Context, ndbClient *ndb_client.NDBClient) (databases []DatabaseResponse, err error)

Fetches all the databases on the NDB instance and retutns a slice of the databases

func GetDatabaseById

func GetDatabaseById(ctx context.Context, ndbClient *ndb_client.NDBClient, id string) (database DatabaseResponse, err error)

Fetches and returns a database by an Id

type DatabaseServer

type DatabaseServer struct {
	Id          string   `json:"id"`
	Name        string   `json:"name"`
	IPAddresses []string `json:"ipAddresses"`
}

type DatabaseServerDeprovisionRequest

type DatabaseServerDeprovisionRequest struct {
	Delete            bool `json:"delete"`
	Remove            bool `json:"remove"`
	SoftRemove        bool `json:"softRemove"`
	DeleteVgs         bool `json:"deleteVgs"`
	DeleteVmSnapshots bool `json:"deleteVmSnapshots"`
}

func GenerateDeprovisionDatabaseServerRequest

func GenerateDeprovisionDatabaseServerRequest() (req *DatabaseServerDeprovisionRequest)

Returns a request to delete a database server vm

type MSSQLProvisionRequestAppender

type MSSQLProvisionRequestAppender struct{}

type MongoDbProvisionRequestAppender

type MongoDbProvisionRequestAppender struct{}

type MonthlySchedule added in v0.0.6

type MonthlySchedule struct {
	Enabled    bool `json:"enabled"`
	DayOfMonth int  `json:"dayOfMonth"`
}

type MySqlProvisionRequestAppender

type MySqlProvisionRequestAppender struct{}

type Node

type Node struct {
	Properties []string `json:"properties"`
	VmName     string   `json:"vmName"`
}

type PostgresProvisionRequestAppender

type PostgresProvisionRequestAppender struct{}

type ProfileResolver

type ProfileResolver interface {
	Resolve(ctx context.Context, allProfiles []ProfileResponse, filter func(p ProfileResponse) bool) (profile ProfileResponse, err error)
	GetName() string
	GetId() string
}

type ProfileResolvers

type ProfileResolvers map[string]ProfileResolver

type ProfileResponse

type ProfileResponse struct {
	Id              string `json:"id"`
	Name            string `json:"name"`
	Type            string `json:"type"`
	EngineType      string `json:"engineType"`
	LatestVersionId string `json:"latestVersionId"`
	Topology        string `json:"topology"`
	SystemProfile   bool   `json:"systemProfile"`
	Status          string `json:"status"`
}

func GetAllProfiles

func GetAllProfiles(ctx context.Context, ndbClient *ndb_client.NDBClient) (profiles []ProfileResponse, err error)

Fetches and returns all the available profiles as a profile slice

type Property

type Property struct {
	Name        string `json:"name"`
	Value       string `json:"value"`
	Description string `json:"description"`
}

type QuarterlySchedule added in v0.0.6

type QuarterlySchedule struct {
	Enabled    bool   `json:"enabled"`
	StartMonth string `json:"startMonth"`
	DayOfMonth int    `json:"dayOfMonth"`
}

type SLAResponse

type SLAResponse struct {
	Id                 string `json:"id"`
	Name               string `json:"name"`
	UniqueName         string `json:"uniqueName"`
	Description        string `json:"description"`
	DailyRetention     int    `json:"dailyRetention"`
	WeeklyRetention    int    `json:"weeklyRetention"`
	MonthlyRetention   int    `json:"monthlyRetention"`
	QuarterlyRetention int    `json:"quarterlyRetention"`
	YearlyRetention    int    `json:"yearlyRetention"`
}

func GetAllSLAs

func GetAllSLAs(ctx context.Context, ndbClient *ndb_client.NDBClient) (slas []SLAResponse, err error)

Fetches and returns all the SLAs as a sla slice

func GetSLAByName added in v0.0.6

func GetSLAByName(ctx context.Context, ndb_client *ndb_client.NDBClient, name string) (sla SLAResponse, err error)

Fetches all the SLAs from the ndb and returns the SLA matching the name Returns an error if not found.

type Schedule added in v0.0.6

type Schedule struct {
	SnapshotTimeOfDay  SnapshotTimeOfDay  `json:"snapshotTimeOfDay"`
	ContinuousSchedule ContinuousSchedule `json:"continuousSchedule"`
	WeeklySchedule     WeeklySchedule     `json:"weeklySchedule"`
	MonthlySchedule    MonthlySchedule    `json:"monthlySchedule"`
	QuarterlySchedule  QuarterlySchedule  `json:"quartelySchedule"`
	YearlySchedule     YearlySchedule     `json:"yearlySchedule"`
}

type SnapshotTimeOfDay added in v0.0.6

type SnapshotTimeOfDay struct {
	Hours   int `json:"hours"`
	Minutes int `json:"minutes"`
	Seconds int `json:"seconds"`
}

type TaskInfoSummaryResponse

type TaskInfoSummaryResponse struct {
	Name                 string                    `json:"name"`
	WorkId               string                    `json:"workId"`
	OperationId          string                    `json:"operationId"`
	DbServerId           string                    `json:"dbserverId"`
	Message              string                    `json:"messgae"`
	EntityId             string                    `json:"entityId"`
	EntityName           string                    `json:"entityName"`
	EntityType           string                    `json:"entityType"`
	Status               string                    `json:"status"`
	AssociatedOperations []TaskInfoSummaryResponse `json:"associatedOperations"`
	DependencyReport     interface{}               `json:"dependencyReport"`
}

func DeprovisionDatabase

func DeprovisionDatabase(ctx context.Context, ndbClient *ndb_client.NDBClient, id string, req DatabaseDeprovisionRequest) (task TaskInfoSummaryResponse, err error)

Deprovisions a database instance given a database id Returns the task info summary response for the operation

func DeprovisionDatabaseServer

func DeprovisionDatabaseServer(ctx context.Context, ndbClient *ndb_client.NDBClient, id string, req DatabaseServerDeprovisionRequest) (task TaskInfoSummaryResponse, err error)

Deprovisions a database server vm given a server id Returns the task info summary response for the operation

func ProvisionDatabase

func ProvisionDatabase(ctx context.Context, ndbClient *ndb_client.NDBClient, req *DatabaseProvisionRequest) (task TaskInfoSummaryResponse, err error)

Provisions a database instance based on the database provisioning request Returns the task info summary response for the operation

type TimeMachineInfo

type TimeMachineInfo struct {
	Name             string   `json:"name"`
	Description      string   `json:"description"`
	SlaId            string   `json:"slaId"`
	Schedule         Schedule `json:"schedule"`
	Tags             []string `json:"tags"`
	AutoTuneLogDrive bool     `json:"autoTuneLogDrive"`
}

type WeeklySchedule added in v0.0.6

type WeeklySchedule struct {
	Enabled   bool   `json:"enabled"`
	DayOfWeek string `json:"dayOfWeek"`
}

type YearlySchedule added in v0.0.6

type YearlySchedule struct {
	Enabled    bool   `json:"enabled"`
	DayOfMonth int    `json:"dayOfMonth"`
	Month      string `json:"month"`
}

Jump to

Keyboard shortcuts

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