Skip to content

Commit

Permalink
Adds datasetSizeInGb attribute to Database and Subscription models (#180
Browse files Browse the repository at this point in the history
)

* adds datasetSizeInGb attribute to DB, Sub models

* fix deprecation test

* addressing comments
  • Loading branch information
greg-oc authored Aug 28, 2024
1 parent 81b4873 commit 25798e9
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 6 deletions.
4 changes: 4 additions & 0 deletions active_active_database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func TestAADatabase_List(t *testing.T) {
"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": 1,
"datasetSizeInGb": 1,
"memoryUsedInMb": 29.9949,
"readOperationsPerSecond": 1000,
"writeOperationsPerSecond": 1000,
Expand Down Expand Up @@ -87,6 +88,7 @@ func TestAADatabase_List(t *testing.T) {
"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": 1,
"datasetSizeInGb": 1,
"memoryUsedInMb": 29.9788,
"readOperationsPerSecond": 1000,
"writeOperationsPerSecond": 1000,
Expand Down Expand Up @@ -175,6 +177,7 @@ func TestAADatabase_List(t *testing.T) {
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(1),
DatasetSizeInGB: redis.Float64(1),
MemoryUsedInMB: redis.Float64(29.9949),
ReadOperationsPerSecond: redis.Int(1000),
WriteOperationsPerSecond: redis.Int(1000),
Expand Down Expand Up @@ -205,6 +208,7 @@ func TestAADatabase_List(t *testing.T) {
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(1),
DatasetSizeInGB: redis.Float64(1),
MemoryUsedInMB: redis.Float64(29.9788),
ReadOperationsPerSecond: redis.Int(1000),
WriteOperationsPerSecond: redis.Int(1000),
Expand Down
10 changes: 6 additions & 4 deletions database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestDatabase_Create(t *testing.T) {
"dryRun": false,
"name": "Redis-database-example",
"protocol": "redis",
"memoryLimitInGb": 1,
"datasetSizeInGb": 1,
"supportOSSClusterApi": false,
"respVersion": "resp3",
"useExternalEndpointForOSSClusterApi": false,
Expand Down Expand Up @@ -88,7 +88,7 @@ func TestDatabase_Create(t *testing.T) {
DryRun: redis.Bool(false),
Name: redis.String("Redis-database-example"),
Protocol: redis.String("redis"),
MemoryLimitInGB: redis.Float64(1),
DatasetSizeInGB: redis.Float64(1),
SupportOSSClusterAPI: redis.Bool(false),
RespVersion: redis.String("resp3"),
UseExternalEndpointForOSSClusterAPI: redis.Bool(false),
Expand Down Expand Up @@ -197,6 +197,7 @@ func TestDatabase_Get(t *testing.T) {
"redisVersionCompliance": "6.0.5",
"status": "active",
"memoryLimitInGb": 7,
"datasetSizeInGb": 7,
"memoryUsedInMb": 5,
"memoryStorage": "ram",
"supportOSSClusterApi": true,
Expand Down Expand Up @@ -263,6 +264,7 @@ func TestDatabase_Get(t *testing.T) {
Region: redis.String("eu-west-1"),
Status: redis.String("active"),
MemoryLimitInGB: redis.Float64(7),
DatasetSizeInGB: redis.Float64(7),
MemoryUsedInMB: redis.Float64(5),
SupportOSSClusterAPI: redis.Bool(true),
RespVersion: redis.String("resp2"),
Expand Down Expand Up @@ -324,7 +326,7 @@ func TestDatabase_Update(t *testing.T) {
s := httptest.NewServer(testServer("key", "secret", putRequest(t, "/subscriptions/42/databases/18", `{
"dryRun": false,
"name": "example",
"memoryLimitInGb": 1,
"datasetSizeInGb": 1,
"supportOSSClusterApi": false,
"respVersion": "resp3",
"useExternalEndpointForOSSClusterApi": false,
Expand Down Expand Up @@ -388,7 +390,7 @@ func TestDatabase_Update(t *testing.T) {
err = subject.Database.Update(context.TODO(), 42, 18, databases.UpdateDatabase{
DryRun: redis.Bool(false),
Name: redis.String("example"),
MemoryLimitInGB: redis.Float64(1),
DatasetSizeInGB: redis.Float64(1),
SupportOSSClusterAPI: redis.Bool(false),
RespVersion: redis.String("resp3"),
UseExternalEndpointForOSSClusterAPI: redis.Bool(false),
Expand Down
3 changes: 3 additions & 0 deletions service/databases/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type CreateDatabase struct {
Name *string `json:"name,omitempty"`
Protocol *string `json:"protocol,omitempty"`
MemoryLimitInGB *float64 `json:"memoryLimitInGb,omitempty"`
DatasetSizeInGB *float64 `json:"datasetSizeInGb,omitempty"`
SupportOSSClusterAPI *bool `json:"supportOSSClusterApi,omitempty"`
RespVersion *string `json:"respVersion,omitempty"`
UseExternalEndpointForOSSClusterAPI *bool `json:"useExternalEndpointForOSSClusterApi,omitempty"`
Expand Down Expand Up @@ -57,6 +58,7 @@ type Database struct {
Region *string `json:"region,omitempty"`
Status *string `json:"status,omitempty"`
MemoryLimitInGB *float64 `json:"memoryLimitInGb,omitempty"`
DatasetSizeInGB *float64 `json:"datasetSizeInGb,omitempty"`
MemoryUsedInMB *float64 `json:"memoryUsedInMb,omitempty"`
SupportOSSClusterAPI *bool `json:"supportOSSClusterApi,omitempty"`
RespVersion *string `json:"respVersion,omitempty"`
Expand Down Expand Up @@ -148,6 +150,7 @@ type UpdateDatabase struct {
DryRun *bool `json:"dryRun,omitempty"`
Name *string `json:"name,omitempty"`
MemoryLimitInGB *float64 `json:"memoryLimitInGb,omitempty"`
DatasetSizeInGB *float64 `json:"datasetSizeInGb,omitempty"`
SupportOSSClusterAPI *bool `json:"supportOSSClusterApi,omitempty"`
RespVersion *string `json:"respVersion,omitempty"`
UseExternalEndpointForOSSClusterAPI *bool `json:"useExternalEndpointForOSSClusterApi,omitempty"`
Expand Down
3 changes: 3 additions & 0 deletions service/databases/model_active_active.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type CrdbDatabase struct {
PublicEndpoint *string `json:"publicEndpoint,omitempty"`
PrivateEndpoint *string `json:"privateEndpoint,omitempty"`
MemoryLimitInGB *float64 `json:"memoryLimitInGb,omitempty"`
DatasetSizeInGB *float64 `json:"datasetSizeInGb,omitempty"`
MemoryUsedInMB *float64 `json:"memoryUsedInMb,omitempty"`
ReadOperationsPerSecond *int `json:"readOperationsPerSecond,omitempty"`
WriteOperationsPerSecond *int `json:"writeOperationsPerSecond,omitempty"`
Expand Down Expand Up @@ -63,6 +64,7 @@ type CreateActiveActiveDatabase struct {
Name *string `json:"name,omitempty"`
Protocol *string `json:"protocol,omitempty"`
MemoryLimitInGB *float64 `json:"memoryLimitInGb,omitempty"`
DatasetSizeInGB *float64 `json:"datasetSizeInGb,omitempty"`
SupportOSSClusterAPI *bool `json:"supportOSSClusterApi,omitempty"`
RespVersion *string `json:"respVersion,omitempty"`
UseExternalEndpointForOSSClusterAPI *bool `json:"useExternalEndpointForOSSClusterApi,omitempty"`
Expand Down Expand Up @@ -93,6 +95,7 @@ func (o LocalThroughput) String() string {
type UpdateActiveActiveDatabase struct {
DryRun *bool `json:"dryRun,omitempty"`
MemoryLimitInGB *float64 `json:"memoryLimitInGb,omitempty"`
DatasetSizeInGB *float64 `json:"datasetSizeInGb,omitempty"`
SupportOSSClusterAPI *bool `json:"supportOSSClusterApi,omitempty"`
UseExternalEndpointForOSSClusterAPI *bool `json:"useExternalEndpointForOSSClusterApi,omitempty"`
ClientSSLCertificate *string `json:"clientSslCertificate,omitempty"`
Expand Down
3 changes: 3 additions & 0 deletions service/fixed/databases/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type CreateFixedDatabase struct {
Name *string `json:"name,omitempty"`
Protocol *string `json:"protocol,omitempty"`
MemoryLimitInGB *float64 `json:"memoryLimitInGb,omitempty"`
DatasetSizeInGB *float64 `json:"datasetSizeInGb,omitempty"`
SupportOSSClusterAPI *bool `json:"supportOSSClusterApi,omitempty"`
RespVersion *string `json:"respVersion,omitempty"`
UseExternalEndpointForOSSClusterAPI *bool `json:"useExternalEndpointForOSSClusterApi,omitempty"`
Expand All @@ -33,6 +34,7 @@ type CreateFixedDatabase struct {
type UpdateFixedDatabase struct {
Name *string `json:"name,omitempty"`
MemoryLimitInGB *float64 `json:"memoryLimitInGb,omitempty"`
DatasetSizeInGB *float64 `json:"datasetSizeInGb,omitempty"`
SupportOSSClusterAPI *bool `json:"supportOSSClusterApi,omitempty"`
RespVersion *string `json:"respVersion,omitempty"`
UseExternalEndpointForOSSClusterAPI *bool `json:"useExternalEndpointForOSSClusterApi,omitempty"`
Expand Down Expand Up @@ -64,6 +66,7 @@ type FixedDatabase struct {
PlanMemoryLimit *float64 `json:"planMemoryLimit,omitempty"`
MemoryLimitMeasurementUnit *string `json:"memoryLimitMeasurementUnit,omitempty"`
MemoryLimitInGb *float64 `json:"memoryLimitInGb,omitempty"`
DatasetSizeInGB *float64 `json:"datasetSizeInGb,omitempty"`
MemoryUsedInMb *float64 `json:"memoryUsedInMb,omitempty"`
NetworkMonthlyUsageInByte *float64 `json:"networkMonthlyUsageInByte,omitempty"`
MemoryStorage *string `json:"memoryStorage,omitempty"`
Expand Down
1 change: 1 addition & 0 deletions service/subscriptions/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type CreateDatabase struct {
Name *string `json:"name,omitempty"`
Protocol *string `json:"protocol,omitempty"`
MemoryLimitInGB *float64 `json:"memoryLimitInGb,omitempty"`
DatasetSizeInGB *float64 `json:"datasetSizeInGb,omitempty"`
SupportOSSClusterAPI *bool `json:"supportOSSClusterApi,omitempty"`
DataPersistence *string `json:"dataPersistence,omitempty"`
Replication *bool `json:"replication,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions subscription_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestSubscription_Create(t *testing.T) {
{
"name": "example",
"protocol": "redis",
"memoryLimitInGb": 1,
"datasetSizeInGb": 1,
"supportOSSClusterApi": true,
"dataPersistence": "none",
"replication": false,
Expand Down Expand Up @@ -125,7 +125,7 @@ func TestSubscription_Create(t *testing.T) {
{
Name: redis.String("example"),
Protocol: redis.String("redis"),
MemoryLimitInGB: redis.Float64(1),
DatasetSizeInGB: redis.Float64(1),
SupportOSSClusterAPI: redis.Bool(true),
DataPersistence: redis.String("none"),
Replication: redis.Bool(false),
Expand Down

0 comments on commit 25798e9

Please sign in to comment.