From 72fe0a4563586af7fe22828c9faf05da31f4012c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20K=C3=A4mmerling?= Date: Wed, 9 Nov 2022 18:26:58 +0100 Subject: [PATCH] PrimaryIPClient Add AllWithOpts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was missed when implementing the primary ip client. Signed-off-by: Lukas Kämmerling --- hcloud/primary_ip.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hcloud/primary_ip.go b/hcloud/primary_ip.go index c534c89a..eccd407b 100644 --- a/hcloud/primary_ip.go +++ b/hcloud/primary_ip.go @@ -240,10 +240,12 @@ func (c *PrimaryIPClient) List(ctx context.Context, opts PrimaryIPListOpts) ([]* // All returns all Primary IPs. func (c *PrimaryIPClient) All(ctx context.Context) ([]*PrimaryIP, error) { - allPrimaryIPs := []*PrimaryIP{} + return c.AllWithOpts(ctx, PrimaryIPListOpts{ListOpts: ListOpts{PerPage: 50}}) +} - opts := PrimaryIPListOpts{} - opts.PerPage = 50 +// AllWithOpts returns all Primary IPs for the given options. +func (c *PrimaryIPClient) AllWithOpts(ctx context.Context, opts PrimaryIPListOpts) ([]*PrimaryIP, error) { + var allPrimaryIPs []*PrimaryIP err := c.client.all(func(page int) (*Response, error) { opts.Page = page