Skip to content

Commit cbbc647

Browse files
jooolaphm07
andauthored
feat: deprecate hcloud datacenters ... commands (#1436)
The API endpoints `GET /v1/datacenters` and `GET /v1/datacenters/{id}` are now deprecated and will be removed after 1 Oct. 2026. After this date, requests to these endpoints will return `HTTP 410 Gone`. See https://docs.hetzner.cloud/changelog#2026-06-02-datacenters-deprecated for more details. --------- Co-authored-by: phm07 <22707808+phm07@users.noreply.github.com>
1 parent 3551b7e commit cbbc647

7 files changed

Lines changed: 55 additions & 9 deletions

File tree

docs/reference/manual/hcloud.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/manual/hcloud_datacenter.md

Lines changed: 11 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/manual/hcloud_datacenter_describe.md

Lines changed: 10 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/manual/hcloud_datacenter_list.md

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/cmd/datacenter/datacenter.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,25 @@ import (
77
"github.com/hetznercloud/cli/internal/state"
88
)
99

10+
const deprecationNotice = `The 'hcloud datacenter ...' commands are deprecated and will be removed after 1 Oct. 2026.
11+
After this date, requests to the datacenters API endpoints will return HTTP 410 Gone.
12+
13+
See https://docs.hetzner.cloud/changelog#2026-06-02-datacenters-deprecated for more details.
14+
`
15+
1016
func NewCommand(s state.State) *cobra.Command {
1117
cmd := &cobra.Command{
1218
Use: "datacenter",
1319
Aliases: []string{"datacenters"},
14-
Short: "View Datacenters",
20+
Short: "View Datacenters (deprecated)",
1521
Args: util.Validate,
1622
TraverseChildren: true,
1723
DisableFlagsInUseLine: true,
24+
25+
Long: deprecationNotice,
26+
PersistentPreRun: func(cmd *cobra.Command, _ []string) {
27+
cmd.PrintErrln("Warning: The 'datacenter' commands are deprecated. Use the 'location' commands instead.")
28+
},
1829
}
1930
cmd.AddCommand(
2031
ListCmd.CobraCommand(s),

internal/cmd/datacenter/describe.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ var DescribeCmd = base.DescribeCmd[*hcloud.Datacenter]{
3232
fmt.Fprint(out, DescribeDatacenter(s.Client(), datacenter, false))
3333
return nil
3434
},
35+
Configure: func(_ state.State, c *cobra.Command) *cobra.Command {
36+
c.Short += " (deprecated)"
37+
c.Long = deprecationNotice
38+
return c
39+
},
3540
}
3641

3742
func DescribeDatacenter(client hcapi2.Client, datacenter *hcloud.Datacenter, short bool) string {

internal/cmd/datacenter/list.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package datacenter
22

33
import (
4+
"fmt"
5+
6+
"github.com/spf13/cobra"
47
"github.com/spf13/pflag"
58

69
"github.com/hetznercloud/cli/internal/cmd/base"
@@ -35,4 +38,10 @@ var ListCmd = &base.ListCmd[*hcloud.Datacenter, schema.Datacenter]{
3538
},
3639

3740
Schema: hcloud.SchemaFromDatacenter,
41+
42+
Configure: func(_ state.State, c *cobra.Command) *cobra.Command {
43+
c.Short += " (deprecated)"
44+
c.Long = fmt.Sprintf("%s\n%s", deprecationNotice, c.Long)
45+
return c
46+
},
3847
}

0 commit comments

Comments
 (0)