Skip to content

Commit

Permalink
Enable CRUD operations for replicas with storage_size_mib (#660)
Browse files Browse the repository at this point in the history
  • Loading branch information
dweinshenker committed Jan 2, 2024
1 parent bbbeb66 commit 69dafba
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions databases.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ type DatabaseReplica struct {
CreatedAt time.Time `json:"created_at"`
PrivateNetworkUUID string `json:"private_network_uuid,omitempty"`
Tags []string `json:"tags,omitempty"`
StorageSizeMib uint64 `json:"storage_size_mib,omitempty"`
}

// DatabasePool represents a database connection pool
Expand Down Expand Up @@ -436,6 +437,7 @@ type DatabaseCreateReplicaRequest struct {
Size string `json:"size"`
PrivateNetworkUUID string `json:"private_network_uuid"`
Tags []string `json:"tags,omitempty"`
StorageSizeMib uint64 `json:"storage_size_mib,omitempty"`
}

// DatabaseUpdateFirewallRulesRequest is used to set the firewall rules for a database
Expand Down
13 changes: 10 additions & 3 deletions databases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1295,6 +1295,7 @@ func TestDatabases_GetReplica(t *testing.T) {
},
PrivateNetworkUUID: "deadbeef-dead-4aa5-beef-deadbeef347d",
Tags: []string{"production", "staging"},
StorageSizeMib: 51200,
}

body := `
Expand Down Expand Up @@ -1324,7 +1325,8 @@ func TestDatabases_GetReplica(t *testing.T) {
"ssl": true
},
"private_network_uuid": "deadbeef-dead-4aa5-beef-deadbeef347d",
"tags": ["production", "staging"]
"tags": ["production", "staging"],
"storage_size_mib": 51200
}
}
`
Expand Down Expand Up @@ -1374,6 +1376,7 @@ func TestDatabases_ListReplicas(t *testing.T) {
},
PrivateNetworkUUID: "deadbeef-dead-4aa5-beef-deadbeef347d",
Tags: []string{"production", "staging"},
StorageSizeMib: 51200,
},
}

Expand Down Expand Up @@ -1403,7 +1406,8 @@ func TestDatabases_ListReplicas(t *testing.T) {
"ssl": true
},
"private_network_uuid": "deadbeef-dead-4aa5-beef-deadbeef347d",
"tags": ["production", "staging"]
"tags": ["production", "staging"],
"storage_size_mib": 51200
}]
}
`
Expand Down Expand Up @@ -1452,6 +1456,7 @@ func TestDatabases_CreateReplica(t *testing.T) {
},
PrivateNetworkUUID: "deadbeef-dead-4aa5-beef-deadbeef347d",
Tags: []string{"production", "staging"},
StorageSizeMib: 51200,
}

body := `
Expand Down Expand Up @@ -1480,7 +1485,8 @@ func TestDatabases_CreateReplica(t *testing.T) {
"ssl": true
},
"private_network_uuid": "deadbeef-dead-4aa5-beef-deadbeef347d",
"tags": ["production", "staging"]
"tags": ["production", "staging"],
"storage_size_mib": 51200
}
}
`
Expand All @@ -1497,6 +1503,7 @@ func TestDatabases_CreateReplica(t *testing.T) {
Size: "db-s-2vcpu-4gb",
PrivateNetworkUUID: privateNetworkUUID,
Tags: []string{"production", "staging"},
StorageSizeMib: uint64(51200),
})
require.NoError(t, err)
require.Equal(t, want, got)
Expand Down

0 comments on commit 69dafba

Please sign in to comment.