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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -277,3 +277,4 @@ CLAUDE.md
.claude

coverage.out
swagger-redis-api.json
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
All notable changes to this project will be documented in this file.
See updating [Changelog example here](https://keepachangelog.com/en/1.0.0/).

## 0.40.0 (30th October 2025)

### Added:
* Added global values fields to `ActiveActiveDatabase` read response: `GlobalDataPersistence`, `GlobalSourceIP`, `GlobalPassword`, `GlobalAlerts`, and `GlobalEnableDefaultUser`
* New `TestAADatabase_Get` test for ActiveActive Get method coverage
* Updated `TestAADatabase_List` test to include global values in response

### Updated:
* Bump golang.org/x/tools to 0.38.0
* Bump github.com/avast/retry-go/v4 to 4.7.0

## 0.39.0 (21st October 2025)

### Added:
Expand Down
233 changes: 233 additions & 0 deletions active_active_database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,221 @@ func TestAADatabase_Update(t *testing.T) {
require.NoError(t, err)
}

func TestAADatabase_Get(t *testing.T) {
body := `{
"databaseId": 1466,
"name": "active-active-db",
"redisVersion": "7.2",
"protocol": "redis",
"status": "active",
"memoryStorage": "ram",
"activeActiveRedis": true,
"activatedOn": "2024-05-08T08:10:02Z",
"lastModified": "2024-05-08T08:22:34Z",
"supportOSSClusterApi": false,
"useExternalEndpointForOSSClusterApi": false,
"replication": true,
"dataEvictionPolicy": "noeviction",
"autoMinorVersionUpgrade": true,
"modules": [],
"globalDataPersistence": "aof-every-1-second",
"globalSourceIp": ["192.168.1.0/24"],
"globalPassword": "********",
"globalAlerts": [
{
"name": "throughput-higher-than",
"value": 90
}
],
"globalEnableDefaultUser": false,
"crdbDatabases": [
{
"provider": "AWS",
"region": "us-east-1",
"redisVersionCompliance": "7.2.0",
"publicEndpoint": "redis-14383.mc940-1.us-east-1-mz.ec2.qa-cloud.rlrcp.com:14383",
"privateEndpoint": "redis-14383.internal.mc940-1.us-east-1-mz.ec2.qa-cloud.rlrcp.com:14383",
"memoryLimitInGb": 2,
"datasetSizeInGb": 2,
"memoryUsedInMb": 45.5,
"readOperationsPerSecond": 2000,
"writeOperationsPerSecond": 2000,
"dataPersistence": "aof-every-1-second",
"queryPerformanceFactor": "6x",
"alerts": [
{
"id": "51054122-2",
"name": "dataset-size",
"value": 85,
"defaultValue": 80
}
],
"security": {
"enableDefaultUser": false,
"sslClientAuthentication": false,
"tlsClientAuthentication": true,
"enableTls": true,
"sourceIps": ["10.0.0.0/8"]
},
"backup": {
"enableRemoteBackup": true,
"interval": "every-12-hours",
"timeUTC": "10:00",
"destination": "s3://bucket/path"
}
},
{
"provider": "AWS",
"region": "us-east-2",
"redisVersionCompliance": "7.2.0",
"publicEndpoint": "redis-14383.mc940-0.us-east-2-mz.ec2.qa-cloud.rlrcp.com:14383",
"privateEndpoint": "redis-14383.internal.mc940-0.us-east-2-mz.ec2.qa-cloud.rlrcp.com:14383",
"memoryLimitInGb": 2,
"datasetSizeInGb": 2,
"memoryUsedInMb": 45.3,
"readOperationsPerSecond": 2000,
"writeOperationsPerSecond": 2000,
"dataPersistence": "aof-every-1-second",
"queryPerformanceFactor": "6x",
"alerts": [
{
"id": "51054121-2",
"name": "dataset-size",
"value": 85,
"defaultValue": 80
}
],
"security": {
"enableDefaultUser": false,
"sslClientAuthentication": false,
"tlsClientAuthentication": true,
"enableTls": true,
"sourceIps": ["10.0.0.0/8"]
},
"backup": {
"enableRemoteBackup": true,
"interval": "every-12-hours",
"timeUTC": "10:00",
"destination": "s3://bucket/path"
}
}
]
}`

s := httptest.NewServer(
testServer(
"apiKey",
"secret",
getRequest(t, "/subscriptions/111478/databases/1466", body),
),
)
defer s.Close()

subject, err := clientFromTestServer(s, "apiKey", "secret")
require.NoError(t, err)

actual, err := subject.Database.GetActiveActive(context.TODO(), 111478, 1466)
require.NoError(t, err)

expected := &databases.ActiveActiveDatabase{
ID: redis.Int(1466),
Name: redis.String("active-active-db"),
Protocol: redis.String("redis"),
RedisVersion: redis.String("7.2"),
Status: redis.String("active"),
MemoryStorage: redis.String("ram"),
ActiveActiveRedis: redis.Bool(true),
ActivatedOn: redis.Time(time.Date(2024, 5, 8, 8, 10, 02, 0, time.UTC)),
LastModified: redis.Time(time.Date(2024, 5, 8, 8, 22, 34, 0, time.UTC)),
SupportOSSClusterAPI: redis.Bool(false),
UseExternalEndpointForOSSClusterAPI: redis.Bool(false),
Replication: redis.Bool(true),
DataEvictionPolicy: redis.String("noeviction"),
AutoMinorVersionUpgrade: redis.Bool(true),
Modules: []*databases.Module{},
GlobalDataPersistence: redis.String("aof-every-1-second"),
GlobalSourceIP: redis.StringSlice("192.168.1.0/24"),
GlobalPassword: redis.String("********"),
GlobalAlerts: []*databases.Alert{
{
Name: redis.String("throughput-higher-than"),
Value: redis.Int(90),
},
},
GlobalEnableDefaultUser: redis.Bool(false),
CrdbDatabases: []*databases.CrdbDatabase{
{
Provider: redis.String("AWS"),
Region: redis.String("us-east-1"),
RedisVersionCompliance: redis.String("7.2.0"),
PublicEndpoint: redis.String("redis-14383.mc940-1.us-east-1-mz.ec2.qa-cloud.rlrcp.com:14383"),
PrivateEndpoint: redis.String("redis-14383.internal.mc940-1.us-east-1-mz.ec2.qa-cloud.rlrcp.com:14383"),
MemoryLimitInGB: redis.Float64(2),
DatasetSizeInGB: redis.Float64(2),
MemoryUsedInMB: redis.Float64(45.5),
ReadOperationsPerSecond: redis.Int(2000),
WriteOperationsPerSecond: redis.Int(2000),
DataPersistence: redis.String("aof-every-1-second"),
QueryPerformanceFactor: redis.String("6x"),
Alerts: []*databases.Alert{
{
Name: redis.String("dataset-size"),
Value: redis.Int(85),
},
},
Security: &databases.Security{
EnableDefaultUser: redis.Bool(false),
SSLClientAuthentication: redis.Bool(false),
TLSClientAuthentication: redis.Bool(true),
EnableTls: redis.Bool(true),
SourceIPs: redis.StringSlice("10.0.0.0/8"),
},
Backup: &databases.Backup{
Enabled: redis.Bool(true),
Interval: redis.String("every-12-hours"),
TimeUTC: redis.String("10:00"),
Destination: redis.String("s3://bucket/path"),
},
},
{
Provider: redis.String("AWS"),
Region: redis.String("us-east-2"),
RedisVersionCompliance: redis.String("7.2.0"),
PublicEndpoint: redis.String("redis-14383.mc940-0.us-east-2-mz.ec2.qa-cloud.rlrcp.com:14383"),
PrivateEndpoint: redis.String("redis-14383.internal.mc940-0.us-east-2-mz.ec2.qa-cloud.rlrcp.com:14383"),
MemoryLimitInGB: redis.Float64(2),
DatasetSizeInGB: redis.Float64(2),
MemoryUsedInMB: redis.Float64(45.3),
ReadOperationsPerSecond: redis.Int(2000),
WriteOperationsPerSecond: redis.Int(2000),
DataPersistence: redis.String("aof-every-1-second"),
QueryPerformanceFactor: redis.String("6x"),
Alerts: []*databases.Alert{
{
Name: redis.String("dataset-size"),
Value: redis.Int(85),
},
},
Security: &databases.Security{
EnableDefaultUser: redis.Bool(false),
SSLClientAuthentication: redis.Bool(false),
TLSClientAuthentication: redis.Bool(true),
EnableTls: redis.Bool(true),
SourceIPs: redis.StringSlice("10.0.0.0/8"),
},
Backup: &databases.Backup{
Enabled: redis.Bool(true),
Interval: redis.String("every-12-hours"),
TimeUTC: redis.String("10:00"),
Destination: redis.String("s3://bucket/path"),
},
},
},
}

assert.Equal(t, expected, actual)
}

func TestAADatabase_List(t *testing.T) {
body := `{
"accountId": 69369,
Expand All @@ -280,6 +495,15 @@ func TestAADatabase_List(t *testing.T) {
"dataEvictionPolicy": "noeviction",
"autoMinorVersionUpgrade": true,
"modules": [],
"globalDataPersistence": "none",
"globalSourceIp": ["0.0.0.0/0"],
"globalAlerts": [
{
"name": "dataset-size",
"value": 80
}
],
"globalEnableDefaultUser": true,
"crdbDatabases": [
{
"provider": "AWS",
Expand Down Expand Up @@ -423,6 +647,15 @@ func TestAADatabase_List(t *testing.T) {
DataEvictionPolicy: redis.String("noeviction"),
AutoMinorVersionUpgrade: redis.Bool(true),
Modules: []*databases.Module{},
GlobalDataPersistence: redis.String("none"),
GlobalSourceIP: redis.StringSlice("0.0.0.0/0"),
GlobalAlerts: []*databases.Alert{
{
Name: redis.String("dataset-size"),
Value: redis.Int(80),
},
},
GlobalEnableDefaultUser: redis.Bool(true),
CrdbDatabases: []*databases.CrdbDatabase{
{
Provider: redis.String("AWS"),
Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ go 1.24.0
toolchain go1.24.1

require (
github.com/avast/retry-go/v4 v4.6.0
github.com/avast/retry-go/v4 v4.7.0
github.com/stretchr/testify v1.11.1
golang.org/x/tools v0.37.0
golang.org/x/tools v0.38.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
golang.org/x/mod v0.28.0 // indirect
golang.org/x/mod v0.29.0 // indirect
golang.org/x/sync v0.17.0 // indirect
golang.org/x/sys v0.36.0 // indirect
golang.org/x/telemetry v0.0.0-20250908211612-aef8a434d053 // indirect
golang.org/x/sys v0.37.0 // indirect
golang.org/x/telemetry v0.0.0-20251008203120-078029d740a8 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
20 changes: 10 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/avast/retry-go/v4 v4.6.0 h1:K9xNA+KeB8HHc2aWFuLb25Offp+0iVRXEvFx8IinRJA=
github.com/avast/retry-go/v4 v4.6.0/go.mod h1:gvWlPhBVsvBbLkVGDg/KwvBv0bEkCOLRRSHKIr2PyOE=
github.com/avast/retry-go/v4 v4.7.0 h1:yjDs35SlGvKwRNSykujfjdMxMhMQQM0TnIjJaHB+Zio=
github.com/avast/retry-go/v4 v4.7.0/go.mod h1:ZMPDa3sY2bKgpLtap9JRUgk2yTAba7cgiFhqxY2Sg6Q=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
Expand All @@ -10,16 +10,16 @@ github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
golang.org/x/mod v0.28.0 h1:gQBtGhjxykdjY9YhZpSlZIsbnaE2+PgjfLWUQTnoZ1U=
golang.org/x/mod v0.28.0/go.mod h1:yfB/L0NOf/kmEbXjzCPOx1iK1fRutOydrCMsqRhEBxI=
golang.org/x/mod v0.29.0 h1:HV8lRxZC4l2cr3Zq1LvtOsi/ThTgWnUk/y64QSs8GwA=
golang.org/x/mod v0.29.0/go.mod h1:NyhrlYXJ2H4eJiRy/WDBO6HMqZQ6q9nk4JzS3NuCK+w=
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/telemetry v0.0.0-20250908211612-aef8a434d053 h1:dHQOQddU4YHS5gY33/6klKjq7Gp3WwMyOXGNp5nzRj8=
golang.org/x/telemetry v0.0.0-20250908211612-aef8a434d053/go.mod h1:+nZKN+XVh4LCiA9DV3ywrzN4gumyCnKjau3NGb9SGoE=
golang.org/x/tools v0.37.0 h1:DVSRzp7FwePZW356yEAChSdNcQo6Nsp+fex1SUW09lE=
golang.org/x/tools v0.37.0/go.mod h1:MBN5QPQtLMHVdvsbtarmTNukZDdgwdwlO5qGacAzF0w=
golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/telemetry v0.0.0-20251008203120-078029d740a8 h1:LvzTn0GQhWuvKH/kVRS3R3bVAsdQWI7hvfLHGgh9+lU=
golang.org/x/telemetry v0.0.0-20251008203120-078029d740a8/go.mod h1:Pi4ztBfryZoJEkyFTI5/Ocsu2jXyDr6iSdgJiYE/uwE=
golang.org/x/tools v0.38.0 h1:Hx2Xv8hISq8Lm16jvBZ2VQf+RLmbd7wVUsALibYI/IQ=
golang.org/x/tools v0.38.0/go.mod h1:yEsQ/d/YK8cjh0L6rZlY8tgtlKiBNTL14pGDJPJpYQs=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
Expand Down
5 changes: 5 additions & 0 deletions service/databases/model_active_active.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ type ActiveActiveDatabase struct {
DataEvictionPolicy *string `json:"dataEvictionPolicy,omitempty"`
Security *Security `json:"security,omitempty"`
Modules []*Module `json:"modules,omitempty"`
GlobalDataPersistence *string `json:"globalDataPersistence,omitempty"`
GlobalSourceIP []*string `json:"globalSourceIp,omitempty"`
GlobalPassword *string `json:"globalPassword,omitempty"`
GlobalAlerts []*Alert `json:"globalAlerts,omitempty"`
GlobalEnableDefaultUser *bool `json:"globalEnableDefaultUser,omitempty"`
CrdbDatabases []*CrdbDatabase `json:"crdbDatabases,omitempty"`
AutoMinorVersionUpgrade *bool `json:"autoMinorVersionUpgrade,omitempty"`
}
Expand Down