databases

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Overview

Package databases allows CRUD operations on the Databases resource - a sub-resource of Subscriptions.

Index

Constants

View Source
const (
	// StatusActive is the active value of the `Status` field in `Database`
	StatusActive = "active"
	// StatusDraft is the draft value of the `Status` field in `Database`
	StatusDraft = "draft"
	// StatusPending is the pending value of the `Status` field in `Database`
	StatusPending = "pending"
	// StatusRCPChangePending is the RCP change pending value of the `Status` field in `Database`
	StatusRCPChangePending = "rcp-change-pending"
	// StatusRCPDraft is the RCP draft value of the `Status` field in `Database`
	StatusRCPDraft = "rcp-draft"
	// StatusRCPActiveChangeDraft is the RCP active change draft value of the `Status` field in `Database`
	StatusRCPActiveChangeDraft = "rcp-active-change-draft"
	// StatusActiveChangeDraft is the Active change draft value of the `Status` field in `Database`
	StatusActiveChangeDraft = "active-change-draft"
	// StatusActiveChangePending is the Active change pending value of the `Status` field in `Database`
	StatusActiveChangePending = "active-change-pending"

	// StatusProxyPolicyChangePending and StatusProxyPolicyChangeDraft
	//The below two Proxy Policy states are caused by a change to the 'support_oss_cluster_api' attribute
	// StatusProxyPolicyChangePending is the Proxy Policy change pending value of the `Status` field in `Database`.
	StatusProxyPolicyChangePending = "proxy-policy-change-pending"
	// StatusProxyPolicyChangeDraft is the Proxy Policy change draft value of the `Status` field in `Database`
	StatusProxyPolicyChangeDraft = "proxy-policy-change-draft"

	// StatusError is the error value of the `Status` field in `Database`
	StatusError = "error"
	// BackupIntervalEvery24Hours is the schedule to back up once a day
	BackupIntervalEvery24Hours = "every-24-hours"
	// BackupIntervalEvery12Hours is the schedule to back up twice a day
	BackupIntervalEvery12Hours = "every-12-hours"
	// BackupIntervalEvery6Hours is the schedule to back up four times a day
	BackupIntervalEvery6Hours = "every-6-hours"
	// BackupIntervalEvery4Hours is the schedule to back up six times a day
	BackupIntervalEvery4Hours = "every-4-hours"
	// BackupIntervalEvery2Hours is the schedule to back up twelve times a day
	BackupIntervalEvery2Hours = "every-2-hours"
	// BackupIntervalEvery1Hours is the schedule to back up every hour
	BackupIntervalEvery1Hours = "every-1-hours"
	// MemoryStorageRam stores data only in RAM
	MemoryStorageRam = "ram"
	// MemoryStorageRamAndFlash stores data both in RAM and on SSD
	MemoryStorageRamAndFlash = "ram-and-flash"
)

Variables

This section is empty.

Functions

func AlertNameValues

func AlertNameValues() []string

func BackupIntervals added in v0.3.0

func BackupIntervals() []string

func BackupStorageTypes added in v0.3.0

func BackupStorageTypes() []string

func DataEvictionPolicyValues

func DataEvictionPolicyValues() []string

func DataPersistenceValues

func DataPersistenceValues() []string

func MemoryStorageValues

func MemoryStorageValues() []string

func ProtocolValues

func ProtocolValues() []string

func SourceTypeValues

func SourceTypeValues() []string

Types

type API

type API struct {
	// contains filtered or unexported fields
}

func NewAPI

func NewAPI(client HttpClient, taskWaiter TaskWaiter, logger Log) *API

func (*API) ActiveActiveCreate added in v0.1.10

func (a *API) ActiveActiveCreate(ctx context.Context, subscription int, db CreateActiveActiveDatabase) (int, error)

ActiveActiveCreate will create a new database for the subscription and return the identifier of the database.

func (*API) ActiveActiveUpdate added in v0.1.10

func (a *API) ActiveActiveUpdate(ctx context.Context, subscription int, database int, update UpdateActiveActiveDatabase) error

ActiveActiveUpdate will update certain values of an existing database.

func (*API) Backup

func (a *API) Backup(ctx context.Context, subscription int, database int) error

Backup will create a manual backup of the database to the destination the database has been configured to backup to.

func (*API) Create

func (a *API) Create(ctx context.Context, subscription int, db CreateDatabase) (int, error)

Create will create a new database for the subscription and return the identifier of the database.

func (*API) Delete

func (a *API) Delete(ctx context.Context, subscription int, database int) error

Delete will destroy an existing database.

func (*API) Get

func (a *API) Get(ctx context.Context, subscription int, database int) (*Database, error)

Get will retrieve an existing database.

func (*API) GetActiveActive added in v0.1.11

func (a *API) GetActiveActive(ctx context.Context, subscription int, database int) (*ActiveActiveDatabase, error)

GetActiveActive will retrieve an existing database.

func (*API) Import

func (a *API) Import(ctx context.Context, subscription int, database int, request Import) error

Import will import data from an RDB file or another Redis database into an existing database.

func (*API) List

func (a *API) List(ctx context.Context, subscription int) *ListDatabase

List will return a ListDatabase that is capable of paging through all of the databases associated with a subscription.

func (*API) ListActiveActive added in v0.1.11

func (a *API) ListActiveActive(ctx context.Context, subscription int) *ListActiveActiveDatabase

ListActiveActive will return a ListDatabase that is capable of paging through all of the databases associated with a subscription.

func (*API) Update

func (a *API) Update(ctx context.Context, subscription int, database int, update UpdateDatabase) error

Update will update certain values of an existing database.

type ActiveActiveDatabase added in v0.1.11

type ActiveActiveDatabase struct {
	ID                                  *int            `json:"databaseId,omitempty"`
	Name                                *string         `json:"name,omitempty"`
	Protocol                            *string         `json:"protocol,omitempty"`
	Status                              *string         `json:"status,omitempty"`
	MemoryStorage                       *string         `json:"memoryStorage,omitempty"`
	ActiveActiveRedis                   *bool           `json:"activeActiveRedis,omitempty"`
	ActivatedOn                         *time.Time      `json:"activatedOn,omitempty"`
	LastModified                        *time.Time      `json:"lastModified,omitempty"`
	SupportOSSClusterAPI                *bool           `json:"supportOSSClusterApi,omitempty"`
	UseExternalEndpointForOSSClusterAPI *bool           `json:"useExternalEndpointForOSSClusterApi,omitempty"`
	Replication                         *bool           `json:"replication,omitempty"`
	DataEvictionPolicy                  *string         `json:"dataEvictionPolicy,omitempty"`
	Modules                             []*Module       `json:"modules,omitempty"`
	CrdbDatabases                       []*CrdbDatabase `json:"crdbDatabases,omitempty"`
}

func (ActiveActiveDatabase) String added in v0.1.11

func (o ActiveActiveDatabase) String() string

type Alert

type Alert struct {
	Name  *string `json:"name,omitempty"`
	Value *int    `json:"value,omitempty"`
}

func (Alert) String

func (o Alert) String() string

type Backup added in v0.1.11

type Backup struct {
	Enabled     *bool   `json:"enableRemoteBackup,omitempty"`
	TimeUTC     *string `json:"timeUTC,omitempty"`
	Interval    *string `json:"interval,omitempty"`
	Destination *string `json:"destination,omitempty"`
}

func (Backup) String added in v0.1.11

func (o Backup) String() string

type Clustering

type Clustering struct {
	NumberOfShards *int         `json:"numberOfShards,omitempty"`
	RegexRules     []*RegexRule `json:"regexRules,omitempty"`
}

func (Clustering) String

func (o Clustering) String() string

type CrdbDatabase added in v0.1.11

type CrdbDatabase struct {
	Provider                 *string   `json:"provider,omitempty"`
	Region                   *string   `json:"region,omitempty"`
	RedisVersionCompliance   *string   `json:"redisVersionCompliance,omitempty"`
	PublicEndpoint           *string   `json:"publicEndpoint,omitempty"`
	PrivateEndpoint          *string   `json:"privateEndpoint,omitempty"`
	MemoryLimitInGB          *float64  `json:"memoryLimitInGb,omitempty"`
	MemoryUsedInMB           *float64  `json:"memoryUsedInMb,omitempty"`
	ReadOperationsPerSecond  *int      `json:"readOperationsPerSecond,omitempty"`
	WriteOperationsPerSecond *int      `json:"writeOperationsPerSecond,omitempty"`
	DataPersistence          *string   `json:"dataPersistence,omitempty"`
	Alerts                   []*Alert  `json:"alerts,omitempty"`
	Security                 *Security `json:"security,omitempty"`
	Backup                   *Backup   `json:"backup,omitempty"`
}

func (CrdbDatabase) String added in v0.1.11

func (o CrdbDatabase) String() string

type CreateActiveActiveDatabase added in v0.1.10

type CreateActiveActiveDatabase struct {
	DryRun                              *bool              `json:"dryRun,omitempty"`
	Name                                *string            `json:"name,omitempty"`
	Protocol                            *string            `json:"protocol,omitempty"`
	MemoryLimitInGB                     *float64           `json:"memoryLimitInGb,omitempty"`
	SupportOSSClusterAPI                *bool              `json:"supportOSSClusterApi,omitempty"`
	RespVersion                         *string            `json:"respVersion,omitempty"`
	UseExternalEndpointForOSSClusterAPI *bool              `json:"useExternalEndpointForOSSClusterApi,omitempty"`
	DataEvictionPolicy                  *string            `json:"dataEvictionPolicy,omitempty"`
	GlobalDataPersistence               *string            `json:"dataPersistence,omitempty"`
	GlobalSourceIP                      []*string          `json:"sourceIp,omitempty"`
	GlobalPassword                      *string            `json:"password,omitempty"`
	GlobalAlerts                        []*Alert           `json:"alerts,omitempty"`
	GlobalModules                       []*Module          `json:"modules,omitempty"`
	LocalThroughputMeasurement          []*LocalThroughput `json:"localThroughputMeasurement,omitempty"`
	PortNumber                          *int               `json:"port,omitempty"`
}

func (CreateActiveActiveDatabase) String added in v0.1.10

type CreateDatabase

type CreateDatabase struct {
	DryRun                              *bool                        `json:"dryRun,omitempty"`
	Name                                *string                      `json:"name,omitempty"`
	Protocol                            *string                      `json:"protocol,omitempty"`
	MemoryLimitInGB                     *float64                     `json:"memoryLimitInGb,omitempty"`
	SupportOSSClusterAPI                *bool                        `json:"supportOSSClusterApi,omitempty"`
	RespVersion                         *string                      `json:"respVersion,omitempty"`
	UseExternalEndpointForOSSClusterAPI *bool                        `json:"useExternalEndpointForOSSClusterApi,omitempty"`
	DataPersistence                     *string                      `json:"dataPersistence,omitempty"`
	DataEvictionPolicy                  *string                      `json:"dataEvictionPolicy,omitempty"`
	Replication                         *bool                        `json:"replication,omitempty"`
	ThroughputMeasurement               *CreateThroughputMeasurement `json:"throughputMeasurement,omitempty"`
	AverageItemSizeInBytes              *int                         `json:"averageItemSizeInBytes,omitempty"`
	ReplicaOf                           []*string                    `json:"replicaOf,omitempty"`
	// Deprecated: Use RemoteBackup instead
	PeriodicBackupPath   *string               `json:"periodicBackupPath,omitempty"`
	SourceIP             []*string             `json:"sourceIp,omitempty"`
	ClientSSLCertificate *string               `json:"clientSslCertificate,omitempty"`
	Password             *string               `json:"password,omitempty"`
	Alerts               []*Alert              `json:"alerts,omitempty"`
	Modules              []*Module             `json:"modules,omitempty"`
	EnableTls            *bool                 `json:"enableTls,omitempty"`
	PortNumber           *int                  `json:"port,omitempty"`
	RemoteBackup         *DatabaseBackupConfig `json:"remoteBackup,omitempty"`
}

func (CreateDatabase) String

func (o CreateDatabase) String() string

type CreateThroughputMeasurement

type CreateThroughputMeasurement struct {
	By    *string `json:"by,omitempty"`
	Value *int    `json:"value,omitempty"`
}

func (CreateThroughputMeasurement) String

type Database

type Database struct {
	ID       *int    `json:"databaseId,omitempty"`
	Name     *string `json:"name,omitempty"`
	Protocol *string `json:"protocol,omitempty"`
	// For filtering out active-active entries, this property should not be present in the JSON response
	ActiveActiveRedis      *bool       `json:"activeActiveRedis,omitempty"`
	Provider               *string     `json:"provider,omitempty"`
	Region                 *string     `json:"region,omitempty"`
	Status                 *string     `json:"status,omitempty"`
	MemoryLimitInGB        *float64    `json:"memoryLimitInGb,omitempty"`
	MemoryUsedInMB         *float64    `json:"memoryUsedInMb,omitempty"`
	SupportOSSClusterAPI   *bool       `json:"supportOSSClusterApi,omitempty"`
	RespVersion            *string     `json:"respVersion,omitempty"`
	DataPersistence        *string     `json:"dataPersistence,omitempty"`
	Replication            *bool       `json:"replication,omitempty"`
	DataEvictionPolicy     *string     `json:"dataEvictionPolicy,omitempty"`
	ThroughputMeasurement  *Throughput `json:"throughputMeasurement,omitempty"`
	ReplicaOf              *ReplicaOf  `json:"replicaOf,omitempty"`
	Clustering             *Clustering `json:"clustering,omitempty"`
	Security               *Security   `json:"security,omitempty"`
	Modules                []*Module   `json:"modules,omitempty"`
	Alerts                 []*Alert    `json:"alerts,omitempty"`
	ActivatedOn            *time.Time  `json:"activatedOn,omitempty"`
	LastModified           *time.Time  `json:"lastModified,omitempty"`
	MemoryStorage          *string     `json:"memoryStorage,omitempty"`
	PrivateEndpoint        *string     `json:"privateEndpoint,omitempty"`
	PublicEndpoint         *string     `json:"publicEndpoint,omitempty"`
	RedisVersionCompliance *string     `json:"redisVersionCompliance,omitempty"`
	Backup                 *Backup     `json:"backup,omitempty"`
}

func (Database) String

func (o Database) String() string

type DatabaseBackupConfig added in v0.1.10

type DatabaseBackupConfig struct {
	Active      *bool   `json:"active,omitempty"`
	Interval    *string `json:"interval,omitempty"`
	TimeUTC     *string `json:"timeUTC,omitempty"`
	StorageType *string `json:"storageType,omitempty"`
	StoragePath *string `json:"storagePath,omitempty"`
}

func (DatabaseBackupConfig) String added in v0.1.10

func (o DatabaseBackupConfig) String() string

type HttpClient

type HttpClient interface {
	Get(ctx context.Context, name, path string, responseBody interface{}) error
	GetWithQuery(ctx context.Context, name, path string, query url.Values, responseBody interface{}) error
	Post(ctx context.Context, name, path string, requestBody interface{}, responseBody interface{}) error
	Put(ctx context.Context, name, path string, requestBody interface{}, responseBody interface{}) error
	Delete(ctx context.Context, name, path string, responseBody interface{}) error
}

type Import

type Import struct {
	SourceType    *string   `json:"sourceType,omitempty"`
	ImportFromURI []*string `json:"importFromUri,omitempty"`
}

func (Import) String

func (o Import) String() string

type ListActiveActiveDatabase added in v0.1.11

type ListActiveActiveDatabase struct {
	// contains filtered or unexported fields
}

func (*ListActiveActiveDatabase) Err added in v0.1.11

Err returns any error that occurred while trying to retrieve the next page of databases.

func (*ListActiveActiveDatabase) Next added in v0.1.11

func (d *ListActiveActiveDatabase) Next() bool

Next attempts to retrieve the next page of databases and will return false if no more databases were found. Any error that occurs within this function can be retrieved from the `Err()` function.

func (*ListActiveActiveDatabase) Value added in v0.1.11

Value returns the current page of databases.

type ListDatabase

type ListDatabase struct {
	// contains filtered or unexported fields
}

func (*ListDatabase) Err

func (d *ListDatabase) Err() error

Err returns any error that occurred while trying to retrieve the next page of databases.

func (*ListDatabase) Next

func (d *ListDatabase) Next() bool

Next attempts to retrieve the next page of databases and will return false if no more databases were found. Any error that occurs within this function can be retrieved from the `Err()` function.

func (*ListDatabase) Value

func (d *ListDatabase) Value() *Database

Value returns the current page of databases.

type LocalRegionProperties added in v0.1.10

type LocalRegionProperties struct {
	Region                     *string               `json:"region,omitempty"`
	RemoteBackup               *DatabaseBackupConfig `json:"remoteBackup,omitempty"`
	LocalThroughputMeasurement *LocalThroughput      `json:"localThroughputMeasurement,omitempty"`
	DataPersistence            *string               `json:"dataPersistence,omitempty"`
	Password                   *string               `json:"password,omitempty"`
	SourceIP                   []*string             `json:"sourceIp,omitempty"`
	// Using a pointer to allow empty slices to be serialised/sent
	Alerts *[]*Alert `json:"alerts,omitempty"`
}

func (LocalRegionProperties) String added in v0.1.10

func (o LocalRegionProperties) String() string

type LocalThroughput added in v0.1.10

type LocalThroughput struct {
	Region                   *string `json:"region,omitempty"`
	WriteOperationsPerSecond *int    `json:"writeOperationsPerSecond,omitempty"`
	ReadOperationsPerSecond  *int    `json:"readOperationsPerSecond,omitempty"`
}

func (LocalThroughput) String added in v0.1.10

func (o LocalThroughput) String() string

type Log

type Log interface {
	Printf(format string, args ...interface{})
}

type Module

type Module struct {
	Name *string `json:"name,omitempty"`
}

func (Module) String

func (o Module) String() string

type NotFound added in v0.1.9

type NotFound struct {
	// contains filtered or unexported fields
}

func (*NotFound) Error added in v0.1.9

func (f *NotFound) Error() string

type RegexRule

type RegexRule struct {
	Ordinal int    `json:"ordinal"`
	Pattern string `json:"pattern"`
}

func (RegexRule) String

func (o RegexRule) String() string

type ReplicaOf

type ReplicaOf struct {
	Endpoints []*string `json:"endpoints,omitempty"`
}

type Security

type Security struct {
	EnableDefaultUser       *bool     `json:"enableDefaultUser,omitempty"`
	SSLClientAuthentication *bool     `json:"sslClientAuthentication,omitempty"`
	SourceIPs               []*string `json:"sourceIps,omitempty"`
	Password                *string   `json:"password,omitempty"`
	EnableTls               *bool     `json:"enableTls,omitempty"`
}

func (Security) String

func (o Security) String() string

type TaskWaiter added in v0.9.0

type TaskWaiter interface {
	WaitForResourceId(ctx context.Context, id string) (int, error)
	Wait(ctx context.Context, id string) error
}

type Throughput

type Throughput struct {
	By    *string `json:"by,omitempty"`
	Value *int    `json:"value,omitempty"`
}

func (Throughput) String

func (o Throughput) String() string

type UpdateActiveActiveDatabase added in v0.1.10

type UpdateActiveActiveDatabase struct {
	DryRun                              *bool     `json:"dryRun,omitempty"`
	MemoryLimitInGB                     *float64  `json:"memoryLimitInGb,omitempty"`
	SupportOSSClusterAPI                *bool     `json:"supportOSSClusterApi,omitempty"`
	UseExternalEndpointForOSSClusterAPI *bool     `json:"useExternalEndpointForOSSClusterApi,omitempty"`
	ClientSSLCertificate                *string   `json:"clientSslCertificate,omitempty"`
	EnableTls                           *bool     `json:"enableTls,omitempty"`
	GlobalDataPersistence               *string   `json:"globalDataPersistence,omitempty"`
	GlobalPassword                      *string   `json:"globalPassword,omitempty"`
	GlobalSourceIP                      []*string `json:"globalSourceIp,omitempty"`
	// Using a pointer to allow empty slices to be serialised/sent
	GlobalAlerts       *[]*Alert                `json:"globalAlerts,omitempty"`
	Regions            []*LocalRegionProperties `json:"regions,omitempty"`
	DataEvictionPolicy *string                  `json:"dataEvictionPolicy,omitempty"`
}

func (UpdateActiveActiveDatabase) String added in v0.1.10

type UpdateDatabase

type UpdateDatabase struct {
	DryRun                              *bool                        `json:"dryRun,omitempty"`
	Name                                *string                      `json:"name,omitempty"`
	MemoryLimitInGB                     *float64                     `json:"memoryLimitInGb,omitempty"`
	SupportOSSClusterAPI                *bool                        `json:"supportOSSClusterApi,omitempty"`
	RespVersion                         *string                      `json:"respVersion,omitempty"`
	UseExternalEndpointForOSSClusterAPI *bool                        `json:"useExternalEndpointForOSSClusterApi,omitempty"`
	DataEvictionPolicy                  *string                      `json:"dataEvictionPolicy,omitempty"`
	Replication                         *bool                        `json:"replication,omitempty"`
	ThroughputMeasurement               *UpdateThroughputMeasurement `json:"throughputMeasurement,omitempty"`
	RegexRules                          []*string                    `json:"regexRules,omitempty"`
	DataPersistence                     *string                      `json:"dataPersistence,omitempty"`
	ReplicaOf                           []*string                    `json:"replicaOf"`
	PeriodicBackupPath                  *string                      `json:"periodicBackupPath,omitempty"`
	SourceIP                            []*string                    `json:"sourceIp,omitempty"`
	ClientSSLCertificate                *string                      `json:"clientSslCertificate,omitempty"`
	Password                            *string                      `json:"password,omitempty"`
	// It's important to use a pointer here, because the terraform user may want to send an empty list.
	// In that case, the developer must pass a (pointer to a) non-nil, zero-length slice
	// If the developer really wants to omit this value, passing a nil slice value would work
	Alerts            *[]*Alert             `json:"alerts,omitempty"`
	EnableTls         *bool                 `json:"enableTls,omitempty"`
	RemoteBackup      *DatabaseBackupConfig `json:"remoteBackup,omitempty"`
	EnableDefaultUser *bool                 `json:"enableDefaultUser,omitempty"`
}

func (UpdateDatabase) String

func (o UpdateDatabase) String() string

type UpdateThroughputMeasurement

type UpdateThroughputMeasurement struct {
	By    *string `json:"by,omitempty"`
	Value *int    `json:"value,omitempty"`
}

func (UpdateThroughputMeasurement) String

Jump to

Keyboard shortcuts

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