From 6b2968cf2e12bd01603dd3926032f092695db0fb Mon Sep 17 00:00:00 2001 From: Matthew Long Date: Thu, 30 Oct 2025 11:59:41 +0000 Subject: [PATCH 1/9] feat: adding global values to get api so terraform can read state --- active_active_database_test.go | 20 ++++++++++++++++++++ service/databases/model_active_active.go | 6 ++++++ 2 files changed, 26 insertions(+) diff --git a/active_active_database_test.go b/active_active_database_test.go index 4c421bf..77bb5b3 100644 --- a/active_active_database_test.go +++ b/active_active_database_test.go @@ -280,6 +280,16 @@ 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 + } + ], + "globalModules": [], + "globalEnableDefaultUser": true, "crdbDatabases": [ { "provider": "AWS", @@ -423,6 +433,16 @@ 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), + }, + }, + GlobalModules: []*databases.Module{}, + GlobalEnableDefaultUser: redis.Bool(true), CrdbDatabases: []*databases.CrdbDatabase{ { Provider: redis.String("AWS"), diff --git a/service/databases/model_active_active.go b/service/databases/model_active_active.go index dcad08a..4cf0773 100644 --- a/service/databases/model_active_active.go +++ b/service/databases/model_active_active.go @@ -22,6 +22,12 @@ 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"` + GlobalModules []*Module `json:"globalModules,omitempty"` + GlobalEnableDefaultUser *bool `json:"globalEnableDefaultUser,omitempty"` CrdbDatabases []*CrdbDatabase `json:"crdbDatabases,omitempty"` AutoMinorVersionUpgrade *bool `json:"autoMinorVersionUpgrade,omitempty"` } From bc5c33901a8bc5d99ff2af74b3bd766d685f6d83 Mon Sep 17 00:00:00 2001 From: Matthew Long Date: Thu, 30 Oct 2025 12:01:16 +0000 Subject: [PATCH 2/9] test: adding in AA database get to fill in missing coverage --- active_active_database_test.go | 225 +++++++++++++++++++++++++++++++++ 1 file changed, 225 insertions(+) diff --git a/active_active_database_test.go b/active_active_database_test.go index 77bb5b3..b0984e5 100644 --- a/active_active_database_test.go +++ b/active_active_database_test.go @@ -256,6 +256,231 @@ 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 + } + ], + "globalModules": [ + { + "name": "RedisJSON" + } + ], + "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), + }, + }, + GlobalModules: []*databases.Module{ + { + Name: redis.String("RedisJSON"), + }, + }, + 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, From 56e8f68f20c68b99d2927f1b9619247407650268 Mon Sep 17 00:00:00 2001 From: Matthew Long Date: Thu, 30 Oct 2025 12:28:44 +0000 Subject: [PATCH 3/9] fix: removing global default modules as it doesn't exist on the api --- .gitignore | 1 + active_active_database_test.go | 12 ------------ service/databases/model_active_active.go | 1 - 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index c8e2d17..0ebe916 100644 --- a/.gitignore +++ b/.gitignore @@ -277,3 +277,4 @@ CLAUDE.md .claude coverage.out +swagger-redis-api.json diff --git a/active_active_database_test.go b/active_active_database_test.go index b0984e5..009a174 100644 --- a/active_active_database_test.go +++ b/active_active_database_test.go @@ -282,11 +282,6 @@ func TestAADatabase_Get(t *testing.T) { "value": 90 } ], - "globalModules": [ - { - "name": "RedisJSON" - } - ], "globalEnableDefaultUser": false, "crdbDatabases": [ { @@ -402,11 +397,6 @@ func TestAADatabase_Get(t *testing.T) { Value: redis.Int(90), }, }, - GlobalModules: []*databases.Module{ - { - Name: redis.String("RedisJSON"), - }, - }, GlobalEnableDefaultUser: redis.Bool(false), CrdbDatabases: []*databases.CrdbDatabase{ { @@ -513,7 +503,6 @@ func TestAADatabase_List(t *testing.T) { "value": 80 } ], - "globalModules": [], "globalEnableDefaultUser": true, "crdbDatabases": [ { @@ -666,7 +655,6 @@ func TestAADatabase_List(t *testing.T) { Value: redis.Int(80), }, }, - GlobalModules: []*databases.Module{}, GlobalEnableDefaultUser: redis.Bool(true), CrdbDatabases: []*databases.CrdbDatabase{ { diff --git a/service/databases/model_active_active.go b/service/databases/model_active_active.go index 4cf0773..f8c1cf4 100644 --- a/service/databases/model_active_active.go +++ b/service/databases/model_active_active.go @@ -26,7 +26,6 @@ type ActiveActiveDatabase struct { GlobalSourceIP []*string `json:"globalSourceIp,omitempty"` GlobalPassword *string `json:"globalPassword,omitempty"` GlobalAlerts []*Alert `json:"globalAlerts,omitempty"` - GlobalModules []*Module `json:"globalModules,omitempty"` GlobalEnableDefaultUser *bool `json:"globalEnableDefaultUser,omitempty"` CrdbDatabases []*CrdbDatabase `json:"crdbDatabases,omitempty"` AutoMinorVersionUpgrade *bool `json:"autoMinorVersionUpgrade,omitempty"` From 219800ff776ace2a6558cb34dab8bbfbd864632c Mon Sep 17 00:00:00 2001 From: Matthew Long Date: Thu, 30 Oct 2025 12:44:26 +0000 Subject: [PATCH 4/9] docs: changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75b6afb..5fa9366 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ 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 + ## 0.39.0 (21st October 2025) ### Added: From da9f67a30f6092118a7c44cecfc868b329451b8b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 30 Oct 2025 12:47:04 +0000 Subject: [PATCH 5/9] chore(deps): bump github.com/avast/retry-go/v4 from 4.6.0 to 4.7.0 Bumps [github.com/avast/retry-go/v4](https://github.com/avast/retry-go) from 4.6.0 to 4.7.0. - [Release notes](https://github.com/avast/retry-go/releases) - [Commits](https://github.com/avast/retry-go/compare/4.6.0...4.7.0) --- updated-dependencies: - dependency-name: github.com/avast/retry-go/v4 dependency-version: 4.7.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index dc8d1fb..6a980be 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ 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 ) diff --git a/go.sum b/go.sum index b2d0f92..15efe33 100644 --- a/go.sum +++ b/go.sum @@ -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= From a36b6432dbfa5f547e90dd9e9993ac923db9c8a6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Oct 2025 00:01:13 +0000 Subject: [PATCH 6/9] chore(deps): bump golang.org/x/tools from 0.37.0 to 0.38.0 Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.37.0 to 0.38.0. - [Release notes](https://github.com/golang/tools/releases) - [Commits](https://github.com/golang/tools/compare/v0.37.0...v0.38.0) --- updated-dependencies: - dependency-name: golang.org/x/tools dependency-version: 0.38.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 8 ++++---- go.sum | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 6a980be..27de6d7 100644 --- a/go.mod +++ b/go.mod @@ -7,16 +7,16 @@ toolchain go1.24.1 require ( 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 ) diff --git a/go.sum b/go.sum index 15efe33..4e3a8b0 100644 --- a/go.sum +++ b/go.sum @@ -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= From e5d9d185bc5fc453d355faff9dea2735912e906c Mon Sep 17 00:00:00 2001 From: Matthew Long Date: Thu, 30 Oct 2025 12:50:08 +0000 Subject: [PATCH 7/9] docs: changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fa9366..673e15c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ See updating [Changelog example here](https://keepachangelog.com/en/1.0.0/). * 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: From bad4bef427fd39fb2bace47c62f2e867d67f1525 Mon Sep 17 00:00:00 2001 From: Matthew Long Date: Thu, 30 Oct 2025 14:31:34 +0000 Subject: [PATCH 8/9] fix: endpoint script was incorrectly marshalling the shape of its response --- privatelink_test.go | 94 +++++++++++++++++++++++++++++++--- service/privatelink/model.go | 5 ++ service/privatelink/service.go | 4 +- 3 files changed, 92 insertions(+), 11 deletions(-) diff --git a/privatelink_test.go b/privatelink_test.go index 93c2160..f3f4b70 100644 --- a/privatelink_test.go +++ b/privatelink_test.go @@ -421,8 +421,6 @@ func TestGetActiveActivePrivateLink(t *testing.T) { } func TestGetPrivateLinkScript(t *testing.T) { - t.Skipf("skipping test until privatelink script is available") - tc := []struct { description string mockedResponse []endpointRequest @@ -436,10 +434,51 @@ func TestGetPrivateLinkScript(t *testing.T) { getRequest( t, "/subscriptions/114019/private-link/endpoint-script?includeTerraformAwsScript=true", - `a pro privatelink aws terraform endpoint script`, + `{ + "taskId": "4e62bd68-06ce-4207-91cd-62b9d8b60dff", + "commandType": "privateLinkEndpointScriptGetRequest", + "status": "received", + "description": "Task request received and is being queued for processing.", + "timestamp": "2025-10-30T14:13:46.539111211Z", + "links": [ + { + "type": "GET", + "href": "https://api-staging.qa.redislabs.com/v1/tasks/4e62bd68-06ce-4207-91cd-62b9d8b60dff", + "rel": "task" + } + ] + }`, ), + getRequest( + t, + "/tasks/4e62bd68-06ce-4207-91cd-62b9d8b60dff", + `{ + "taskId": "4e62bd68-06ce-4207-91cd-62b9d8b60dff", + "commandType": "privateLinkEndpointScriptGetRequest", + "status": "processing-completed", + "description": "Request processing completed successfully and its resources are now being provisioned / de-provisioned.", + "timestamp": "2025-10-30T14:13:51.991415541Z", + "response": { + "resourceId": 114019, + "resource": { + "resourceEndpointScript": "python script content here", + "terraformAwsScript": "terraform script content here" + } + }, + "links": [ + { + "type": "GET", + "href": "https://api-staging.qa.redislabs.com/v1/tasks/4e62bd68-06ce-4207-91cd-62b9d8b60dff", + "rel": "self" + } + ] + }`, + ), + }, + expectedResult: &pl.PrivateLinkEndpointScript{ + ResourceEndpointScript: redis.String("python script content here"), + TerraformAwsScript: redis.String("terraform script content here"), }, - expectedResult: redis.String("a pro privatelink aws terraform endpoint script"), }, } for _, testCase := range tc { @@ -464,8 +503,6 @@ func TestGetPrivateLinkScript(t *testing.T) { } func TestGetActiveActivePrivateLinkScript(t *testing.T) { - t.Skipf("skipping test until privatelink script is available") - tc := []struct { description string mockedResponse []endpointRequest @@ -479,10 +516,51 @@ func TestGetActiveActivePrivateLinkScript(t *testing.T) { getRequest( t, "/subscriptions/114019/regions/1/private-link/endpoint-script?includeTerraformAwsScript=true", - `an active active aws terraform endpoint script`, + `{ + "taskId": "5f73ce79-17df-5db1-a2de-18993ea71f00", + "commandType": "activeActivePrivateLinkEndpointScriptGetRequest", + "status": "received", + "description": "Task request received and is being queued for processing.", + "timestamp": "2025-10-30T14:13:46.539111211Z", + "links": [ + { + "type": "GET", + "href": "https://api-staging.qa.redislabs.com/v1/tasks/5f73ce79-17df-5db1-a2de-18993ea71f00", + "rel": "task" + } + ] + }`, ), + getRequest( + t, + "/tasks/5f73ce79-17df-5db1-a2de-18993ea71f00", + `{ + "taskId": "5f73ce79-17df-5db1-a2de-18993ea71f00", + "commandType": "activeActivePrivateLinkEndpointScriptGetRequest", + "status": "processing-completed", + "description": "Request processing completed successfully and its resources are now being provisioned / de-provisioned.", + "timestamp": "2025-10-30T14:13:51.991415541Z", + "response": { + "resourceId": 114019, + "resource": { + "resourceEndpointScript": "active active python script content here", + "terraformAwsScript": "active active terraform script content here" + } + }, + "links": [ + { + "type": "GET", + "href": "https://api-staging.qa.redislabs.com/v1/tasks/5f73ce79-17df-5db1-a2de-18993ea71f00", + "rel": "self" + } + ] + }`, + ), + }, + expectedResult: &pl.PrivateLinkEndpointScript{ + ResourceEndpointScript: redis.String("active active python script content here"), + TerraformAwsScript: redis.String("active active terraform script content here"), }, - expectedResult: redis.String("an active active aws terraform endpoint script"), }, } for _, testCase := range tc { diff --git a/service/privatelink/model.go b/service/privatelink/model.go index 49d64c3..d01bd8c 100644 --- a/service/privatelink/model.go +++ b/service/privatelink/model.go @@ -79,6 +79,11 @@ func (f *NotFoundActiveActive) Error() string { return fmt.Sprintf("privatelink resource not found - subscription %d, region %d", f.subscriptionID, f.regionID) } +type PrivateLinkEndpointScript struct { + ResourceEndpointScript *string `json:"resourceEndpointScript,omitempty"` + TerraformAwsScript *string `json:"terraformAwsScript,omitempty"` +} + const ( // PrivateLinkStatusInitializing when PrivateLink is initialising PrivateLinkStatusInitializing = "initializing" diff --git a/service/privatelink/service.go b/service/privatelink/service.go index c7af6f1..5a8ab4b 100644 --- a/service/privatelink/service.go +++ b/service/privatelink/service.go @@ -61,8 +61,6 @@ func (a *API) GetPrivateLink(ctx context.Context, subscription int) (*PrivateLin return task, nil } -type PrivateLinkEndpointScript = string - // GetPrivateLinkEndpointScript will get the script for an endpoint. func (a *API) GetPrivateLinkEndpointScript(ctx context.Context, subscriptionId int) (*PrivateLinkEndpointScript, error) { message := fmt.Sprintf("get private link for subscription %d", subscriptionId) @@ -205,7 +203,7 @@ func (a *API) getScript(ctx context.Context, message string, path string) (*Priv return nil, err } - a.logger.Printf("Waiting for PrivateLink script get request %d to complete", task.ID) + a.logger.Printf("Waiting for PrivateLink script get request %s to complete", *task.ID) var response PrivateLinkEndpointScript err = a.taskWaiter.WaitForResource(ctx, *task.ID, &response) From eff2a2bf574c0e7519db27849a7feeb2d9a10305 Mon Sep 17 00:00:00 2001 From: Matthew Long Date: Fri, 31 Oct 2025 09:59:52 +0000 Subject: [PATCH 9/9] docs: changelog --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 673e15c..684eab1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ 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) +## 0.40.0 (31st October 2025) ### Added: * Added global values fields to `ActiveActiveDatabase` read response: `GlobalDataPersistence`, `GlobalSourceIP`, `GlobalPassword`, `GlobalAlerts`, and `GlobalEnableDefaultUser` @@ -13,6 +13,9 @@ See updating [Changelog example here](https://keepachangelog.com/en/1.0.0/). * Bump golang.org/x/tools to 0.38.0 * Bump github.com/avast/retry-go/v4 to 4.7.0 +### Fixed: +* Fixed an issue with endpoint scripts not unmarshalling correctly. + ## 0.39.0 (21st October 2025) ### Added: