Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 0 additions & 73 deletions service/databases/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,6 @@ func (o CreateDatabase) String() string {
return internal.ToString(o)
}

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"`
UseExternalEndpointForOSSClusterAPI *bool `json:"useExternalEndpointForOSSClusterApi,omitempty"`
GlobalDataPersistence *string `json:"dataPersistence,omitempty"`
GlobalSourceIP []*string `json:"sourceIp,omitempty"`
GlobalPassword *string `json:"password,omitempty"`
GlobalAlerts []*CreateAlert `json:"alerts,omitempty"`
LocalThroughputMeasurement []*LocalThroughput `json:"localThroughputMeasurement,omitempty"`
}

func (o CreateActiveActiveDatabase) String() string {
return internal.ToString(o)
}

type CreateThroughputMeasurement struct {
By *string `json:"by,omitempty"`
Value *int `json:"value,omitempty"`
Expand Down Expand Up @@ -201,25 +183,6 @@ func (o UpdateDatabase) String() string {
return internal.ToString(o)
}

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"`
GlobalAlerts []*UpdateAlert `json:"globalAlerts,omitempty"`
Regions []*LocalRegionProperties `json:"regions,omitempty"`
DataEvictionPolicy *string `json:"dataEvictionPolicy,omitempty"`
}

func (o UpdateActiveActiveDatabase) String() string {
return internal.ToString(o)
}

type UpdateThroughputMeasurement struct {
By *string `json:"by,omitempty"`
Value *int `json:"value,omitempty"`
Expand All @@ -238,42 +201,6 @@ func (o UpdateAlert) String() string {
return internal.ToString(o)
}

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"`
Alerts []*UpdateAlert `json:"alerts,omitempty"`
}

func (o LocalRegionProperties) String() string {
return internal.ToString(o)
}

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

func (o LocalThroughput) String() string {
return internal.ToString(o)
}

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 (o DatabaseBackupConfig) String() string {
return internal.ToString(o)
}

type Import struct {
SourceType *string `json:"sourceType,omitempty"`
ImportFromURI []*string `json:"importFromUri,omitempty"`
Expand Down
148 changes: 148 additions & 0 deletions service/databases/model_active_active.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
package databases

import (
"time"

"github.com/RedisLabs/rediscloud-go-api/internal"
)

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"`
CrdbDatabases []*CrdbDatabase `json:"crdbDatabases,omitempty"`
}

func (o ActiveActiveDatabase) String() string {
return internal.ToString(o)
}

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 (o CrdbDatabase) String() string {
return internal.ToString(o)
}

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

func (o Backup) String() string {
return internal.ToString(o)
}

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"`
UseExternalEndpointForOSSClusterAPI *bool `json:"useExternalEndpointForOSSClusterApi,omitempty"`
GlobalDataPersistence *string `json:"dataPersistence,omitempty"`
GlobalSourceIP []*string `json:"sourceIp,omitempty"`
GlobalPassword *string `json:"password,omitempty"`
GlobalAlerts []*CreateAlert `json:"alerts,omitempty"`
LocalThroughputMeasurement []*LocalThroughput `json:"localThroughputMeasurement,omitempty"`
}

func (o CreateActiveActiveDatabase) String() string {
return internal.ToString(o)
}

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

func (o LocalThroughput) String() string {
return internal.ToString(o)
}

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"`
GlobalAlerts []*UpdateAlert `json:"globalAlerts,omitempty"`
Regions []*LocalRegionProperties `json:"regions,omitempty"`
DataEvictionPolicy *string `json:"dataEvictionPolicy,omitempty"`
}

func (o UpdateActiveActiveDatabase) String() string {
return internal.ToString(o)
}

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"`
Alerts []*UpdateAlert `json:"alerts,omitempty"`
}

func (o LocalRegionProperties) String() string {
return internal.ToString(o)
}

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 (o DatabaseBackupConfig) String() string {
return internal.ToString(o)
}

type listActiveActiveDatabaseResponse struct {
AccountId *string `json:"accountId,omitempty"`
Subscription []*listActiveActiveDbSubscription `json:"subscription,omitempty"`
}

func (o listActiveActiveDatabaseResponse) String() string {
return internal.ToString(o)
}

type listActiveActiveDbSubscription struct {
ID *int `json:"subscriptionId,omitempty"`
Databases []*ActiveActiveDatabase `json:"databases,omitempty"`
}

func (o listActiveActiveDbSubscription) String() string {
return internal.ToString(o)
}
36 changes: 0 additions & 36 deletions service/databases/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,6 @@ func (a *API) Create(ctx context.Context, subscription int, db CreateDatabase) (
return id, nil
}

// Create will create a new database for the subscription and return the identifier of the database.
func (a *API) ActiveActiveCreate(ctx context.Context, subscription int, db CreateActiveActiveDatabase) (int, error) {
var task taskResponse
err := a.client.Post(ctx, fmt.Sprintf("create database for subscription %d", subscription), fmt.Sprintf("/subscriptions/%d/databases", subscription), db, &task)
if err != nil {
return 0, err
}

a.logger.Printf("Waiting for new database for subscription %d to finish being created", subscription)

id, err := a.task.WaitForResourceId(ctx, *task.ID)
if err != nil {
return 0, err
}

return id, nil
}

// List will return a ListDatabase that is capable of paging through all of the databases associated with a
// subscription.
func (a *API) List(ctx context.Context, subscription int) *ListDatabase {
Expand Down Expand Up @@ -109,24 +91,6 @@ func (a *API) Update(ctx context.Context, subscription int, database int, update
return nil
}

// Update will update certain values of an existing database.
func (a *API) ActiveActiveUpdate(ctx context.Context, subscription int, database int, update UpdateActiveActiveDatabase) error {
var task taskResponse
err := a.client.Put(ctx, fmt.Sprintf("update database %d for subscription %d", database, subscription), fmt.Sprintf("/subscriptions/%d/databases/%d/regions", subscription, database), update, &task)
if err != nil {
return err
}

a.logger.Printf("Waiting for database %d for subscription %d to finish being updated", database, subscription)

err = a.task.Wait(ctx, *task.ID)
if err != nil {
return err
}

return nil
}

// Delete will destroy an existing database.
func (a *API) Delete(ctx context.Context, subscription int, database int) error {
var task taskResponse
Expand Down
Loading