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

chore(account): update ResourceLimits struct #270

Merged
merged 1 commit into from
Oct 23, 2023
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file.
See updating [Changelog example here](https://keepachangelog.com/en/1.0.0/)

## [Unreleased]
### Added
- account: `NetworkPeerings`, `NTPExcessGiB`, `StorageMaxIOPS`, and `LoadBalancers` fields to the `ResourceLimits` struct.

## [6.8.1]
### Changed
Expand Down
4 changes: 4 additions & 0 deletions upcloud/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,15 @@ 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"`
}

// UnmarshalJSON is a custom unmarshaller that deals with
Expand Down
10 changes: 9 additions & 1 deletion upcloud/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,15 @@ func TestUnmarshalAccount(t *testing.T) {
"cores": 200,
"detached_floating_ips": 10,
"memory": 1048576,
"network_peerings": 100,
"networks": 100,
"ntp_excess_gib": 20000,
"public_ipv4": 100,
"public_ipv6": 100,
"storage_hdd": 10240,
"storage_ssd": 10240
"storage_maxiops": 10240,
"storage_ssd": 10240,
"load_balancers": 50
}
}
}
Expand All @@ -36,11 +40,15 @@ func TestUnmarshalAccount(t *testing.T) {
assert.Equal(t, 200, account.ResourceLimits.Cores)
assert.Equal(t, 10, account.ResourceLimits.DetachedFloatingIps)
assert.Equal(t, 1048576, account.ResourceLimits.Memory)
assert.Equal(t, 100, account.ResourceLimits.NetworkPeerings)
assert.Equal(t, 100, account.ResourceLimits.Networks)
assert.Equal(t, 20000, account.ResourceLimits.NTPExcessGiB)
assert.Equal(t, 100, account.ResourceLimits.PublicIPv4)
assert.Equal(t, 100, account.ResourceLimits.PublicIPv6)
assert.Equal(t, 10240, account.ResourceLimits.StorageHDD)
assert.Equal(t, 10240, account.ResourceLimits.StorageMaxIOPS)
assert.Equal(t, 10240, account.ResourceLimits.StorageSSD)
assert.Equal(t, 50, account.ResourceLimits.LoadBalancers)
}

// TestMarshalAccount tests that Account objects marshal correctly
Expand Down