serverscom

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 15 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BadRequestError

type BadRequestError struct {
	StatusCode int
	ErrorCode  string
	Message    string
}

BadRequestError represents an errors related to 400 response status code

func (*BadRequestError) Error

func (e *BadRequestError) Error() string

type BandwidthOption

type BandwidthOption struct {
	ID     int64  `json:"id"`
	Name   string `json:"name"`
	Type   string `json:"type"`
	Commit *int64 `json:"commit,omitempty"`
}

BandwidthOption represents bandwidth option

type Client

type Client struct {
	UserAgent string

	CloudComputingInstances CloudComputingInstancesService
	Hosts                   HostsService
	L2Segments              L2SegmentsService

	Locations             LocationsService
	CloudComputingRegions CloudComputingRegionsService
	SSHKeys               SSHKeysService
	SSLCertificates       SSLCertificatesService

	NetworkPools NetworkPoolsService

	LoadBalancers LoadBalancersService
	// contains filtered or unexported fields
}

Client manages communication with Servers.com API V1

func NewClient

func NewClient(token string) *Client

NewClient builds a new client with token

func NewClientWithEndpoint

func NewClientWithEndpoint(token, baseURL string) *Client

NewClientWithEndpoint builds a new client with token and api endpoint

func (*Client) SetupUserAgent

func (cli *Client) SetupUserAgent(userAgent string)

SetupUserAgent setups custom User-Agent header, by default: go-serverscom-client

type CloudComputingFlavor

type CloudComputingFlavor struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

CloudComputingFlavor represents cloud computing flavor

type CloudComputingImage

type CloudComputingImage struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

CloudComputingImage represents cloud computing image

type CloudComputingInstance

type CloudComputingInstance struct {
	Name               string    `json:"name"`
	ID                 string    `json:"id"`
	RegionID           int64     `json:"region_id"`
	RegionCode         string    `json:"region_code"`
	OpenstackUUID      string    `json:"openstack_uuid"`
	Status             string    `json:"status"`
	FlavorID           string    `json:"flavor_id"`
	FlavorName         string    `json:"flavor_name"`
	ImageID            string    `json:"image_id"`
	ImageName          *string   `json:"image_name"`
	PublicIPv4Address  *string   `json:"public_ipv4_address"`
	PrivateIPv4Address *string   `json:"private_ipv4_address"`
	PublicIPv6Address  *string   `json:"public_ipv6_address"`
	GPNEnabled         bool      `json:"gpn_enabled"`
	IPv6Enabled        bool      `json:"ipv6_enabled"`
	Created            time.Time `json:"created_at"`
	Updated            time.Time `json:"updated_at"`
}

CloudComputingInstance represents cloud instance

type CloudComputingInstanceCreateInput

type CloudComputingInstanceCreateInput struct {
	Name              string  `json:"name"`
	RegionID          int64   `json:"region_id"`
	FlavorID          string  `json:"flavor_id"`
	ImageID           string  `json:"image_id"`
	GPNEnabled        *bool   `json:"gpn_enabled,omitempty"`
	IPv6Enabled       *bool   `json:"ipv6_enabled,omitempty"`
	SSHKeyFingerprint *string `json:"ssh_key_fingerprint,omitempty"`
	BackupCopies      *int    `json:"backup_copies,omitempty"`
}

CloudComputingInstanceCreateInput represents cloud instance create input

type CloudComputingInstanceReinstallInput

type CloudComputingInstanceReinstallInput struct {
	ImageID string `json:"image_id"`
}

CloudComputingInstanceReinstallInput represents cloud instance reinstall input

type CloudComputingInstanceUpdateInput

type CloudComputingInstanceUpdateInput struct {
	Name         *string `json:"name,omitempty"`
	BackupCopies *int    `json:"backup_copies,omitempty"`
	GPNEnabled   *bool   `json:"gpn_enabled,omitempty"`
	IPv6Enabled  *bool   `json:"ipv6_enabled,omitempty"`
}

CloudComputingInstanceUpdateInput represents cloud instance update input

type CloudComputingInstanceUpgradeInput

type CloudComputingInstanceUpgradeInput struct {
	FlavorID string `json:"flavor_id"`
}

CloudComputingInstanceUpgradeInput represents cloud instance upgrade input

type CloudComputingInstancesHandler

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

CloudComputingInstancesHandler handles operations around cloud instances

func (*CloudComputingInstancesHandler) ApproveUpgrade

ApproveUpgrade cloud instance Endpoint: https://developers.servers.com/api-documentation/v1/#operation/ApproveInstanceUpgrade

func (*CloudComputingInstancesHandler) Collection

Collection builds a new Collection[CloudComputingInstance] interface

func (*CloudComputingInstancesHandler) CreatePTRRecord

func (h *CloudComputingInstancesHandler) CreatePTRRecord(ctx context.Context, cloudInstanceID string, input PTRRecordCreateInput) (*PTRRecord, error)

CreatePTRRecord creates ptr record for the cloud instance Endpoint: https://developers.servers.com/api-documentation/v1/#operation/CreatePtrForInstance

func (*CloudComputingInstancesHandler) Delete

Delete cloud instance Endpoint: https://developers.servers.com/api-documentation/v1/#operation/DeleteInstance

func (*CloudComputingInstancesHandler) DeletePTRRecord

func (h *CloudComputingInstancesHandler) DeletePTRRecord(ctx context.Context, cloudInstanceID string, ptrRecordID string) error

DeletePTRRecord deleted ptr record for the cloud instance Endpoint: https://developers.servers.com/api-documentation/v1/#operation/DetetePtrForInstance

func (*CloudComputingInstancesHandler) PTRRecords

PTRRecords builds a new Collection[PTRRecord] interface

func (*CloudComputingInstancesHandler) PowerOff

PowerOff cloud instance Endpoint: https://developers.servers.com/api-documentation/v1/#operation/SwitchPowerOff

func (*CloudComputingInstancesHandler) PowerOn

PowerOn cloud instance Endpoint: https://developers.servers.com/api-documentation/v1/#operation/SwitchPowerOn

func (*CloudComputingInstancesHandler) RevertUpgrade

RevertUpgrade cloud instance Endpoint: https://developers.servers.com/api-documentation/v1/#operation/RevertInstanceUpgrade

func (*CloudComputingInstancesHandler) Unrescue

Unrescue cloud instance Endpoint: https://developers.servers.com/api-documentation/v1/#operation/ExitFromRescueState

type CloudComputingInstancesService

type CloudComputingInstancesService interface {
	// Primary collection
	Collection() Collection[CloudComputingInstance]

	// Generic operations
	Get(ctx context.Context, id string) (*CloudComputingInstance, error)
	Create(ctx context.Context, input CloudComputingInstanceCreateInput) (*CloudComputingInstance, error)
	Update(ctx context.Context, id string, input CloudComputingInstanceUpdateInput) (*CloudComputingInstance, error)
	Delete(ctx context.Context, id string) error

	// Additional operations
	Reinstall(ctx context.Context, id string, input CloudComputingInstanceReinstallInput) (*CloudComputingInstance, error)
	Rescue(ctx context.Context, id string) (*CloudComputingInstance, error)
	Unrescue(ctx context.Context, id string) (*CloudComputingInstance, error)
	Upgrade(ctx context.Context, id string, input CloudComputingInstanceUpgradeInput) (*CloudComputingInstance, error)
	RevertUpgrade(ctx context.Context, id string) (*CloudComputingInstance, error)
	ApproveUpgrade(ctx context.Context, id string) (*CloudComputingInstance, error)
	PowerOn(ctx context.Context, id string) (*CloudComputingInstance, error)
	PowerOff(ctx context.Context, id string) (*CloudComputingInstance, error)
	CreatePTRRecord(ctx context.Context, cloudInstanceID string, input PTRRecordCreateInput) (*PTRRecord, error)
	DeletePTRRecord(ctx context.Context, cloudInstanceID string, ptrRecordID string) error

	// Additional collections
	PTRRecords(id string) Collection[PTRRecord]
}

CloudComputingInstancesService is an interface to interfacing with the Cloud Instance endpoints API documentation: https://developers.servers.com/api-documentation/v1/#tag/Cloud-Instance

type CloudComputingRegion

type CloudComputingRegion struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
	Code string `json:"code"`
}

CloudComputingRegion represents cloud computing region

type CloudComputingRegionsHandler

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

CloudComputingRegionsHandler handles operations around cloud computing regions

func (*CloudComputingRegionsHandler) Collection

Collection builds a new Collection[CloudComputingRegion] interface

func (*CloudComputingRegionsHandler) Flavors

Flavors builds a new Collection[CloudComputingFlavor] interface

func (*CloudComputingRegionsHandler) Images

Images builds a new Collection[CloudComputingImage] interface

type CloudComputingRegionsService

type CloudComputingRegionsService interface {
	// Primary collection
	Collection() Collection[CloudComputingRegion]

	// Additional collections
	Images(regionID int64) Collection[CloudComputingImage]
	Flavors(regionID int64) Collection[CloudComputingFlavor]
}

CloudComputingRegionsService is an interface to interfacing with the cloud computing regions endpoints API documentation: https://developers.servers.com/api-documentation/v1/#tag/Cloud-Region

type Collection added in v1.0.0

type Collection[K any] interface {
	IsClean() bool

	HasPreviousPage() bool
	HasNextPage() bool
	HasFirstPage() bool
	HasLastPage() bool

	NextPage(ctx context.Context) ([]K, error)
	PreviousPage(ctx context.Context) ([]K, error)
	FirstPage(ctx context.Context) ([]K, error)
	LastPage(ctx context.Context) ([]K, error)

	Collect(ctx context.Context) ([]K, error)
	List(ctx context.Context) ([]K, error)

	SetPage(page int) Collection[K]
	SetPerPage(perPage int) Collection[K]
	SetParam(name, value string) Collection[K]

	Refresh(ctx context.Context) error
}

Collection is an interface for interfacing with the collection

type CollectionHandler added in v1.0.0

type CollectionHandler[K any] struct {
	// contains filtered or unexported fields
}

CollectionHandler handles operations around collection

func NewCollection added in v1.0.0

func NewCollection[K any](client *Client, path string) *CollectionHandler[K]

NewCollection produces a new CollectionHandler and represents this as an interface of Collection

func (*CollectionHandler[K]) Collect added in v1.0.0

func (col *CollectionHandler[K]) Collect(ctx context.Context) ([]K, error)

Collect navigates by pages until the last page is reached will be reached and returns accumulated data between pages.

This method uses NextPage.

func (*CollectionHandler[K]) FirstPage added in v1.0.0

func (col *CollectionHandler[K]) FirstPage(ctx context.Context) ([]K, error)

FirstPage navigates to the first page returns a []Network, produces an error, when a collection has no first page.

Before using this method please ensure IsClean returns false and HasFirstPage returns true. You can force to load pagination metadata by calling Refresh or List methods.

func (*CollectionHandler[K]) HasFirstPage added in v1.0.0

func (col *CollectionHandler[K]) HasFirstPage() bool

HasFirstPage returns a bool value where truth is means collection has a first page.

In case when IsClean returns true, this method will return false, which means no request(s) were made and collection doesn't have metadata to know about pagination.

First metadata will come with the first called methods such: NextPage, PreviousPage, LastPage, FirstPage, List, Refresh, Collect.

func (*CollectionHandler[K]) HasLastPage added in v1.0.0

func (col *CollectionHandler[K]) HasLastPage() bool

HasLastPage returns a bool value where truth is means collection has a last page.

In case when IsClean returns true, this method will return false, which means no request(s) were made and collection doesn't have metadata to know about pagination.

First metadata will come with the first called methods such: NextPage, PreviousPage, LastPage, FirstPage, List, Refresh, Collect.

func (*CollectionHandler[K]) HasNextPage added in v1.0.0

func (col *CollectionHandler[K]) HasNextPage() bool

HasNextPage returns a bool value where truth is means collection has a next page.

In case when IsClean returns true, this method will return false, which means no request(s) were made and collection doesn't have metadata to know about pagination.

First metadata will come with the first called methods such: NextPage, PreviousPage, LastPage, FirstPage, List, Refresh, Collect.

func (*CollectionHandler[K]) HasPreviousPage added in v1.0.0

func (col *CollectionHandler[K]) HasPreviousPage() bool

HasPreviousPage returns a bool value where truth is means collection has a previous page.

In case when IsClean returns true, this method will return false, which means no request(s) were made and collection doesn't have metadata to know about pagination.

First metadata will come with the first called methods such: NextPage, PreviousPage, LastPage, FirstPage, List, Refresh, Collect.

func (*CollectionHandler[K]) IsClean added in v1.0.0

func (col *CollectionHandler[K]) IsClean() bool

IsClean returns a bool value where true is means, this collection not used yet and doesn't contain any state.

func (*CollectionHandler[K]) LastPage added in v1.0.0

func (col *CollectionHandler[K]) LastPage(ctx context.Context) ([]K, error)

LastPage navigates to the last page returns a []Network, produces an error, when a collection has no last page.

Before using this method please ensure IsClean returns false and HasLastPage returns true. You can force to load pagination metadata by calling Refresh or List methods.

func (*CollectionHandler[K]) List added in v1.0.0

func (col *CollectionHandler[K]) List(ctx context.Context) ([]K, error)

List returns a []BandwidthOption limited by pagination.

This method performs request only once when IsClean returns false, also this request doesn't perform request when such methods were called before: NextPage, PreviousPage, LastPage, FirstPage, Refresh, Collect.

In the case when previously called method is Collect, this method returns data from the last page.

func (*CollectionHandler[K]) NextPage added in v1.0.0

func (col *CollectionHandler[K]) NextPage(ctx context.Context) ([]K, error)

NextPage navigates to the next page returns a []Network, produces an error, when a collection has no next page.

Before using this method please ensure IsClean returns false and HasNextPage returns true. You can force to load pagination metadata by calling Refresh or List methods.

func (*CollectionHandler[K]) PreviousPage added in v1.0.0

func (col *CollectionHandler[K]) PreviousPage(ctx context.Context) ([]K, error)

PreviousPage navigates to the previous page returns a []Network, produces an error, when a collection has no previous page.

Before using this method please ensure IsClean returns false and HasPreviousPage returns true. You can force to load pagination metadata by calling Refresh or List methods.

func (*CollectionHandler[K]) Refresh added in v1.0.0

func (col *CollectionHandler[K]) Refresh(ctx context.Context) error

Refresh performs the request and then updates accumulated data limited by pagination.

After calling this method accumulated data can be extracted by List method.

func (*CollectionHandler[K]) SetPage added in v1.0.0

func (col *CollectionHandler[K]) SetPage(page int) Collection[K]

SetPage sets current page param.

func (*CollectionHandler[K]) SetParam added in v1.0.0

func (col *CollectionHandler[K]) SetParam(name, value string) Collection[K]

SetParam sets param.

func (*CollectionHandler[K]) SetPerPage added in v1.0.0

func (col *CollectionHandler[K]) SetPerPage(perPage int) Collection[K]

SetPerPage sets current per page param.

type ConfigurationDetails

type ConfigurationDetails struct {
	RAMSize                 int     `json:"ram_size"`
	ServerModelID           *int64  `json:"server_model_id"`
	ServerModelName         *string `json:"server_model_name"`
	PublicUplinkID          *int64  `json:"public_uplink_id"`
	PublicUplinkName        *string `json:"public_uplink_name"`
	PrivateUplinkID         *int64  `json:"private_uplink_id"`
	PrivateUplinkName       *string `json:"private_uplink_name"`
	BandwidthID             *int64  `json:"bandwidth_id"`
	BandwidthName           *string `json:"bandwidth_name"`
	OperatingSystemID       *int64  `json:"operating_system_id"`
	OperatingSystemFullName *string `json:"operating_system_full_name"`
}

ConfigurationDetails represents host configuration details

type ConflictError

type ConflictError struct {
	StatusCode int
	ErrorCode  string
	Message    string
}

ConflictError represents an errors related to 409 response status code

func (*ConflictError) Error

func (e *ConflictError) Error() string

type DedicatedServer

type DedicatedServer struct {
	ID                   string               `json:"id"`
	Type                 string               `json:"type"`
	Title                string               `json:"title"`
	LocationID           int64                `json:"location_id"`
	LocationCode         string               `json:"location_code"`
	Status               string               `json:"status"`
	OperationalStatus    string               `json:"operational_status"`
	PowerStatus          string               `json:"power_status"`
	Configuration        string               `json:"configuration"`
	PrivateIPv4Address   *string              `json:"private_ipv4_address"`
	PublicIPv4Address    *string              `json:"public_ipv4_address"`
	ScheduledRelease     *time.Time           `json:"scheduled_release_at"`
	ConfigurationDetails ConfigurationDetails `json:"configuration_details"`
	Created              time.Time            `json:"created_at"`
	Updated              time.Time            `json:"updated_at"`
}

DedicatedServer represents dedicated server

type DedicatedServerCreateInput

type DedicatedServerCreateInput struct {
	ServerModelID      int64                            `json:"server_model_id"`
	LocationID         int64                            `json:"location_id"`
	RAMSize            int                              `json:"ram_size"`
	UplinkModels       DedicatedServerUplinkModelsInput `json:"uplink_models"`
	Drives             DedicatedServerDrivesInput       `json:"drives"`
	Features           []string                         `json:"features,omitempty"`
	IPv6               bool                             `json:"ipv6"`
	Hosts              []DedicatedServerHostInput       `json:"hosts"`
	OperatingSystemID  *int64                           `json:"operating_system_id"`
	SSHKeyFingerprints []string                         `json:"ssh_key_fingerprints,omitempty"`
	UserData           *string                          `json:"user_data,omitempty"`
}

DedicatedServerCreateInput represents dedicated server create input, example:

driveModelID := int64(1)
osUbuntuServerID := int64(1)
rootFilesystem := "ext4"
raidLevel := 0

input := DedicatedServerCreateInput{
  ServerModelID: int64(1),
  LocationID: int64(1),
  RAMSize: 32,
  UplinkModels: DedicatedServerUplinkModelInput{
    PublicUplink &DedicatedServerPublicUplinkInput{ID: int64(1), BandwidthModelID: int64(1)},
    PrivateUplink: DedicatedServerPrivateUplinkInput{ID: int64(2)},
  },
  Drives: DedicatedServerDrivesInput{
    Slots: []DedicatedServerSlotInput{
      DedicatedServerSlotInput{Position: 0, DriveModelID: &driveModelID},
      DedicatedServerSlotInput{Position: 1, DriveModelID: &driveModelID},
    },
    Layout: []DedicatedServerLayoutInput{
      DedicatedServerLayoutInput{
        SlotPositions: []int{0, 1},
        Riad:          &raidLevel,
        Partitions:    []DedicatedServerLayoutPartitionInput{
          DedicatedServerLayoutPartitionInput{Target: "swap", Size: 4096, Fill: false},
          DedicatedServerLayoutPartitionInput{Target: "/", Fs: &rootFilesystem, Size: 100000, Fill: true},
        },
      },
    },
  },
  IPv6: true,
  OperatingSystemID: &osUbuntuServerID,
  SSHKeyFingerprints: []string{
    "48:81:0c:43:99:12:71:5e:ba:fd:e7:2f:20:d7:95:e8"
  },
  Hosts: []DedicatedServerHostInput{
    Hostname: "example-host",
  },
}

type DedicatedServerDrivesInput

type DedicatedServerDrivesInput struct {
	Slots  []DedicatedServerSlotInput   `json:"slots"`
	Layout []DedicatedServerLayoutInput `json:"layout"`
}

DedicatedServerDrivesInput represents drives for DedicatedServerCreateInput

type DedicatedServerHostInput

type DedicatedServerHostInput struct {
	Hostname             string  `json:"hostname"`
	PublicIPv4NetworkID  *string `json:"public_ipv4_network_id,omitempty"`
	PrivateIPv4NetworkID *string `json:"private_ipv4_network_id,omitempty"`
}

DedicatedServerHostInput represents hosts for DedicatedServerCreateInput

type DedicatedServerLayoutInput

type DedicatedServerLayoutInput struct {
	SlotPositions []int                                 `json:"slot_positions"`
	Raid          *int                                  `json:"raid,omitempty"`
	Partitions    []DedicatedServerLayoutPartitionInput `json:"partitions"`
}

DedicatedServerLayoutInput represents layout for DedicatedServerDrivesInput

type DedicatedServerLayoutPartitionInput

type DedicatedServerLayoutPartitionInput struct {
	Target string  `json:"target"`
	Size   int     `json:"size"`
	Fs     *string `json:"fs,omitempty"`
	Fill   bool    `json:"fill,omitempty"`
}

DedicatedServerLayoutPartitionInput represents partition for DedicatedServerLayoutInput

type DedicatedServerPrivateUplinkInput

type DedicatedServerPrivateUplinkInput struct {
	ID int64 `json:"id"`
}

DedicatedServerPrivateUplinkInput represents private uplink for DedicatedServerUplinkModelsInput

type DedicatedServerPublicUplinkInput

type DedicatedServerPublicUplinkInput struct {
	ID               int64 `json:"id"`
	BandwidthModelID int64 `json:"bandwidth_model_id"`
}

DedicatedServerPublicUplinkInput represents public uplink for DedicatedServerUplinkModelsInput

type DedicatedServerSlotInput

type DedicatedServerSlotInput struct {
	Position     int    `json:"position"`
	DriveModelID *int64 `json:"drive_model_id,omitempty"`
}

DedicatedServerSlotInput represents slot for DedicatedServerDrivesInput

type DedicatedServerUplinkModelsInput

type DedicatedServerUplinkModelsInput struct {
	Public  *DedicatedServerPublicUplinkInput `json:"public,omitempty"`
	Private DedicatedServerPrivateUplinkInput `json:"private"`
}

DedicatedServerUplinkModelsInput represents uplinks for DedicatedServerCreateInput

type DriveModel

type DriveModel struct {
	ID         int64  `json:"id"`
	Name       string `json:"name"`
	Capacity   int    `json:"capacity"`
	Interface  string `json:"interface"`
	FormFactor string `json:"form_factor"`
	MediaType  string `json:"media_type"`
}

DriveModel represents drive model

type ForbiddenError

type ForbiddenError struct {
	StatusCode int
	ErrorCode  string
	Message    string
}

ForbiddenError represents an errors related to 403 response status code

func (*ForbiddenError) Error

func (e *ForbiddenError) Error() string

type Host

type Host struct {
	ID                 string     `json:"id"`
	Type               string     `json:"type"`
	Title              string     `json:"title"`
	LocationID         int64      `json:"location_id"`
	LocationCode       string     `json:"location_code"`
	Status             string     `json:"status"`
	OperationalStatus  string     `json:"operational_status"`
	PowerStatus        string     `json:"power_status"`
	Configuration      string     `json:"configuration"`
	PrivateIPv4Address *string    `json:"private_ipv4_address"`
	PublicIPv4Address  *string    `json:"public_ipv4_address"`
	ScheduledRelease   *time.Time `json:"scheduled_release_at"`
	Created            time.Time  `json:"created_at"`
	Updated            time.Time  `json:"updated_at"`
}

Host represents host

type HostConnection

type HostConnection struct {
	Port       string  `json:"port"`
	Type       string  `json:"type"`
	MACAddress *string `json:"macaddr"`
}

HostConnection represents host connection

type HostDriveSlot

type HostDriveSlot struct {
	Position   int         `json:"position"`
	Interface  string      `json:"interface"`
	FormFactor string      `json:"form_factor"`
	DriveModel *DriveModel `json:"drive_model"`
}

HostDriveSlot represents host drive slot

type HostPowerFeed

type HostPowerFeed struct {
	Name   string `json:"name"`
	Status string `json:"status"`
}

HostPowerFeed represents feed status

type HostsHandler

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

HostsHandler handles operations around hosts

func (*HostsHandler) AbortReleaseForDedicatedServer

func (h *HostsHandler) AbortReleaseForDedicatedServer(ctx context.Context, id string) (*DedicatedServer, error)

AbortReleaseForDedicatedServer aborts scheduled release for the dedicated server Endpoint: https://developers.servers.com/api-documentation/v1/#operation/AbortReleaseForAnExistingDedicatedServer

func (*HostsHandler) Collection

func (h *HostsHandler) Collection() Collection[Host]

Collection builds a new Collection[Host] interface

func (*HostsHandler) CreateDedicatedServers

func (h *HostsHandler) CreateDedicatedServers(ctx context.Context, input DedicatedServerCreateInput) ([]DedicatedServer, error)

CreateDedicatedServers creates a dedicated servers Endpoint: https://developers.servers.com/api-documentation/v1/#operation/CreateANewDedicatedServer

func (*HostsHandler) CreatePTRRecordForDedicatedServer

func (h *HostsHandler) CreatePTRRecordForDedicatedServer(ctx context.Context, id string, input PTRRecordCreateInput) (*PTRRecord, error)

CreatePTRRecordForDedicatedServer creates ptr record for the dedicated server Endpoint: https://developers.servers.com/api-documentation/v1/#operation/CreatePtrRecordForServerNetworks

func (*HostsHandler) DedicatedServerConnections

func (h *HostsHandler) DedicatedServerConnections(id string) Collection[HostConnection]

DedicatedServerConnections builds a new Collection[HostConnection] interface

func (*HostsHandler) DedicatedServerDriveSlots

func (h *HostsHandler) DedicatedServerDriveSlots(id string) Collection[HostDriveSlot]

DedicatedServerDriveSlots builds a new Collection[HostDriveSlot] interface

func (*HostsHandler) DedicatedServerNetworks

func (h *HostsHandler) DedicatedServerNetworks(id string) Collection[Network]

DedicatedServerNetworks builds a new Collection[Network] interface

func (*HostsHandler) DedicatedServerPTRRecords

func (h *HostsHandler) DedicatedServerPTRRecords(id string) Collection[PTRRecord]

DedicatedServerPTRRecords builds a new Collection[PTRRecord] interface

func (*HostsHandler) DedicatedServerPowerFeeds

func (h *HostsHandler) DedicatedServerPowerFeeds(ctx context.Context, id string) ([]HostPowerFeed, error)

DedicatedServerPowerFeeds returns list of dedicated server power feeds with status Endpoint: https://developers.servers.com/api-documentation/v1/#operation/ListAllPowerFeedsForAnExistingDedicatedServer

func (*HostsHandler) DeletePTRRecordForDedicatedServer

func (h *HostsHandler) DeletePTRRecordForDedicatedServer(ctx context.Context, hostID string, ptrRecordID string) error

DeletePTRRecordForDedicatedServer deleted ptr record for the dedicated server Endpoint: https://developers.servers.com/api-documentation/v1/#operation/DeleteAnExistingPtrRecord

func (*HostsHandler) GetDedicatedServer

func (h *HostsHandler) GetDedicatedServer(ctx context.Context, id string) (*DedicatedServer, error)

GetDedicatedServer returns a dedicated server Endpoint: https://developers.servers.com/api-documentation/v1/#operation/RetrieveAnExistingDedicatedServer

func (*HostsHandler) GetKubernetesBaremetalNode added in v1.0.0

func (h *HostsHandler) GetKubernetesBaremetalNode(ctx context.Context, id string) (*KubernetesBaremetalNode, error)

GetKubernetesBaremetalNode returns a kubernetes baremetal node

func (*HostsHandler) PowerCycleDedicatedServer

func (h *HostsHandler) PowerCycleDedicatedServer(ctx context.Context, id string) (*DedicatedServer, error)

PowerCycleDedicatedServer sends power-cycle command to the dedicated server Endpoint: https://developers.servers.com/api-documentation/v1/#operation/SendPowerCycleCommandToAnExistingDedicatedServer

func (*HostsHandler) PowerOffDedicatedServer

func (h *HostsHandler) PowerOffDedicatedServer(ctx context.Context, id string) (*DedicatedServer, error)

PowerOffDedicatedServer sends power-off command to the dedicated server Endpoint: https://developers.servers.com/api-documentation/v1/#operation/SendPowerOffCommandToAnExistingDedicatedServer

func (*HostsHandler) PowerOnDedicatedServer

func (h *HostsHandler) PowerOnDedicatedServer(ctx context.Context, id string) (*DedicatedServer, error)

PowerOnDedicatedServer sends power-on command to the dedicated server Endpoint: https://developers.servers.com/api-documentation/v1/#operation/SendPowerOnCommandToAnExistingDedicatedServer

func (*HostsHandler) ReinstallOperatingSystemForDedicatedServer

func (h *HostsHandler) ReinstallOperatingSystemForDedicatedServer(ctx context.Context, id string, input OperatingSystemReinstallInput) (*DedicatedServer, error)

ReinstallOperatingSystemForDedicatedServer performs operating system reinstallation Endpoint: https://developers.servers.com/api-documentation/v1/#operation/StartOperatingSystemReinstallProcess

func (*HostsHandler) ScheduleReleaseForDedicatedServer

func (h *HostsHandler) ScheduleReleaseForDedicatedServer(ctx context.Context, id string) (*DedicatedServer, error)

ScheduleReleaseForDedicatedServer schedules release for for the dedicated server Endpoint: https://developers.servers.com/api-documentation/v1/#operation/ScheduleReleaseForAnExistingDedicatedServer

type HostsService

type HostsService interface {
	// Primary collection
	Collection() Collection[Host]

	// Generic operations
	GetDedicatedServer(ctx context.Context, id string) (*DedicatedServer, error)
	GetKubernetesBaremetalNode(ctx context.Context, id string) (*KubernetesBaremetalNode, error)
	CreateDedicatedServers(ctx context.Context, input DedicatedServerCreateInput) ([]DedicatedServer, error)

	// Additional operations
	ScheduleReleaseForDedicatedServer(ctx context.Context, id string) (*DedicatedServer, error)
	AbortReleaseForDedicatedServer(ctx context.Context, id string) (*DedicatedServer, error)
	PowerOnDedicatedServer(ctx context.Context, id string) (*DedicatedServer, error)
	PowerOffDedicatedServer(ctx context.Context, id string) (*DedicatedServer, error)
	PowerCycleDedicatedServer(ctx context.Context, id string) (*DedicatedServer, error)
	CreatePTRRecordForDedicatedServer(ctx context.Context, id string, input PTRRecordCreateInput) (*PTRRecord, error)
	DeletePTRRecordForDedicatedServer(ctx context.Context, hostID string, ptrRecordID string) error
	ReinstallOperatingSystemForDedicatedServer(ctx context.Context, id string, input OperatingSystemReinstallInput) (*DedicatedServer, error)

	// Additional collections
	DedicatedServerPowerFeeds(ctx context.Context, id string) ([]HostPowerFeed, error)
	DedicatedServerConnections(id string) Collection[HostConnection]
	DedicatedServerNetworks(id string) Collection[Network]
	DedicatedServerDriveSlots(id string) Collection[HostDriveSlot]
	DedicatedServerPTRRecords(id string) Collection[PTRRecord]
}

HostsService is an interface for interfacing with Host, Dedicated Server endpoints API documentation: https://developers.servers.com/api-documentation/v1/#tag/Hosts https://developers.servers.com/api-documentation/v1/#tag/Dedicated-Server

type InternalServerError

type InternalServerError struct {
	StatusCode int
	ErrorCode  string
	Message    string
}

InternalServerError represents an errors related to 500 response status code

func (*InternalServerError) Error

func (e *InternalServerError) Error() string

type KubernetesBaremetalNode added in v1.0.0

type KubernetesBaremetalNode struct {
	ID                   string               `json:"id"`
	Type                 string               `json:"type"`
	Title                string               `json:"title"`
	LocationID           int64                `json:"location_id"`
	LocationCode         string               `json:"location_code"`
	Status               string               `json:"status"`
	OperationalStatus    string               `json:"operational_status"`
	PowerStatus          string               `json:"power_status"`
	Configuration        string               `json:"configuration"`
	PrivateIPv4Address   *string              `json:"private_ipv4_address"`
	PublicIPv4Address    *string              `json:"public_ipv4_address"`
	ScheduledRelease     *time.Time           `json:"scheduled_release_at"`
	ConfigurationDetails ConfigurationDetails `json:"configuration_details"`
	Created              time.Time            `json:"created_at"`
	Updated              time.Time            `json:"updated_at"`
}

KubernetesBaremetalNode represents kubernetes baremetal node

type L2LocationGroup

type L2LocationGroup struct {
	ID          int64   `json:"id"`
	Name        string  `json:"name"`
	Code        string  `json:"code"`
	GroupType   string  `json:"group_type"`
	LocationIDs []int64 `json:"location_ids"`
}

L2LocationGroup represents l2 location groups

type L2Member

type L2Member struct {
	ID      string    `json:"id"`
	Title   string    `json:"title"`
	Mode    string    `json:"mode"`
	Vlan    *int      `json:"vlan"`
	Status  string    `json:"status"`
	Created time.Time `json:"created_at"`
	Updated time.Time `json:"updated_at"`
}

L2Member respresents l2 segment member

type L2Segment

type L2Segment struct {
	ID                string    `json:"id"`
	Name              string    `json:"name"`
	Type              string    `json:"type"`
	Status            string    `json:"status"`
	LocationGroupID   int64     `json:"location_group_id"`
	LocationGroupCode string    `json:"location_group_code"`
	Created           time.Time `json:"created_at"`
	Updated           time.Time `json:"updated_at"`
}

L2Segment represents l2 segment

type L2SegmentChangeNetworksInput

type L2SegmentChangeNetworksInput struct {
	Create []L2SegmentCreateNetworksInput `json:"create,omitempty"`
	Delete []string                       `json:"delete,omitempty"`
}

L2SegmentChangeNetworksInput represents input to change networks

type L2SegmentCreateInput

type L2SegmentCreateInput struct {
	Name            *string                `json:"name,omitempty"`
	Type            string                 `json:"type"`
	LocationGroupID int64                  `json:"location_group_id"`
	Members         []L2SegmentMemberInput `json:"members"`
}

L2SegmentCreateInput represents l2 segment create input

type L2SegmentCreateNetworksInput

type L2SegmentCreateNetworksInput struct {
	Mask               int    `json:"mask"`
	DistributionMethod string `json:"distribution_method"`
}

L2SegmentCreateNetworksInput represents input to create networks for L2SegmentChangeNetworksInput

type L2SegmentMemberInput

type L2SegmentMemberInput struct {
	ID   string `json:"id"`
	Mode string `json:"mode"`
}

L2SegmentMemberInput represents l2 segment member input for L2SegmentCreateInput and L2SegmentUpdateInput

type L2SegmentUpdateInput

type L2SegmentUpdateInput struct {
	Name    *string                `json:"name,omitempty"`
	Members []L2SegmentMemberInput `json:"members,omitempty"`
}

L2SegmentUpdateInput represents l2 segment update input

type L2SegmentsHandler

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

L2SegmentsHandler handles operatings around l2 segments

func (*L2SegmentsHandler) ChangeNetworks

func (h *L2SegmentsHandler) ChangeNetworks(ctx context.Context, segmentID string, input L2SegmentChangeNetworksInput) (*L2Segment, error)

ChangeNetworks changes networks set Endpoint: https://developers.servers.com/api-documentation/v1/#operation/UpdateAnExistingL2SegmentNetworks

func (*L2SegmentsHandler) Collection

func (h *L2SegmentsHandler) Collection() Collection[L2Segment]

Collection builds a new Collection[L2Segment] interface

func (*L2SegmentsHandler) Delete

func (h *L2SegmentsHandler) Delete(ctx context.Context, segmentID string) error

Delete l2 segment Endpoint: https://developers.servers.com/api-documentation/v1/#operation/DeleteAnExistingL2Segment

func (*L2SegmentsHandler) LocationGroups

func (h *L2SegmentsHandler) LocationGroups() Collection[L2LocationGroup]

LocationGroups builds a new Collection[L2LocationGroup] interface

func (*L2SegmentsHandler) Members

func (h *L2SegmentsHandler) Members(segmentID string) Collection[L2Member]

Members builds a new Collection[L2Member] interface

func (*L2SegmentsHandler) Networks

func (h *L2SegmentsHandler) Networks(segmentID string) Collection[Network]

Networks builds a new L2NetworksCollection interface

type L2SegmentsService

type L2SegmentsService interface {
	// Primary collection
	Collection() Collection[L2Segment]

	// Extra collections
	LocationGroups() Collection[L2LocationGroup]

	// Generic operations
	Get(ctx context.Context, segmentID string) (*L2Segment, error)
	Create(ctx context.Context, input L2SegmentCreateInput) (*L2Segment, error)
	Update(ctx context.Context, segmentID string, input L2SegmentUpdateInput) (*L2Segment, error)
	Delete(ctx context.Context, segmentID string) error

	// Additional operations
	ChangeNetworks(ctx context.Context, segmentID string, input L2SegmentChangeNetworksInput) (*L2Segment, error)

	// Additional collections
	Members(segmentID string) Collection[L2Member]
	Networks(segmentID string) Collection[Network]
}

L2SegmentsService is an interface for interfacing with Host, Dedicated Server endpoints API documentation: https://developers.servers.com/api-documentation/v1/#tag/L2-Segment

type L4LoadBalancer added in v1.0.0

type L4LoadBalancer struct {
	ID                string    `json:"id"`
	Name              string    `json:"name"`
	Type              string    `json:"type"`
	Status            string    `json:"status"`
	ExternalAddresses []string  `json:"external_addresses"`
	LocationID        int64     `json:"location_id"`
	StoreLogs         bool      `json:"store_logs"`
	Created           time.Time `json:"created_at"`
	Updated           time.Time `json:"updated_at"`
}

L4LoadBalancer represents l4 load balancer

type L4LoadBalancerCreateInput added in v1.0.0

type L4LoadBalancerCreateInput struct {
	Name          string                `json:"name"`
	LocationID    int64                 `json:"location_id"`
	StoreLogs     *bool                 `json:"store_logs,omitempty"`
	VHostZones    []L4VHostZoneInput    `json:"vhost_zones"`
	UpstreamZones []L4UpstreamZoneInput `json:"upstream_zones"`
}

L4LoadBalancerUpdateInput represents l4 load balancer create input

type L4LoadBalancerUpdateInput added in v1.0.0

type L4LoadBalancerUpdateInput struct {
	Name          *string               `json:"name,omitempty"`
	StoreLogs     *bool                 `json:"store_logs,omitempty"`
	VHostZones    []L4VHostZoneInput    `json:"vhost_zones,omitempty"`
	UpstreamZones []L4UpstreamZoneInput `json:"upstream_zones,omitempty"`
}

L4LoadBalancerUpdateInput represents l4 load balancer update input

type L4UpstreamInput added in v1.0.0

type L4UpstreamInput struct {
	IP     string `json:"ip"`
	Port   int32  `json:"port"`
	Weight int32  `json:"weight"`
}

L4UpstreamInput represents l4 upstream input

type L4UpstreamZoneInput added in v1.0.0

type L4UpstreamZoneInput struct {
	ID         string            `json:"id"`
	Method     *string           `json:"method,omitempty"`
	UDP        bool              `json:"udp"`
	HCInterval *int              `json:"hc_interval,omitempty"`
	HCJitter   *int              `json:"hc_jitter,omitempty"`
	Upstreams  []L4UpstreamInput `json:"upstreams"`
}

L4UpstreamZoneInput represents l4 upstream zone input

type L4VHostZoneInput added in v1.0.0

type L4VHostZoneInput struct {
	ID            string  `json:"id"`
	UDP           bool    `json:"udp"`
	ProxyProtocol bool    `json:"proxy_protocol"`
	Ports         []int32 `json:"ports"`
	Description   *string `json:"description"`
	UpstreamID    string  `json:"upstream_id"`
}

L4VHostZoneInput represents l4 vhost zone input

type L7LoadBalancer added in v1.0.2

type L7LoadBalancer struct {
	ID                string    `json:"id"`
	Name              string    `json:"name"`
	Type              string    `json:"type"`
	Domains           []string  `json:"domains"`
	Status            string    `json:"status"`
	ExternalAddresses []string  `json:"external_addresses"`
	LocationID        int64     `json:"location_id"`
	Geoip             bool      `json:"geoip"`
	StoreLogs         bool      `json:"store_logs"`
	StoreLogsRegionID int64     `json:"store_logs_region_id"`
	Created           time.Time `json:"created_at"`
	Updated           time.Time `json:"updated_at"`
}

L7LoadBalancer represents l7 load balancer

type L7LoadBalancerCreateInput added in v1.0.2

type L7LoadBalancerCreateInput struct {
	Name              string                `json:"name"`
	LocationID        int64                 `json:"location_id"`
	StoreLogs         *bool                 `json:"store_logs,omitempty"`
	StoreLogsRegionID *int                  `json:"store_logs_region_id,,omitempty"`
	Geoip             *bool                 `json:"geoip,omitempty"`
	VHostZones        []L7VHostZoneInput    `json:"vhost_zones"`
	UpstreamZones     []L7UpstreamZoneInput `json:"upstream_zones"`
}

L7LoadBalancerUpdateInput represents l7 load balancer create input

type L7LoadBalancerUpdateInput added in v1.0.2

type L7LoadBalancerUpdateInput struct {
	Name                string                `json:"name,omitempty"`
	StoreLogs           *bool                 `json:"store_logs,omitempty"`
	StoreLogsRegionID   *int                  `json:"store_logs_region_id,,omitempty"`
	Geoip               *bool                 `json:"geoip,omitempty"`
	NewExternalIpsCount *int                  `json:"new_external_ips_count,omitempty"`
	DeleteExternalIps   []string              `json:"delete_external_ips,omitempty"`
	VHostZones          []L7VHostZoneInput    `json:"vhost_zones,omitempty"`
	UpstreamZones       []L7UpstreamZoneInput `json:"upstream_zones,omitempty"`
}

L7LoadBalancerUpdateInput represents l7 load balancer update input

type L7LocationZoneInput added in v1.0.2

type L7LocationZoneInput struct {
	Location     string `json:"location"`
	UpstreamID   string `json:"upstream_id"`
	UpstreamPath string `json:"upstream_path"`
}

L7LocationZoneInput represents l7 location zone input

type L7UpstreamInput added in v1.0.2

type L7UpstreamInput struct {
	IP          string `json:"ip"`
	Port        int32  `json:"port"`
	Weight      int32  `json:"weight,omitempty"`
	MaxConns    int32  `json:"max_conns,omitempty"`
	MaxFails    int32  `json:"max_fails,omitempty"`
	FailTimeout int32  `json:"fail_timeout,omitempty"`
}

L7UpstreamInput represents l7 upstream input

type L7UpstreamZoneInput added in v1.0.2

type L7UpstreamZoneInput struct {
	ID            string            `json:"id"`
	Method        *string           `json:"method,omitempty"`
	SSL           bool              `json:"ssl"`
	Sticky        bool              `json:"sticky"`
	HCInterval    *int              `json:"hc_interval,omitempty"`
	HCJitter      *int              `json:"hc_jitter,omitempty"`
	HCFails       *int              `json:"hc_fails,omitempty"`
	HCPasses      *int              `json:"hc_passes,omitempty"`
	HCDomain      *string           `json:"hc_domain,omitempty"`
	HCPath        *string           `json:"hc_path,omitempty"`
	HCMethod      *string           `json:"hc_method,omitempty"`
	HCMandatory   bool              `json:"hc_mandatory,omitempty"`
	HCStatus      *string           `json:"hc_status,omitempty"`
	TLSPreset     *string           `json:"tls_preset,omitempty"`
	GRPC          bool              `json:"grpc,omitempty"`
	HCGRPCService *string           `json:"hc_grpc_service,omitempty"`
	HCGRPCStatus  *int              `json:"hc_grpc_status,omitempty"`
	Upstreams     []L7UpstreamInput `json:"upstreams"`
}

L7UpstreamZoneInput represents l7 upstream zone input

type L7VHostZoneInput added in v1.0.2

type L7VHostZoneInput struct {
	ID                  string                `json:"id"`
	Ports               []int32               `json:"ports"`
	SSL                 bool                  `json:"ssl"`
	HTTP2               bool                  `json:"http2"`
	HTTPToHttpsRedirect bool                  `json:"http_to_https_redirect"`
	HTTP2PushPreload    bool                  `json:"http2_push_preload"`
	Domains             []string              `json:"domains"`
	SSLCertID           string                `json:"ssl_certificate_id"`
	LocationZones       []L7LocationZoneInput `json:"location_zones"`
}

L7VHostZoneInput represents l7 vhost zone input

type LoadBalancer added in v1.0.0

type LoadBalancer struct {
	ID                string    `json:"id"`
	Name              string    `json:"name"`
	Type              string    `json:"type"`
	Status            string    `json:"status"`
	ExternalAddresses []string  `json:"external_addresses"`
	LocationID        int64     `json:"location_id"`
	Created           time.Time `json:"created_at"`
	Updated           time.Time `json:"updated_at"`
}

/ LoadBalancer represents load balancer

type LoadBalancersHandler added in v1.0.0

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

LoadBalancersHandler handles operations around hosts

func (*LoadBalancersHandler) Collection added in v1.0.0

func (h *LoadBalancersHandler) Collection() Collection[LoadBalancer]

Collection builds a new Collection[LoadBalancer] interface

func (*LoadBalancersHandler) CreateL4LoadBalancer added in v1.0.0

func (h *LoadBalancersHandler) CreateL4LoadBalancer(ctx context.Context, input L4LoadBalancerCreateInput) (*L4LoadBalancer, error)

CreateL4LoadBalancer creates a l4 load balancer Endpoint: https://developers.servers.com/api-documentation/v1/#tag/Load-Balancer/operation/CreateANewL4LoadBalancer

func (*LoadBalancersHandler) CreateL7LoadBalancer added in v1.0.2

func (h *LoadBalancersHandler) CreateL7LoadBalancer(ctx context.Context, input L7LoadBalancerCreateInput) (*L7LoadBalancer, error)

CreateL7LoadBalancer creates a l7 load balancer Endpoint: https://developers.servers.com/api-documentation/v1/#tag/Load-Balancer/operation/CreateANewL7LoadBalancer

func (*LoadBalancersHandler) DeleteL4LoadBalancer added in v1.0.0

func (h *LoadBalancersHandler) DeleteL4LoadBalancer(ctx context.Context, id string) error

DeleteL4LoadBalancer deletes l4 load balancer Endpoint: https://developers.servers.com/api-documentation/v1/#tag/Load-Balancer/operation/DeleteAnExistingL4LoadBalancer

func (*LoadBalancersHandler) DeleteL7LoadBalancer added in v1.0.2

func (h *LoadBalancersHandler) DeleteL7LoadBalancer(ctx context.Context, id string) error

DeleteL7LoadBalancer deletes l7 load balancer Endpoint: https://developers.servers.com/api-documentation/v1/#tag/Load-Balancer/operation/DeleteAnExistingL7LoadBalancer

func (*LoadBalancersHandler) GetL4LoadBalancer added in v1.0.0

func (h *LoadBalancersHandler) GetL4LoadBalancer(ctx context.Context, id string) (*L4LoadBalancer, error)

GetL4LoadBalancer returns a l4 load balancer Endpoint: https://developers.servers.com/api-documentation/v1/#tag/Load-Balancer/operation/RetrieveAnExisitingL4LoadBalancer

func (*LoadBalancersHandler) GetL7LoadBalancer added in v1.0.2

func (h *LoadBalancersHandler) GetL7LoadBalancer(ctx context.Context, id string) (*L7LoadBalancer, error)

GetL7LoadBalancer returns a l7 load balancer Endpoint: https://developers.servers.com/api-documentation/v1/#tag/Load-Balancer/operation/RetrieveAnExistingL7LoadBalancer

func (*LoadBalancersHandler) UpdateL4LoadBalancer added in v1.0.0

func (h *LoadBalancersHandler) UpdateL4LoadBalancer(ctx context.Context, id string, input L4LoadBalancerUpdateInput) (*L4LoadBalancer, error)

UpdateL4LoadBalancer updates l4 load balancer Endpoint: https://developers.servers.com/api-documentation/v1/#tag/Load-Balancer/operation/UpdateAnExisitingL4LoadBalancer

func (*LoadBalancersHandler) UpdateL7LoadBalancer added in v1.0.2

func (h *LoadBalancersHandler) UpdateL7LoadBalancer(ctx context.Context, id string, input L7LoadBalancerUpdateInput) (*L7LoadBalancer, error)

UpdateL7LoadBalancer updates l7 load balancer Endpoint: https://developers.servers.com/api-documentation/v1/#tag/Load-Balancer/operation/UpdateAnExistingL7LoadBalancer

type LoadBalancersService added in v1.0.0

type LoadBalancersService interface {
	// Primary collection
	Collection() Collection[LoadBalancer]

	// Generic operations
	GetL4LoadBalancer(ctx context.Context, id string) (*L4LoadBalancer, error)
	CreateL4LoadBalancer(ctx context.Context, input L4LoadBalancerCreateInput) (*L4LoadBalancer, error)
	UpdateL4LoadBalancer(ctx context.Context, id string, input L4LoadBalancerUpdateInput) (*L4LoadBalancer, error)
	DeleteL4LoadBalancer(ctx context.Context, id string) error
	GetL7LoadBalancer(ctx context.Context, id string) (*L7LoadBalancer, error)
	CreateL7LoadBalancer(ctx context.Context, input L7LoadBalancerCreateInput) (*L7LoadBalancer, error)
	UpdateL7LoadBalancer(ctx context.Context, id string, input L7LoadBalancerUpdateInput) (*L7LoadBalancer, error)
	DeleteL7LoadBalancer(ctx context.Context, id string) error
}

LoadBalancersService is an interface for interfacing with Load balancers endpoints API documentation: https://developers.servers.com/api-documentation/v1/#tag/LoadBalancers

type Location

type Location struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
	Code string `json:"code"`
}

Location represents location

type LocationsHandler

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

LocationsHandler handles operations around cloud instances

func (*LocationsHandler) BandwidthOptions

func (h *LocationsHandler) BandwidthOptions(LocationID, ServerModelID, uplinkID int64) Collection[BandwidthOption]

BandwidthOptions builds a new Collection[BandwidthOption] interface

func (*LocationsHandler) Collection

func (h *LocationsHandler) Collection() Collection[Location]

Collection builds a new LocationsCollection interface

func (*LocationsHandler) DriveModelOptions

func (h *LocationsHandler) DriveModelOptions(LocationID, ServerModelID int64) Collection[DriveModel]

DriveModelOptions builds a new Collection[DriveModel] interface

func (*LocationsHandler) OperatingSystemOptions

func (h *LocationsHandler) OperatingSystemOptions(LocationID, ServerModelID int64) Collection[OperatingSystemOption]

OperatingSystemOptions builds a new Collection[OperatingSystemOption] interface

func (*LocationsHandler) RAMOptions

func (h *LocationsHandler) RAMOptions(LocationID, ServerModelID int64) Collection[RAMOption]

RAMOptions builds a new Collection[RAMOption] interface

func (*LocationsHandler) ServerModelOptions

func (h *LocationsHandler) ServerModelOptions(LocationID int64) Collection[ServerModelOption]

ServerModelOptions builds a new Collection[ServerModelOption interface

func (*LocationsHandler) UplinkOptions

func (h *LocationsHandler) UplinkOptions(LocationID, ServerModelID int64) Collection[UplinkOption]

UplinkOptions builds a new Collection[UplinkOption] interface

type LocationsService

type LocationsService interface {
	// Primary collection
	Collection() Collection[Location]

	// Generic operations
	ServerModelOptions(LocationID int64) Collection[ServerModelOption]
	RAMOptions(LocationID, ServerModelID int64) Collection[RAMOption]
	OperatingSystemOptions(LocationID, ServerModelID int64) Collection[OperatingSystemOption]
	DriveModelOptions(LocationID, ServerModelID int64) Collection[DriveModel]
	UplinkOptions(LocationID, ServerModelID int64) Collection[UplinkOption]
	BandwidthOptions(LocationID, ServerModelID, uplinkID int64) Collection[BandwidthOption]
}

LocationsService is an interface to interfacing with the Location and Order options endpoints API documentation: https://developers.servers.com/api-documentation/v1/#tag/Location https://developers.servers.com/api-documentation/v1/#tag/Server-Model-Option https://developers.servers.com/api-documentation/v1/#tag/Drive-Model-Option https://developers.servers.com/api-documentation/v1/#tag/Ram-Option https://developers.servers.com/api-documentation/v1/#tag/Operating-System-Option https://developers.servers.com/api-documentation/v1/#tag/Uplink-Model-Option https://developers.servers.com/api-documentation/v1/#tag/Bandwidth-Option

type Network

type Network struct {
	ID                 string    `json:"id"`
	Title              *string   `json:"title,omitempty"`
	Status             string    `json:"status"`
	Cidr               *string   `json:"cidr,omitempty"`
	Family             string    `json:"family"`
	InterfaceType      string    `json:"interface_type"`
	DistributionMethod string    `json:"distribution_method"`
	Additional         bool      `json:"additional"`
	Created            time.Time `json:"created_at"`
	Updated            time.Time `json:"updated_at"`

	// DEPRECATED: should be replaced by Statu
	State string `json:"state"`
}

Network represents network

type NetworkPool

type NetworkPool struct {
	ID          string    `json:"id"`
	Title       *string   `json:"title"`
	CIDR        string    `json:"cidr"`
	Type        string    `json:"type"`
	LocationIDs []int     `json:"location_ids"`
	Created     time.Time `json:"created_at"`
	Updated     time.Time `json:"updated_at"`
}

NetworkPool represents network pool

type NetworkPoolInput

type NetworkPoolInput struct {
	Title *string `json:"title"`
}

NetworkPoolInput represents network pool input

type NetworkPoolsHandler

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

NetworkPoolsHandler handles operations around network pools

func (*NetworkPoolsHandler) Collection

func (h *NetworkPoolsHandler) Collection() Collection[NetworkPool]

Collection builds a new Collection[NetworkPool] interface

func (*NetworkPoolsHandler) CreateSubnetwork

func (h *NetworkPoolsHandler) CreateSubnetwork(ctx context.Context, networkPoolID string, input SubnetworkCreateInput) (*Subnetwork, error)

CreateSubnetwork returns created subnetwork from the pool Endpoint: https://developers.servers.com/api-documentation/v1/#operation/CreateOrAllocateSubnetworkFromTheNetworkPool

func (*NetworkPoolsHandler) DeleteSubnetwork

func (h *NetworkPoolsHandler) DeleteSubnetwork(ctx context.Context, networkPoolID, subnetworkID string) error

DeleteSubnetwork delete subnetwork Endpoint: https://developers.servers.com/api-documentation/v1/#operation/DeleteAnExistingSubnetwork

func (*NetworkPoolsHandler) Get

Get returns a network pool Endpoint: https://developers.servers.com/api-documentation/v1/#operation/RetrieveAnExistingNetworkPool

func (*NetworkPoolsHandler) GetSubnetwork

func (h *NetworkPoolsHandler) GetSubnetwork(ctx context.Context, networkPoolID, subnetworkID string) (*Subnetwork, error)

GetSubnetwork returns subnetwork from the pool Endpoint: https://developers.servers.com/api-documentation/v1/#operation/RetrieveAnExistingSubnetwork

func (*NetworkPoolsHandler) Subnetworks

func (h *NetworkPoolsHandler) Subnetworks(networkPoolID string) Collection[Subnetwork]

Subnetworks builds a new Collection[Subnetwork] interface

func (*NetworkPoolsHandler) Update

Update returns updated network pool Endpoint: https://developers.servers.com/api-documentation/v1/#operation/UpdateAnExistingNetworkPool

func (*NetworkPoolsHandler) UpdateSubnetwork

func (h *NetworkPoolsHandler) UpdateSubnetwork(ctx context.Context, networkPoolID, subnetworkID string, input SubnetworkUpdateInput) (*Subnetwork, error)

UpdateSubnetwork returns subnetwork from the pool Endpoint: https://developers.servers.com/api-documentation/v1/#operation/UpdateAnExistingSubnetwork

type NetworkPoolsService

type NetworkPoolsService interface {
	// Primary collection
	Collection() Collection[NetworkPool]

	// Generic operations
	Get(ctx context.Context, id string) (*NetworkPool, error)
	Update(ctx context.Context, id string, input NetworkPoolInput) (*NetworkPool, error)

	CreateSubnetwork(ctx context.Context, networkPoolID string, input SubnetworkCreateInput) (*Subnetwork, error)
	GetSubnetwork(ctx context.Context, networkPoolID, subnetworkID string) (*Subnetwork, error)
	UpdateSubnetwork(ctx context.Context, networkPoolID, subnetworkID string, input SubnetworkUpdateInput) (*Subnetwork, error)
	DeleteSubnetwork(ctx context.Context, networkPoolID, subnetworkID string) error

	// Additional collections
	Subnetworks(networkPoolID string) Collection[Subnetwork]
}

NetworkPoolsService is an interface to interfacing with the Network Pool endpoints API documentation: https://developers.servers.com/api-documentation/v1/#tag/Network-Pool

type NotFoundError

type NotFoundError struct {
	StatusCode int
	ErrorCode  string
	Message    string
}

NotFoundError represents an errors related to 404 response status code

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

type OperatingSystemOption

type OperatingSystemOption struct {
	ID          int64    `json:"id"`
	FullName    string   `json:"full_name"`
	Name        string   `json:"name"`
	Version     string   `json:"version"`
	Arch        string   `json:"arch"`
	Filesystems []string `json:"filesystems"`
}

OperatingSystemOption represents operating system option

type OperatingSystemReinstallDrivesInput

type OperatingSystemReinstallDrivesInput struct {
	Layout []OperatingSystemReinstallLayoutInput `json:"layout,omitempty"`
}

OperatingSystemReinstallDrivesInput represents drives for os reinstallation input

type OperatingSystemReinstallInput

type OperatingSystemReinstallInput struct {
	Hostname           string                              `json:"hostname"`
	Drives             OperatingSystemReinstallDrivesInput `json:"drives"`
	OperatingSystemID  *int64                              `json:"operating_system_id,omitempty"`
	SSHKeyFingerprints []string                            `json:"ssh_key_fingerprints,omitempty"`
}

OperatingSystemReinstallInput represents os reinstallation input

type OperatingSystemReinstallLayoutInput

type OperatingSystemReinstallLayoutInput struct {
	SlotPositions []int                                    `json:"slot_positions"`
	Raid          *int                                     `json:"raid,omitempty"`
	Ignore        *bool                                    `json:"ignore,omitempty"`
	Partitions    []OperatingSystemReinstallPartitionInput `json:"partitions,omitempty"`
}

OperatingSystemReinstallLayoutInput represents layout for os reinstallation drives input

type OperatingSystemReinstallPartitionInput

type OperatingSystemReinstallPartitionInput struct {
	Target string  `json:"target"`
	Size   int     `json:"size"`
	Fs     *string `json:"fs,omitempty"`
	Fill   bool    `json:"fill,omitempty"`
}

OperatingSystemReinstallPartitionInput represents partition for os reinstallation layout input

type PTRRecord

type PTRRecord struct {
	ID       string `json:"id"`
	IP       string `json:"ip"`
	Domain   string `json:"domain"`
	Priority int    `json:"priority"`
	TTL      int    `json:"ttl"`
}

PTRRecord represents ptr record

type PTRRecordCreateInput

type PTRRecordCreateInput struct {
	IP       string `json:"ip"`
	Domain   string `json:"domain"`
	Priority *int   `json:"priority"`
	TTL      *int   `json:"ttl"`
}

PTRRecordCreateInput represents ptr record create input

type ParsingError

type ParsingError struct {
	StatusCode   int
	Body         string
	ParsingError error
}

ParsingError represents any error related to the problem with parsing a body

func (*ParsingError) Error

func (e *ParsingError) Error() string

type RAMOption

type RAMOption struct {
	RAM  int    `json:"ram"`
	Type string `json:"type"`
}

RAMOption represents ram option

type SSHKey

type SSHKey struct {
	Name        string    `json:"name"`
	Fingerprint string    `json:"fingerprint"`
	Created     time.Time `json:"created_at"`
	Updated     time.Time `json:"updated_at"`
}

SSHKey represents ssh key

type SSHKeyCreateInput

type SSHKeyCreateInput struct {
	Name      string `json:"name"`
	PublicKey string `json:"public_key"`
}

SSHKeyCreateInput represents ssh key create input

type SSHKeyUpdateInput

type SSHKeyUpdateInput struct {
	Name string `json:"name"`
}

SSHKeyUpdateInput represents ssh key update input

type SSHKeysHandler

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

SSHKeysHandler handles operations around ssh keys

func (*SSHKeysHandler) Collection

func (h *SSHKeysHandler) Collection() Collection[SSHKey]

Collection builds a new Collection[SSHKey] interface

func (*SSHKeysHandler) Delete

func (h *SSHKeysHandler) Delete(ctx context.Context, fingerprint string) error

Delete ssh key Endpoint: https://developers.servers.com/api-documentation/v1/#operation/DeleteSshKey

func (*SSHKeysHandler) Get

func (h *SSHKeysHandler) Get(ctx context.Context, fingerprint string) (*SSHKey, error)

Get ssh key Endpoint: https://developers.servers.com/api-documentation/v1/#operation/ShowSshKey

func (*SSHKeysHandler) Update

func (h *SSHKeysHandler) Update(ctx context.Context, fingerprint string, input SSHKeyUpdateInput) (*SSHKey, error)

Update ssh key Endpoint: https://developers.servers.com/api-documentation/v1/#operation/UpdateTheNameOfSshKey

type SSHKeysService

type SSHKeysService interface {
	// Primary collection
	Collection() Collection[SSHKey]

	// Generic operations
	Get(ctx context.Context, fingerprint string) (*SSHKey, error)
	Create(ctx context.Context, input SSHKeyCreateInput) (*SSHKey, error)
	Update(ctx context.Context, fingerprint string, input SSHKeyUpdateInput) (*SSHKey, error)
	Delete(ctx context.Context, fingerprint string) error
}

SSHKeysService is an interface to interfacing with the SSH Key endpoints API documentation: https://developers.servers.com/api-documentation/v1/#tag/SSH-Key

type SSLCertificate

type SSLCertificate struct {
	ID              string     `json:"id"`
	Name            string     `json:"name"`
	Sha1Fingerprint string     `json:"sha1_fingerprint"`
	Expires         *time.Time `json:"expires_at"`
	Created         time.Time  `json:"created_at"`
	Updated         time.Time  `json:"updated_at"`
}

SSLCertificate represents ssl certificate

type SSLCertificateCreateCustomInput

type SSLCertificateCreateCustomInput struct {
	Name       string `json:"name"`
	PublicKey  string `json:"public_key"`
	PrivateKey string `json:"private_key"`
	ChainKey   string `json:"chain_key,omitempty"`
}

SSLCertificateCreateCustomInput represents custom ssl certificate create input

type SSLCertificateCustom

type SSLCertificateCustom struct {
	ID              string     `json:"id"`
	Name            string     `json:"name"`
	Sha1Fingerprint string     `json:"sha1_fingerprint"`
	Expires         *time.Time `json:"expires_at"`
	Created         time.Time  `json:"created_at"`
	Updated         time.Time  `json:"updated_at"`
}

SSLCertificateCustom represents custom ssl certificate

type SSLCertificatesHandler

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

SSLCertificatesHandler handles operations around ssl certificates

func (*SSLCertificatesHandler) Collection

Collection builds a new Collection[SSLCertificate] interface

func (*SSLCertificatesHandler) CreateCustom

CreateCustom creates a custom ssl certificate

func (*SSLCertificatesHandler) GetCustom

GetCustom returns a custom ssl certificate

type SSLCertificatesService

type SSLCertificatesService interface {
	// Primary collection
	Collection() Collection[SSLCertificate]

	// Generic operations
	CreateCustom(ctx context.Context, input SSLCertificateCreateCustomInput) (*SSLCertificateCustom, error)
	GetCustom(ctx context.Context, id string) (*SSLCertificateCustom, error)
}

SSLCertificatesService is an interface to interfacing with the SSL Certificate endpoints API documentation: https://developers.servers.com/api-documentation/v1/#tag/SSL-Certificate

type ServerModelOption

type ServerModelOption struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
	RAM  int    `json:"ram"`
}

ServerModelOption represents server model option

type Subnetwork

type Subnetwork struct {
	ID            string    `json:"id"`
	NetworkPoolID string    `json:"network_pool_id"`
	Title         *string   `json:"title"`
	CIDR          string    `json:"cidr"`
	Attached      bool      `json:"attached"`
	InterfaceType string    `json:"interface_type"`
	Created       time.Time `json:"created_at"`
	Updated       time.Time `json:"updated_at"`
}

Subnetwork represents subnetwork

type SubnetworkCreateInput

type SubnetworkCreateInput struct {
	Title *string `json:"title"`
	CIDR  *string `json:"cidr,omitempty"`
	Mask  *int    `json:"mask,omitempty"`
}

SubnetworkCreateInput represents subnetwork create input

type SubnetworkUpdateInput

type SubnetworkUpdateInput struct {
	Title *string `json:"title"`
}

SubnetworkUpdateInput respresents subnetwork update input

type UnauthorizedError

type UnauthorizedError struct {
	StatusCode int
	ErrorCode  string
	Message    string
}

UnauthorizedError represents an errors related to 401 response status code

func (*UnauthorizedError) Error

func (e *UnauthorizedError) Error() string

type UnprocessableEntityError

type UnprocessableEntityError struct {
	StatusCode int
	ErrorCode  string
	Message    string
	Errors     map[string]string
}

UnprocessableEntityError represents an errors related to 422 response status code

func (*UnprocessableEntityError) Error

func (e *UnprocessableEntityError) Error() string

type UplinkOption

type UplinkOption struct {
	ID         int64  `json:"id"`
	Name       string `json:"name"`
	Type       string `json:"type"`
	Speed      int    `json:"speed"`
	Redundancy bool   `json:"redundancy"`
}

UplinkOption represents uplink option

Jump to

Keyboard shortcuts

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