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

Added missing db-related fields #659

Merged
merged 2 commits into from
Jan 29, 2025
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions databases.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,21 @@ const (

// A Database is a instance of Linode Managed Databases
type Database struct {
ID int `json:"id"`
Status DatabaseStatus `json:"status"`
Label string `json:"label"`
Hosts DatabaseHost `json:"hosts"`
Region string `json:"region"`
Type string `json:"type"`
Engine string `json:"engine"`
Version string `json:"version"`
ClusterSize int `json:"cluster_size"`
Platform DatabasePlatform `json:"platform"`
Fork *DatabaseFork `json:"fork"`
ID int `json:"id"`
Status DatabaseStatus `json:"status"`
Label string `json:"label"`
Hosts DatabaseHost `json:"hosts"`
Region string `json:"region"`
Type string `json:"type"`
Engine string `json:"engine"`
Version string `json:"version"`
ClusterSize int `json:"cluster_size"`
Platform DatabasePlatform `json:"platform"`
Fork *DatabaseFork `json:"fork"`
Updates DatabaseMaintenanceWindow `json:"updates"`
UsedDiskSizeGB int `json:"used_disk_size_gb"`
TotalDiskSizeGB int `json:"total_disk_size_gb"`
Port int `json:"port"`

// Members has dynamic keys so it is a map
Members map[string]DatabaseMemberType `json:"members"`
Expand Down Expand Up @@ -134,11 +138,13 @@ type DatabaseType struct {
Disk int `json:"disk"`
Memory int `json:"memory"`
Engines DatabaseTypeEngineMap `json:"engines"`
Deprecated bool `json:"deprecated"`
}

// DatabaseTypeEngineMap stores a list of Database Engine types by engine
type DatabaseTypeEngineMap struct {
MySQL []DatabaseTypeEngine `json:"mysql"`
MySQL []DatabaseTypeEngine `json:"mysql"`
PostgreSQL []DatabaseTypeEngine `json:"postgresql"`
}

// DatabaseTypeEngine Sizes and Prices
Expand Down
3 changes: 3 additions & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,12 @@ golang.org/x/crypto v0.30.0 h1:RwoQn3GkWiMkzlX562cLB7OxWvjH1L8xutO2WoJcRoY=
golang.org/x/crypto v0.30.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA=
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
Expand Down
3 changes: 3 additions & 0 deletions mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ type MySQLDatabase struct {
Updates DatabaseMaintenanceWindow `json:"updates"`
Fork *DatabaseFork `json:"fork"`
OldestRestoreTime *time.Time `json:"-"`
UsedDiskSizeGB int `json:"used_disk_size_gb"`
TotalDiskSizeGB int `json:"total_disk_size_gb"`
Port int `json:"port"`
}

func (d *MySQLDatabase) UnmarshalJSON(b []byte) error {
Expand Down
2 changes: 2 additions & 0 deletions postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ type PostgresDatabase struct {
Updated *time.Time `json:"-"`
Fork *DatabaseFork `json:"fork"`
OldestRestoreTime *time.Time `json:"-"`
UsedDiskSizeGB int `json:"used_disk_size_gb"`
TotalDiskSizeGB int `json:"total_disk_size_gb"`
}

func (d *PostgresDatabase) UnmarshalJSON(b []byte) error {
Expand Down
4 changes: 2 additions & 2 deletions test/integration/fixtures/TestDatabase_Engine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Fri, 27 Dec 2024 18:13:13 GMT
- Wed, 22 Jan 2025 15:05:07 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down Expand Up @@ -106,7 +106,7 @@ interactions:
Content-Type:
- application/json
Expires:
- Fri, 27 Dec 2024 18:13:13 GMT
- Wed, 22 Jan 2025 15:05:08 GMT
Pragma:
- no-cache
Strict-Transport-Security:
Expand Down
Loading