Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding project_id to databases #537

Merged
merged 1 commit into from Jun 3, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions databases.go
Expand Up @@ -154,6 +154,7 @@ type Database struct {
CreatedAt time.Time `json:"created_at,omitempty"`
PrivateNetworkUUID string `json:"private_network_uuid,omitempty"`
Tags []string `json:"tags,omitempty"`
ProjectID string `json:"project_id,omitempty"`
}

// DatabaseCA represents a database ca.
Expand Down Expand Up @@ -217,6 +218,7 @@ type DatabaseCreateRequest struct {
PrivateNetworkUUID string `json:"private_network_uuid"`
Tags []string `json:"tags,omitempty"`
BackupRestore *DatabaseBackupRestore `json:"backup_restore,omitempty"`
ProjectID string `json:"project_id"`
}

// DatabaseResizeRequest can be used to initiate a database resize operation.
Expand Down
9 changes: 7 additions & 2 deletions databases_test.go
Expand Up @@ -58,6 +58,7 @@ var db = Database{
SizeSlug: "db-s-2vcpu-4gb",
PrivateNetworkUUID: "da4e0206-d019-41d7-b51f-deadbeefbb8f",
Tags: []string{"production", "staging"},
ProjectID: "6d0f9073-0a24-4f1b-9065-7dc5c8bad3e2",
}

var dbJSON = `
Expand Down Expand Up @@ -106,7 +107,8 @@ var dbJSON = `
},
"size": "db-s-2vcpu-4gb",
"private_network_uuid": "da4e0206-d019-41d7-b51f-deadbeefbb8f",
"tags": ["production", "staging"]
"tags": ["production", "staging"],
"project_id": "6d0f9073-0a24-4f1b-9065-7dc5c8bad3e2"
}
`

Expand Down Expand Up @@ -203,6 +205,7 @@ func TestDatabases_Create(t *testing.T) {
SizeSlug: "db-s-2vcpu-4gb",
NumNodes: 2,
Tags: []string{"production", "staging"},
ProjectID: "05d84f74-db8c-4de5-ae72-2fd4823fb1c8",
},
want: &Database{
ID: "8d91899c-0739-4a1a-acc5-deadbeefbb8f",
Expand Down Expand Up @@ -236,6 +239,7 @@ func TestDatabases_Create(t *testing.T) {
MaintenanceWindow: nil,
SizeSlug: "db-s-2vcpu-4gb",
Tags: []string{"production", "staging"},
ProjectID: "05d84f74-db8c-4de5-ae72-2fd4823fb1c8",
},
body: `
{
Expand Down Expand Up @@ -270,7 +274,8 @@ func TestDatabases_Create(t *testing.T) {
"created_at": "2019-02-26T06:12:39Z",
"maintenance_window": null,
"size": "db-s-2vcpu-4gb",
"tags": ["production", "staging"]
"tags": ["production", "staging"],
"project_id": "05d84f74-db8c-4de5-ae72-2fd4823fb1c8"
}
}`,
},
Expand Down