instance

package
v2.35.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatSSHKeyToTag added in v2.28.0

func FormatSSHKeyToTag(publicKey string) string

func GetCommands

func GetCommands() *core.Commands

GetCommands returns instance commands.

This function: - Gets the generated commands - Register handwritten marshalers - Apply handwritten overrides (of Command.Run and Command.View) - Merge handwritten commands

func GetGeneratedCommands

func GetGeneratedCommands() *core.Commands

func SizeValue added in v2.35.0

func SizeValue(s *scw.Size) scw.Size

Types

type PostServerCreationSetupFunc added in v2.35.0

type PostServerCreationSetupFunc func(ctx context.Context, server *instance.Server) error

type SSHKeyFormat added in v2.16.0

type SSHKeyFormat struct {
	Name string `json:"name"`
	Type string `json:"type"`
	Key  string `json:"key"`
}

type ServerBuilder added in v2.33.0

type ServerBuilder struct {
	// contains filtered or unexported fields
}

func NewServerBuilder added in v2.33.0

func NewServerBuilder(client *scw.Client, name string, zone scw.Zone, commercialType string) *ServerBuilder

NewServerBuilder creates a new builder for a server with requested commercialType in given zone. commercialType will be used to validate that added components are supported.

func (*ServerBuilder) AddAdminPasswordEncryptionSSHKeyID added in v2.33.0

func (sb *ServerBuilder) AddAdminPasswordEncryptionSSHKeyID(adminPasswordEncryptionSSHKeyID *string) *ServerBuilder

func (*ServerBuilder) AddBootType added in v2.33.0

func (sb *ServerBuilder) AddBootType(bootType string) *ServerBuilder

func (*ServerBuilder) AddDynamicIPRequired added in v2.35.0

func (sb *ServerBuilder) AddDynamicIPRequired(dynamicIPRequired *bool) *ServerBuilder

func (*ServerBuilder) AddEnableIPv6 added in v2.33.0

func (sb *ServerBuilder) AddEnableIPv6(enableIPv6 *bool) *ServerBuilder

func (*ServerBuilder) AddIP added in v2.33.0

func (sb *ServerBuilder) AddIP(ip string) (*ServerBuilder, error)

AddIP takes an ip argument and change requests accordingly. ip could be:

  • "new"
  • A flexible IP UUID
  • A flexible IP address
  • "dynamic"
  • "none"

func (*ServerBuilder) AddImage added in v2.33.0

func (sb *ServerBuilder) AddImage(image string) (*ServerBuilder, error)

AddImage handle a custom image argument. image could be:

  • A local image UUID.
  • An image label.

func (*ServerBuilder) AddOrganizationID added in v2.33.0

func (sb *ServerBuilder) AddOrganizationID(orgID *string) *ServerBuilder

func (*ServerBuilder) AddPlacementGroup added in v2.33.0

func (sb *ServerBuilder) AddPlacementGroup(placementGroupID string) *ServerBuilder

func (*ServerBuilder) AddProjectID added in v2.33.0

func (sb *ServerBuilder) AddProjectID(projectID *string) *ServerBuilder

func (*ServerBuilder) AddRoutedIPEnabled added in v2.33.0

func (sb *ServerBuilder) AddRoutedIPEnabled(routedIPEnabled *bool) *ServerBuilder

func (*ServerBuilder) AddSecurityGroup added in v2.33.0

func (sb *ServerBuilder) AddSecurityGroup(securityGroupID string) *ServerBuilder

func (*ServerBuilder) AddTags added in v2.33.0

func (sb *ServerBuilder) AddTags(tags []string) *ServerBuilder

func (*ServerBuilder) AddVolumes added in v2.33.0

func (sb *ServerBuilder) AddVolumes(rootVolume string, additionalVolumes []string) (*ServerBuilder, error)

AddVolumes build volume templates from arguments.

More format details in buildVolumeTemplate function.

Also add default volumes to server, ex: scratch storage for GPU servers

func (*ServerBuilder) Build added in v2.33.0

func (sb *ServerBuilder) Build() (*instance.CreateServerRequest, []*instance.CreateIPRequest)

func (*ServerBuilder) BuildPostCreationSetup added in v2.35.0

func (sb *ServerBuilder) BuildPostCreationSetup() PostServerCreationSetupFunc

func (*ServerBuilder) Validate added in v2.33.0

func (sb *ServerBuilder) Validate() error

func (*ServerBuilder) ValidateVolumes added in v2.33.0

func (sb *ServerBuilder) ValidateVolumes() error

ValidateVolumes validates that the volumes are valid and sanitize the prepared template. Server creation should fail if ValidateVolumes is not ran before.

type ServerGetRdpPasswordResponse added in v2.31.0

type ServerGetRdpPasswordResponse struct {
	Username          string
	Password          string
	SSHKeyID          *string
	SSHKeyDescription string
}

type VolumeBuilder added in v2.35.0

type VolumeBuilder struct {
	Zone       scw.Zone
	VolumeType instance.VolumeVolumeType

	// SnapshotID is the ID of the snapshot the volume should be created from.
	SnapshotID *string
	// VolumeID is the ID of the volume if one should be imported.
	VolumeID *string
	// Size is the size of the created Volume. If used, the volume should be created from scratch.
	Size *scw.Size
	// IOPS is the io per second to be configured for a created volume.
	IOPS *uint32
}

func NewVolumeBuilder added in v2.35.0

func NewVolumeBuilder(zone scw.Zone, flagV string) (*VolumeBuilder, error)

NewVolumeBuilder creates a volume builder from a 'volumes' argument item.

Volumes definition must be through multiple arguments (eg: volumes.0="l:20GB" volumes.1="b:100GB" volumes.2="sbs:50GB:15000)

A valid volume format is either - a "creation" format: ^((local|l|block|b|scratch|s|sbs):)?\d+GB?(:\d+)?$ (size is handled by go-humanize, so other sizes are supported) - a "creation" format with a snapshot id: l:<uuid> b:<uuid> - a UUID format

func (*VolumeBuilder) BuildVolumeServerTemplate added in v2.35.0

func (vb *VolumeBuilder) BuildVolumeServerTemplate(apiInstance *instance.API, apiBlock *block.API) (*instance.VolumeServerTemplate, error)

BuildVolumeServerTemplate builds the requested volume template to be used in a CreateServerRequest

func (*VolumeBuilder) ExecutePostCreationSetup added in v2.35.0

func (vb *VolumeBuilder) ExecutePostCreationSetup(ctx context.Context, apiBlock *block.API, volumeID string)

ExecutePostCreationSetup executes requests that are required after volume creation.

Jump to

Keyboard shortcuts

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