Repository: hetznercloud/hcloud-go
Pull request #253 (2023-05-03 10:09:31)

fix(deps): update module github.com/prometheus/client_golang to v1.15.1
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/prometheus/client_golang](https://togithub.com/prometheus/client_golang) | require | patch | `v1.15.0` -> `v1.15.1` |

---

### Release Notes

<details>
<summary>prometheus/client_golang</summary>

### [`v1.15.1`](https://togithub.com/prometheus/client_golang/releases/tag/v1.15.1)

[Compare Source](https://togithub.com/prometheus/client_golang/compare/v1.15.0...v1.15.1)

#### Changes

-   \[BUGFIX] Fixed promhttp.Instrument\* handlers wrongly trying to attach exemplar to unsupported metrics (e.g. summary), \
    causing panics [#&#8203;1253](https://togithub.com/prometheus/client_golang/issues/1253)

**Full Changelog**: https://github.com/prometheus/client_golang/compare/v1.15.0...v1.15.1

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/hetznercloud/hcloud-go).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS42OS4zIiwidXBkYXRlZEluVmVyIjoiMzUuNjkuMyIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->



Patch:
diff --git a/go.mod b/go.mod
index c7b1231..7a0c00d 100644
--- a/go.mod
+++ b/go.mod
@@ -4,7 +4,7 @@ go 1.19
 
 require (
 	github.com/google/go-cmp v0.5.9
-	github.com/prometheus/client_golang v1.15.0
+	github.com/prometheus/client_golang v1.15.1
 	github.com/stretchr/testify v1.8.2
 	golang.org/x/net v0.9.0
 )
diff --git a/go.sum b/go.sum
index b102933..9219cce 100644
--- a/go.sum
+++ b/go.sum
@@ -180,6 +180,8 @@ github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj
 github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y=
 github.com/prometheus/client_golang v1.15.0 h1:5fCgGYogn0hFdhyhLbw7hEsWxufKtY9klyvdNfFlFhM=
 github.com/prometheus/client_golang v1.15.0/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk=
+github.com/prometheus/client_golang v1.15.1 h1:8tXpTmJbyH5lydzFPoxSIJ0J46jdh3tylbvM1xCv0LI=
+github.com/prometheus/client_golang v1.15.1/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk=
 github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
 github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
 github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
diff --git a/hcloud/iso.go b/hcloud/iso.go
index d5814cb..d0a2a13 100644
--- a/hcloud/iso.go
+++ b/hcloud/iso.go
@@ -134,10 +134,12 @@ func (c *ISOClient) List(ctx context.Context, opts ISOListOpts) ([]*ISO, *Respon
 
 // All returns all ISOs.
 func (c *ISOClient) All(ctx context.Context) ([]*ISO, error) {
-	allISOs := []*ISO{}
+	return c.AllWithOpts(ctx, ISOListOpts{ListOpts: ListOpts{PerPage: 50}})
+}
 
-	opts := ISOListOpts{}
-	opts.PerPage = 50
+// AllWithOpts returns all ISOs for the given options.
+func (c *ISOClient) AllWithOpts(ctx context.Context, opts ISOListOpts) ([]*ISO, error) {
+	allISOs := make([]*ISO, 0)
 
 	err := c.client.all(func(page int) (*Response, error) {
 		opts.Page = page


Test patch:
diff --git a/hcloud/iso_test.go b/hcloud/iso_test.go
index 5c05e06..1d010a7 100644
--- a/hcloud/iso_test.go
+++ b/hcloud/iso_test.go
@@ -242,4 +242,65 @@ func TestISOClient(t *testing.T) {
 			t.Errorf("unexpected isos")
 		}
 	})
+
+	t.Run("AllWithOpts", func(t *testing.T) {
+		env := newTestEnv()
+		defer env.Teardown()
+
+		env.Mux.HandleFunc("/isos", func(w http.ResponseWriter, r *http.Request) {
+			if name := r.URL.Query().Get("name"); name != "my-iso" {
+				t.Errorf("unexpected name: %s", name)
+			}
+			w.Header().Set("Content-Type", "application/json")
+			var isos []schema.ISO
+			var meta schema.Meta
+			if name := r.URL.Query().Get("page"); name == "1" {
+				isos = []schema.ISO{
+					{ID: 1},
+					{ID: 2},
+				}
+				meta = schema.Meta{
+					Pagination: &schema.MetaPagination{
+						Page:         1,
+						NextPage:     2,
+						LastPage:     2,
+						PerPage:      2,
+						TotalEntries: 3,
+					},
+				}
+			} else {
+				isos = []schema.ISO{
+					{ID: 3},
+				}
+				meta = schema.Meta{
+					Pagination: &schema.MetaPagination{
+						Page:         2,
+						LastPage:     2,
+						PerPage:      2,
+						TotalEntries: 3,
+					},
+				}
+			}
+			json.NewEncoder(w).Encode(struct {
+				ISOs []schema.ISO `json:"isos"`
+				Meta schema.Meta  `json:"meta"`
+			}{
+				ISOs: isos,
+				Meta: meta,
+			})
+		})
+
+		ctx := context.Background()
+		opts := ISOListOpts{Name: "my-iso"}
+		isos, err := env.Client.ISO.AllWithOpts(ctx, opts)
+		if err != nil {
+			t.Fatal(err)
+		}
+		if len(isos) != 3 {
+			t.Fatalf("expected 3 isos; got %d", len(isos))
+		}
+		if isos[0].ID != 1 || isos[1].ID != 2 || isos[2].ID != 3 {
+			t.Errorf("unexpected isos")
+		}
+	})
 }