Skip to content

Conversation

@jooola
Copy link
Member

@jooola jooola commented Sep 24, 2025

Server Types now depend on Locations.

  • We added a new locations property to the Server Types resource. The new property defines a list of supported Locations and additional per Locations details such as deprecations information.

  • We deprecated the deprecation property from the Server Types resource. The property will gradually be phased out as per Locations deprecations are being announced. Please use the new per Locations deprecation information instead.

See our changelog for more details.

Upgrading

// Before
func ValidateServerType(serverType *hcloud.ServerType) error {
	if serverType.IsDeprecated() {
		return fmt.Errorf("server type %s is deprecated", serverType.Name)
	}
	return nil
}
// After
func ValidateServerType(serverType *hcloud.ServerType, location *hcloud.Location) error {
	serverTypeLocationIndex := slices.IndexFunc(serverType.Locations, func(e hcloud.ServerTypeLocation) bool {
		return e.Location.Name == location.Name
	})
	if serverTypeLocationIndex < 0 {
		return fmt.Errorf("server type %s is not supported in location %q", serverType.Name, location.Name)
	}

	if serverType.Locations[serverTypeLocationIndex].IsDeprecated() {
		return fmt.Errorf("server type %q is deprecated in location %q", serverType.Name, location.Name)
	}

	return nil
}

@jooola jooola requested a review from a team as a code owner September 24, 2025 16:53
@codecov
Copy link

codecov bot commented Sep 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.61%. Comparing base (ad63e6b) to head (6cb0144).

Additional details and impacted files
@@              Coverage Diff               @@
##           sliceutill     #730      +/-   ##
==============================================
+ Coverage       79.26%   79.61%   +0.34%     
==============================================
  Files              51       52       +1     
  Lines            4428     4503      +75     
==============================================
+ Hits             3510     3585      +75     
  Misses            703      703              
  Partials          215      215              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jooola jooola force-pushed the server-type-locations branch from 9ad54a7 to 6cb0144 Compare September 24, 2025 16:57
@jooola jooola changed the base branch from main to sliceutill September 24, 2025 16:57
Base automatically changed from sliceutill to main September 25, 2025 07:45
[Server Types](https://docs.hetzner.cloud/reference/cloud#server-types) now depend on [Locations](https://docs.hetzner.cloud/reference/cloud#locations).

- We added a new `locations` property to the [Server Types](https://docs.hetzner.cloud/reference/cloud#server-types) resource. The new property defines a list of supported [Locations](https://docs.hetzner.cloud/reference/cloud#locations) and additional per [Locations](https://docs.hetzner.cloud/reference/cloud#locations) details such as deprecations information.

- We deprecated the `deprecation` property from the [Server Types](https://docs.hetzner.cloud/reference/cloud#server-types) resource. The property will gradually be phased out as per [Locations](https://docs.hetzner.cloud/reference/cloud#locations) deprecations are being announced. Please use the new per [Locations](https://docs.hetzner.cloud/reference/cloud#locations) deprecation information instead.

See our [changelog](https://docs.hetzner.cloud/changelog#2025-09-24-per-location-server-types) for more details.

**Upgrading**

```go
// Before
func ValidateServerType(serverType *hcloud.ServerType) error {
	if serverType.IsDeprecated() {
		return fmt.Errorf("server type %s is deprecated", serverType.Name)
	}
	return nil
}
```

```go
// After
func ValidateServerType(serverType *hcloud.ServerType, location *hcloud.Location) error {
	serverTypeLocationIndex := slices.IndexFunc(serverType.Locations, func(e hcloud.ServerTypeLocation) bool {
		return e.Location.Name == location.Name
	})
	if serverTypeLocationIndex < 0 {
		return fmt.Errorf("server type %s is not supported in location %q", serverType.Name, location.Name)
	}

	if serverType.Locations[serverTypeLocationIndex].IsDeprecated() {
		return fmt.Errorf("server type %q is deprecated in location %q", serverType.Name, location.Name)
	}

	return nil
}
```

Co-authored-by: Jonas L. <jooola@users.noreply.github.com>
@jooola jooola force-pushed the server-type-locations branch from 6cb0144 to 156be43 Compare September 25, 2025 07:46
@jooola jooola merged commit 66ace28 into main Sep 25, 2025
3 checks passed
@jooola jooola deleted the server-type-locations branch September 25, 2025 07:53
jooola pushed a commit that referenced this pull request Sep 25, 2025
<!-- section-start changelog -->
[Server Types](https://docs.hetzner.cloud/reference/cloud#server-types)
now depend on
[Locations](https://docs.hetzner.cloud/reference/cloud#locations).

- We added a new `locations` property to the [Server
Types](https://docs.hetzner.cloud/reference/cloud#server-types)
resource. The new property defines a list of supported
[Locations](https://docs.hetzner.cloud/reference/cloud#locations) and
additional per
[Locations](https://docs.hetzner.cloud/reference/cloud#locations)
details such as deprecations information.

- We deprecated the `deprecation` property from the [Server
Types](https://docs.hetzner.cloud/reference/cloud#server-types)
resource. The property will gradually be phased out as per
[Locations](https://docs.hetzner.cloud/reference/cloud#locations)
deprecations are being announced. Please use the new per
[Locations](https://docs.hetzner.cloud/reference/cloud#locations)
deprecation information instead.

See our
[changelog](https://docs.hetzner.cloud/changelog#2025-09-24-per-location-server-types)
for more details.

#### Upgrading

```go
// Before
func ValidateServerType(serverType *hcloud.ServerType) error {
	if serverType.IsDeprecated() {
		return fmt.Errorf(&#34;server type %s is deprecated&#34;, serverType.Name)
	}
	return nil
}
```

```go
// After
func ValidateServerType(serverType *hcloud.ServerType, location *hcloud.Location) error {
	serverTypeLocationIndex := slices.IndexFunc(serverType.Locations, func(e hcloud.ServerTypeLocation) bool {
		return e.Location.Name == location.Name
	})
	if serverTypeLocationIndex &lt; 0 {
		return fmt.Errorf(&#34;server type %s is not supported in location %q&#34;, serverType.Name, location.Name)
	}

	if serverType.Locations[serverTypeLocationIndex].IsDeprecated() {
		return fmt.Errorf(&#34;server type %q is deprecated in location %q&#34;, serverType.Name, location.Name)
	}

	return nil
}
```

### Features

- **exp**: add `sliceutil.Transform` function (#731)
- per locations server types (#730)

<!-- section-end changelog -->

---

<details>
<summary><h4>PR by <a
href="https://github.com/apricote/releaser-pleaser">releaser-pleaser</a>
🤖</h4></summary>

If you want to modify the proposed release, add you overrides here. You
can learn more about the options in the docs.

## Release Notes

### Prefix / Start

This will be added to the start of the release notes.

```rp-prefix
[Server Types](https://docs.hetzner.cloud/reference/cloud#server-types) now depend on [Locations](https://docs.hetzner.cloud/reference/cloud#locations).

- We added a new `locations` property to the [Server Types](https://docs.hetzner.cloud/reference/cloud#server-types) resource. The new property defines a list of supported [Locations](https://docs.hetzner.cloud/reference/cloud#locations) and additional per [Locations](https://docs.hetzner.cloud/reference/cloud#locations) details such as deprecations information.

- We deprecated the `deprecation` property from the [Server Types](https://docs.hetzner.cloud/reference/cloud#server-types) resource. The property will gradually be phased out as per [Locations](https://docs.hetzner.cloud/reference/cloud#locations) deprecations are being announced. Please use the new per [Locations](https://docs.hetzner.cloud/reference/cloud#locations) deprecation information instead.

See our [changelog](https://docs.hetzner.cloud/changelog#2025-09-24-per-location-server-types) for more details.

#### Upgrading

```go
// Before
func ValidateServerType(serverType *hcloud.ServerType) error {
	if serverType.IsDeprecated() {
		return fmt.Errorf("server type %s is deprecated", serverType.Name)
	}
	return nil
}
```

```go
// After
func ValidateServerType(serverType *hcloud.ServerType, location
*hcloud.Location) error {
serverTypeLocationIndex := slices.IndexFunc(serverType.Locations, func(e
hcloud.ServerTypeLocation) bool {
		return e.Location.Name == location.Name
	})
	if serverTypeLocationIndex < 0 {
return fmt.Errorf("server type %s is not supported in location %q",
serverType.Name, location.Name)
	}

	if serverType.Locations[serverTypeLocationIndex].IsDeprecated() {
return fmt.Errorf("server type %q is deprecated in location %q",
serverType.Name, location.Name)
	}

	return nil
}
```
```

### Suffix / End

This will be added to the end of the release notes.

```rp-suffix
```

</details>

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
apricote pushed a commit to hetznercloud/fleeting-plugin-hetzner that referenced this pull request Sep 25, 2025
…5.0 (hetznercloud/fleeting-plugin-hetzner!281)

This MR contains the following updates:

| Package | Change | Age | Confidence |
|---|---|---|---|
| [github.com/hetznercloud/hcloud-go/v2](https://github.com/hetznercloud/hcloud-go) | `v2.24.0` -> `v2.25.0` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fhetznercloud%2fhcloud-go%2fv2/v2.25.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fhetznercloud%2fhcloud-go%2fv2/v2.24.0/v2.25.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>hetznercloud/hcloud-go (github.com/hetznercloud/hcloud-go/v2)</summary>

### [`v2.25.0`](https://github.com/hetznercloud/hcloud-go/blob/HEAD/CHANGELOG.md#v2250)

[Compare Source](hetznercloud/hcloud-go@v2.24.0...v2.25.0)

[Server Types](https://docs.hetzner.cloud/reference/cloud#server-types) now depend on [Locations](https://docs.hetzner.cloud/reference/cloud#locations).

- We added a new `locations` property to the [Server Types](https://docs.hetzner.cloud/reference/cloud#server-types) resource. The new property defines a list of supported [Locations](https://docs.hetzner.cloud/reference/cloud#locations) and additional per [Locations](https://docs.hetzner.cloud/reference/cloud#locations) details such as deprecations information.

- We deprecated the `deprecation` property from the [Server Types](https://docs.hetzner.cloud/reference/cloud#server-types) resource. The property will gradually be phased out as per [Locations](https://docs.hetzner.cloud/reference/cloud#locations) deprecations are being announced. Please use the new per [Locations](https://docs.hetzner.cloud/reference/cloud#locations) deprecation information instead.

See our [changelog](https://docs.hetzner.cloud/changelog#2025-09-24-per-location-server-types) for more details.

##### Upgrading

```go
// Before
func ValidateServerType(serverType *hcloud.ServerType) error {
	if serverType.IsDeprecated() {
		return fmt.Errorf("server type %s is deprecated", serverType.Name)
	}
	return nil
}
```

```go
// After
func ValidateServerType(serverType *hcloud.ServerType, location *hcloud.Location) error {
	serverTypeLocationIndex := slices.IndexFunc(serverType.Locations, func(e hcloud.ServerTypeLocation) bool {
		return e.Location.Name == location.Name
	})
	if serverTypeLocationIndex < 0 {
		return fmt.Errorf("server type %s is not supported in location %q", serverType.Name, location.Name)
	}

	if serverType.Locations[serverTypeLocationIndex].IsDeprecated() {
		return fmt.Errorf("server type %q is deprecated in location %q", serverType.Name, location.Name)
	}

	return nil
}
```

##### Features

- **exp**: add `sliceutil.Transform` function ([#&#8203;731](hetznercloud/hcloud-go#731))
- per locations server types ([#&#8203;730](hetznercloud/hcloud-go#730))

</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 MR is behind base branch, or you tick the rebase/retry checkbox.

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

---

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

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMzAuMSIsInVwZGF0ZWRJblZlciI6IjQxLjEzMC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants