brightbox

package module
v2.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 35 Imported by: 4

README

Brightbox Go Library

Go Reference

gobrightbox is a Brightbox API client library written in Go.

Documentation is available at pkg.go.dev

The following are the instructions for version 1 of the GO library.

version 2 instructions are in the v2 directory.

Install

go get github.com/brightbox/gobrightbox@vX.Y.Z

where X.Y.Z is the version you need.

Authentication

This client does not itself handle authentication. Instead, use the standard OAuth2 golang library to authenticate and create tokens.

Supported Objects

Help

If you need help using this library, drop an email to support at brightbox dot com.

Licence

This code is released under an MIT License.

Copyright (c) 2015-2022 Brightbox Systems Ltd.

Documentation

Overview

Package brightbox provides a client to access the Brightbox API

A Client is created by passing a context and a config to the Connect function

// Setup connection to API
client, err := brightbox.Connect(ctx, conf)

There are two types of Config available. A [clientcredentials.Config] authenticates using an API Client and is specific to a particular Brightbox account. A [passwordcredentials.Config] authenticates using a Username and can be used with any authorised Brightbox account.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

type APIClient struct {
	ResourceRef
	ID               string
	Name             string
	Description      string
	Secret           string
	PermissionsGroup permissionsgroup.Enum `json:"permissions_group"`
	RevokedAt        *time.Time            `json:"revoked_at"`
	Account          *Account
}

APIClient represents an API client. https://api.gb1.brightbox.com/1.0/#api_client

type APIClientOptions

type APIClientOptions struct {
	ID               string                `json:"-"`
	Name             *string               `json:"name,omitempty"`
	Description      *string               `json:"description,omitempty"`
	PermissionsGroup permissionsgroup.Enum `json:"permissions_group,omitempty"`
}

APIClientOptions is used to create and update api clients

type APIError

type APIError struct {
	// StatusCode will hold the HTTP status code from the request that errored
	StatusCode int
	// Status will hold the HTTP status line from the request that errored
	Status string
	// AuthError will hold any available OAuth "error" field contents. See
	// https://api.gb1.brightbox.com/1.0/#errors
	AuthError string `json:"error"`
	// AuthErrorDescription will hold any available OAuth "error_description"
	// field contents. See https://api.gb1.brightbox.com/1.0/#errors
	AuthErrorDescription string `json:"error_description"`
	// ErrorName will hold any available Brightbox API "error_name" field
	// contents. See https://api.gb1.brightbox.com/1.0/#request_errors
	ErrorName string `json:"error_name"`
	// Errors will hold any available Brightbox API "errors" field contents. See
	// https://api.gb1.brightbox.com/1.0/#request_errors
	Errors []string `json:"errors"`
	// ParseError will hold any errors from the JSON parser whilst parsing an
	// API response
	ParseError error
	// RequestURL will hold the full URL used to make the request that errored,
	// if available
	RequestURL *url.URL
	// ResponseBody will hold the raw respose body of the request that errored,
	// if available
	ResponseBody []byte
}

APIError can be returned when an API request fails. It provides any error messages provided by the API, along with other details about the response.

func (*APIError) Error

func (e *APIError) Error() string

Error implements the error interface

func (*APIError) Unwrap

func (e *APIError) Unwrap() error

Unwrap implements the error wrapping interface Returns the parse errors from the JSON parser and Unmarshal interface

type Account

type Account struct {
	ResourceRef
	ID                    string
	Name                  string
	Status                accountstatus.Enum `json:"status"`
	Address1              string             `json:"address_1"`
	Address2              string             `json:"address_2"`
	City                  string
	County                string
	Postcode              string
	CountryCode           string     `json:"country_code"`
	CountryName           string     `json:"country_name"`
	VatRegistrationNumber string     `json:"vat_registration_number"`
	TelephoneNumber       string     `json:"telephone_number"`
	TelephoneVerified     bool       `json:"telephone_verified"`
	VerifiedTelephone     string     `json:"verified_telephone"`
	VerifiedIP            string     `json:"verified_ip"`
	ValidCreditCard       bool       `json:"valid_credit_card"`
	ServersUsed           uint       `json:"servers_used"`
	RAMLimit              uint       `json:"ram_limit"`
	RAMUsed               uint       `json:"ram_used"`
	DbsInstancesUsed      uint       `json:"dbs_instances_used"`
	DbsRAMLimit           uint       `json:"dbs_ram_limit"`
	DbsRAMUsed            uint       `json:"dbs_ram_used"`
	BlockStorageLimit     uint       `json:"block_storage_limit"`
	BlockStorageUsed      uint       `json:"block_storage_used"`
	CloudIPsLimit         uint       `json:"cloud_ips_limit"`
	CloudIPsUsed          uint       `json:"cloud_ips_used"`
	LoadBalancersLimit    uint       `json:"load_balancers_limit"`
	LoadBalancersUsed     uint       `json:"load_balancers_used"`
	LibraryFtpHost        string     `json:"library_ftp_host"`
	LibraryFtpUser        string     `json:"library_ftp_user"`
	LibraryFtpPassword    string     `json:"library_ftp_password"`
	CreatedAt             *time.Time `json:"created_at"`
	VerifiedAt            *time.Time `json:"verified_at"`
	Owner                 *User
	Clients               []APIClient
	Images                []Image
	Servers               []Server
	LoadBalancers         []LoadBalancer     `json:"load_balancers"`
	DatabaseServers       []DatabaseServer   `json:"database_servers"`
	DatabaseSnapshots     []DatabaseSnapshot `json:"database_snapshots"`
	CloudIPs              []CloudIP          `json:"cloud_ips"`
	ServerGroups          []ServerGroup      `json:"server_groups"`
	FirewallPolicies      []FirewallPolicy   `json:"firewall_policies"`
	Users                 []User
	Volumes               []Volume
	Zones                 []Zone
}

Account represents a Brightbox Cloud Account https://api.gb1.brightbox.com/1.0/#account

func (Account) CreatedAtUnix

func (s Account) CreatedAtUnix() int64

CreatedAt implements the CreateDated interface for Account

type AccountOptions

type AccountOptions struct {
	ID                    string  `json:"-"`
	Name                  *string `json:"name,omitempty"`
	Address1              *string `json:"address_1,omitempty"`
	Address2              *string `json:"address_2,omitempty"`
	City                  *string `json:"city,omitempty"`
	County                *string `json:"county,omitempty"`
	Postcode              *string `json:"postcode,omitempty"`
	CountryCode           *string `json:"country_code,omitempty"`
	VatRegistrationNumber *string `json:"vat_registration_number,omitempty"`
	TelephoneNumber       *string `json:"telephone_number,omitempty"`
}

AccountOptions is used to update objects

type Client

type Client struct {
	UserAgent string
	// contains filtered or unexported fields
}

Client represents a connection to the Brightbox API. You should use NewConnect to allocate and configure Clients, and pass in either a clientcredentials or password configuration.

func Connect

func Connect(ctx context.Context, config Oauth2) (*Client, error)

Connect allocates and configures a Client for interacting with the API.

Example (Api_client_auth)

Authenticate using an API Client identifier and secret, and get a list of configMaps

package main

import (
	"context"
	"fmt"
	"log"

	brightbox "github.com/brightbox/gobrightbox/v2"
	"github.com/brightbox/gobrightbox/v2/clientcredentials"
)

func main() {
	// Brightbox client details issued on a specific account
	clientID := "cli-xxxxx"
	clientSecret := "somesecret"

	// Setup Config
	conf := &clientcredentials.Config{
		ID:     clientID,
		Secret: clientSecret,
	}

	// Underlying network connection context.
	ctx := context.Background()

	// Setup connection to API
	client, err := brightbox.Connect(ctx, conf)
	if err != nil {
		log.Fatal(err)
	}

	// Get a list of configMaps
	configMaps, err := client.ConfigMaps(ctx)
	if err != nil {
		log.Fatal(err)
	}
	for _, configMap := range configMaps {
		fmt.Printf("id:%s name:%s\n", configMap.ID, configMap.Name)
	}

	// Create a new configMap
	name := "new_map"
	data := map[string]interface{}{
		"attribute": 42,
	}
	configMap, err := client.CreateConfigMap(
		ctx,
		brightbox.ConfigMapOptions{
			Name: &name,
			Data: &data,
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("id:%s name:%s\n", configMap.ID, configMap.Name)
}
Output:

Example (Different_region)

Authenticate using an API Client identifier and secret, and get a list of configMaps, but in a different region

package main

import (
	"context"
	"fmt"
	"log"

	brightbox "github.com/brightbox/gobrightbox/v2"
	"github.com/brightbox/gobrightbox/v2/clientcredentials"
	"github.com/brightbox/gobrightbox/v2/endpoint"
)

func main() {
	// Brightbox client details issued on a specific account
	clientID := "cli-xxxxx"
	clientSecret := "somesecret"
	region := "https://api.gb1s.brightbox.com"

	// Setup Config
	conf := &clientcredentials.Config{
		ID:     clientID,
		Secret: clientSecret,
		Config: endpoint.Config{
			BaseURL: region,
		},
	}

	// Underlying network connection context.
	ctx := context.Background()

	// Setup connection to API
	client, err := brightbox.Connect(ctx, conf)
	if err != nil {
		log.Fatal(err)
	}

	// Get a list of configMaps
	configMaps, err := client.ConfigMaps(ctx)
	if err != nil {
		log.Fatal(err)
	}
	for _, configMap := range configMaps {
		fmt.Printf("id:%s name:%s\n", configMap.ID, configMap.Name)
	}

	// Create a new configMap
	name := "new_map"
	data := map[string]interface{}{
		"attribute": 42,
	}
	configMap, err := client.CreateConfigMap(
		ctx,
		brightbox.ConfigMapOptions{
			Name: &name,
			Data: &data,
		},
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("id:%s name:%s\n", configMap.ID, configMap.Name)
}
Output:

Example (Password_auth)

Authenticate using OAuth2 password credentials, and get a list of configMaps

package main

import (
	"context"
	"fmt"
	"log"

	brightbox "github.com/brightbox/gobrightbox/v2"
	"github.com/brightbox/gobrightbox/v2/endpoint"
	"github.com/brightbox/gobrightbox/v2/passwordcredentials"
)

func main() {
	// Brightbox username and password
	userName := "john@example.com"
	userPassword := "mypassword"
	// Users can have multiple accounts, so you need to specify which one
	accountID := "acc-h3nbk"
	// These OAuth2 application credentials are public, distributed with the
	// cli.
	applicationID := "app-12345"
	applicationSecret := "mocbuipbiaa6k6c"

	// Setup Config
	conf := &passwordcredentials.Config{
		UserName: userName,
		Password: userPassword,
		ID:       applicationID,
		Secret:   applicationSecret,
		Config: endpoint.Config{
			Account: accountID,
			Scopes:  endpoint.InfrastructureScope,
		},
	}

	// Underlying network connection context.
	ctx := context.Background()

	// Setup connection to API
	client, err := brightbox.Connect(ctx, conf)
	if err != nil {
		log.Fatal(err)
	}

	// Get a list of configMaps
	configMaps, err := client.ConfigMaps(ctx)
	if err != nil {
		log.Fatal(err)
	}
	for _, configMap := range configMaps {
		fmt.Printf("id:%s name:%s\n", configMap.ID, configMap.Name)
	}
}
Output:

Example (Server_type_by_handle)

Authenticate using an API Client identifier and secret, and obtain a ServerType by its handle

package main

import (
	"context"
	"fmt"
	"log"

	brightbox "github.com/brightbox/gobrightbox/v2"
	"github.com/brightbox/gobrightbox/v2/clientcredentials"
)

func main() {
	// Brightbox client details issued on a specific account
	clientID := "cli-xxxxx"
	clientSecret := "somesecret"

	// Setup Config
	conf := &clientcredentials.Config{
		ID:     clientID,
		Secret: clientSecret,
	}

	// Underlying network connection context.
	ctx := context.Background()

	// Setup connection to API
	client, err := brightbox.Connect(ctx, conf)
	if err != nil {
		log.Fatal(err)
	}

	// Get a server type by handle
	serverType, err := client.ServerTypeByHandle(ctx, "2gb.ssd")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("id:%s name:%s\n", serverType.ID, serverType.Name)
}
Output:

func (*Client) APIClient

func (c *Client) APIClient(ctx context.Context, identifier string) (*APIClient, error)

APIClient retrieves a detailed view of one resource

func (*Client) APIClients

func (c *Client) APIClients(ctx context.Context) ([]APIClient, error)

APIClients returns the collection view for APIClient

func (*Client) Account

func (c *Client) Account(ctx context.Context, identifier string) (*Account, error)

Account retrieves a detailed view of one resource

func (*Client) Accounts

func (c *Client) Accounts(ctx context.Context) ([]Account, error)

Accounts returns the collection view for Account

func (*Client) ActivateConsoleForServer

func (c *Client) ActivateConsoleForServer(ctx context.Context, identifier string) (*Server, error)

ActivateConsoleForServer will issue a request to enable the graphical console for an existing server.

func (*Client) AddListenersToLoadBalancer

func (c *Client) AddListenersToLoadBalancer(ctx context.Context, identifier string, listeners []LoadBalancerListener) (*LoadBalancer, error)

AddListenersToLoadBalancer adds listeners to an existing load balancer.

func (*Client) AddNodesToLoadBalancer

func (c *Client) AddNodesToLoadBalancer(ctx context.Context, identifier string, nodes []LoadBalancerNode) (*LoadBalancer, error)

AddNodesToLoadBalancer adds nodes to an existing load balancer.

func (*Client) AddServersToServerGroup

func (c *Client) AddServersToServerGroup(ctx context.Context, identifier string, attachment ServerGroupMemberList) (*ServerGroup, error)

AddServersToServerGroup adds servers to an existing server group

func (*Client) AllowUnknownFields

func (q *Client) AllowUnknownFields()

AllowUnknownFields stops the Client generating an error is an unsupported field is returned by the API.

func (*Client) ApplyFirewallPolicy

func (c *Client) ApplyFirewallPolicy(ctx context.Context, identifier string, attachment FirewallPolicyAttachment) (*FirewallPolicy, error)

ApplyFirewallPolicy issues a request to apply the given firewall policy to the given server group.

func (*Client) AttachVolume

func (c *Client) AttachVolume(ctx context.Context, identifier string, attachment VolumeAttachment) (*Volume, error)

AttachVolume issues a request to attach the volume to a particular server and optionally mark it as the boot volume

func (*Client) CloudIP

func (c *Client) CloudIP(ctx context.Context, identifier string) (*CloudIP, error)

CloudIP retrieves a detailed view of one resource

func (*Client) CloudIPs

func (c *Client) CloudIPs(ctx context.Context) ([]CloudIP, error)

CloudIPs returns the collection view for CloudIP

func (*Client) Collaboration

func (c *Client) Collaboration(ctx context.Context, identifier string) (*Collaboration, error)

Collaboration retrieves a detailed view of one resource

func (*Client) Collaborations

func (c *Client) Collaborations(ctx context.Context) ([]Collaboration, error)

Collaborations returns the collection view for Collaboration

func (*Client) ConfigMap

func (c *Client) ConfigMap(ctx context.Context, identifier string) (*ConfigMap, error)

ConfigMap retrieves a detailed view of one resource

func (*Client) ConfigMaps

func (c *Client) ConfigMaps(ctx context.Context) ([]ConfigMap, error)

ConfigMaps returns the collection view for ConfigMap

func (*Client) CreateAPIClient

func (c *Client) CreateAPIClient(ctx context.Context, newAPIClient APIClientOptions) (*APIClient, error)

CreateAPIClient creates a new resource from the supplied option map.

It takes an instance of APIClientOptions. Not all attributes can be specified at create time (such as ID, which is allocated for you).

func (*Client) CreateCloudIP

func (c *Client) CreateCloudIP(ctx context.Context, newCloudIP CloudIPOptions) (*CloudIP, error)

CreateCloudIP creates a new resource from the supplied option map.

It takes an instance of CloudIPOptions. Not all attributes can be specified at create time (such as ID, which is allocated for you).

func (*Client) CreateCollaboration

func (c *Client) CreateCollaboration(ctx context.Context, newCollaboration CollaborationOptions) (*Collaboration, error)

CreateCollaboration creates a new resource from the supplied option map.

It takes an instance of CollaborationOptions. Not all attributes can be specified at create time (such as ID, which is allocated for you).

func (*Client) CreateConfigMap

func (c *Client) CreateConfigMap(ctx context.Context, newConfigMap ConfigMapOptions) (*ConfigMap, error)

CreateConfigMap creates a new resource from the supplied option map.

It takes an instance of ConfigMapOptions. Not all attributes can be specified at create time (such as ID, which is allocated for you).

func (*Client) CreateDatabaseServer

func (c *Client) CreateDatabaseServer(ctx context.Context, newDatabaseServer DatabaseServerOptions) (*DatabaseServer, error)

CreateDatabaseServer creates a new resource from the supplied option map.

It takes an instance of DatabaseServerOptions. Not all attributes can be specified at create time (such as ID, which is allocated for you).

func (*Client) CreateFirewallPolicy

func (c *Client) CreateFirewallPolicy(ctx context.Context, newFirewallPolicy FirewallPolicyOptions) (*FirewallPolicy, error)

CreateFirewallPolicy creates a new resource from the supplied option map.

It takes an instance of FirewallPolicyOptions. Not all attributes can be specified at create time (such as ID, which is allocated for you).

func (*Client) CreateFirewallRule

func (c *Client) CreateFirewallRule(ctx context.Context, newFirewallRule FirewallRuleOptions) (*FirewallRule, error)

CreateFirewallRule creates a new resource from the supplied option map.

It takes an instance of FirewallRuleOptions. Not all attributes can be specified at create time (such as ID, which is allocated for you).

func (*Client) CreateImage

func (c *Client) CreateImage(ctx context.Context, newImage ImageOptions) (*Image, error)

CreateImage creates a new resource from the supplied option map.

It takes an instance of ImageOptions. Not all attributes can be specified at create time (such as ID, which is allocated for you).

func (*Client) CreateLoadBalancer

func (c *Client) CreateLoadBalancer(ctx context.Context, newLoadBalancer LoadBalancerOptions) (*LoadBalancer, error)

CreateLoadBalancer creates a new resource from the supplied option map.

It takes an instance of LoadBalancerOptions. Not all attributes can be specified at create time (such as ID, which is allocated for you).

func (*Client) CreateServer

func (c *Client) CreateServer(ctx context.Context, newServer ServerOptions) (*Server, error)

CreateServer creates a new resource from the supplied option map.

It takes an instance of ServerOptions. Not all attributes can be specified at create time (such as ID, which is allocated for you).

func (*Client) CreateServerGroup

func (c *Client) CreateServerGroup(ctx context.Context, newServerGroup ServerGroupOptions) (*ServerGroup, error)

CreateServerGroup creates a new resource from the supplied option map.

It takes an instance of ServerGroupOptions. Not all attributes can be specified at create time (such as ID, which is allocated for you).

func (*Client) CreateVolume

func (c *Client) CreateVolume(ctx context.Context, newVolume VolumeOptions) (*Volume, error)

CreateVolume creates a new resource from the supplied option map.

It takes an instance of VolumeOptions. Not all attributes can be specified at create time (such as ID, which is allocated for you).

func (*Client) DatabaseServer

func (c *Client) DatabaseServer(ctx context.Context, identifier string) (*DatabaseServer, error)

DatabaseServer retrieves a detailed view of one resource

func (*Client) DatabaseServerType

func (c *Client) DatabaseServerType(ctx context.Context, identifier string) (*DatabaseServerType, error)

DatabaseServerType retrieves a detailed view of one resource

func (*Client) DatabaseServerTypes

func (c *Client) DatabaseServerTypes(ctx context.Context) ([]DatabaseServerType, error)

DatabaseServerTypes returns the collection view for DatabaseServerType

func (*Client) DatabaseServers

func (c *Client) DatabaseServers(ctx context.Context) ([]DatabaseServer, error)

DatabaseServers returns the collection view for DatabaseServer

func (*Client) DatabaseSnapshot

func (c *Client) DatabaseSnapshot(ctx context.Context, identifier string) (*DatabaseSnapshot, error)

DatabaseSnapshot retrieves a detailed view of one resource

func (*Client) DatabaseSnapshots

func (c *Client) DatabaseSnapshots(ctx context.Context) ([]DatabaseSnapshot, error)

DatabaseSnapshots returns the collection view for DatabaseSnapshot

func (*Client) DestroyAPIClient

func (c *Client) DestroyAPIClient(ctx context.Context, identifier string) (*APIClient, error)

DestroyAPIClient destroys an existing resource.

func (*Client) DestroyCloudIP

func (c *Client) DestroyCloudIP(ctx context.Context, identifier string) (*CloudIP, error)

DestroyCloudIP destroys an existing resource.

func (*Client) DestroyCollaboration

func (c *Client) DestroyCollaboration(ctx context.Context, identifier string) (*Collaboration, error)

DestroyCollaboration destroys an existing resource.

func (*Client) DestroyConfigMap

func (c *Client) DestroyConfigMap(ctx context.Context, identifier string) (*ConfigMap, error)

DestroyConfigMap destroys an existing resource.

func (*Client) DestroyDatabaseServer

func (c *Client) DestroyDatabaseServer(ctx context.Context, identifier string) (*DatabaseServer, error)

DestroyDatabaseServer destroys an existing resource.

func (*Client) DestroyDatabaseSnapshot

func (c *Client) DestroyDatabaseSnapshot(ctx context.Context, identifier string) (*DatabaseSnapshot, error)

DestroyDatabaseSnapshot destroys an existing resource.

func (*Client) DestroyFirewallPolicy

func (c *Client) DestroyFirewallPolicy(ctx context.Context, identifier string) (*FirewallPolicy, error)

DestroyFirewallPolicy destroys an existing resource.

func (*Client) DestroyFirewallRule

func (c *Client) DestroyFirewallRule(ctx context.Context, identifier string) (*FirewallRule, error)

DestroyFirewallRule destroys an existing resource.

func (*Client) DestroyImage

func (c *Client) DestroyImage(ctx context.Context, identifier string) (*Image, error)

DestroyImage destroys an existing resource.

func (*Client) DestroyLoadBalancer

func (c *Client) DestroyLoadBalancer(ctx context.Context, identifier string) (*LoadBalancer, error)

DestroyLoadBalancer destroys an existing resource.

func (*Client) DestroyServer

func (c *Client) DestroyServer(ctx context.Context, identifier string) (*Server, error)

DestroyServer destroys an existing resource.

func (*Client) DestroyServerGroup

func (c *Client) DestroyServerGroup(ctx context.Context, identifier string) (*ServerGroup, error)

DestroyServerGroup destroys an existing resource.

func (*Client) DestroyVolume

func (c *Client) DestroyVolume(ctx context.Context, identifier string) (*Volume, error)

DestroyVolume destroys an existing resource.

func (*Client) DetachVolume

func (c *Client) DetachVolume(ctx context.Context, identifier string) (*Volume, error)

DetachVolume issues a request to disconnect a volume from a server

func (*Client) DisallowUnknownFields

func (q *Client) DisallowUnknownFields()

DisallowUnknownFields causes the Client to generate an error if an unsupported field is returned by the API.

func (*Client) ExtractTokenID

func (q *Client) ExtractTokenID() (string, error)

ExtractTokenID implements the AuthResult interface for gophercloud clients

func (*Client) FirewallPolicies

func (c *Client) FirewallPolicies(ctx context.Context) ([]FirewallPolicy, error)

FirewallPolicies returns the collection view for FirewallPolicy

func (*Client) FirewallPolicy

func (c *Client) FirewallPolicy(ctx context.Context, identifier string) (*FirewallPolicy, error)

FirewallPolicy retrieves a detailed view of one resource

func (*Client) FirewallRule

func (c *Client) FirewallRule(ctx context.Context, identifier string) (*FirewallRule, error)

FirewallRule retrieves a detailed view of one resource

func (*Client) FirewallRules

func (c *Client) FirewallRules(ctx context.Context) ([]FirewallRule, error)

FirewallRules returns the collection view for FirewallRule

func (*Client) HTTPClient

func (q *Client) HTTPClient() *http.Client

HTTPClient returns the current HTTP structure within the client

func (*Client) Image

func (c *Client) Image(ctx context.Context, identifier string) (*Image, error)

Image retrieves a detailed view of one resource

func (*Client) Images

func (c *Client) Images(ctx context.Context) ([]Image, error)

Images returns the collection view for Image

func (*Client) Interface

func (c *Client) Interface(ctx context.Context, identifier string) (*Interface, error)

Interface retrieves a detailed view of one resource

func (*Client) Interfaces

func (c *Client) Interfaces(ctx context.Context) ([]Interface, error)

Interfaces returns the collection view for Interface

func (*Client) LoadBalancer

func (c *Client) LoadBalancer(ctx context.Context, identifier string) (*LoadBalancer, error)

LoadBalancer retrieves a detailed view of one resource

func (*Client) LoadBalancers

func (c *Client) LoadBalancers(ctx context.Context) ([]LoadBalancer, error)

LoadBalancers returns the collection view for LoadBalancer

func (*Client) LockDatabaseServer

func (c *Client) LockDatabaseServer(ctx context.Context, identifier string) (*DatabaseServer, error)

LockDatabaseServer locks a resource against destroy requests

func (*Client) LockDatabaseSnapshot

func (c *Client) LockDatabaseSnapshot(ctx context.Context, identifier string) (*DatabaseSnapshot, error)

LockDatabaseSnapshot locks a resource against destroy requests

func (*Client) LockImage

func (c *Client) LockImage(ctx context.Context, identifier string) (*Image, error)

LockImage locks a resource against destroy requests

func (*Client) LockLoadBalancer

func (c *Client) LockLoadBalancer(ctx context.Context, identifier string) (*LoadBalancer, error)

LockLoadBalancer locks a resource against destroy requests

func (*Client) LockServer

func (c *Client) LockServer(ctx context.Context, identifier string) (*Server, error)

LockServer locks a resource against destroy requests

func (*Client) LockVolume

func (c *Client) LockVolume(ctx context.Context, identifier string) (*Volume, error)

LockVolume locks a resource against destroy requests

func (*Client) MapCloudIP

func (c *Client) MapCloudIP(ctx context.Context, identifier string, attachment CloudIPAttachment) (*CloudIP, error)

MapCloudIP issues a request to map the cloud ip to the destination. The destination can be an identifier of any resource capable of receiving a Cloud IP, such as a server interface, a load balancer, or a cloud sql instace.

func (*Client) MoveServersToServerGroup

func (c *Client) MoveServersToServerGroup(ctx context.Context, from string, to string, servers ServerGroupMemberList) (*ServerGroup, error)

MoveServersToServerGroup moves servers between two existing server groups

func (*Client) RebootServer

func (c *Client) RebootServer(ctx context.Context, identifier string) (*Server, error)

RebootServer issues a "soft" reboot to the server, however the OS make ignore it. The console remains connected.

func (*Client) RemoveFirewallPolicy

func (c *Client) RemoveFirewallPolicy(ctx context.Context, identifier string, serverGroup FirewallPolicyAttachment) (*FirewallPolicy, error)

RemoveFirewallPolicy issues a request to remove the given firewall policy from the given server group.

func (*Client) RemoveListenersFromLoadBalancer

func (c *Client) RemoveListenersFromLoadBalancer(ctx context.Context, identifier string, listeners []LoadBalancerListener) (*LoadBalancer, error)

RemoveListenersFromLoadBalancer removes listeners from an existing load balancer.

func (*Client) RemoveNodesFromLoadBalancer

func (c *Client) RemoveNodesFromLoadBalancer(ctx context.Context, identifier string, nodes []LoadBalancerNode) (*LoadBalancer, error)

RemoveNodesFromLoadBalancer removes nodes from an existing load balancer.

func (*Client) RemoveServersFromServerGroup

func (c *Client) RemoveServersFromServerGroup(ctx context.Context, identifier string, attachment ServerGroupMemberList) (*ServerGroup, error)

RemoveServersFromServerGroup remove servers from an existing server group

func (*Client) ResendCollaboration

func (c *Client) ResendCollaboration(ctx context.Context, identifier string) (*Collaboration, error)

ResendCollaboration resends the invitation email to the collaborator.

func (*Client) ResetAPIClientPassword

func (c *Client) ResetAPIClientPassword(ctx context.Context, identifier string) (*APIClient, error)

ResetAPIClientPassword resets the password in APIClient, returning it in the returned resource. This is the only time the new password is available in plaintext.

func (*Client) ResetAccountPassword

func (c *Client) ResetAccountPassword(ctx context.Context, identifier string) (*Account, error)

ResetAccountPassword resets the password in Account, returning it in the returned resource. This is the only time the new password is available in plaintext.

func (*Client) ResetDatabaseServer added in v2.1.0

func (c *Client) ResetDatabaseServer(ctx context.Context, identifier string) (*DatabaseServer, error)

ResetDatabaseServer issues a "reset" instruction to a DatabaseServer

func (*Client) ResetDatabaseServerPassword

func (c *Client) ResetDatabaseServerPassword(ctx context.Context, identifier string) (*DatabaseServer, error)

ResetDatabaseServerPassword resets the password in DatabaseServer, returning it in the returned resource. This is the only time the new password is available in plaintext.

func (*Client) ResetServer

func (c *Client) ResetServer(ctx context.Context, identifier string) (*Server, error)

ResetServer issues a "hard" reboot to the server which cannot be ignored by the OS. The console remains connected.

func (*Client) ResizeDatabaseServer added in v2.1.0

func (c *Client) ResizeDatabaseServer(ctx context.Context, identifier string, newSize DatabaseServerNewSize) (*DatabaseServer, error)

ResizeDatabaseServer issues a request to change the server type of a server changing the amount of cpu and ram it has.

func (*Client) ResizeServer

func (c *Client) ResizeServer(ctx context.Context, identifier string, newSize ServerNewSize) (*Server, error)

ResizeServer issues a request to change the server type of a server changing the amount of cpu and ram it has.

func (*Client) ResizeVolume

func (c *Client) ResizeVolume(ctx context.Context, identifier string, newSize VolumeNewSize) (*Volume, error)

ResizeVolume issues a request to change the server type of a server changing the amount of cpu and ram it has.

func (*Client) ResourceBaseURL

func (q *Client) ResourceBaseURL() *url.URL

ResourceBaseURL returns the base URL within the client

func (*Client) Server

func (c *Client) Server(ctx context.Context, identifier string) (*Server, error)

Server retrieves a detailed view of one resource

func (*Client) ServerGroup

func (c *Client) ServerGroup(ctx context.Context, identifier string) (*ServerGroup, error)

ServerGroup retrieves a detailed view of one resource

func (*Client) ServerGroups

func (c *Client) ServerGroups(ctx context.Context) ([]ServerGroup, error)

ServerGroups returns the collection view for ServerGroup

func (*Client) ServerType

func (c *Client) ServerType(ctx context.Context, identifier string) (*ServerType, error)

ServerType retrieves a detailed view of one resource

func (*Client) ServerTypeByHandle

func (c *Client) ServerTypeByHandle(ctx context.Context, handle string) (*ServerType, error)

ServerType retrieves a detailed view of one resource using a handle

func (*Client) ServerTypes

func (c *Client) ServerTypes(ctx context.Context) ([]ServerType, error)

ServerTypes returns the collection view for ServerType

func (*Client) Servers

func (c *Client) Servers(ctx context.Context) ([]Server, error)

Servers returns the collection view for Server

func (*Client) ShutdownServer

func (c *Client) ShutdownServer(ctx context.Context, identifier string) (*Server, error)

ShutdownServer will issue a safe shutdown request to the server.

func (*Client) StartServer

func (c *Client) StartServer(ctx context.Context, identifier string) (*Server, error)

StartServer will issue a start request for the server to become active.

func (*Client) StopServer

func (c *Client) StopServer(ctx context.Context, identifier string) (*Server, error)

StopServer will issue a stop request for the server to become inactve.

func (*Client) UnMapCloudIP

func (c *Client) UnMapCloudIP(ctx context.Context, identifier string) (*CloudIP, error)

UnMapCloudIP issues a request to unmap the cloud ip.

func (*Client) UnlockDatabaseServer

func (c *Client) UnlockDatabaseServer(ctx context.Context, identifier string) (*DatabaseServer, error)

UnlockDatabaseServer unlocks a resource, re-enabling destroy requests

func (*Client) UnlockDatabaseSnapshot

func (c *Client) UnlockDatabaseSnapshot(ctx context.Context, identifier string) (*DatabaseSnapshot, error)

UnlockDatabaseSnapshot unlocks a resource, re-enabling destroy requests

func (*Client) UnlockImage

func (c *Client) UnlockImage(ctx context.Context, identifier string) (*Image, error)

UnlockImage unlocks a resource, re-enabling destroy requests

func (*Client) UnlockLoadBalancer

func (c *Client) UnlockLoadBalancer(ctx context.Context, identifier string) (*LoadBalancer, error)

UnlockLoadBalancer unlocks a resource, re-enabling destroy requests

func (*Client) UnlockServer

func (c *Client) UnlockServer(ctx context.Context, identifier string) (*Server, error)

UnlockServer unlocks a resource, re-enabling destroy requests

func (*Client) UnlockVolume

func (c *Client) UnlockVolume(ctx context.Context, identifier string) (*Volume, error)

UnlockVolume unlocks a resource, re-enabling destroy requests

func (*Client) UpdateAPIClient

func (c *Client) UpdateAPIClient(ctx context.Context, updateAPIClient APIClientOptions) (*APIClient, error)

UpdateAPIClient updates an existing resources's attributes. Not all attributes can be changed (such as ID).

It takes an instance of APIClientOptions. Specify the resource you want to update using the ID field.

func (*Client) UpdateAccount

func (c *Client) UpdateAccount(ctx context.Context, updateAccount AccountOptions) (*Account, error)

UpdateAccount updates an existing resources's attributes. Not all attributes can be changed (such as ID).

It takes an instance of AccountOptions. Specify the resource you want to update using the ID field.

func (*Client) UpdateCloudIP

func (c *Client) UpdateCloudIP(ctx context.Context, updateCloudIP CloudIPOptions) (*CloudIP, error)

UpdateCloudIP updates an existing resources's attributes. Not all attributes can be changed (such as ID).

It takes an instance of CloudIPOptions. Specify the resource you want to update using the ID field.

func (*Client) UpdateConfigMap

func (c *Client) UpdateConfigMap(ctx context.Context, updateConfigMap ConfigMapOptions) (*ConfigMap, error)

UpdateConfigMap updates an existing resources's attributes. Not all attributes can be changed (such as ID).

It takes an instance of ConfigMapOptions. Specify the resource you want to update using the ID field.

func (*Client) UpdateDatabaseServer

func (c *Client) UpdateDatabaseServer(ctx context.Context, updateDatabaseServer DatabaseServerOptions) (*DatabaseServer, error)

UpdateDatabaseServer updates an existing resources's attributes. Not all attributes can be changed (such as ID).

It takes an instance of DatabaseServerOptions. Specify the resource you want to update using the ID field.

func (*Client) UpdateDatabaseSnapshot

func (c *Client) UpdateDatabaseSnapshot(ctx context.Context, updateDatabaseSnapshot DatabaseSnapshotOptions) (*DatabaseSnapshot, error)

UpdateDatabaseSnapshot updates an existing resources's attributes. Not all attributes can be changed (such as ID).

It takes an instance of DatabaseSnapshotOptions. Specify the resource you want to update using the ID field.

func (*Client) UpdateFirewallPolicy

func (c *Client) UpdateFirewallPolicy(ctx context.Context, updateFirewallPolicy FirewallPolicyOptions) (*FirewallPolicy, error)

UpdateFirewallPolicy updates an existing resources's attributes. Not all attributes can be changed (such as ID).

It takes an instance of FirewallPolicyOptions. Specify the resource you want to update using the ID field.

func (*Client) UpdateFirewallRule

func (c *Client) UpdateFirewallRule(ctx context.Context, updateFirewallRule FirewallRuleOptions) (*FirewallRule, error)

UpdateFirewallRule updates an existing resources's attributes. Not all attributes can be changed (such as ID).

It takes an instance of FirewallRuleOptions. Specify the resource you want to update using the ID field.

func (*Client) UpdateImage

func (c *Client) UpdateImage(ctx context.Context, updateImage ImageOptions) (*Image, error)

UpdateImage updates an existing resources's attributes. Not all attributes can be changed (such as ID).

It takes an instance of ImageOptions. Specify the resource you want to update using the ID field.

func (*Client) UpdateLoadBalancer

func (c *Client) UpdateLoadBalancer(ctx context.Context, updateLoadBalancer LoadBalancerOptions) (*LoadBalancer, error)

UpdateLoadBalancer updates an existing resources's attributes. Not all attributes can be changed (such as ID).

It takes an instance of LoadBalancerOptions. Specify the resource you want to update using the ID field.

func (*Client) UpdateServer

func (c *Client) UpdateServer(ctx context.Context, updateServer ServerOptions) (*Server, error)

UpdateServer updates an existing resources's attributes. Not all attributes can be changed (such as ID).

It takes an instance of ServerOptions. Specify the resource you want to update using the ID field.

func (*Client) UpdateServerGroup

func (c *Client) UpdateServerGroup(ctx context.Context, updateServerGroup ServerGroupOptions) (*ServerGroup, error)

UpdateServerGroup updates an existing resources's attributes. Not all attributes can be changed (such as ID).

It takes an instance of ServerGroupOptions. Specify the resource you want to update using the ID field.

func (*Client) UpdateUser

func (c *Client) UpdateUser(ctx context.Context, updateUser UserOptions) (*User, error)

UpdateUser updates an existing resources's attributes. Not all attributes can be changed (such as ID).

It takes an instance of UserOptions. Specify the resource you want to update using the ID field.

func (*Client) UpdateVolume

func (c *Client) UpdateVolume(ctx context.Context, updateVolume VolumeOptions) (*Volume, error)

UpdateVolume updates an existing resources's attributes. Not all attributes can be changed (such as ID).

It takes an instance of VolumeOptions. Specify the resource you want to update using the ID field.

func (*Client) User

func (c *Client) User(ctx context.Context, identifier string) (*User, error)

User retrieves a detailed view of one resource

func (*Client) Users

func (c *Client) Users(ctx context.Context) ([]User, error)

Users returns the collection view for User

func (*Client) Volume

func (c *Client) Volume(ctx context.Context, identifier string) (*Volume, error)

Volume retrieves a detailed view of one resource

func (*Client) Volumes

func (c *Client) Volumes(ctx context.Context) ([]Volume, error)

Volumes returns the collection view for Volume

func (*Client) Zone

func (c *Client) Zone(ctx context.Context, identifier string) (*Zone, error)

Zone retrieves a detailed view of one resource

func (*Client) ZoneByHandle

func (c *Client) ZoneByHandle(ctx context.Context, handle string) (*Zone, error)

Zone retrieves a detailed view of one resource using a handle

func (*Client) Zones

func (c *Client) Zones(ctx context.Context) ([]Zone, error)

Zones returns the collection view for Zone

type CloudIP

type CloudIP struct {
	ResourceRef
	ID              string
	Name            string
	PublicIP        string             `json:"public_ip"`
	PublicIPv4      string             `json:"public_ipv4"`
	PublicIPv6      string             `json:"public_ipv6"`
	Status          cloudipstatus.Enum `json:"status"`
	ReverseDNS      string             `json:"reverse_dns"`
	Fqdn            string
	Mode            mode.Enum
	Account         *Account
	Interface       *Interface
	Server          *Server
	ServerGroup     *ServerGroup     `json:"server_group"`
	PortTranslators []PortTranslator `json:"port_translators"`
	LoadBalancer    *LoadBalancer    `json:"load_balancer"`
	DatabaseServer  *DatabaseServer  `json:"database_server"`
}

CloudIP represents a Cloud IP https://api.gb1.brightbox.com/1.0/#cloud_ip

type CloudIPAttachment

type CloudIPAttachment struct {
	Destination string `json:"destination"`
}

CloudIPAttachment is used in conjunction with MapCloudIP to specify the destination the CloudIP should be mapped to

type CloudIPOptions

type CloudIPOptions struct {
	ID              string           `json:"-"`
	ReverseDNS      *string          `json:"reverse_dns,omitempty"`
	Mode            mode.Enum        `json:"mode,omitempty"`
	Name            *string          `json:"name,omitempty"`
	PortTranslators []PortTranslator `json:"port_translators,omitempty"`
}

CloudIPOptions is used in conjunction with CreateCloudIP and UpdateCloudIP to create and update cloud IPs.

type Collaboration

type Collaboration struct {
	ResourceRef
	ID         string
	Email      string
	Role       string
	RoleLabel  string `json:"role_label"`
	Status     collaborationstatus.Enum
	CreatedAt  *time.Time `json:"created_at"`
	StartedAt  *time.Time `json:"started_at"`
	FinishedAt *time.Time `json:"finished_at"`
	Account    *Account
	User       *User
	Inviter    *User
}

Collaboration represents an API client. https://api.gb1.brightbox.com/1.0/#api_client

func (Collaboration) CreatedAtUnix

func (s Collaboration) CreatedAtUnix() int64

CreatedAt implements the CreateDated interface for Collaboration

type CollaborationOptions

type CollaborationOptions struct {
	ID    string  `json:"-"`
	Email *string `json:"email,omitempty"`
	Role  *string `json:"role,omitempty"`
}

CollaborationOptions is used to create and update api clients

type ConfigMap

type ConfigMap struct {
	ResourceRef
	ID   string                 `json:"id"`
	Name string                 `json:"name"`
	Data map[string]interface{} `json:"data"`
}

ConfigMap represents a config map https://api.gb1.brightbox.com/1.0/#config_maps

type ConfigMapOptions

type ConfigMapOptions struct {
	ID   string                  `json:"-"`
	Name *string                 `json:"name,omitempty"`
	Data *map[string]interface{} `json:"data,omitempty"`
}

ConfigMapOptions is used to create and update config maps

type CreateDated

type CreateDated interface {
	// The Unix time in seconds the API object was created
	CreatedAtUnix() int64
}

CreateDated is a constraint type that selects all Brightbox objects with a creation date

type DatabaseServer

type DatabaseServer struct {
	ResourceRef
	ID                      string
	Name                    string
	Description             string
	Status                  databaseserverstatus.Enum
	DatabaseEngine          string   `json:"database_engine"`
	DatabaseVersion         string   `json:"database_version"`
	AdminUsername           string   `json:"admin_username"`
	AdminPassword           string   `json:"admin_password"`
	SnapshotsRetention      string   `json:"snapshots_retention"`
	SnapshotsSchedule       string   `json:"snapshots_schedule"`
	AllowAccess             []string `json:"allow_access"`
	MaintenanceWeekday      uint8    `json:"maintenance_weekday"`
	MaintenanceHour         uint8    `json:"maintenance_hour"`
	Locked                  bool
	CreatedAt               *time.Time `json:"created_at"`
	DeletedAt               *time.Time `json:"deleted_at"`
	UpdatedAt               *time.Time `json:"updated_at"`
	SnapshotsScheduleNextAt *time.Time `json:"snapshots_schedule_next_at"`
	Account                 *Account
	Zone                    *Zone
	DatabaseServerType      *DatabaseServerType `json:"database_server_type"`
	CloudIPs                []CloudIP           `json:"cloud_ips"`
}

DatabaseServer represents a database server. https://api.gb1.brightbox.com/1.0/#database_server

func (DatabaseServer) CreatedAtUnix

func (s DatabaseServer) CreatedAtUnix() int64

CreatedAt implements the CreateDated interface for DatabaseServer

type DatabaseServerNewSize added in v2.1.0

type DatabaseServerNewSize = ServerNewSize

DatabaseServerNewSize is used in conjunction with ResizeDatabaseServer to specify the new DatabaseServerType for the Database Server

type DatabaseServerOptions

type DatabaseServerOptions struct {
	ID                 string   `json:"-"`
	Name               *string  `json:"name,omitempty"`
	Description        *string  `json:"description,omitempty"`
	Engine             string   `json:"engine,omitempty"`
	Version            string   `json:"version,omitempty"`
	AllowAccess        []string `json:"allow_access,omitempty"`
	Snapshot           string   `json:"snapshot,omitempty"`
	Zone               string   `json:"zone,omitempty"`
	DatabaseType       string   `json:"database_type,omitempty"`
	MaintenanceWeekday *uint8   `json:"maintenance_weekday,omitempty"`
	MaintenanceHour    *uint8   `json:"maintenance_hour,omitempty"`
	SnapshotsRetention *string  `json:"snapshots_retention,omitempty"`
	SnapshotsSchedule  *string  `json:"snapshots_schedule,omitempty"`
}

DatabaseServerOptions is used in conjunction with CreateDatabaseServer and UpdateDatabaseServer to create and update database servers.

type DatabaseServerType

type DatabaseServerType struct {
	ResourceRef
	ID          string
	Name        string
	Description string
	RAM         uint
	DiskSize    uint `json:"disk_size"`
	Default     bool
}

DatabaseServerType represents a database server type https://api.gb1.brightbox.com/1.0/#database_type

type DatabaseSnapshot

type DatabaseSnapshot struct {
	ResourceRef
	ID              string
	Name            string
	Description     string
	Status          databasesnapshotstatus.Enum
	DatabaseEngine  string `json:"database_engine"`
	DatabaseVersion string `json:"database_version"`
	Source          string
	SourceTrigger   string `json:"source_trigger"`
	Size            uint
	CreatedAt       *time.Time `json:"created_at"`
	UpdatedAt       *time.Time `json:"updated_at"`
	DeletedAt       *time.Time `json:"deleted_at"`
	Locked          bool
	Account         Account
}

DatabaseSnapshot represents a snapshot of a database server. https://api.gb1.brightbox.com/1.0/#databaseSnapshot

func (DatabaseSnapshot) CreatedAtUnix

func (s DatabaseSnapshot) CreatedAtUnix() int64

CreatedAt implements the CreateDated interface for DatabaseSnapshot

type DatabaseSnapshotOptions

type DatabaseSnapshotOptions struct {
	ID          string  `json:"-"`
	Name        *string `json:"name,omitempty"`
	Description *string `json:"description,omitempty"`
}

DatabaseSnapshotOptions is used to update snapshots

type FirewallPolicy

type FirewallPolicy struct {
	ResourceRef
	ID          string
	Name        string
	Default     bool
	Description string
	CreatedAt   *time.Time `json:"created_at"`
	Account     *Account
	ServerGroup *ServerGroup   `json:"server_group"`
	Rules       []FirewallRule `json:"rules"`
}

FirewallPolicy represents a firewall policy. https://api.gb1.brightbox.com/1.0/#firewall_policy

func (FirewallPolicy) CreatedAtUnix

func (s FirewallPolicy) CreatedAtUnix() int64

CreatedAt implements the CreateDated interface for FirewallPolicy

type FirewallPolicyAttachment

type FirewallPolicyAttachment struct {
	ServerGroup string `json:"server_group"`
}

FirewallPolicyAttachment is used in conjunction with FirewallPolicyOptions, ApplyFirewallPolicy and RemoveFirewallPolicy to specify the group that the firewall policy should apply to. The ServerGroup parameter should be a server group identifier.

type FirewallPolicyOptions

type FirewallPolicyOptions struct {
	ID          string  `json:"-"`
	Name        *string `json:"name,omitempty"`
	Description *string `json:"description,omitempty"`
	*FirewallPolicyAttachment
}

FirewallPolicyOptions is used in conjunction with CreateFirewallPolicy and UpdateFirewallPolicy to create and update firewall policies.

type FirewallRule

type FirewallRule struct {
	ResourceRef
	ID              string
	Source          string          `json:"source"`
	SourcePort      string          `json:"source_port"`
	Destination     string          `json:"destination"`
	DestinationPort string          `json:"destination_port"`
	Protocol        string          `json:"protocol"`
	IcmpTypeName    string          `json:"icmp_type_name"`
	Description     string          `json:"description"`
	CreatedAt       *time.Time      `json:"created_at"`
	FirewallPolicy  *FirewallPolicy `json:"firewall_policy"`
}

FirewallRule represents a firewall rule. https://api.gb1.brightbox.com/1.0/#firewall_rule

func (FirewallRule) CreatedAtUnix

func (s FirewallRule) CreatedAtUnix() int64

CreatedAt implements the CreateDated interface for FirewallRule

type FirewallRuleOptions

type FirewallRuleOptions struct {
	ID              string  `json:"-"`
	FirewallPolicy  string  `json:"firewall_policy,omitempty"`
	Protocol        *string `json:"protocol,omitempty"`
	Source          *string `json:"source,omitempty"`
	SourcePort      *string `json:"source_port,omitempty"`
	Destination     *string `json:"destination,omitempty"`
	DestinationPort *string `json:"destination_port,omitempty"`
	IcmpTypeName    *string `json:"icmp_type_name,omitempty"`
	Description     *string `json:"description,omitempty"`
}

FirewallRuleOptions is used in conjunction with CreateFirewallRule and UpdateFirewallRule to create and update firewall rules.

type Image

type Image struct {
	ResourceRef
	ID                string
	Name              string
	Username          string
	Status            imagestatus.Enum
	Locked            bool
	Description       string
	Source            string
	Arch              arch.Enum
	Official          bool
	Public            bool
	Owner             string
	SourceTrigger     sourcetrigger.Enum `json:"source_trigger"`
	SourceType        sourcetype.Enum    `json:"source_type"`
	VirtualSize       uint               `json:"virtual_size"`
	DiskSize          uint               `json:"disk_size"`
	MinRAM            *uint              `json:"min_ram"`
	CompatibilityMode bool               `json:"compatibility_mode"`
	LicenceName       string             `json:"licence_name"`
	CreatedAt         *time.Time         `json:"created_at"`
	Ancestor          *Image
}

Image represents a Machine Image https://api.gb1.brightbox.com/1.0/#image

func (Image) CreatedAtUnix

func (s Image) CreatedAtUnix() int64

CreatedAt implements the CreateDated interface for Image

type ImageOptions

type ImageOptions struct {
	ID                string           `json:"-"`
	Name              *string          `json:"name,omitempty"`
	Username          *string          `json:"username,omitempty"`
	Description       *string          `json:"description,omitempty"`
	MinRAM            *uint            `json:"min_ram,omitempty"`
	Server            string           `json:"server,omitempty"`
	Volume            string           `json:"volume,omitempty"`
	Arch              arch.Enum        `json:"arch,omitempty"`
	Status            imagestatus.Enum `json:"status,omitempty"`
	Public            *bool            `json:"public,omitempty"`
	CompatibilityMode *bool            `json:"compatibility_mode,omitempty"`
	URL               string           `json:"http_url,omitempty"`
}

ImageOptions is used to create and update machine images

type Interface

type Interface struct {
	ResourceRef
	ID          string
	MacAddress  string `json:"mac_address"`
	IPv4Address string `json:"ipv4_address"`
	IPv6Address string `json:"ipv6_address"`
	Server      *Server
}

Interface represent a server's network interface(s) https://api.gb1.brightbox.com/1.0/#interface

type LoadBalancer

type LoadBalancer struct {
	ResourceRef
	ID                string
	Name              string
	Status            loadbalancerstatus.Enum
	Locked            bool
	HTTPSRedirect     bool   `json:"https_redirect"`
	SslMinimumVersion string `json:"ssl_minimum_version"`
	BufferSize        uint   `json:"buffer_size"`
	Policy            balancingpolicy.Enum
	Listeners         []LoadBalancerListener
	Healthcheck       LoadBalancerHealthcheck
	Certificate       *LoadBalancerAcmeCertificate
	Acme              *LoadBalancerAcme
	CreatedAt         *time.Time `json:"created_at"`
	DeletedAt         *time.Time `json:"deleted_at"`
	Account           *Account
	Nodes             []Server
	CloudIPs          []CloudIP `json:"cloud_ips"`
}

LoadBalancer represents a Load Balancer https://api.gb1.brightbox.com/1.0/#load_balancer

func (LoadBalancer) CreatedAtUnix

func (s LoadBalancer) CreatedAtUnix() int64

CreatedAt implements the CreateDated interface for LoadBalancer

type LoadBalancerAcme

type LoadBalancerAcme struct {
	Certificate *LoadBalancerAcmeCertificate `json:"certificate"`
	Domains     []LoadBalancerAcmeDomain     `json:"domains"`
}

LoadBalancerAcme represents an ACME object on a LoadBalancer

type LoadBalancerAcmeCertificate

type LoadBalancerAcmeCertificate struct {
	Fingerprint string    `json:"fingerprint"`
	ExpiresAt   time.Time `json:"expires_at"`
	IssuedAt    time.Time `json:"issued_at"`
}

LoadBalancerAcmeCertificate represents an ACME issued certificate on a LoadBalancer

type LoadBalancerAcmeDomain

type LoadBalancerAcmeDomain struct {
	Identifier  string `json:"identifier"`
	Status      string `json:"status"`
	LastMessage string `json:"last_message"`
}

LoadBalancerAcmeDomain represents a domain for which ACME support has been requested

type LoadBalancerHealthcheck

type LoadBalancerHealthcheck struct {
	Type          healthchecktype.Enum `json:"type"`
	Port          uint16               `json:"port"`
	Request       string               `json:"request,omitempty"`
	Interval      uint                 `json:"interval,omitempty"`
	Timeout       uint                 `json:"timeout,omitempty"`
	ThresholdUp   uint                 `json:"threshold_up,omitempty"`
	ThresholdDown uint                 `json:"threshold_down,omitempty"`
}

LoadBalancerHealthcheck represents a health check on a LoadBalancer

type LoadBalancerListener

type LoadBalancerListener struct {
	Protocol      listenerprotocol.Enum `json:"protocol,omitempty"`
	In            uint16                `json:"in,omitempty"`
	Out           uint16                `json:"out,omitempty"`
	Timeout       uint                  `json:"timeout,omitempty"`
	ProxyProtocol proxyprotocol.Enum    `json:"proxy_protocol,omitempty"`
}

LoadBalancerListener represents a listener on a LoadBalancer

type LoadBalancerNode

type LoadBalancerNode struct {
	Node string `json:"node,omitempty"`
}

LoadBalancerNode is used in conjunction with LoadBalancerOptions, AddNodesToLoadBalancer, RemoveNodesFromLoadBalancer to specify a list of servers to use as load balancer nodes. The Node parameter should be a server identifier.

type LoadBalancerOptions

type LoadBalancerOptions struct {
	ID                    string                   `json:"-"`
	Name                  *string                  `json:"name,omitempty"`
	Nodes                 []LoadBalancerNode       `json:"nodes,omitempty"`
	Policy                balancingpolicy.Enum     `json:"policy,omitempty"`
	Listeners             []LoadBalancerListener   `json:"listeners,omitempty"`
	Healthcheck           *LoadBalancerHealthcheck `json:"healthcheck,omitempty"`
	Domains               *[]string                `json:"domains,omitempty"`
	CertificatePem        *string                  `json:"certificate_pem,omitempty"`
	CertificatePrivateKey *string                  `json:"certificate_private_key,omitempty"`
	SslMinimumVersion     *string                  `json:"ssl_minimum_version,omitempty"`
	HTTPSRedirect         *bool                    `json:"https_redirect,omitempty"`
}

LoadBalancerOptions is used in conjunction with CreateLoadBalancer and UpdateLoadBalancer to create and update load balancers

type Oauth2

type Oauth2 interface {
	Client(ctx context.Context) (*http.Client, oauth2.TokenSource, error)
	APIURL() (*url.URL, error)
}

Oauth2 is the abstract interface for any Brightbox oauth2 client generator

type PortTranslator

type PortTranslator struct {
	Incoming uint16                 `json:"incoming"`
	Outgoing uint16                 `json:"outgoing"`
	Protocol transportprotocol.Enum `json:"protocol,omitempty"`
}

PortTranslator represents a port translator on a Cloud IP

type ResourceRef

type ResourceRef struct {
	URL          string `json:"url"`
	ResourceType string `json:"resource_type"`
}

ResourceRef contains the header fields in every API object

type Server

type Server struct {
	ResourceRef
	ServerConsole
	ID                      string
	Name                    string
	Status                  serverstatus.Enum `json:"status"`
	Hostname                string
	Fqdn                    string
	UserData                string     `json:"user_data"`
	CreatedAt               *time.Time `json:"created_at"`
	DeletedAt               *time.Time `json:"deleted_at"`
	StartedAt               *time.Time `json:"started_at"`
	SnapshotsSchedule       string     `json:"snapshots_schedule"`
	SnapshotsScheduleNextAt *time.Time `json:"snapshots_schedule_next_at"`
	SnapshotsRetention      string     `json:"snapshots_retention"`
	Locked                  bool       `json:"locked"`
	CompatibilityMode       bool       `json:"compatibility_mode"`
	DiskEncrypted           bool       `json:"disk_encrypted"`
	Account                 *Account
	Image                   *Image
	Zone                    *Zone
	ServerType              *ServerType   `json:"server_type"`
	CloudIPs                []CloudIP     `json:"cloud_ips"`
	ServerGroups            []ServerGroup `json:"server_groups"`
	Snapshots               []Image
	Interfaces              []Interface
	Volumes                 []Volume
}

Server represents a Cloud Server https://api.gb1.brightbox.com/1.0/#server DeletedAt is nil if the server has not yet been deleted

func (Server) CreatedAtUnix

func (s Server) CreatedAtUnix() int64

CreatedAt implements the CreateDated interface for Server

type ServerConsole

type ServerConsole struct {
	ConsoleToken        *string    `json:"console_token"`
	ConsoleURL          *string    `json:"console_url"`
	ConsoleTokenExpires *time.Time `json:"console_token_expires"`
}

ServerConsole is embedded into Server and contains the fields used in response to an ActivateConsoleForServer request.

type ServerGroup

type ServerGroup struct {
	ResourceRef
	ID             string
	Name           string
	Description    string
	Default        bool
	Fqdn           string
	CreatedAt      *time.Time `json:"created_at"`
	Account        *Account
	FirewallPolicy *FirewallPolicy `json:"firewall_policy"`
	Servers        []Server
}

ServerGroup represents a server group https://api.gb1.brightbox.com/1.0/#server_group

func (ServerGroup) CreatedAtUnix

func (s ServerGroup) CreatedAtUnix() int64

CreatedAt implements the CreateDated interface for ServerGroup

type ServerGroupMember

type ServerGroupMember struct {
	Server string `json:"server"`
}

ServerGroupMember is used to add, remove and move a server between server groups

type ServerGroupMemberList

type ServerGroupMemberList struct {
	Servers []ServerGroupMember `json:"servers"`
}

ServerGroupMemberList is used to add, remove and move servers between server groups

type ServerGroupOptions

type ServerGroupOptions struct {
	ID          string  `json:"-"`
	Name        *string `json:"name,omitempty"`
	Description *string `json:"description,omitempty"`
}

ServerGroupOptions is used in combination with CreateServerGroup and UpdateServerGroup to create and update server groups

type ServerNewSize

type ServerNewSize struct {
	NewType string `json:"new_type"`
}

ServerNewSize is used in conjunction with ResizeServer to specify the new Server type for the Server

type ServerOptions

type ServerOptions struct {
	ID                 string        `json:"-"`
	Image              *string       `json:"image,omitempty"`
	Name               *string       `json:"name,omitempty"`
	ServerType         *string       `json:"server_type,omitempty"`
	Zone               *string       `json:"zone,omitempty"`
	UserData           *string       `json:"user_data,omitempty"`
	SnapshotsRetention *string       `json:"snapshots_retention,omitempty"`
	SnapshotsSchedule  *string       `json:"snapshots_schedule,omitempty"`
	ServerGroups       []string      `json:"server_groups,omitempty"`
	CompatibilityMode  *bool         `json:"compatibility_mode,omitempty"`
	DiskEncrypted      *bool         `json:"disk_encrypted,omitempty"`
	CloudIP            *bool         `json:"cloud_ip,omitempty"`
	Volumes            []VolumeEntry `json:"volumes,omitempty"`
}

ServerOptions is used in conjunction with CreateServer and UpdateServer to create and update servers. UserData needs to be base64 encoded.

type ServerType

type ServerType struct {
	ResourceRef
	ID          string
	Name        string
	Status      servertypestatus.Enum
	Cores       uint
	RAM         uint
	Handle      string
	DiskSize    uint             `json:"disk_size"`
	StorageType storagetype.Enum `json:"storage_type"`
}

ServerType represents a Server Type https://api.gb1.brightbox.com/1.0/#server_type

type TwoFactorAuthType

type TwoFactorAuthType struct {
	Enabled bool
}

TwoFactorAuthType is nested in User

type User

type User struct {
	ResourceRef
	ID             string
	Name           string
	EmailAddress   string            `json:"email_address"`
	EmailVerified  bool              `json:"email_verified"`
	SSHKey         string            `json:"ssh_key"`
	MessagingPref  bool              `json:"messaging_pref"`
	CreatedAt      *time.Time        `json:"created_at"`
	TwoFactorAuth  TwoFactorAuthType `json:"2fa"`
	DefaultAccount *Account          `json:"default_account"`
	Accounts       []Account
}

User represents a Brightbox User https://api.gb1.brightbox.com/1.0/#user

func (User) CreatedAtUnix

func (s User) CreatedAtUnix() int64

CreatedAt implements the CreateDated interface for User

type UserOptions

type UserOptions struct {
	ID                   string  `json:"-"`
	Name                 *string `json:"name,omitempty"`
	EmailAddress         *string `json:"email_address,omitempty"`
	SSHKey               *string `json:"ssh_key,omitempty"`
	Password             *string `json:"password,omitempty"`
	PasswordConfirmation *string `json:"password_confirmation,omitempty"`
}

UserOptions is used to update objects

type Volume

type Volume struct {
	ResourceRef
	ID               string
	Name             string
	Status           volumestatus.Enum
	Description      string
	DeleteWithServer bool `json:"delete_with_server"`
	Boot             bool
	Encrypted        bool
	FilesystemLabel  string              `json:"filesystem_label"`
	FilesystemType   filesystemtype.Enum `json:"filesystem_type"`
	Locked           bool
	Serial           string
	Size             uint
	Source           string
	SourceType       volumetype.Enum  `json:"source_type"`
	StorageType      storagetype.Enum `json:"storage_type"`
	CreatedAt        *time.Time       `json:"created_at"`
	DeletedAt        *time.Time       `json:"deleted_at"`
	UpdatedAt        *time.Time       `json:"updated_at"`
	Server           *Server
	Account          *Account
	Image            *Image
}

Volume represents a Brightbox Volume https://api.gb1.brightbox.com/1.0/#volume

func (Volume) CreatedAtUnix

func (s Volume) CreatedAtUnix() int64

CreatedAt implements the CreateDated interface for Volume

type VolumeAttachment

type VolumeAttachment struct {
	Server string `json:"server"`
	Boot   bool   `json:"boot"`
}

VolumeAttachment is used in conjunction with AttachVolume and DetachVolume

type VolumeEntry

type VolumeEntry struct {
	Volume string `json:"volume,omitempty"`
	Size   uint   `json:"size,omitempty"`
	Image  string `json:"image,omitempty"`
}

VolumeEntry is used within ServerOptions to specify the boot volume for a server on creation. Either volume or image/disk size can be given

type VolumeNewSize

type VolumeNewSize struct {
	From uint `json:"from"`
	To   uint `json:"to"`
}

VolumeNewSize is used in conjunction with ResizeVolume to specify the change in the disk size

type VolumeOptions

type VolumeOptions struct {
	ID               string              `json:"-"`
	Name             *string             `json:"name,omitempty"`
	Description      *string             `json:"description,omitempty"`
	Serial           *string             `json:"serial,omitempty"`
	DeleteWithServer *bool               `json:"delete_with_server,omitempty"`
	FilesystemLabel  *string             `json:"filesystem_label,omitempty"`
	FilesystemType   filesystemtype.Enum `json:"filesystem_type,omitempty"`
	Size             *uint               `json:"size,omitempty"`
	Image            *string             `json:"image,omitempty"`
	Encrypted        *bool               `json:"encrypted,omitempty"`
}

VolumeOptions is used to create and update volumes create and update servers.

type Zone

type Zone struct {
	ResourceRef
	ID     string
	Handle string
}

Zone represents a Zone https://api.gb1.brightbox.com/1.0/#zone

Directories

Path Synopsis
Package clientcredentials implements the API client credentials access method.
Package clientcredentials implements the API client credentials access method.
Package endpoint manages the API endpoint details
Package endpoint manages the API endpoint details
enums
accountstatus
Package accountstatus is an enumeration of the states Pending, Active, Overdue, Warning, Suspended, Terminated, Closed, Deleted
Package accountstatus is an enumeration of the states Pending, Active, Overdue, Warning, Suspended, Terminated, Closed, Deleted
arch
Package arch is an enumeration of the states X86_64, I686
Package arch is an enumeration of the states X86_64, I686
balancingpolicy
Package balancingpolicy is an enumeration of the states LeastConnections, RoundRobin, SourceAddress
Package balancingpolicy is an enumeration of the states LeastConnections, RoundRobin, SourceAddress
cloudipstatus
Package cloudipstatus is an enumeration of the states Mapped, Unmapped
Package cloudipstatus is an enumeration of the states Mapped, Unmapped
collaborationstatus
Package collaborationstatus is an enumeration of the states Pending, Accepted, Rejected, Cancelled, Ended
Package collaborationstatus is an enumeration of the states Pending, Accepted, Rejected, Cancelled, Ended
databaseserverstatus
Package databaseserverstatus is an enumeration of the states Creating, Active, Deleting, Deleted, Failing, Failed
Package databaseserverstatus is an enumeration of the states Creating, Active, Deleting, Deleted, Failing, Failed
databasesnapshotstatus
Package databasesnapshotstatus is an enumeration of the states Creating, Available, Deleting, Deleted, Failed
Package databasesnapshotstatus is an enumeration of the states Creating, Available, Deleting, Deleted, Failed
filesystemtype
Package filesystemtype is an enumeration of the states Xfs, Ext4
Package filesystemtype is an enumeration of the states Xfs, Ext4
healthchecktype
Package healthchecktype is an enumeration of the states Tcp, Http
Package healthchecktype is an enumeration of the states Tcp, Http
imagestatus
Package imagestatus is an enumeration of the states Creating, Available, Deprecated, Unavailable, Deleting, Deleted, Failed
Package imagestatus is an enumeration of the states Creating, Available, Deprecated, Unavailable, Deleting, Deleted, Failed
listenerprotocol
Package listenerprotocol is an enumeration of the states Tcp, Http, Https
Package listenerprotocol is an enumeration of the states Tcp, Http, Https
loadbalancerstatus
Package loadbalancerstatus is an enumeration of the states Creating, Active, Deleting, Deleted, Failing, Failed
Package loadbalancerstatus is an enumeration of the states Creating, Active, Deleting, Deleted, Failing, Failed
mode
Package mode is an enumeration of the states Nat, Route
Package mode is an enumeration of the states Nat, Route
permissionsgroup
Package permissionsgroup is an enumeration of the states Full, Storage
Package permissionsgroup is an enumeration of the states Full, Storage
proxyprotocol
Package proxyprotocol is an enumeration of the states V1, V2, V2Ssl, V2SslCn
Package proxyprotocol is an enumeration of the states V1, V2, V2Ssl, V2SslCn
serverstatus
Package serverstatus is an enumeration of the states Creating, Active, Inactive, Deleting, Deleted, Failed, Unavailable
Package serverstatus is an enumeration of the states Creating, Active, Inactive, Deleting, Deleted, Failed, Unavailable
servertypestatus
Package servertypestatus is an enumeration of the states Experimental, Available, Deprecated
Package servertypestatus is an enumeration of the states Experimental, Available, Deprecated
sourcetrigger
Package sourcetrigger is an enumeration of the states Manual, Schedule
Package sourcetrigger is an enumeration of the states Manual, Schedule
sourcetype
Package sourcetype is an enumeration of the states Upload, Snapshot
Package sourcetype is an enumeration of the states Upload, Snapshot
storagetype
Package storagetype is an enumeration of the states Local, Network
Package storagetype is an enumeration of the states Local, Network
transportprotocol
Package transportprotocol is an enumeration of the states Tcp, Udp
Package transportprotocol is an enumeration of the states Tcp, Udp
volumestatus
Package volumestatus is an enumeration of the states Creating, Attached, Detached, Deleting, Deleted, Failed
Package volumestatus is an enumeration of the states Creating, Attached, Detached, Deleting, Deleted, Failed
volumetype
Package volumetype is an enumeration of the states Image, Volume, Raw
Package volumetype is an enumeration of the states Image, Volume, Raw
Package passwordcredentials implements the API Resource Owner Password Credentials access method.
Package passwordcredentials implements the API Resource Owner Password Credentials access method.

Jump to

Keyboard shortcuts

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