Skip to content
Open
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
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ See updating [Changelog example here](https://keepachangelog.com/en/1.0.0/)

## [Unreleased]

## [8.42.1]

### Added

- managed database: add `AdditionalDiskSpaceGiB`, `Labels`, `Networks`, and `TerminationProtection` to `request.CloneManagedDatabaseRequest`

## [8.42.0]

### Added
Expand Down Expand Up @@ -809,7 +815,8 @@ See updating [Changelog example here](https://keepachangelog.com/en/1.0.0/)

First stable release

[Unreleased]: https://github.com/UpCloudLtd/upcloud-go-api/compare/v8.42.0...HEAD
[Unreleased]: https://github.com/UpCloudLtd/upcloud-go-api/compare/v8.42.1...HEAD
[8.42.1]: https://github.com/UpCloudLtd/upcloud-go-api/compare/v8.42.0...v8.42.1
[8.42.0]: https://github.com/UpCloudLtd/upcloud-go-api/compare/v8.41.0...v8.42.0
[8.41.0]: https://github.com/UpCloudLtd/upcloud-go-api/compare/v8.40.0...v8.41.0
[8.40.0]: https://github.com/UpCloudLtd/upcloud-go-api/compare/v8.39.0...v8.40.0
Expand Down
2 changes: 1 addition & 1 deletion upcloud/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
)

const (
Version string = "8.42.0"
Version string = "8.42.1"
APIVersion string = "1.3"
APIBaseURL string = "https://api.upcloud.com"

Expand Down
16 changes: 10 additions & 6 deletions upcloud/request/managed_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func (c *CancelManagedDatabaseSession) RequestURL() string {

// CloneManagedDatabaseRequest represents a request to cancel
type CloneManagedDatabaseRequest struct {
AdditionalDiskSpaceGiB int `json:"additional_disk_space_gib,omitempty"`
// UUID selects an existing managed database instance to clone
UUID string `json:"-"`
// CloneTime selects a point-in-time from where to clone the data. Zero value selects the most recent available.
Expand All @@ -42,12 +43,15 @@ type CloneManagedDatabaseRequest struct {
// Only for Valkey. Create a clone of your database service data from the backups by name.
BackupName string `json:"backup_name,omitempty"`

HostNamePrefix string `json:"hostname_prefix"`
Maintenance ManagedDatabaseMaintenanceTimeRequest `json:"maintenance,omitempty"`
Plan string `json:"plan"`
Properties ManagedDatabasePropertiesRequest `json:"properties,omitempty"`
Title string `json:"title,omitempty"`
Zone string `json:"zone"`
HostNamePrefix string `json:"hostname_prefix"`
Labels []upcloud.Label `json:"labels,omitempty"`
Maintenance ManagedDatabaseMaintenanceTimeRequest `json:"maintenance,omitempty"`
Networks []upcloud.ManagedDatabaseNetwork `json:"networks,omitempty"`
Plan string `json:"plan"`
Properties ManagedDatabasePropertiesRequest `json:"properties,omitempty"`
Title string `json:"title,omitempty"`
TerminationProtection *bool `json:"termination_protection,omitempty"`
Zone string `json:"zone"`
}

// MarshalJSON implements json.Marshaler
Expand Down
16 changes: 12 additions & 4 deletions upcloud/request/managed_database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@ func TestCloneManagedDatabaseRequest_MarshalJSON(t *testing.T) {
})

req := CloneManagedDatabaseRequest{
UUID: "fakeuuid",
CloneTime: time.Date(2021, 1, 1, 0, 0, 0, 0, time.UTC),
HostNamePrefix: "fakename",
BackupName: "backup name",
AdditionalDiskSpaceGiB: 20,
UUID: "fakeuuid",
CloneTime: time.Date(2021, 1, 1, 0, 0, 0, 0, time.UTC),
HostNamePrefix: "fakename",
BackupName: "backup name",
Labels: []upcloud.Label{{Key: "env", Value: "test"}},
Networks: []upcloud.ManagedDatabaseNetwork{{Family: "IPv4", Name: "private", Type: "private"}},
TerminationProtection: upcloud.BoolPtr(false),
Maintenance: ManagedDatabaseMaintenanceTimeRequest{
DayOfWeek: "monday",
Time: "12:00:00",
Expand All @@ -48,12 +52,16 @@ func TestCloneManagedDatabaseRequest_MarshalJSON(t *testing.T) {

const expect = `{
"hostname_prefix": "fakename",
"additional_disk_space_gib": 20,
"plan": "fakeplan",
"backup_name": "backup name",
"labels": [{"key": "env", "value": "test"}],
"networks": [{"family": "IPv4", "name": "private", "type": "private"}],
"properties": {
"fakeprop": "fakevalue"
},
"title": "faketitle",
"termination_protection": false,
"zone": "fakezone",
"clone_time": "2021-01-01T00:00:00Z",
"maintenance": {
Expand Down