Skip to content

Commit

Permalink
PrimaryIPClient Add AllWithOpts
Browse files Browse the repository at this point in the history
This was missed when implementing the primary ip client.

Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
  • Loading branch information
LKaemmerling committed Nov 9, 2022
1 parent 55dafa9 commit 72fe0a4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions hcloud/primary_ip.go
Expand Up @@ -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
Expand Down

0 comments on commit 72fe0a4

Please sign in to comment.