Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions hcloud/storage_box.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ const (
// StorageBoxClient is a client for the Storage Box API.
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-boxes
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
type StorageBoxClient struct {
client *Client
Action *ResourceActionClient[*StorageBox]
Expand All @@ -101,8 +99,6 @@ type StorageBoxClient struct {
// GetByID retrieves a [StorageBox] by its ID. If the [StorageBox] does not exist, nil is returned.
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-boxes-get-a-storage-box
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) GetByID(ctx context.Context, id int64) (*StorageBox, *Response, error) {
const opPath = "/storage_boxes/%d"
ctx = ctxutil.SetOpPath(ctx, opPath)
Expand All @@ -123,8 +119,6 @@ func (c *StorageBoxClient) GetByID(ctx context.Context, id int64) (*StorageBox,
// GetByName retrieves a [StorageBox] by its name. If the [StorageBox] does not exist, nil is returned.
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-boxes-list-storage-boxes
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) GetByName(ctx context.Context, name string) (*StorageBox, *Response, error) {
return firstByName(name, func() ([]*StorageBox, *Response, error) {
return c.List(ctx, StorageBoxListOpts{Name: name})
Expand All @@ -136,8 +130,6 @@ func (c *StorageBoxClient) GetByName(ctx context.Context, name string) (*Storage
//
// When fetching by ID, see https://docs.hetzner.cloud/reference/hetzner#storage-boxes-get-a-storage-box
// When fetching by name, see https://docs.hetzner.cloud/reference/hetzner#storage-boxes-list-storage-boxes
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) Get(ctx context.Context, idOrName string) (*StorageBox, *Response, error) {
return getByIDOrName(ctx, c.GetByID, c.GetByName, idOrName)
}
Expand Down Expand Up @@ -166,8 +158,6 @@ func (l StorageBoxListOpts) values() url.Values {
// when their value corresponds to their zero value or when they are empty.
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-boxes-list-storage-boxes
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) List(ctx context.Context, opts StorageBoxListOpts) ([]*StorageBox, *Response, error) {
const opPath = "/storage_boxes?%s"
ctx = ctxutil.SetOpPath(ctx, opPath)
Expand All @@ -185,17 +175,13 @@ func (c *StorageBoxClient) List(ctx context.Context, opts StorageBoxListOpts) ([
// All returns all [StorageBox].
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-boxes-list-storage-boxes
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) All(ctx context.Context) ([]*StorageBox, error) {
return c.AllWithOpts(ctx, StorageBoxListOpts{})
}

// AllWithOpts returns all [StorageBox] with the given options.
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-boxes-list-storage-boxes
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) AllWithOpts(ctx context.Context, opts StorageBoxListOpts) ([]*StorageBox, error) {
if opts.ListOpts.PerPage == 0 {
opts.ListOpts.PerPage = 50
Expand Down Expand Up @@ -250,8 +236,6 @@ type StorageBoxCreateResult struct {
// is sent to the API. They are not addressable by ID or name.
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-boxes-create-a-storage-box
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) Create(ctx context.Context, opts StorageBoxCreateOpts) (StorageBoxCreateResult, *Response, error) {
const opPath = "/storage_boxes"
ctx = ctxutil.SetOpPath(ctx, opPath)
Expand Down Expand Up @@ -284,8 +268,6 @@ type StorageBoxUpdateOpts struct {
// Update updates a [StorageBox] with the given options.
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-boxes-update-a-storage-box
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) Update(ctx context.Context, storageBox *StorageBox, opts StorageBoxUpdateOpts) (*StorageBox, *Response, error) {
const opPath = "/storage_boxes/%d"
ctx = ctxutil.SetOpPath(ctx, opPath)
Expand All @@ -309,8 +291,6 @@ type StorageBoxDeleteResult struct {
// Delete deletes a [StorageBox].
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-boxes-delete-a-storage-box
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) Delete(ctx context.Context, storageBox *StorageBox) (StorageBoxDeleteResult, *Response, error) {
const opPath = "/storage_boxes/%d"
ctx = ctxutil.SetOpPath(ctx, opPath)
Expand Down Expand Up @@ -348,8 +328,6 @@ func (o StorageBoxFoldersOpts) values() url.Values {
// Folders lists folders in a [StorageBox].
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-boxes-list-folders-of-a-storage-box
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) Folders(ctx context.Context, storageBox *StorageBox, opts StorageBoxFoldersOpts) (StorageBoxFoldersResult, *Response, error) {
const opPath = "/storage_boxes/%d/folders?%s"
ctx = ctxutil.SetOpPath(ctx, opPath)
Expand All @@ -376,8 +354,6 @@ type StorageBoxChangeProtectionOpts struct {
// ChangeProtection changes the protection level of a [StorageBox].
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-box-actions-change-protection
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) ChangeProtection(ctx context.Context, storageBox *StorageBox, opts StorageBoxChangeProtectionOpts) (*Action, *Response, error) {
const opPath = "/storage_boxes/%d/actions/change_protection"
ctx = ctxutil.SetOpPath(ctx, opPath)
Expand All @@ -401,8 +377,6 @@ type StorageBoxChangeTypeOpts struct {
// ChangeType changes the type of a [StorageBox].
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-box-actions-change-type
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) ChangeType(ctx context.Context, storageBox *StorageBox, opts StorageBoxChangeTypeOpts) (*Action, *Response, error) {
const opPath = "/storage_boxes/%d/actions/change_type"
ctx = ctxutil.SetOpPath(ctx, opPath)
Expand All @@ -426,8 +400,6 @@ type StorageBoxResetPasswordOpts struct {
// ResetPassword resets the password of a [StorageBox].
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-box-actions-reset-password
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) ResetPassword(ctx context.Context, storageBox *StorageBox, opts StorageBoxResetPasswordOpts) (*Action, *Response, error) {
const opPath = "/storage_boxes/%d/actions/reset_password"
ctx = ctxutil.SetOpPath(ctx, opPath)
Expand Down Expand Up @@ -455,8 +427,6 @@ type StorageBoxUpdateAccessSettingsOpts struct {
// UpdateAccessSettings updates the [StorageBoxAccessSettings] of a [StorageBox].
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-box-actions-update-access-settings
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) UpdateAccessSettings(ctx context.Context, storageBox *StorageBox, opts StorageBoxUpdateAccessSettingsOpts) (*Action, *Response, error) {
const opPath = "/storage_boxes/%d/actions/update_access_settings"
ctx = ctxutil.SetOpPath(ctx, opPath)
Expand All @@ -480,8 +450,6 @@ type StorageBoxRollbackSnapshotOpts struct {
// RollbackSnapshot rolls back a [StorageBox] to a [StorageBoxSnapshot].
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-box-actions-rollback-snapshot
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) RollbackSnapshot(
ctx context.Context,
storageBox *StorageBox,
Expand Down Expand Up @@ -520,8 +488,6 @@ type StorageBoxEnableSnapshotPlanOpts struct {
// EnableSnapshotPlan enables a [StorageBoxSnapshotPlan] for a [StorageBox].
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-box-actions-enable-snapshot-plan
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) EnableSnapshotPlan(
ctx context.Context,
storageBox *StorageBox,
Expand All @@ -544,8 +510,6 @@ func (c *StorageBoxClient) EnableSnapshotPlan(
// DisableSnapshotPlan disables the [StorageBoxSnapshotPlan] for a [StorageBox].
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-box-actions-disable-snapshot-plan
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) DisableSnapshotPlan(
ctx context.Context,
storageBox *StorageBox,
Expand Down
18 changes: 0 additions & 18 deletions hcloud/storage_box_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ type StorageBoxSnapshotStats struct {
// GetSnapshotByID gets a [StorageBoxSnapshot] by its ID.
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-box-snapshots-get-a-snapshot
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) GetSnapshotByID(ctx context.Context, storageBox *StorageBox, id int64) (*StorageBoxSnapshot, *Response, error) {
const optPath = "/storage_boxes/%d/snapshots/%d"
ctx = ctxutil.SetOpPath(ctx, optPath)
Expand All @@ -55,8 +53,6 @@ func (c *StorageBoxClient) GetSnapshotByID(ctx context.Context, storageBox *Stor
// GetSnapshotByName gets a [StorageBoxSnapshot] by its name.
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-box-snapshots-list-snapshots
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) GetSnapshotByName(
ctx context.Context,
storageBox *StorageBox,
Expand All @@ -72,8 +68,6 @@ func (c *StorageBoxClient) GetSnapshotByName(
//
// When fetching by ID, see https://docs.hetzner.cloud/reference/hetzner#storage-box-snapshots-get-a-snapshot
// When fetching by name, see https://docs.hetzner.cloud/reference/hetzner#storage-box-snapshots-list-snapshots
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) GetSnapshot(
ctx context.Context,
storageBox *StorageBox,
Expand Down Expand Up @@ -121,8 +115,6 @@ func (o StorageBoxSnapshotListOpts) values() url.Values {
// Pagination is not supported, so this will return all [StorageBoxSnapshot] at once.
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-box-snapshots-list-snapshots
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) ListSnapshots(
ctx context.Context,
storageBox *StorageBox,
Expand All @@ -144,8 +136,6 @@ func (c *StorageBoxClient) ListSnapshots(
// AllSnapshotsWithOpts lists all [StorageBoxSnapshot] of a [StorageBox] with the given options.
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-box-snapshots-list-snapshots
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) AllSnapshotsWithOpts(
ctx context.Context,
storageBox *StorageBox,
Expand All @@ -158,8 +148,6 @@ func (c *StorageBoxClient) AllSnapshotsWithOpts(
// AllSnapshots lists all [StorageBoxSnapshot] of a [StorageBox] without any options.
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-box-snapshots-list-snapshots
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) AllSnapshots(
ctx context.Context,
storageBox *StorageBox,
Expand All @@ -184,8 +172,6 @@ type StorageBoxSnapshotCreateResult struct {
// CreateSnapshot creates a new [StorageBoxSnapshot] for the given [StorageBox] with the provided options.
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-box-snapshots-create-a-snapshot
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) CreateSnapshot(
ctx context.Context,
storageBox *StorageBox,
Expand Down Expand Up @@ -219,8 +205,6 @@ type StorageBoxSnapshotUpdateOpts struct {
// UpdateSnapshot updates the given [StorageBoxSnapshot] of a [StorageBox] with the provided options.
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-box-snapshots-update-a-snapshot
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) UpdateSnapshot(
ctx context.Context,
snapshot *StorageBoxSnapshot,
Expand Down Expand Up @@ -248,8 +232,6 @@ type StorageBoxSnapshotDeleteResult struct {
// DeleteSnapshot deletes the given [StorageBoxSnapshot] of a [StorageBox].
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-box-snapshots-delete-a-snapshot
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) DeleteSnapshot(
ctx context.Context,
snapshot *StorageBoxSnapshot,
Expand Down
26 changes: 0 additions & 26 deletions hcloud/storage_box_subaccount.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ type StorageBoxSubaccountAccessSettings struct {
//
// When fetching by ID, see https://docs.hetzner.cloud/reference/hetzner#storage-box-subaccounts-get-a-subaccount
// When fetching by name, see https://docs.hetzner.cloud/reference/hetzner#storage-box-subaccounts-list-subaccounts
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) GetSubaccount(
ctx context.Context,
storageBox *StorageBox,
Expand All @@ -62,8 +60,6 @@ func (c *StorageBoxClient) GetSubaccount(
// GetSubaccountByID retrieves a [StorageBoxSubaccount] by its ID.
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-box-subaccounts-get-a-subaccount
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) GetSubaccountByID(
ctx context.Context,
storageBox *StorageBox,
Expand All @@ -88,8 +84,6 @@ func (c *StorageBoxClient) GetSubaccountByID(
// GetSubaccountByName retrieves a [StorageBoxSubaccount] by its name.
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-box-subaccounts-list-subaccounts
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) GetSubaccountByName(
ctx context.Context,
storageBox *StorageBox,
Expand All @@ -105,8 +99,6 @@ func (c *StorageBoxClient) GetSubaccountByName(
// GetSubaccountByUsername retrieves a [StorageBoxSubaccount] by its username.
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-box-subaccounts-list-subaccounts
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) GetSubaccountByUsername(
ctx context.Context,
storageBox *StorageBox,
Expand Down Expand Up @@ -147,8 +139,6 @@ func (o StorageBoxSubaccountListOpts) values() url.Values {
// ListSubaccounts lists all [StorageBoxSubaccount] of a [StorageBox].
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-box-subaccounts-list-subaccounts
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) ListSubaccounts(
ctx context.Context,
storageBox *StorageBox,
Expand All @@ -170,8 +160,6 @@ func (c *StorageBoxClient) ListSubaccounts(
// AllSubaccountsWithOpts retrieves all [StorageBoxSubaccount] of a [StorageBox] with the given options.
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-box-subaccounts-list-subaccounts
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) AllSubaccountsWithOpts(
ctx context.Context,
storageBox *StorageBox,
Expand All @@ -184,8 +172,6 @@ func (c *StorageBoxClient) AllSubaccountsWithOpts(
// AllSubaccounts retrieves all [StorageBoxSubaccount] of a [StorageBox].
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-box-subaccounts-list-subaccounts
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) AllSubaccounts(
ctx context.Context,
storageBox *StorageBox,
Expand Down Expand Up @@ -223,8 +209,6 @@ type StorageBoxSubaccountCreateResult struct {
// CreateSubaccount creates a new [StorageBoxSubaccount] for a [StorageBox].
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-box-subaccounts-create-a-subaccount
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) CreateSubaccount(
ctx context.Context,
storageBox *StorageBox,
Expand Down Expand Up @@ -259,8 +243,6 @@ type StorageBoxSubaccountUpdateOpts struct {
// UpdateSubaccount updates a [StorageBoxSubaccount] of a [StorageBox].
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-box-subaccounts-update-a-subaccount
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) UpdateSubaccount(
ctx context.Context,
subaccount *StorageBoxSubaccount,
Expand Down Expand Up @@ -288,8 +270,6 @@ type StorageBoxSubaccountDeleteResult struct {
// DeleteSubaccount deletes a [StorageBoxSubaccount] from a [StorageBox].
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-box-subaccounts-delete-a-subaccount
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) DeleteSubaccount(
ctx context.Context,
subaccount *StorageBoxSubaccount,
Expand Down Expand Up @@ -318,8 +298,6 @@ type StorageBoxSubaccountResetPasswordOpts struct {
// ResetSubaccountPassword resets the password of a [StorageBoxSubaccount].
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-box-subaccount-actions-reset-password
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) ResetSubaccountPassword(
ctx context.Context,
subaccount *StorageBoxSubaccount,
Expand Down Expand Up @@ -351,8 +329,6 @@ type StorageBoxSubaccountUpdateAccessSettingsOpts struct {
// UpdateSubaccountAccessSettings updates the [StorageBoxSubaccountAccessSettings] of a [StorageBoxSubaccount].
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-box-subaccount-actions-update-access-settings
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) UpdateSubaccountAccessSettings(
ctx context.Context,
subaccount *StorageBoxSubaccount,
Expand Down Expand Up @@ -380,8 +356,6 @@ type StorageBoxSubaccountChangeHomeDirectoryOpts struct {
// UpdateSubaccountAccessSettings changes the home directory of a [StorageBoxSubaccount].
//
// See https://docs.hetzner.cloud/reference/hetzner#storage-box-subaccount-actions-change-home-directory
//
// Experimental: [StorageBoxClient] is experimental, breaking changes may occur within minor releases.
func (c *StorageBoxClient) ChangeSubaccountHomeDirectory(
ctx context.Context,
subaccount *StorageBoxSubaccount,
Expand Down
Loading