Skip to content

Commit

Permalink
feat(account): add ManagedObjectStorages resource limit (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
kangasta authored Dec 20, 2023
1 parent b33999b commit 797f7a1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ See updating [Changelog example here](https://keepachangelog.com/en/1.0.0/)
### Added
- Managed Database sub-properties support. E.g., PostgreSQL property `timescaledb` is of type `object` and has `max_background_workers` sub-property.
- Managed Object Storage: add `name` property
- Account: add `ManagedObjectStorages` field to `ResourceLimits`

### Fixed
- Managed Object Storage: omit empty labels slice when creating managed object storage instance
Expand Down
25 changes: 13 additions & 12 deletions upcloud/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,19 @@ type Account struct {

// ResourceLimits represents an account's resource limits
type ResourceLimits struct {
Cores int `json:"cores,omitempty"`
DetachedFloatingIps int `json:"detached_floating_ips,omitempty"`
Memory int `json:"memory,omitempty"`
NetworkPeerings int `json:"network_peerings,omitempty"`
Networks int `json:"networks,omitempty"`
NTPExcessGiB int `json:"ntp_excess_gib,omitempty"`
PublicIPv4 int `json:"public_ipv4,omitempty"`
PublicIPv6 int `json:"public_ipv6,omitempty"`
StorageHDD int `json:"storage_hdd,omitempty"`
StorageMaxIOPS int `json:"storage_maxiops,omitempty"`
StorageSSD int `json:"storage_ssd,omitempty"`
LoadBalancers int `json:"load_balancers,omitempty"`
Cores int `json:"cores,omitempty"`
DetachedFloatingIps int `json:"detached_floating_ips,omitempty"`
ManagedObjectStorages int `json:"managed_object_storages,omitempty"`
Memory int `json:"memory,omitempty"`
NetworkPeerings int `json:"network_peerings,omitempty"`
Networks int `json:"networks,omitempty"`
NTPExcessGiB int `json:"ntp_excess_gib,omitempty"`
PublicIPv4 int `json:"public_ipv4,omitempty"`
PublicIPv6 int `json:"public_ipv6,omitempty"`
StorageHDD int `json:"storage_hdd,omitempty"`
StorageMaxIOPS int `json:"storage_maxiops,omitempty"`
StorageSSD int `json:"storage_ssd,omitempty"`
LoadBalancers int `json:"load_balancers,omitempty"`
}

// UnmarshalJSON is a custom unmarshaller that deals with
Expand Down
2 changes: 2 additions & 0 deletions upcloud/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func TestUnmarshalAccount(t *testing.T) {
"resource_limits": {
"cores": 200,
"detached_floating_ips": 10,
"managed_object_storages": 7,
"memory": 1048576,
"network_peerings": 100,
"networks": 100,
Expand All @@ -39,6 +40,7 @@ func TestUnmarshalAccount(t *testing.T) {
assert.Equal(t, "username", account.UserName)
assert.Equal(t, 200, account.ResourceLimits.Cores)
assert.Equal(t, 10, account.ResourceLimits.DetachedFloatingIps)
assert.Equal(t, 7, account.ResourceLimits.ManagedObjectStorages)
assert.Equal(t, 1048576, account.ResourceLimits.Memory)
assert.Equal(t, 100, account.ResourceLimits.NetworkPeerings)
assert.Equal(t, 100, account.ResourceLimits.Networks)
Expand Down

0 comments on commit 797f7a1

Please sign in to comment.