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

DBAAS-3906: Include updatePool for DB Clusters #596

Merged

Conversation

DMW2151
Copy link
Contributor

@DMW2151 DMW2151 commented Jan 18, 2023

Adds updatePool + updatesDatabaseService, allows for Postgres pool updates through godo, makes a PUT request to /v2/databases/$uuid/pools/$poolname.

import (
    "context"
    "github.com/digitalocean/godo"
)

func main() {

    pat := "..."
    dbUUID := "..."
    client := godo.NewFromToken(pat)
    
    _, err := client.Databases.UpdatePool(context.Background(), dbUUID, "backend-pool", &godo.DatabaseUpdatePoolRequest{
        User:     "username",
        Size:     14,
        Database: "defaultdb",
        Mode:     "transaction",
    })
}

@DMW2151 DMW2151 changed the title include update pgpool call DBAAS-3906: Include updatePool for DB Clusters Jan 18, 2023
Copy link
Contributor

@ChiefMateStarbuck ChiefMateStarbuck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great work

databases.go Outdated
@@ -299,6 +300,14 @@ type DatabaseCreatePoolRequest struct {
Mode string `json:"mode"`
}

// DatabaseUpdatePoolRequest is used to update a database connection pool
type DatabaseUpdatePoolRequest struct {
User string `json:"user"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are any of the struct vales within the update request required?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, size, database, and mode.

Copy link
Contributor

@ChiefMateStarbuck ChiefMateStarbuck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one nit

databases.go Outdated Show resolved Hide resolved
add `omitempty` on `DatabaseUpdatePoolRequest` User field

Co-authored-by: Samuel Guyah <[email protected]>
databases.go Show resolved Hide resolved
@ChiefMateStarbuck ChiefMateStarbuck merged commit 4018345 into digitalocean:main Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants