From 854ff3d0eb6d4f1a205f4a163c7349093467f77c Mon Sep 17 00:00:00 2001 From: Toni Kangas Date: Mon, 23 Oct 2023 14:10:02 +0300 Subject: [PATCH] chore(account): update `ResourceLimits` struct --- CHANGELOG.md | 2 ++ upcloud/account.go | 4 ++++ upcloud/account_test.go | 10 +++++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 263a7818..e6f8d662 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/upcloud/account.go b/upcloud/account.go index 967ee8da..d168c2f9 100644 --- a/upcloud/account.go +++ b/upcloud/account.go @@ -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 diff --git a/upcloud/account_test.go b/upcloud/account_test.go index 656a4b99..c843bdc6 100644 --- a/upcloud/account_test.go +++ b/upcloud/account_test.go @@ -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 } } } @@ -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