glesys

package module
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2021 License: MIT Imports: 13 Imported by: 2

README

Build Status

glesys-go

This is the official client library for interacting with the GleSYS API.

Requirements

  • Go 1.11 or higher. Required for modules support, older versions may still build but are not guaranteed to work.

Getting Started

Installation
go get github.com/glesys/glesys-go
Authentication

To use the glesys-go library you need a GleSYS Cloud account and a valid API key. You can sign up for an account at https://glesys.com/signup. After signing up visit https://cloud.glesys.com to create an API key for your Project.

Set up a Client
client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")
Create a Server
// Create a Server
server, err := client.Servers.Create(context.Background(), glesys.CreateServerParams{Password: "..."}.WithDefaults())
List all Servers
// List all Servers
servers, err := client.Servers.List(context.Background())
User agent

To be able to monitor usage and help track down issues, we encourage you to provide a user agent string identifying your application or library. Recommended syntax is my-library/version or www.example.com.

Context

glesys-go uses Go's context library to handle timeouts and deadlines. All functions making HTTP requests requires a context argument.

Documentation

Full documentation is available at https://godoc.org/github.com/glesys/glesys-go.

Contribute

We love Pull Requests ♥
  1. Fork the repo.
  2. Make sure to run the tests to verify that you're starting with a clean slate.
  3. Add a test for your change, make sure it fails. Refactoring existing code or improving documentation does not require new tests.
  4. Make the changes and ensure the test pass.
  5. Commit your changes, push to your fork and submit a Pull Request.
Syntax

Please use the formatting provided by gofmt.

License

The contents of this repository are distributed under the MIT license, see LICENSE.

Documentation

Overview

Package glesys is the official Go client for interacting with the GleSYS API.

Please note that only a subset of features available in the GleSYS API has been implemented. We greatly appreciate contributions.

Getting Started

To get started you need to signup for a GleSYS Cloud account and create an API key. Signup is available at https://glesys.com/signup and API keys can be created at https://customer.glesys.com.

client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

CL12345 is the key of the Project you want to work with.

To be able to monitor usage and help track down issues, we encourage you to provide a user agent string identifying your application or library. Recommended syntax is "my-library/version" or "www.example.com".

The different modules of the GleSYS API are available on the client. For example:

client.EmailDomains.Overview(...)
client.IPs.List(...)
client.NetworkAdapters.Create(...)
client.Networks.Create(...)
client.Servers.Create(...)

More examples provided below.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddBackendParams

type AddBackendParams struct {
	ConnectTimeout  int    `json:"connecttimeout,omitempty"`
	Mode            string `json:"mode,omitempty"`
	Name            string `json:"name"`
	ResponseTimeout int    `json:"responsetimeout,omitempty"`
	StickySession   string `json:"stickysession,omitempty"`
}

AddBackendParams used when creating backends

type AddCertificateParams

type AddCertificateParams struct {
	Name        string `json:"certificatename"`
	Certificate string `json:"certificate"`
}

AddCertificateParams represents a certificate name and content

type AddDNSDomainParams

type AddDNSDomainParams struct {
	Name              string `json:"domainname"`
	CreateRecords     string `json:"createrecords,omitempty"`
	Expire            int    `json:"expire,omitempty"`
	Minimum           int    `json:"minimum,omitempty"`
	PrimaryNameServer string `json:"primarynameserver,omitempty"`
	Refresh           int    `json:"refresh,omitempty"`
	ResponsiblePerson string `json:"responsibleperson,omitempty"`
	Retry             int    `json:"retry,omitempty"`
	TTL               int    `json:"ttl,omitempty"`
}

AddDNSDomainParams - used for adding existing domains to GleSYS use CreateRecords = false to not create additional records.

type AddFrontendParams

type AddFrontendParams struct {
	Backend        string `json:"backendname"`
	ClientTimeout  int    `json:"clienttimeout,omitempty"`
	MaxConnections int    `json:"maxconnections,omitempty"`
	Name           string `json:"name"`
	Port           int    `json:"port"`
	SSLCertificate string `json:"sslcertificate,omitempty"`
}

AddFrontendParams used when creating frontends

type AddRecordParams

type AddRecordParams struct {
	DomainName string `json:"domainname"`
	Data       string `json:"data"`
	Host       string `json:"host"`
	Type       string `json:"type"`
	TTL        int    `json:"ttl,omitempty"`
}

AddRecordParams - parameters for updating domain records

type AddTargetParams

type AddTargetParams struct {
	Backend  string `json:"backendname"`
	Name     string `json:"name"`
	Port     int    `json:"port"`
	TargetIP string `json:"ipaddress"`
	Weight   int    `json:"weight"`
}

AddTargetParams used when creating targets

type AvailableIPsParams

type AvailableIPsParams struct {
	DataCenter string `json:"datacenter"`
	Platform   string `json:"platform"`
	Version    int    `json:"ipversion"`
}

AvailableIPsParams is used to filter results when listing available IP addresses

type BlacklistParams

type BlacklistParams struct {
	Prefix string `json:"prefix"`
}

BlacklistParams set prefix to add/delete

type ChangeNameserverParams

type ChangeNameserverParams struct {
	DomainName string `json:"domainname"`
	NS1        string `json:"NS1"`
	NS2        string `json:"NS2"`
	NS3        string `json:"NS3,omitempty"`
	NS4        string `json:"NS4,omitempty"`
}

ChangeNameserverParams - parameters for updating the nameservers for domain

type Client

type Client struct {
	DNSDomains      *DNSDomainService
	EmailDomains    *EmailDomainService
	IPs             *IPService
	LoadBalancers   *LoadBalancerService
	ObjectStorages  *ObjectStorageService
	Servers         *ServerService
	Networks        *NetworkService
	NetworkAdapters *NetworkAdapterService
	// contains filtered or unexported fields
}

Client is used to interact with the GleSYS API

func NewClient

func NewClient(project, apiKey, userAgent string) *Client

NewClient creates a new Client for interacting with the GleSYS API. This is the main entrypoint for API interactions.

type CreateAccountParams

type CreateAccountParams struct {
	EmailAccount       string `json:"emailaccount"`
	Password           string `json:"password"`
	AntiSpamLevel      int    `json:"antispamlevel,omitempty"`
	AntiVirus          string `json:"antivirus,omitempty"`
	AutoRespond        string `json:"autorespond,omitempty"`
	AutoRespondMessage string `json:"autorespondmessage,omitempty"`
	Quota              int    `json:"quota,omitempty"`
	RejectSpam         string `json:"rejectspam,omitempty"`
}

CreateAccountParams is used for creating new email accounts.

type CreateLoadBalancerParams

type CreateLoadBalancerParams struct {
	DataCenter string `json:"datacenter"`
	IPv4       string `json:"ip,omitempty"`
	IPv6       string `json:"ipv6,omitempty"`
	Name       string `json:"name"`
}

CreateLoadBalancerParams is used when creating a new loadbalancer

type CreateNetworkAdapterParams

type CreateNetworkAdapterParams struct {
	AdapterType string `json:"adaptertype,omitempty"`
	Bandwidth   int    `json:"bandwidth,omitempty"`
	NetworkID   string `json:"networkid,omitempty"`
	ServerID    string `json:"serverid"`
}

CreateNetworkAdapterParams is used when creating a new network adapter

type CreateNetworkParams

type CreateNetworkParams struct {
	DataCenter  string `json:"datacenter"`
	Description string `json:"description"`
}

CreateNetworkParams is used when creating a new network

type CreateObjectStorageCredentialParams

type CreateObjectStorageCredentialParams struct {
	InstanceID  string `json:"instanceid"`
	Description string `json:"description,omitempty"`
}

CreateObjectStorageCredentialParams is used when creating a new credential

type CreateObjectStorageInstanceParams

type CreateObjectStorageInstanceParams struct {
	CreateInitialBucket bool   `json:"createinitialbucket,omitempty"`
	DataCenter          string `json:"datacenter"`
	Description         string `json:"description,omitempty"`
}

CreateObjectStorageInstanceParams is used when creating a new instance

type CreateServerParams

type CreateServerParams struct {
	Bandwidth    int    `json:"bandwidth"`
	CampaignCode string `json:"campaigncode,omitempty"`
	CPU          int    `json:"cpucores"`
	DataCenter   string `json:"datacenter"`
	Description  string `json:"description,omitempty"`
	Hostname     string `json:"hostname"`
	IPv4         string `json:"ip"`
	IPv6         string `json:"ipv6"`
	Memory       int    `json:"memorysize"`
	Password     string `json:"rootpassword,omitempty"`
	Platform     string `json:"platform"`
	PublicKey    string `json:"sshkey,omitempty"`
	Storage      int    `json:"disksize"`
	Template     string `json:"templatename"`
	Users        []User `json:"users,omitempty"`
}

CreateServerParams is used when creating a new server

func (CreateServerParams) WithDefaults

func (p CreateServerParams) WithDefaults() CreateServerParams

WithDefaults populates the parameters with default values. Existing parameters will not be overwritten.

func (CreateServerParams) WithUser

func (p CreateServerParams) WithUser(username string, publicKeys []string, password string) CreateServerParams

WithUser populates the Users parameter of CreateServerParams for platforms with user support eg. KVM Existing parameters will not be overwritten.

type DNSDomain

type DNSDomain struct {
	Name                  string           `json:"domainname"`
	Available             bool             `json:"available,omitempty"`
	CreateTime            string           `json:"createtime,omitempty"`
	DisplayName           string           `json:"displayname,omitempty"`
	Expire                int              `json:"expire,omitempty"`
	Minimum               int              `json:"minimum,omitempty"`
	Prices                []DNSDomainPrice `json:"prices,omitempty"`
	PrimaryNameServer     string           `json:"primarynameserver,omitempty"`
	RecordCount           int              `json:"recordcount,omitempty"`
	Refresh               int              `json:"refresh,omitempty"`
	RegistrarInfo         RegistrarInfo    `json:"registrarinfo,omitempty"`
	ResponsiblePerson     string           `json:"responsibleperson,omitempty"`
	Retry                 int              `json:"retry,omitempty"`
	TTL                   int              `json:"ttl,omitempty"`
	UsingGlesysNameserver string           `json:"usingglesysnameserver,omitempty"`
}

DNSDomain represents a domain

type DNSDomainPrice

type DNSDomainPrice struct {
	Amount   float64 `json:"amount"`
	Currency string  `json:"currency"`
	Years    int     `json:"years"`
}

DNSDomainPrice represents the price for a single domain

type DNSDomainRecord

type DNSDomainRecord struct {
	DomainName string `json:"domainname"`
	Data       string `json:"data"`
	Host       string `json:"host"`
	RecordID   int    `json:"recordid"`
	TTL        int    `json:"ttl"`
	Type       string `json:"type"`
}

DNSDomainRecord - data in the domain

type DNSDomainService

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

DNSDomainService provides functions to interact with dns domains

func (*DNSDomainService) AddDNSDomain

func (s *DNSDomainService) AddDNSDomain(context context.Context, params AddDNSDomainParams) (*DNSDomain, error)

AddDNSDomain - add an existing domain to your GleSYS account

func (*DNSDomainService) AddRecord

func (s *DNSDomainService) AddRecord(context context.Context, params AddRecordParams) (*DNSDomainRecord, error)

AddRecord - add a domain record

func (*DNSDomainService) Available

func (s *DNSDomainService) Available(context context.Context, search string) (*[]DNSDomain, error)

Available - checks if the domain is available

func (*DNSDomainService) ChangeNameservers

func (s *DNSDomainService) ChangeNameservers(context context.Context, params ChangeNameserverParams) error

ChangeNameservers - change the nameservers for domain

func (*DNSDomainService) Delete

func (s *DNSDomainService) Delete(context context.Context, params DeleteDNSDomainParams) error

Delete - deletes a domain from the dns system

func (*DNSDomainService) DeleteRecord

func (s *DNSDomainService) DeleteRecord(context context.Context, recordID int) error

DeleteRecord deletes a record

func (*DNSDomainService) Details

func (s *DNSDomainService) Details(context context.Context, domainname string) (*DNSDomain, error)

Details - return details about the domain

func (*DNSDomainService) Edit

func (s *DNSDomainService) Edit(context context.Context, params EditDNSDomainParams) (*DNSDomain, error)

Edit - edit domain parameters

func (*DNSDomainService) List

func (s *DNSDomainService) List(context context.Context) (*[]DNSDomain, error)

List - return a list of all domains in your account

func (*DNSDomainService) ListRecords

func (s *DNSDomainService) ListRecords(context context.Context, domainname string) (*[]DNSDomainRecord, error)

ListRecords - return a list of all records for domain

func (*DNSDomainService) Register

func (s *DNSDomainService) Register(context context.Context, params RegisterDNSDomainParams) (*DNSDomain, error)

Register - Register a domain

func (*DNSDomainService) Renew

func (s *DNSDomainService) Renew(context context.Context, params RenewDNSDomainParams) (*DNSDomain, error)

Renew - Renew a domain

func (*DNSDomainService) SetAutoRenew

func (s *DNSDomainService) SetAutoRenew(context context.Context, params SetAutoRenewParams) (*DNSDomain, error)

SetAutoRenew - Set a domain to renew automatically

func (*DNSDomainService) Transfer

func (s *DNSDomainService) Transfer(context context.Context, params RegisterDNSDomainParams) (*DNSDomain, error)

Transfer - Transfer a domain

func (*DNSDomainService) UpdateRecord

func (s *DNSDomainService) UpdateRecord(context context.Context, params UpdateRecordParams) (*DNSDomainRecord, error)

UpdateRecord - update a domain record

type DeleteDNSDomainParams

type DeleteDNSDomainParams struct {
	Name             string `json:"domainname"`
	ForceDeleteEmail string `json:"forcedeleteemail,omitempty"`
}

DeleteDNSDomainParams - parameters for deleting a domain from the dns system. Set ForceDeleteEmail to true, to delete a domain AND email accounts for the domain.

type DeleteObjectStorageCredentialParams

type DeleteObjectStorageCredentialParams struct {
	InstanceID   string `json:"instanceid"`
	CredentialID string `json:"credentialid"`
}

DeleteObjectStorageCredentialParams is used when deleting an existing credential

type DestroyServerParams

type DestroyServerParams struct {
	KeepIP bool `json:"keepip"`
}

DestroyServerParams is used when destroying a server

type EditAccountParams

type EditAccountParams struct {
	AntiSpamLevel      int    `json:"antispamlevel,omitempty"`
	AntiVirus          string `json:"antivirus,omitempty"`
	Password           string `json:"password,omitempty"`
	AutoRespond        string `json:"autorespond,omitempty"`
	AutoRespondMessage string `json:"autorespondmessage,omitempty"`
	Quota              int    `json:"quota,omitempty"`
	RejectSpam         string `json:"rejectspam,omitempty"`
}

EditAccountParams is used for updating the different values on an email account.

type EditBackendParams

type EditBackendParams struct {
	ConnectTimeout  int    `json:"connecttimeout,omitempty"`
	Mode            string `json:"mode,omitempty"`
	Name            string `json:"backendname"`
	ResponseTimeout int    `json:"responsetimeout,omitempty"`
	StickySession   string `json:"stickysession,omitempty"`
}

EditBackendParams used to edit a backend

type EditDNSDomainParams

type EditDNSDomainParams struct {
	Name              string `json:"domainname"`
	Expire            int    `json:"expire,omitempty"`
	Minimum           int    `json:"minimum,omitempty"`
	PrimaryNameServer string `json:"primarynameserver,omitempty"`
	Refresh           int    `json:"refresh,omitempty"`
	ResponsiblePerson string `json:"responsibleperson,omitempty"`
	Retry             int    `json:"retry,omitempty"`
	TTL               int    `json:"ttl,omitempty"`
}

EditDNSDomainParams - used when editing domain parameters

type EditFrontendParams

type EditFrontendParams struct {
	ClientTimeout  int    `json:"clienttimeout,omitempty"`
	MaxConnections int    `json:"maxconnections,omitempty"`
	Name           string `json:"frontendname"`
	Port           int    `json:"port,omitempty"`
	SSLCertificate string `json:"sslcertificate,omitempty"`
}

EditFrontendParams used to edit a frontend

type EditLoadBalancerParams

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

EditLoadBalancerParams is used when editing a loadbalancer

type EditNetworkAdapterParams

type EditNetworkAdapterParams struct {
	Bandwidth int    `json:"bandwidth,omitempty"`
	NetworkID string `json:"networkid,omitempty"`
}

EditNetworkAdapterParams is used when editing an existing network adapter

type EditNetworkParams

type EditNetworkParams struct {
	Description string `json:"description"`
}

EditNetworkParams is used when editing an existing network

type EditObjectStorageInstanceParams

type EditObjectStorageInstanceParams struct {
	Description string `json:"description,omitempty"`
	InstanceID  string `json:"instanceid"`
}

EditObjectStorageInstanceParams is used when editing an existing instance

type EditServerParams

type EditServerParams struct {
	Bandwidth   int    `json:"bandwidth,omitempty"`
	CPU         int    `json:"cpucores,omitempty"`
	Description string `json:"description,omitempty"`
	Hostname    string `json:"hostname,omitempty"`
	Memory      int    `json:"memorysize,omitempty"`
	Storage     int    `json:"disksize,omitempty"`
}

EditServerParams is used when editing an existing server

type EditTargetParams

type EditTargetParams struct {
	Backend  string `json:"backendname"`
	Name     string `json:"targetname"`
	Port     int    `json:"port,omitempty"`
	TargetIP string `json:"ipaddress,omitempty"`
	Weight   int    `json:"weight,omitempty"`
}

EditTargetParams used when editing targets

type EmailAccount

type EmailAccount struct {
	EmailAccount         string            `json:"emailaccount"`
	DisplayName          string            `json:"displayname"`
	Quota                EmailAccountQuota `json:"quota"`
	AntiSpamLevel        int               `json:"antispamlevel"`
	AntiVirus            string            `json:"antivirus"`
	AutoRespond          string            `json:"autorespond"`
	AutoRespondMessage   string            `json:"autorespondmessage,omitempty"`
	AutoRespondSaveEmail string            `json:"autorespondsaveemail"`
	RejectSpam           string            `json:"rejectspam"`
	Created              string            `json:"created"`
	Modified             string            `json:"modified,omitempty"`
}

EmailAccount represents a single email account

type EmailAccountQuota

type EmailAccountQuota struct {
	Max  int    `json:"max"`
	Unit string `json:"unit"`
}

EmailAccountQuota represents quota for a single email account

type EmailAccountQuotaUsed

type EmailAccountQuotaUsed struct {
	Amount int    `json:"amount"`
	Unit   string `json:"unit"`
}

EmailAccountQuotaUsed the quota used

type EmailAccountsPricelist

type EmailAccountsPricelist struct {
	Amount     float64 `json:"amount"`
	Currency   string  `json:"currency"`
	Unit       string  `json:"unit"`
	FreeAmount float64 `json:"freeamount"`
}

EmailAccountsPricelist is the pricelist for email

type EmailAlias

type EmailAlias struct {
	EmailAlias  string `json:"emailalias"`
	DisplayName string `json:"displayname"`
	GoTo        string `json:"goto"`
}

EmailAlias represents a single email alias

type EmailAliasParams

type EmailAliasParams struct {
	EmailAlias string `json:"emailalias"`
	GoTo       string `json:"goto"`
}

EmailAliasParams is used for creating new email aliases as well as editing already existing ones.

type EmailCostEntity

type EmailCostEntity struct {
	Amount   float64 `json:"amount"`
	Currency string  `json:"currency"`
}

EmailCostEntity represents the amount and currency or a cost

type EmailCosts

type EmailCosts struct {
	Costs     EmailCostsContainer     `json:"costs"`
	PriceList EmailPricelistContainer `json:"pricelist"`
}

EmailCosts represents a email cost object

type EmailCostsContainer

type EmailCostsContainer struct {
	Quota    EmailCostsEntry `json:"quota"`
	Accounts EmailCostsEntry `json:"accounts"`
}

EmailCostsContainer contains quota and accounts for email costs

type EmailCostsEntry

type EmailCostsEntry struct {
	Amount float64         `json:"amount"`
	Cost   EmailCostEntity `json:"cost"`
}

EmailCostsEntry represents a cost object

type EmailDomainService

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

EmailDomainService provides functions to interact with the Email api

func (*EmailDomainService) Costs

func (em *EmailDomainService) Costs(context context.Context) (*EmailCosts, error)

Costs returns the email related costs and the current pricelist.

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	costs, _ := client.EmailDomains.Costs(context.Background())

	fmt.Printf("%#v\n", costs)
}
Output:

func (*EmailDomainService) CreateAccount

func (em *EmailDomainService) CreateAccount(context context.Context, params CreateAccountParams) (*EmailAccount, error)

CreateAccount allows you to create an email account.

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	// NOTE: All parameters except for EmailAccount and Password are optional and can be omitted.
	createaccount, _ := client.EmailDomains.CreateAccount(context.Background(), glesys.CreateAccountParams{
		EmailAccount:       "new_user@example.com",
		Password:           "SuperSecretPassword",
		AntiSpamLevel:      3,
		AntiVirus:          "yes",
		AutoRespond:        "yes",
		AutoRespondMessage: "Your Automatic Response",
		Quota:              400,
		RejectSpam:         "yes",
	})

	fmt.Printf("%#v\n", createaccount)
}
Output:

func (*EmailDomainService) CreateAlias

func (em *EmailDomainService) CreateAlias(context context.Context, params EmailAliasParams) (*EmailAlias, error)

CreateAlias sets up a new alias.

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	alias, _ := client.EmailDomains.CreateAlias(context.Background(), glesys.EmailAliasParams{
		EmailAlias: "alias@example.com",
		GoTo:       "user@example.com",
	})

	fmt.Printf("%#v\n", alias)
}
Output:

func (*EmailDomainService) Delete

func (em *EmailDomainService) Delete(context context.Context, email string) error

Delete allows you to remove an email account or alias.

Example
package main

import (
	"context"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	// NOTE: The email parameter can be both an account and an alias.
	client.EmailDomains.Delete(context.Background(), "user@example.com")
}
Output:

func (*EmailDomainService) EditAccount

func (em *EmailDomainService) EditAccount(context context.Context, emailAccount string, params EditAccountParams) (*EmailAccount, error)

EditAccount allows you to Edit an email account's parameters.

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	// NOTE: All parameters are optional and can be omitted.
	editaccount, _ := client.EmailDomains.EditAccount(context.Background(), "user@example.com", glesys.EditAccountParams{
		AntiSpamLevel:      3,
		AntiVirus:          "yes",
		Password:           "SuperSecretPassword",
		AutoRespond:        "yes",
		AutoRespondMessage: "Your Automatic Response",
		Quota:              400,
		RejectSpam:         "yes",
	})

	fmt.Printf("%#v\n", editaccount)
}
Output:

func (*EmailDomainService) EditAlias

func (em *EmailDomainService) EditAlias(context context.Context, params EmailAliasParams) (*EmailAlias, error)

EditAlias updates an already existing alias.

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	alias, _ := client.EmailDomains.EditAlias(context.Background(), glesys.EmailAliasParams{
		EmailAlias: "alias@example.com",
		GoTo:       "another_user@example.com",
	})

	fmt.Printf("%#v\n", alias)
}
Output:

func (*EmailDomainService) GlobalQuota

func (em *EmailDomainService) GlobalQuota(context context.Context, params GlobalQuotaParams) (*EmailGlobalQuota, error)

GlobalQuota enables the user to set and get the global quota.

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	// NOTE: The GlobalQuota parameter can be omitted to only fetch the current value.
	globalquota, _ := client.EmailDomains.GlobalQuota(context.Background(), glesys.GlobalQuotaParams{
		GlobalQuota: 20480,
	})

	fmt.Println(globalquota.Usage)
	fmt.Println(globalquota.Max)
}
Output:

func (*EmailDomainService) List

func (em *EmailDomainService) List(context context.Context, domain string, params ListEmailsParams) (*EmailList, error)

List Gets a list of all accounts and aliases of a domain with full details.

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	// NOTE: The filter in ListEmailsParams is optional and can be omitted.
	list, _ := client.EmailDomains.List(context.Background(), "example.com", glesys.ListEmailsParams{
		Filter: "user@example.com",
	})

	fmt.Printf("%#v\n", list)
}
Output:

func (*EmailDomainService) Overview

func (em *EmailDomainService) Overview(context context.Context, params OverviewParams) (*EmailOverview, error)

Overview fetches a summary of the email accounts and domains on the account.

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	// NOTE: All parameters in OverviewParams are optional and can be omitted.
	overview, _ := client.EmailDomains.Overview(context.Background(), glesys.OverviewParams{
		Filter: "example.com",
		Page:   1,
	})

	fmt.Printf("%#v", overview)
}
Output:

func (*EmailDomainService) Quota

func (em *EmailDomainService) Quota(context context.Context, emailaccount string) (*EmailQuota, error)

Quota returns the used and total quota for an email account.

type EmailGlobalQuota

type EmailGlobalQuota struct {
	Usage int `json:"usage"`
	Max   int `json:"max"`
}

EmailGlobalQuota represents the global quota and usage

type EmailList

type EmailList struct {
	EmailAccounts []EmailAccount `json:"emailaccounts"`
	EmailAliases  []EmailAlias   `json:"emailaliases"`
}

EmailList holds arrays of email accounts and aliases

type EmailOverview

type EmailOverview struct {
	Summary EmailOverviewSummary  `json:"summary"`
	Domains []EmailOverviewDomain `json:"domains"`
	Meta    EmailOverviewMeta     `json:"meta"`
}

EmailOverview represents the overview of the accounts email setups.

type EmailOverviewDomain

type EmailOverviewDomain struct {
	DomainName  string `json:"domainname"`
	DisplayName string `json:"displayname"`
	Accounts    int    `json:"accounts"`
	Aliases     int    `json:"aliases"`
}

EmailOverviewDomain represents a single email domain

type EmailOverviewMeta

type EmailOverviewMeta struct {
	Page    int `json:"page"`
	Total   int `json:"total"`
	PerPage int `json:"perpage"`
}

EmailOverviewMeta is used to paginate the results

type EmailOverviewSummary

type EmailOverviewSummary struct {
	Accounts    int `json:"accounts"`
	MaxAccounts int `json:"maxaccounts"`
	Aliases     int `json:"aliases"`
	MaxAliases  int `json:"maxaliases"`
}

EmailOverviewSummary represents limits for the current project

type EmailPricelistContainer

type EmailPricelistContainer struct {
	Quota    EmailQuotaPricelist    `json:"quota"`
	Accounts EmailAccountsPricelist `json:"accounts"`
}

EmailPricelistContainer contains quota and accounts for pricelist

type EmailQuota

type EmailQuota struct {
	EmailAccount string                `json:"emailaccount"`
	Used         EmailAccountQuotaUsed `json:"used"`
	Total        EmailAccountQuota     `json:"total"`
}

EmailQuota represents a quota object for a single email account

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	quota, _ := client.EmailDomains.Quota(context.Background(), "user@example.com")

	fmt.Printf("%#v\n", quota)
}
Output:

type EmailQuotaPricelist

type EmailQuotaPricelist struct {
	Amount     string  `json:"amount"`
	Currency   string  `json:"currency"`
	Unit       string  `json:"unit"`
	FreeAmount float64 `json:"freeamount"`
}

EmailQuotaPricelist is the pricelist for quota options

type GlobalQuotaParams

type GlobalQuotaParams struct {
	GlobalQuota int `json:"globalquota,omitempty"`
}

GlobalQuotaParams is used for updating the global quota for email accounts.

type IP

type IP struct {
	Address         string   `json:"ipaddress"`
	Broadcast       string   `json:"broadcast,omitempty"`
	Cost            IPCost   `json:"cost,omitempty"`
	DataCenter      string   `json:"datacenter,omitempty"`
	Gateway         string   `json:"gateway,omitempty"`
	LockedToAccount string   `json:"lockedtoaccount,omitempty"`
	NameServers     []string `json:"nameservers,omitempty"`
	Netmask         string   `json:"netmask,omitempty"`
	Platforms       []string `json:"platforms,omitempty"`
	Platform        string   `json:"platform,omitempty"`
	PTR             string   `json:"ptr,omitempty"`
	Reserved        string   `json:"reserved,omitempty"`
	ServerID        string   `json:"serverid,omitempty"`
	Version         int      `json:"ipversion,omitempty"`
}

IP represents an IP address

func (*IP) IsIPv4

func (ip *IP) IsIPv4() bool

IsIPv4 verify that ip is IPv4

func (*IP) IsIPv6

func (ip *IP) IsIPv6() bool

IsIPv6 verify that ip is IPv6

type IPCost

type IPCost struct {
	Amount     float64 `json:"amount"`
	Currency   string  `json:"currency"`
	TimePeriod string  `json:"timeperiod"`
}

IPCost is used to show cost details for a IP address

type IPService

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

IPService provides functions to interact with IP addresses

func (*IPService) Available

func (s *IPService) Available(context context.Context, params AvailableIPsParams) (*[]IP, error)

Available returns a list of IP addresses available for reservation

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	ips, _ := client.IPs.Available(context.Background(), glesys.AvailableIPsParams{
		DataCenter: "Falkenberg",
		Platform:   "OpenVZ",
		Version:    4,
	})

	for _, ip := range *ips {
		fmt.Println(ip.Address)
	}
}
Output:

func (*IPService) Details

func (s *IPService) Details(context context.Context, ipAddress string) (*IP, error)

Details about an IP address

func (*IPService) Release

func (s *IPService) Release(context context.Context, ipAddress string) error

Release releases a reserved IP address

Example
package main

import (
	"context"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	client.IPs.Release(context.Background(), "1.2.3.4")
}
Output:

func (*IPService) Reserve

func (s *IPService) Reserve(context context.Context, ipAddress string) (*IP, error)

Reserve reserves an available IP address

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	ip, _ := client.IPs.Reserve(context.Background(), "1.2.3.4")

	fmt.Println(ip.Address)
}
Output:

func (*IPService) Reserved

func (s *IPService) Reserved(context context.Context) (*[]IP, error)

Reserved returns a list of reserved IP addresses

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	ips, _ := client.IPs.Reserved(context.Background())

	for _, ip := range *ips {
		fmt.Println(ip.Address)
	}
}
Output:

func (*IPService) ResetPTR

func (s *IPService) ResetPTR(context context.Context, ipAddress string) (*IP, error)

ResetPTR resets PTR for an IP address

func (*IPService) SetPTR

func (s *IPService) SetPTR(context context.Context, ipAddress string, ptrdata string) (*IP, error)

SetPTR sets PTR for an IP address

type ListEmailsParams

type ListEmailsParams struct {
	Filter string `json:"filter,omitempty"`
}

ListEmailsParams is used for filtering when listing emails for a domain.

type LoadBalancer

type LoadBalancer struct {
	DataCenter string `json:"datacenter"`
	ID         string `json:"loadbalancerid"`
	Name       string `json:"name"`
}

LoadBalancer represents a loadbalancer

type LoadBalancerBackend

type LoadBalancerBackend struct {
	ConnectTimeout  int      `json:"connecttimeout"`
	Mode            string   `json:"mode"`
	Name            string   `json:"name"`
	ResponseTimeout int      `json:"responsetimeout"`
	Status          string   `json:"status"`
	StickySession   string   `json:"stickysessions"`
	Targets         []Target `json:"targets"`
}

LoadBalancerBackend represents a LoadBalancer Backend

type LoadBalancerCost

type LoadBalancerCost struct {
	Amount     float64 `json:"amount"`
	Currency   string  `json:"currency"`
	Timeperiod string  `json:"timeperiod"`
}

LoadBalancerCost represents the cost details for a load balancer

type LoadBalancerDetails

type LoadBalancerDetails struct {
	BackendsList  []LoadBalancerBackend  `json:"backends"`
	Blacklists    []string               `json:"blacklist"`
	Cost          LoadBalancerCost       `json:"cost"`
	DataCenter    string                 `json:"datacenter"`
	FrontendsList []LoadBalancerFrontend `json:"frontends"`
	ID            string                 `json:"loadbalancerid"`
	IPList        []LoadBalancerIP       `json:"ipaddress"`
	Name          string                 `json:"name"`
}

LoadBalancerDetails represents the detailed version of a load balancer

type LoadBalancerFrontend

type LoadBalancerFrontend struct {
	Backend        string `json:"backend"`
	ClientTimeout  int    `json:"clienttimeout"`
	MaxConnections int    `json:"maxconnections"`
	Name           string `json:"name"`
	Port           int    `json:"port"`
	Status         string `json:"status"`
	SSLCertificate string `json:"sslcertificate"`
}

LoadBalancerFrontend represents a LoadBalancer Frontend

type LoadBalancerIP

type LoadBalancerIP struct {
	Address         string  `json:"ipaddress"`
	Cost            float64 `json:"cost"`
	Currency        string  `json:"currency"`
	LockedToAccount bool    `json:"lockedtoaccount"`
	Version         int     `json:"version"`
}

LoadBalancerIP represents a single load balancer IP

type LoadBalancerService

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

LoadBalancerService provides functions to interact with LoadBalancers

func (*LoadBalancerService) AddBackend

func (lb *LoadBalancerService) AddBackend(context context.Context, loadbalancerID string, params AddBackendParams) (*LoadBalancerDetails, error)

AddBackend creates a new backend used by the loadbalancer specified

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	loadbalancer, _ := client.LoadBalancers.AddBackend(context.Background(), "lb123456",
		glesys.AddBackendParams{
			Name: "mywebbackend",
			Mode: "http",
		})

	// print the name of all backends for the LoadBalancer
	for i := range (*loadbalancer).BackendsList {
		be := (*loadbalancer).BackendsList[i]
		fmt.Println("Name:", be.Name)
	}
}
Output:

func (*LoadBalancerService) AddCertificate

func (lb *LoadBalancerService) AddCertificate(context context.Context, loadbalancerID string, params AddCertificateParams) error

AddCertificate adds a certificate to the loadbalancer specified

Example
package main

import (
	"context"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	mybase64pem := "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCm15Y2VydAotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCi0tLS0tQkVHSU4gUFJJVkFURSBLRVktLS0tLQpteWtleQotLS0tLUVORCBQUklWQVRFIEtFWS0tLS0tCg=="

	client.LoadBalancers.AddCertificate(context.Background(), "lb123456", glesys.AddCertificateParams{
		Name:        "mycert",
		Certificate: mybase64pem,
	})
}
Output:

func (*LoadBalancerService) AddFrontend

func (lb *LoadBalancerService) AddFrontend(context context.Context, loadbalancerID string, params AddFrontendParams) (*LoadBalancerDetails, error)

AddFrontend creates a new frontend used by the loadbalancer specified

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	loadbalancer, _ := client.LoadBalancers.AddFrontend(context.Background(), "lb123456",
		glesys.AddFrontendParams{
			Name:           "mywebfrontend",
			Backend:        "mywebbackend",
			Port:           80,
			ClientTimeout:  4000,
			MaxConnections: 1000,
		})

	// print the name of all frontends for the LoadBalancer
	for i := range (*loadbalancer).FrontendsList {
		fe := (*loadbalancer).FrontendsList[i]
		fmt.Println("Name:", fe.Name)
	}
}
Output:

func (*LoadBalancerService) AddTarget

func (lb *LoadBalancerService) AddTarget(context context.Context, loadbalancerID string, params AddTargetParams) (*LoadBalancerDetails, error)

AddTarget adds a target to the backend specified

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	loadbalancer, _ := client.LoadBalancers.AddTarget(context.Background(), "lb123456",
		glesys.AddTargetParams{
			Backend:  "mywebbackend",
			Name:     "web01",
			Port:     8080,
			TargetIP: "172.17.0.10",
			Weight:   5,
		})

	for i := range (*loadbalancer).BackendsList {
		be := (*loadbalancer).BackendsList[i]
		for k := range be.Targets {
			fmt.Printf("Backend: %s, Target: %s\n", be.Name, be.Targets[k].Name)
		}
	}
}
Output:

func (*LoadBalancerService) AddToBlacklist

func (lb *LoadBalancerService) AddToBlacklist(context context.Context, loadbalancerID string, params BlacklistParams) (*LoadBalancerDetails, error)

AddToBlacklist adds a prefix to loadbalancer blacklist

func (*LoadBalancerService) Create

Create creates a new loadbalancer

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	loadbalancer, _ := client.LoadBalancers.Create(context.Background(),
		glesys.CreateLoadBalancerParams{
			DataCenter: "Falkenberg",
			Name:       "mylb-1",
		})

	fmt.Println(loadbalancer.ID)
}
Output:

func (*LoadBalancerService) Destroy

func (lb *LoadBalancerService) Destroy(context context.Context, loadbalancerID string) error

Destroy deletes a loadbalancer

Example
package main

import (
	"context"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	client.LoadBalancers.Destroy(context.Background(), "lb123456")
}
Output:

func (*LoadBalancerService) Details

func (lb *LoadBalancerService) Details(context context.Context, loadbalancerID string) (*LoadBalancerDetails, error)

Details returns a detailed information about one loadbalancer

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	loadbalancer, _ := client.LoadBalancers.Details(context.Background(), "lb123456")

	fmt.Println(loadbalancer.Name)
}
Output:

func (*LoadBalancerService) DisableTarget

func (lb *LoadBalancerService) DisableTarget(context context.Context, loadbalancerID string, params ToggleTargetParams) (*LoadBalancerDetails, error)

DisableTarget disables the specified target for the LoadBalancerBackend

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	loadbalancer, _ := client.LoadBalancers.DisableTarget(context.Background(), "lb123456",
		glesys.ToggleTargetParams{
			Backend: "mywebbackend",
			Name:    "web01",
		})

	for i := range (*loadbalancer).BackendsList {
		be := (*loadbalancer).BackendsList[i]
		for k := range be.Targets {
			fmt.Printf("Backend: %s, Target: %s, Status: %s\n", be.Name, be.Targets[k].Name, be.Targets[k].Status)
		}
	}
}
Output:

func (*LoadBalancerService) Edit

func (lb *LoadBalancerService) Edit(context context.Context, loadbalancerID string, params EditLoadBalancerParams) (*LoadBalancerDetails, error)

Edit edits a loadbalancer

func (*LoadBalancerService) EditBackend

func (lb *LoadBalancerService) EditBackend(context context.Context, loadbalancerID string, params EditBackendParams) (*LoadBalancerDetails, error)

EditBackend edits a Backend

func (*LoadBalancerService) EditFrontend

func (lb *LoadBalancerService) EditFrontend(context context.Context, loadbalancerID string, params EditFrontendParams) (*LoadBalancerDetails, error)

EditFrontend edits a frontend

func (*LoadBalancerService) EditTarget

func (lb *LoadBalancerService) EditTarget(context context.Context, loadbalancerID string, params EditTargetParams) (*LoadBalancerDetails, error)

EditTarget edits a target for the specified backend

func (*LoadBalancerService) EnableTarget

func (lb *LoadBalancerService) EnableTarget(context context.Context, loadbalancerID string, params ToggleTargetParams) (*LoadBalancerDetails, error)

EnableTarget enables a target for the specified LoadBalancerBackend

func (*LoadBalancerService) List

func (lb *LoadBalancerService) List(context context.Context) (*[]LoadBalancer, error)

List returns a list of loadbalancers

func (*LoadBalancerService) ListCertificates

func (lb *LoadBalancerService) ListCertificates(context context.Context, loadbalancerID string) (*[]string, error)

ListCertificates list certificates for the LoadBalancer

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	certlist, _ := client.LoadBalancers.ListCertificates(context.Background(), "lb123456")

	for _, cert := range *certlist {
		fmt.Println("Certificate:", cert)
	}
}
Output:

func (*LoadBalancerService) RemoveBackend

func (lb *LoadBalancerService) RemoveBackend(context context.Context, loadbalancerID string, params RemoveBackendParams) error

RemoveBackend deletes a backend

func (*LoadBalancerService) RemoveCertificate

func (lb *LoadBalancerService) RemoveCertificate(context context.Context, loadbalancerID string, params string) error

RemoveCertificate deletes a certificate from the loadbalancer

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	err := client.LoadBalancers.RemoveCertificate(context.Background(), "lb123456", "mycert")

	if err != nil {
		fmt.Printf("Error removing certificate: %s\n", err)
	}
}
Output:

func (*LoadBalancerService) RemoveFromBlacklist

func (lb *LoadBalancerService) RemoveFromBlacklist(context context.Context, loadbalancerID string, params BlacklistParams) (*LoadBalancerDetails, error)

RemoveFromBlacklist deletes a prefix from the LoadBalancer blacklist

func (*LoadBalancerService) RemoveFrontend

func (lb *LoadBalancerService) RemoveFrontend(context context.Context, loadbalancerID string, params RemoveFrontendParams) error

RemoveFrontend deletes a frontend

func (*LoadBalancerService) RemoveTarget

func (lb *LoadBalancerService) RemoveTarget(context context.Context, loadbalancerID string, params RemoveTargetParams) error

RemoveTarget deletes a target from the specified LoadBalancerBackend

type Network

type Network struct {
	DataCenter  string `json:"datacenter"`
	Description string `json:"description"`
	ID          string `json:"networkid"`
	Public      string `json:"public"`
}

Network represents a network

func (*Network) IsPublic

func (s *Network) IsPublic() bool

IsPublic return true if network is public

type NetworkAdapter

type NetworkAdapter struct {
	AdapterType string `json:"adaptertype,omitempty"`
	Bandwidth   int    `json:"bandwidth"`
	ID          string `json:"networkadapterid"`
	Name        string `json:"name"`
	NetworkID   string `json:"networkid"`
	ServerID    string `json:"serverid"`
	State       string `json:"state"`
}

NetworkAdapter represents a networkadapter

func (*NetworkAdapter) IsLocked

func (na *NetworkAdapter) IsLocked() bool

IsLocked returns true if the network adapter is currently locked, false otherwise

func (*NetworkAdapter) IsReady

func (na *NetworkAdapter) IsReady() bool

IsReady returns true if the network adapter is currently ready, false otherwise

type NetworkAdapterService

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

NetworkAdapterService provides functions to interact with Networks

func (*NetworkAdapterService) Create

Create creates a new NetworkAdapter

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	// NOTE: All parameters except ServerID are optional, the values shown below
	// are defaults and can be omitted.

	networkAdapter, _ := client.NetworkAdapters.Create(context.Background(), glesys.CreateNetworkAdapterParams{
		AdapterType: "VMXNET 3", // "E1000" also available
		Bandwidth:   100,
		NetworkID:   "internet-fbg",
		ServerID:    "wps123456",
	})

	fmt.Println(networkAdapter.ID)
}
Output:

func (*NetworkAdapterService) Destroy

func (s *NetworkAdapterService) Destroy(context context.Context, networkAdapterID string) error

Destroy deletes a NetworkAdapter

Example
package main

import (
	"context"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	client.NetworkAdapters.Destroy(context.Background(), "f590b422-453c-4fc4-99e7-af2b72a60f63")
}
Output:

func (*NetworkAdapterService) Details

func (s *NetworkAdapterService) Details(context context.Context, networkAdapterID string) (*NetworkAdapter, error)

Details returns detailed information about a NetworkAdapter

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	networkAdapter, _ := client.NetworkAdapters.Details(context.Background(), "f590b422-453c-4fc4-99e7-af2b72a60f63")

	fmt.Println(networkAdapter.Name)
}
Output:

func (*NetworkAdapterService) Edit

func (s *NetworkAdapterService) Edit(context context.Context, networkAdapterID string, params EditNetworkAdapterParams) (*NetworkAdapter, error)

Edit modifies a NetworkAdapter

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	// NOTE: Changes are not reflected immediately.

	networkAdapter, _ := client.NetworkAdapters.Edit(context.Background(), "f590b422-453c-4fc4-99e7-af2b72a60f63", glesys.EditNetworkAdapterParams{
		Bandwidth: 200,
		NetworkID: "vl12345",
	})

	fmt.Println(networkAdapter.Name)
}
Output:

type NetworkService

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

NetworkService provides functions to interact with Networks

func (*NetworkService) Create

func (s *NetworkService) Create(context context.Context, params CreateNetworkParams) (*Network, error)

Create creates a new network

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	network, _ := client.Networks.Create(context.Background(), glesys.CreateNetworkParams{
		DataCenter:  "Falkenberg",
		Description: "My Network",
	})

	fmt.Println(network.ID)
}
Output:

func (*NetworkService) Destroy

func (s *NetworkService) Destroy(context context.Context, networkID string) error

Destroy deletes a network

Example
package main

import (
	"context"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	client.Networks.Destroy(context.Background(), "vl123456")
}
Output:

func (*NetworkService) Details

func (s *NetworkService) Details(context context.Context, networkID string) (*Network, error)

Details returns detailed information about one network

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	network, _ := client.Networks.Details(context.Background(), "vl123456")

	fmt.Println(network.Description)
}
Output:

func (*NetworkService) Edit

func (s *NetworkService) Edit(context context.Context, networkID string, params EditNetworkParams) (*Network, error)

Edit modifies a network

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	network, _ := client.Networks.Edit(context.Background(), "vl123456", glesys.EditNetworkParams{
		Description: "My Private Network",
	})

	fmt.Println(network.Description)
}
Output:

func (*NetworkService) List

func (s *NetworkService) List(context context.Context) (*[]Network, error)

List returns a list of Networks available under your account

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	networks, _ := client.Networks.List(context.Background())

	for _, network := range *networks {
		fmt.Println(network.ID)
	}
}
Output:

type ObjectStorageCredential

type ObjectStorageCredential struct {
	AccessKey    string `json:"accesskey"`
	Created      string `json:"created"`
	CredentialID string `json:"id"`
	Description  string `json:"description,omitempty"`
	SecretKey    string `json:"secretkey"`
}

ObjectStorageCredential represents a credential for an Object Storage credential

type ObjectStorageInstance

type ObjectStorageInstance struct {
	Created     string                    `json:"created"`
	Credentials []ObjectStorageCredential `json:"credentials"`
	DataCenter  string                    `json:"datacenter"`
	Description string                    `json:"description,omitempty"`
	InstanceID  string                    `json:"id"`
}

ObjectStorageInstance represents a Object Storage Instance

type ObjectStorageService

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

ObjectStorageService provides functions to interact with Networks

func (*ObjectStorageService) CreateCredential

CreateCredential creates a Credential for an Object Storage Instance

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	params := glesys.CreateObjectStorageCredentialParams{
		InstanceID:  "os-ab123",
		Description: "New Key 1",
	}

	credential, _ := client.ObjectStorages.CreateCredential(context.Background(), params)

	fmt.Println(credential.AccessKey)
}
Output:

func (*ObjectStorageService) CreateInstance

CreateInstance creates a new Object Storage Instance

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	params := glesys.CreateObjectStorageInstanceParams{
		DataCenter:  "dc-sto1",
		Description: "My ObjectStorage",
	}

	instance, _ := client.ObjectStorages.CreateInstance(context.Background(), params)

	fmt.Println(instance.InstanceID)
}
Output:

func (*ObjectStorageService) DeleteCredential

func (s *ObjectStorageService) DeleteCredential(context context.Context, params DeleteObjectStorageCredentialParams) error

DeleteCredential deletes a Credential for an Object Storage Instance

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	params := glesys.DeleteObjectStorageCredentialParams{
		InstanceID:   "os-ab123",
		CredentialID: "16df46b3-b2f0-471b-81bf-56c26fff7c4d",
	}

	err := client.ObjectStorages.DeleteCredential(context.Background(), params)

	if err != nil {
		fmt.Printf("Error removing objectstorage credential: %s", err)
	}
}
Output:

func (*ObjectStorageService) DeleteInstance

func (s *ObjectStorageService) DeleteInstance(context context.Context, instanceID string) error

DeleteInstance deletes an Object Storage Instance !!!THIS WILL DELETE ALL CREDENTIALS AND DATA FOR THIS INSTANCE!!!

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	err := client.ObjectStorages.DeleteInstance(context.Background(), "os-ab123")

	if err != nil {
		fmt.Printf("Error removing objectstorage instance: %s", err)
	}
}
Output:

func (*ObjectStorageService) EditInstance

EditInstance Updates the description for an instance

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	params := glesys.EditObjectStorageInstanceParams{
		InstanceID:  "os-ab123",
		Description: "My ObjectStorage New",
	}

	instance, _ := client.ObjectStorages.EditInstance(context.Background(), params)

	fmt.Println(instance.Description)
}
Output:

func (*ObjectStorageService) InstanceDetails

func (s *ObjectStorageService) InstanceDetails(context context.Context, instanceID string) (*ObjectStorageInstance, error)

InstanceDetails returns detailed information about an Object Storage Instance

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	instance, _ := client.ObjectStorages.InstanceDetails(context.Background(), "os-ab123")

	fmt.Println(instance.InstanceID)
}
Output:

func (*ObjectStorageService) ListInstances

func (s *ObjectStorageService) ListInstances(context context.Context) (*[]ObjectStorageInstance, error)

ListInstances returns a list of Object Storage Instances available under your account

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	instances, _ := client.ObjectStorages.ListInstances(context.Background())

	for _, instance := range *instances {
		fmt.Println(instance.InstanceID)
	}
}
Output:

type OverviewParams

type OverviewParams struct {
	Filter string `json:"filter,omitempty"`
	Page   int    `json:"page,omitempty"`
}

OverviewParams is used for filtering and/or paging on the overview endpoint.

type RegisterDNSDomainParams

type RegisterDNSDomainParams struct {
	Name               string `json:"domainname"`
	Address            string `json:"address"`
	City               string `json:"city"`
	Country            string `json:"country"`
	Email              string `json:"email"`
	Firstname          string `json:"firstname"`
	Lastname           string `json:"lastname"`
	OrganizationNumber int    `json:"organizationnumber"`
	Organization       string `json:"organization"`
	PhoneNumber        string `json:"phonenumber"`
	ZipCode            string `json:"zipcode"`

	FaxNumber string `json:"fax,omitempty"`
	NumYears  int    `json:"numyears,omitempty"`
}

RegisterDNSDomainParams - parameters used when registering a domain

type RegistrarInfo

type RegistrarInfo struct {
	AutoRenew        string `json:"autorenew"`
	State            string `json:"state"`
	StateDescription string `json:"statedescription,omitempty"`
	Expire           string `json:"expire,omitempty"`
	TLD              string `json:"tld,omitempty"`
	InvoiceNumber    string `json:"invoicenumber,omitempty"`
}

RegistrarInfo contains information about the registrar for the domain

type RemoveBackendParams

type RemoveBackendParams struct {
	Name string `json:"backendname"`
}

RemoveBackendParams used when removing

type RemoveFrontendParams

type RemoveFrontendParams struct {
	Name string `json:"frontendname"`
}

RemoveFrontendParams used when removing

type RemoveTargetParams

type RemoveTargetParams struct {
	Backend string `json:"backendname"`
	Name    string `json:"name"`
}

RemoveTargetParams used when removing targets

type RenewDNSDomainParams

type RenewDNSDomainParams struct {
	Name     string `json:"domainname"`
	NumYears int    `json:"numyears"`
}

RenewDNSDomainParams - parameters to send when renewing a domain.

type Server

type Server struct {
	DataCenter string `json:"datacenter"`
	Hostname   string `json:"hostname"`
	ID         string `json:"serverid"`
	Platform   string `json:"platform"`
}

Server is a simplified version of a server

type ServerDetails

type ServerDetails struct {
	CPU             int                   `json:"cpucores"`
	Bandwidth       int                   `json:"bandwidth"`
	DataCenter      string                `json:"datacenter"`
	Description     string                `json:"description"`
	Hostname        string                `json:"hostname"`
	ID              string                `json:"serverid"`
	InitialTemplate ServerTemplateDetails `json:"initialtemplate,omitempty"`
	IPList          []ServerIP            `json:"iplist"`
	Platform        string                `json:"platform"`
	Memory          int                   `json:"memorysize"`
	State           string                `json:"state"`
	Storage         int                   `json:"disksize"`
	Template        string                `json:"templatename"`
}

ServerDetails is a more complete representation of a server

func (*ServerDetails) IsLocked

func (sd *ServerDetails) IsLocked() bool

IsLocked returns true if the server is currently locked, false otherwise

func (*ServerDetails) IsRunning

func (sd *ServerDetails) IsRunning() bool

IsRunning returns true if the server is currently running, false otherwise

type ServerIP

type ServerIP struct {
	Address string `json:"ipaddress"`
	Version int    `json:"version,omitempty"`
}

ServerIP is a simple representation of the IP address used in a server.

type ServerService

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

ServerService provides functions to interact with servers

func (*ServerService) Create

func (s *ServerService) Create(context context.Context, params CreateServerParams) (*ServerDetails, error)

Create creates a new server

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	server, _ := client.Servers.Create(context.Background(), glesys.CreateServerParams{
		Bandwidth:    100,
		CampaignCode: "",
		CPU:          2,
		DataCenter:   "Falkenberg",
		Description:  "",
		Hostname:     "my-hostname",
		IPv4:         "any",
		IPv6:         "any",
		Memory:       2048,
		Password:     "...",
		Platform:     "OpenVZ",
		PublicKey:    "...",
		Storage:      50,
		Template:     "Debian 8 64-bit",
	})

	fmt.Println(server.ID)

	// NOTE: You can also use the WithDefaults() to provide defaults values for
	// all required parameters except Password (or PublicKey)

	server2, _ := client.Servers.Create(context.Background(), glesys.CreateServerParams{
		Password: "...",
	}.WithDefaults())

	fmt.Println(server2.ID)
}
Output:

func (*ServerService) Destroy

func (s *ServerService) Destroy(context context.Context, serverID string, params DestroyServerParams) error

Destroy deletes a server

Example
package main

import (
	"context"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	client.Servers.Destroy(context.Background(), "vz12345", glesys.DestroyServerParams{
		KeepIP: true, // KeepIP defaults to false
	})
}
Output:

func (*ServerService) Details

func (s *ServerService) Details(context context.Context, serverID string) (*ServerDetails, error)

Details returns detailed information about one server

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	server, _ := client.Servers.Details(context.Background(), "vz12345")

	fmt.Println(server.Hostname)
}
Output:

func (*ServerService) Edit

func (s *ServerService) Edit(context context.Context, serverID string, params EditServerParams) (*ServerDetails, error)

Edit modifies a server

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	server, _ := client.Servers.Edit(context.Background(), "vz12345", glesys.EditServerParams{
		Bandwidth:   100,
		CPU:         4,
		Description: "Web Server",
		Hostname:    "example.com",
		Memory:      4096,
		Storage:     250,
	})

	fmt.Println(server.ID)
}
Output:

func (*ServerService) List

func (s *ServerService) List(context context.Context) (*[]Server, error)

List returns a list of servers

Example
package main

import (
	"context"
	"fmt"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	servers, _ := client.Servers.List(context.Background())

	for _, server := range *servers {
		fmt.Println(server.Hostname)
	}
}
Output:

func (*ServerService) Start

func (s *ServerService) Start(context context.Context, serverID string) error

Start turns on a server

Example
package main

import (
	"context"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	client.Servers.Start(context.Background(), "vz12345")
}
Output:

func (*ServerService) Stop

func (s *ServerService) Stop(context context.Context, serverID string, params StopServerParams) error

Stop turns off a server

Example
package main

import (
	"context"

	glesys "github.com/glesys/glesys-go/v3"
)

func main() {
	client := glesys.NewClient("CL12345", "your-api-key", "my-application/0.0.1")

	client.Servers.Stop(context.Background(), "vz12345", glesys.StopServerParams{
		Type: "reboot", // Type "soft", "hard" and "reboot" available
	})
}
Output:

type ServerTemplateDetails

type ServerTemplateDetails struct {
	ID          string   `json:"id"`
	CurrentTags []string `json:"currenttags,omitempty"`
	Name        string   `json:"name"`
}

ServerTemplateDetails represents initialtemplate for a KVM server.

type SetAutoRenewParams

type SetAutoRenewParams struct {
	Name         string `json:"domainname"`
	SetAutoRenew string `json:"setautorenew"`
}

SetAutoRenewParams - parameters to send for renewing a domain automatically.

type StopServerParams

type StopServerParams struct {
	Type string `json:"type"`
}

StopServerParams is used when stopping a server. Supported types are `soft` `hard` and `reboot`.

type Target

type Target struct {
	Enabled  bool   `json:"enabled"`
	Name     string `json:"name"`
	Port     int    `json:"port"`
	Status   string `json:"status"`
	TargetIP string `json:"ipaddress"`
	Weight   int    `json:"weight"`
}

Target is used in backends

type ToggleTargetParams

type ToggleTargetParams struct {
	Backend string `json:"backendname"`
	Name    string `json:"targetname"`
}

ToggleTargetParams used when enabling/disabling targets

type UpdateRecordParams

type UpdateRecordParams struct {
	RecordID int    `json:"recordid"`
	Data     string `json:"data,omitempty"`
	Host     string `json:"host,omitempty"`
	Type     string `json:"type,omitempty"`
	TTL      int    `json:"ttl,omitempty"`
}

UpdateRecordParams - parameters for updating domain records

type User

type User struct {
	Username   string   `json:"username"`
	PublicKeys []string `json:"sshkeys,omitempty"`
	Password   string   `json:"password,omitempty"`
}

User represents a system user when creating servers (currently supported in KVM)

Jump to

Keyboard shortcuts

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