cloudapiserver

package
v6.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2024 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrSuspendCubeLast signals to the Server Resource UpdateContext that the cube server will be suspended so that the operation is deferred
	ErrSuspendCubeLast error
	// ErrServerNotFound returned when the server with the requested ID does not exist
	ErrServerNotFound error
	// ErrNoBootDevice is returned if the Server does not have a boot cdrom or boot volume set
	ErrNoBootDevice = errors.New("server has no boot device")
)

Functions

This section is empty.

Types

type Service

type Service struct {
	Client *ionoscloud.APIClient
	Meta   any
	D      *schema.ResourceData
}

func (*Service) Create

func (ss *Service) Create(ctx context.Context, datacenterID string) (*ionoscloud.Server, *ionoscloud.APIResponse, error)

func (*Service) Delete

func (ss *Service) Delete(ctx context.Context, datacenterID, serverID, ID string) (*ionoscloud.APIResponse, error)

func (*Service) FindById

func (ss *Service) FindById(ctx context.Context, datacenterID, serverID string, depth int32) (*ionoscloud.Server, error)

func (*Service) GetAttachedVolumes added in v6.4.12

func (ss *Service) GetAttachedVolumes(ctx context.Context, datacenterID, serverID string) ([]*ionoscloud.Volume, *ionoscloud.APIResponse, error)

func (*Service) GetCurrentBootDeviceID added in v6.4.12

func (ss *Service) GetCurrentBootDeviceID(ctx context.Context, datacenterId, serverId string) (string, string, error)

func (*Service) GetDefaultBootVolume added in v6.4.12

func (ss *Service) GetDefaultBootVolume(ctx context.Context, datacenterId, serverId string) (*ionoscloud.Volume, error)

func (*Service) GetServerType

func (ss *Service) GetServerType(ctx context.Context, datacenterID, serverID string) (string, error)

func (*Service) GetVmState

func (ss *Service) GetVmState(ctx context.Context, datacenterID, serverID string) (string, error)

func (*Service) PxeBoot added in v6.4.13

func (ss *Service) PxeBoot(ctx context.Context, datacenterID, serverID string) error

PxeBoot restarts the Server into the PXE shell by unsetting the primary boot device of the VM and performing a reset

func (*Service) Reboot added in v6.4.13

func (ss *Service) Reboot(ctx context.Context, datacenterID, serverID string) error

Reboot resets the VM,

func (*Service) Start

func (ss *Service) Start(ctx context.Context, datacenterID, serverID, serverType string) error

func (*Service) Stop

func (ss *Service) Stop(ctx context.Context, datacenterID, serverID, serverType string) error

func (*Service) Update

func (ss *Service) Update(ctx context.Context, datacenterID, serverID string, serverProperties ionoscloud.ServerProperties) (*ionoscloud.Server, *ionoscloud.APIResponse, error)

func (*Service) UpdateBootDevice added in v6.4.12

func (ss *Service) UpdateBootDevice(ctx context.Context, datacenterID, serverID, newBootDeviceID string) error

UpdateBootDevice will set a new boot device for the server, which can be a volume or bootable image CDROM. When the new boot device is a volume, it must be already attached to the server. When the new boot device is a CDROM image, it will be attached by default. If the current boot device is a CDROM image, it will be detached after it is changed by this operation.

func (*Service) UpdateVmState

func (ss *Service) UpdateVmState(ctx context.Context, datacenterID, serverID, newVmState string) error

type UnboundService added in v6.4.13

type UnboundService interface {
	Update(context.Context, string, string, ionoscloud.ServerProperties) (*ionoscloud.Server, *ionoscloud.APIResponse, error)
	GetDefaultBootVolume(ctx context.Context, datacenterID, serverID string) (*ionoscloud.Volume, error)
	UpdateBootDevice(ctx context.Context, datacenterID, serverID, newBootDeviceID string) error
	PxeBoot(ctx context.Context, datacenterID, serverID string) error
	Reboot(ctx context.Context, datacenterID, serverID string) error
}

UnboundService allows usage of a subset of the method set of the Service This is useful when using the Service in Provider Context functions that belong to a different resource which needs to interact with an already existing server In this case, the Service will not be 'bound' to the state of the Server resource The methods of this interface must not write to the state, since the Service will use a placeholder ResourceData reference

func NewUnboundService added in v6.4.13

func NewUnboundService(serverID string, meta any) UnboundService

NewUnboundService creates an UnboundService with a subset of the underlying Service methods The concrete Service is created with a dummy ResourceData reference which has the ID of the Server this service will interact with This ensure state tracking functions such as WaitForResourceToBeReady use the correct ID

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL