civogo

package module
v0.2.53 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2021 License: MIT Imports: 15 Imported by: 70

README

Civogo - The Golang client library for Civo

go.dev reference Build Status Lint

Civogo is a Go client library for accessing the Civo cloud API.

You can view the client API docs at https://pkg.go.dev/github.com/civo/civogo and view the API documentation at https://api.civo.com

Install

go get github.com/civo/civogo

Usage

import "github.com/civo/civogo"

From there you create a Civo client specifying your API key and use public methods to interact with Civo's API.

Authentication

Your API key is listed within the Civo control panel's security page. You can also reset the token there, for example, if accidentally put it in source code and found it had been leaked.

You can then use your API key to create a new client:

package main

import (
	"context"
	"github.com/civo/civogo"
)

const (
    apiKey = "mykeygoeshere"
)

func main() {
  client, err := civogo.NewClient(apiKey)
  // ...
}

Examples

To create a new Instance:

config, err := client.NewInstanceConfig()
if err != nil {
  t.Errorf("Failed to create a new config: %s", err)
  return err
}

config.Hostname = "foo.example.com"

instance, err := client.CreateInstance(config)
if err != nil {
  t.Errorf("Failed to create instance: %s", err)
  return err
}

To get all Instances:

instances, err := client.ListAllInstances()
if err != nil {
  t.Errorf("Failed to create instance: %s", err)
  return err
}

for _, i := range instances {
    fmt.Println(i.Hostname)
}
Pagination

If a list of objects is paginated by the API, you must request pages individually. For example, to fetch all instances without using the ListAllInstances method:

func MyListAllInstances(client *civogo.Client) ([]civogo.Instance, error) {
    list := []civogo.Instance{}

    pageOfItems, err := client.ListInstances(1, 50)
    if err != nil {
        return []civogo.Instance{}, err
    }

    if pageOfItems.Pages == 1 {
        return pageOfItems.Items, nil
    }

    for page := 2;  page<=pageOfItems.Pages; page++ {
        pageOfItems, err := client.ListInstances(1, 50)
        if err != nil {
            return []civogo.Instance{}, err
        }

        list = append(list, pageOfItems.Items)
    }

    return list, nil
}

Error handler

​ In the latest version of the library we have added a new way to handle errors. Below are some examples of how to use the new error handler, and the complete list of errors is here. ​ This is an example of how to make use of the new errors, suppose we want to create a new Kubernetes cluster, and do it this way but choose a name that already exists within the clusters that we have: ​

// kubernetes config
configK8s := &civogo.KubernetesClusterConfig{
    NumTargetNodes: 5,
    Name: "existent-name",
}
// Send to create the cluster
resp, err := client.NewKubernetesClusters(configK8s)
if err != nil {
     if errors.Is(err, civogo.DatabaseKubernetesClusterDuplicateError) {
     // add some actions
     }
}

The following lines are new: ​

if err != nil {
     if errors.Is(err, civogo.DatabaseKubernetesClusterDuplicateError) {
     // add some actions
     }
}

In this way. we can make decisions faster based on known errors, and we know what to expect. There is also the option of being able to say this to account for some errors but not others: ​

if err != nil {
     if errors.Is(err, civogo.DatabaseKubernetesClusterDuplicateError) {
     // add some actions
     }
     if errors.Is(err, civogo.UnknownError) {
         // exit with error
     }
}

We can use UnknownError for errors that are not defined.

Contributing

If you want to get involved, we'd love to receive a pull request - or an offer to help over our KUBE100 Slack channel. Please see the contribution guidelines.

Documentation

Index

Constants

View Source
const (
	// DNSRecordTypeA represents an A record
	DNSRecordTypeA = "A"

	// DNSRecordTypeCName represents an CNAME record
	DNSRecordTypeCName = "CNAME"

	// DNSRecordTypeMX represents an MX record
	DNSRecordTypeMX = "MX"

	// DNSRecordTypeSRV represents an SRV record
	DNSRecordTypeSRV = "SRV"

	// DNSRecordTypeTXT represents an TXT record
	DNSRecordTypeTXT = "TXT"
)
View Source
const ResultSuccess = "success"

ResultSuccess represents a successful SimpleResponse

View Source
const Version = "0.2.21"

Version represents the version of the civogo lib

Variables

View Source
var (
	// ErrDNSDomainNotFound is returned when the domain is not found
	ErrDNSDomainNotFound = fmt.Errorf("domain not found")

	// ErrDNSRecordNotFound is returned when the record is not found
	ErrDNSRecordNotFound = fmt.Errorf("record not found")
)
View Source
var (
	ResponseDecodeFailedError = constError("ResponseDecodeFailed")
	DisabledServiceError      = constError("DisabledServiceError")
	NoAPIKeySuppliedError     = constError("NoAPIKeySuppliedError")
	MultipleMatchesError      = constError("MultipleMatchesError")
	ZeroMatchesError          = constError("ZeroMatchesError")
	IDisEmptyError            = constError("IDisEmptyError")
	TimeoutError              = constError("TimeoutError")
	RegionUnavailableError    = constError("RegionUnavailable")

	CivoStatsdRecordFailedError = constError("CivoStatsdRecordFailedError")
	AuthenticationFailedError   = constError("AuthenticationFailedError")
	CommonError                 = constError("Error")

	// Volume Error
	CannotRescueNewVolumeError              = constError("CannotRescueNewVolumeError")
	CannotRestoreNewVolumeError             = constError("CannotRestoreNewVolumeError")
	CannotScaleAlreadyRescalingClusterError = constError("CannotScaleAlreadyRescalingClusterError")
	VolumeInvalidSizeError                  = constError("VolumeInvalidSizeError")

	DatabaseAccountDestroyError      = constError("DatabaseAccountDestroyError")
	DatabaseAccountNotFoundError     = constError("DatabaseAccountNotFoundError")
	DatabaseAccountAccessDeniedError = constError("DatabaseAccountAccessDeniedError")
	DatabaseCreatingAccountError     = constError("DatabaseCreatingAccountError")

	DatabaseUpdatingAccountError = constError("DatabaseUpdatingAccountError")
	DatabaseAccountStatsError    = constError("DatabaseAccountStatsError")
	DatabaseActionListingError   = constError("DatabaseActionListingError")
	DatabaseActionCreateError    = constError("DatabaseActionCreateError")
	DatabaseAPIKeyCreateError    = constError("DatabaseApiKeyCreateError")
	DatabaseAPIKeyDuplicateError = constError("DatabaseApiKeyDuplicateError")
	DatabaseAPIKeyNotFoundError  = constError("DatabaseApiKeyNotFoundError")

	DatabaseAPIkeyDestroyError           = constError("DatabaseAPIkeyDestroyError")
	DatabaseAuditLogListingError         = constError("DatabaseAuditLogListingError")
	DatabaseBlueprintNotFoundError       = constError("DatabaseBlueprintNotFoundError")
	DatabaseBlueprintDeleteFailedError   = constError("DatabaseBlueprintDeleteFailedError")
	DatabaseBlueprintCreateError         = constError("DatabaseBlueprintCreateError")
	DatabaseBlueprintUpdateError         = constError("DatabaseBlueprintUpdateError")
	ParameterEmptyVolumeIDError          = constError("ParameterEmptyVolumeIDError")
	ParameterEmptyOpenstackVolumeIDError = constError("ParameterEmptyOpenstackVolumeIDError")
	DatabaseChangeAPIKeyError            = constError("DatabaseChangeAPIKeyError")
	DatabaseChargeListingError           = constError("DatabaseChargeListingError")
	DatabaseConnectionFailedError        = constError("DatabaseConnectionFailedError")

	DatabaseDNSDomainCreateError        = constError("DatabaseDnsDomainCreateError")
	DatabaseDNSDomainUpdateError        = constError("DatabaseDnsDomainUpdateError")
	DatabaseDNSDomainDuplicateNameError = constError("DatabaseDnsDomainDuplicateNameError")
	DatabaseDNSDomainNotFoundError      = constError("DatabaseDNSDomainNotFoundError")
	DatabaseDNSRecordCreateError        = constError("DatabaseDNSRecordCreateError")
	DatabaseDNSRecordNotFoundError      = constError("DatabaseDNSRecordNotFoundError")
	DatabaseDNSRecordUpdateError        = constError("DatabaseDNSRecordUpdateError")
	DatabaseListingDNSDomainsError      = constError("DatabaseListingDNSDomainsError")

	DatabaseFirewallCreateError           = constError("DatabaseFirewallCreateError")
	DatabaseFirewallRulesInvalidParams    = constError("DatabaseFirewallRulesInvalidParams")
	DatabaseFirewallDuplicateNameError    = constError("DatabaseFirewallDuplicateNameError")
	DatabaseFirewallMismatchError         = constError("DatabaseFirewallMismatchError")
	DatabaseFirewallNotFoundError         = constError("DatabaseFirewallNotFoundError")
	DatabaseFirewallSaveFailedError       = constError("DatabaseFirewallSaveFailedError")
	DatabaseFirewallDeleteFailedError     = constError("DatabaseFirewallDeleteFailedError")
	DatabaseFirewallRuleCreateError       = constError("DatabaseFirewallRuleCreateError")
	DatabaseFirewallRuleDeleteFailedError = constError("DatabaseFirewallRuleDeleteFailedError")
	DatabaseFirewallRulesFindError        = constError("DatabaseFirewallRulesFindError")
	DatabaseListingFirewallsError         = constError("DatabaseListingFirewallsError")
	FirewallDuplicateError                = constError("FirewallDuplicateError")

	// Instances Errors
	DatabaseInstanceAlreadyinRescueStateError              = constError("DatabaseInstanceAlreadyinRescueStateError")
	DatabaseInstanceBuildError                             = constError("DatabaseInstanceBuildError")
	DatabaseInstanceBuildMultipleWithExistingPublicIPError = constError("DatabaseInstanceBuildMultipleWithExistingPublicIPError")
	DatabaseInstanceCreateError                            = constError("DatabaseInstanceCreateError")
	DatabaseInstanceSnapshotTooBigError                    = constError("DatabaseInstanceSnapshotTooBigError")
	DatabaseInstanceDuplicateError                         = constError("DatabaseInstanceDuplicateError")
	DatabaseInstanceDuplicateNameError                     = constError("DatabaseInstanceDuplicateNameError")
	DatabaseInstanceListError                              = constError("DatabaseInstanceListError")
	DatabaseInstanceNotFoundError                          = constError("DatabaseInstanceNotFoundError")
	DatabaseInstanceNotInOpenStackError                    = constError("DatabaseInstanceNotInOpenStackError")
	DatabaseCannotManageClusterInstanceError               = constError("DatabaseCannotManageClusterInstanceError")
	DatabaseOldInstanceFindError                           = constError("DatabaseOldInstanceFindError")
	DatabaseCannotMoveIPError                              = constError("DatabaseCannotMoveIPError")
	DatabaseIPFindError                                    = constError("DatabaseIPFindError")

	// Kubernetes Errors
	DatabaseKubernetesClusterInvalidError         = constError("DatabaseKubernetesClusterInvalid")
	DatabaseKubernetesApplicationNotFoundError    = constError("DatabaseKubernetesApplicationNotFound")
	DatabaseKubernetesApplicationInvalidPlanError = constError("DatabaseKubernetesApplicationInvalidPlan")
	DatabaseKubernetesClusterDuplicateError       = constError("DatabaseKubernetesClusterDuplicate")
	DatabaseKubernetesClusterNotFoundError        = constError("DatabaseKubernetesClusterNotFound")
	DatabaseKubernetesNodeNotFoundError           = constError("DatabaseKubernetesNodeNotFound")

	DatabaseListingAccountsError              = constError("DatabaseListingAccountsError")
	DatabaseListingMembershipsError           = constError("DatabaseListingMembershipsError")
	DatabaseMembershipCannotDeleteError       = constError("DatabaseMembershipCannotDeleteError")
	DatabaseMembershipsGrantAccessError       = constError("DatabaseMembershipsGrantAccessError")
	DatabaseMembershipsInvalidInvitationError = constError("DatabaseMembershipsInvalidInvitationError")
	DatabaseMembershipsInvalidStatusError     = constError("DatabaseMembershipsInvalidStatusError")
	DatabaseMembershipsNotFoundError          = constError("DatabaseMembershipsNotFoundError")
	DatabaseMembershipsSuspendedError         = constError("DatabaseMembershipsSuspendedError")

	DatabaseLoadbalancerDuplicateError = constError("DatabaseLoadbalancerDuplicateError")
	DatabaseLoadbalancerInvalidError   = constError("DatabaseLoadbalancerInvalidError")
	DatabaseLoadbalancerNotFoundError  = constError("DatabaseLoadbalancerNotFoundError")

	DatabaseNetworksListError              = constError("DatabaseNetworksListError")
	DatabaseNetworkCreateError             = constError("DatabaseNetworkCreateError")
	DatabaseNetworkExistsError             = constError("DatabaseNetworkExistsError")
	DatabaseNetworkDeleteLastError         = constError("DatabaseNetworkDeleteLastError")
	DatabaseNetworkDeleteWithInstanceError = constError("DatabaseNetworkDeleteWithInstanceError")
	DatabaseNetworkDuplicateNameError      = constError("DatabaseNetworkDuplicateNameError")
	DatabaseNetworkLookupError             = constError("DatabaseNetworkLookupError")
	DatabaseNetworkNotFoundError           = constError("DatabaseNetworkNotFoundError")
	DatabaseNetworkSaveError               = constError("DatabaseNetworkSaveError")

	DatabasePrivateIPFromPublicIPError = constError("DatabasePrivateIPFromPublicIPError")

	DatabaseQuotaNotFoundError   = constError("DatabaseQuotaNotFoundError")
	DatabaseQuotaUpdateError     = constError("DatabaseQuotaUpdateError")
	QuotaLimitReachedError       = constError("QuotaLimitReachedError")
	DatabaseServiceNotFoundError = constError("DatabaseServiceNotFoundError")
	DatabaseSizeNotFoundError    = constError("DatabaseServiceNotFoundError")
	DatabaseSizesListError       = constError("DatabaseSizesListError")

	DatabaseSnapshotCannotDeleteInUseError      = constError("DatabaseSnapshotCannotDeleteInUseError")
	DatabaseSnapshotCannotReplaceError          = constError("DatabaseSnapshotCannotReplaceError")
	DatabaseSnapshotCreateError                 = constError("DatabaseSnapshotCreateError")
	DatabaseSnapshotCreateInstanceNotFoundError = constError("DatabaseSnapshotCreateInstanceNotFoundError")
	DatabaseSnapshotCreateAlreadyInProcessError = constError("DatabaseSnapshotCreateAlreadyInProcessError")
	DatabaseSnapshotNotFoundError               = constError("DatabaseSnapshotNotFoundError")
	DatabaseSnapshotsListError                  = constError("DatabaseSnapshotsListError")

	DatabaseSSHKeyDestroyError       = constError("DatabaseSSHKeyDestroyError")
	DatabaseSSHKeyCreateError        = constError("DatabaseSSHKeyCreateError")
	DatabaseSSHKeyUpdateError        = constError("DatabaseSSHKeyUpdateError")
	DatabaseSSHKeyDuplicateNameError = constError("DatabaseSSHKeyDuplicateNameError")
	DatabaseSSHKeyNotFoundError      = constError("DatabaseSSHKeyNotFoundError")
	SSHKeyDuplicateError             = constError("SSHKeyDuplicateError")

	DatabaseTeamCannotDeleteError      = constError("DatabaseTeamCannotDeleteError")
	DatabaseTeamCreateError            = constError("DatabaseTeamCreateError")
	DatabaseTeamListingError           = constError("DatabaseTeamListingError")
	DatabaseTeamMembershipCreateError  = constError("DatabaseTeamMembershipCreateError")
	DatabaseTeamNotFoundError          = constError("DatabaseTeamNotFoundError")
	DatabaseTemplateDestroyError       = constError("DatabaseTemplateDestroyError")
	DatabaseTemplateNotFoundError      = constError("DatabaseTemplateNotFoundError")
	DatabaseTemplateUpdateError        = constError("DatabaseTemplateUpdateError")
	DatabaseTemplateWouldConflictError = constError("DatabaseTemplateWouldConflictError")
	DatabaseImageIDInvalidError        = constError("DatabaseImageIDInvalidError")

	DatabaseUserAlreadyExistsError          = constError("DatabaseUserAlreadyExistsError")
	DatabaseUserNewError                    = constError("DatabaseUserNewError")
	DatabaseUserConfirmedError              = constError("DatabaseUserConfirmedError")
	DatabaseUserSuspendedError              = constError("DatabaseUserSuspendedError")
	DatabaseUserLoginFailedError            = constError("DatabaseUserLoginFailedError")
	DatabaseUserNoChangeStatusError         = constError("DatabaseUserNoChangeStatusError")
	DatabaseUserNotFoundError               = constError("DatabaseUserNotFoundError")
	DatabaseUserPasswordInvalidError        = constError("DatabaseUserPasswordInvalidError")
	DatabaseUserPasswordSecuringFailedError = constError("DatabaseUserPasswordSecuringFailedError")
	DatabaseUserUpdateError                 = constError("DatabaseUserUpdateError")
	DatabaseCreatingUserError               = constError("DatabaseCreatingUserError")

	DatabaseVolumeIDInvalidError                 = constError("DatabaseVolumeIDInvalidError")
	DatabaseVolumeDuplicateNameError             = constError("DatabaseVolumeDuplicateNameError")
	DatabaseVolumeCannotMultipleAttachError      = constError("DatabaseVolumeCannotMultipleAttachError")
	DatabaseVolumeStillAttachedCannotResizeError = constError("DatabaseVolumeStillAttachedCannotResizeError")
	DatabaseVolumeNotAttachedError               = constError("DatabaseVolumeNotAttachedError")
	DatabaseVolumeNotFoundError                  = constError("DatabaseVolumeNotFoundError")
	DatabaseVolumeDeleteFailedError              = constError("DatabaseVolumeDeleteFailedError")

	DatabaseWebhookDestroyError       = constError("DatabaseWebhookDestroyError")
	DatabaseWebhookNotFoundError      = constError("DatabaseWebhookNotFoundError")
	DatabaseWebhookUpdateError        = constError("DatabaseWebhookUpdateError")
	DatabaseWebhookWouldConflictError = constError("DatabaseWebhookWouldConflictError")

	OpenstackConnectionFailedError        = constError("OpenstackConnectionFailedError")
	OpenstackCreatingProjectError         = constError("OpenstackCreatingProjectError")
	OpenstackCreatingUserError            = constError("OpenstackCreatingUserError")
	OpenstackFirewallCreateError          = constError("OpenstackFirewallCreateError")
	OpenstackFirewallDestroyError         = constError("OpenstackFirewallDestroyError")
	OpenstackFirewallRuleDestroyError     = constError("OpenstackFirewallRuleDestroyError")
	OpenstackInstanceCreateError          = constError("OpenstackInstanceCreateError")
	OpenstackInstanceDestroyError         = constError("OpenstackInstanceDestroyError")
	OpenstackInstanceFindError            = constError("OpenstackInstanceFindError")
	OpenstackInstanceRebootError          = constError("OpenstackInstanceRebootError")
	OpenstackInstanceRebuildError         = constError("OpenstackInstanceRebuildError")
	OpenstackInstanceResizeError          = constError("OpenstackInstanceResizeError")
	OpenstackInstanceRestoreError         = constError("OpenstackInstanceRestoreError")
	OpenstackInstanceSetFirewallError     = constError("OpenstackInstanceSetFirewallError")
	OpenstackInstanceStartError           = constError("OpenstackInstanceStartError")
	OpenstackInstanceStopError            = constError("OpenstackInstanceStopError")
	OpenstackIPCreateError                = constError("OpenstackIPCreateError")
	OpenstackNetworkCreateFailedError     = constError("OpenstackNetworkCreateFailedError")
	OpenstackNnetworkDestroyFailedError   = constError("OpenstackNnetworkDestroyFailedError")
	OpenstackNetworkEnsureConfiguredError = constError("OpenstackNetworkEnsureConfiguredError")
	OpenstackPublicIPConnectError         = constError("OpenstackPublicIPConnectError")
	OpenstackQuotaApplyError              = constError("OpenstackQuotaApplyError")
	OpenstackSnapshotDestroyError         = constError("OpenstackSnapshotDestroyError")
	OpenstackSSHKeyUploadError            = constError("OpenstackSSHKeyUploadError")
	OpenstackProjectDestroyError          = constError("OpenstackProjectDestroyError")
	OpenstackProjectFindError             = constError("OpenstackProjectFindError")
	OpenstackUserDestroyError             = constError("OpenstackUserDestroyError")
	OpenstackURLGlanceError               = constError("OpenstackUrlGlanceError")
	OpenstackURLNovaError                 = constError("OpenstackURLNovaError")
	AuthenticationInvalidKeyError         = constError("AuthenticationInvalidKeyError")
	AuthenticationAccessDeniedError       = constError("AuthenticationAccessDeniedError")

	InstanceStateMustBeActiveOrShutoffError = constError("InstanceStateMustBeActiveOrShutoffError")
	MarshalingObjectsToJSONError            = constError("MarshalingObjectsToJsonError")
	NetworkCreateDefaultError               = constError("NetworkCreateDefaultError")
	NetworkDeleteDefaultError               = constError("NetworkDeleteDefaultError")
	ParameterTimeValueError                 = constError("ParameterTimeValueError")
	ParameterDateRangeTooLongError          = constError("ParameterDateRangeTooLongError")
	ParameterDNSRecordTypeError             = constError("ParameterDnsRecordTypeError")
	ParameterDNSRecordCnameApexError        = constError("ParameterDNSRecordCnameApexError")
	ParameterPublicKeyEmptyError            = constError("ParameterPublicKeyEmptyError")
	ParameterDateRangeError                 = constError("ParameterDateRangeError")
	ParameterIDMissingError                 = constError("ParameterIDMissingError")
	ParameterIDToIntegerError               = constError("ParameterIDToIntegerError")
	ParameterImageAndVolumeIDMissingError   = constError("ParameterImageAndVolumeIDMissingError")
	ParameterLabelInvalidError              = constError("ParameterLabelInvalidError")
	ParameterNameInvalidError               = constError("ParameterNameInvalidError")
	ParameterPrivateIPMissingError          = constError("ParameterPrivateIPMissingError")
	ParameterPublicIPMissingError           = constError("ParameterPublicIPMissingError")
	ParameterSizeMissingError               = constError("ParameterSizeMissingError")
	ParameterVolumeSizeIncorrectError       = constError("ParameterVolumeSizeIncorrectError")
	ParameterVolumeSizeMustIncreaseError    = constError("ParameterVolumeSizeMustIncreaseError")
	CannotResizeVolumeError                 = constError("CannotResizeVolumeError")
	ParameterSnapshotMissingError           = constError("ParameterSnapshotMissingError")
	ParameterSnapshotIncorrectFormatError   = constError("ParameterSnapshotIncorrectFormatError")
	ParameterStartPortMissingError          = constError("ParameterStartPortMissingError")
	DatabaseTemplateParseRequestError       = constError("DatabaseTemplateParseRequestError")
	ParameterValueMissingError              = constError("ParameterValueMissingError")

	OutOFCapacityError                           = constError("OutOFCapacityError")
	CannotGetConsoleError                        = constError("CannotGetConsoleError")
	DatabaseDNSDomainInvalidError                = constError("DatabaseDNSDomainInvalidError")
	DatabaseFirewallExistsError                  = constError("DatabaseFirewallExistsError")
	DatabaseKubernetesClusterNoPoolsError        = constError("DatabaseKubernetesClusterNoPoolsError")
	DatabaseKubernetesClusterInvalidVersionError = constError("DatabaseKubernetesClusterInvalidVersionError")
	DatabaseNamespacesListError                  = constError("DatabaseNamespacesListError")
	DatabaseNamespaceCreateError                 = constError("DatabaseNamespaceCreateError")
	DatabaseNamespaceExistsError                 = constError("DatabaseNamespaceExistsError")
	DatabaseNamespaceDeleteLastError             = constError("DatabaseNamespaceDeleteLastError")
	DatabaseNamespaceDeleteWithInstanceError     = constError("DatabaseNamespaceDeleteWithInstanceError")
	DatabaseNamespaceDuplicateNameError          = constError("DatabaseNamespaceDuplicateNameError")
	DatabaseNamespaceLookupError                 = constError("DatabaseNamespaceLookupError")
	DatabaseNamespaceNotFoundError               = constError("DatabaseNamespaceNotFoundError")
	DatabaseNamespaceSaveError                   = constError("DatabaseNamespaceSaveError")
	DatabaseQuotaLockFailedError                 = constError("DatabaseQuotaLockFailedError")
	DatabaseDiskImageNotFoundError               = constError("DatabaseDiskImageNotFoundError")
	DatabaseDiskImageNotImplementedError         = constError("DatabaseDiskImageNotImplementedError")
	DatabaseTemplateExistsError                  = constError("DatabaseTemplateExistsError")
	DatabaseTemplateSaveFailedError              = constError("DatabaseTemplateSaveFailedError")
	KubernetesClusterInvalidNameError            = constError("KubernetesClusterInvalidNameError")

	AccountNotEnabledIncCardError     = constError("AccountNotEnabledIncCardError")
	AccountNotEnabledWithoutCardError = constError("AccountNotEnabledWithoutCardError")

	UnknownError        = constError("UnknownError")
	AuthenticationError = constError("AuthenticationError")
	InternalServerError = constError("InternalServerError")
)

Errors raised by package civogo

Functions

This section is empty.

Types

type Account added in v0.2.50

type Account struct {
	ID              string    `json:"id"`
	CreatedAt       time.Time `json:"created_at,omitempty"`
	UpdatedAt       time.Time `json:"updated_at,omitempty"`
	Label           string    `json:"label,omitempty"`
	EmailAddress    string    `json:"email_address,omitempty"`
	APIKey          string    `json:"api_key,omitempty"`
	Token           string    `json:"token,omitempty"`
	Flags           string    `json:"flags,omitempty"`
	Timezone        string    `json:"timezone,omitempty"`
	Partner         string    `json:"partner,omitempty"`
	DefaultUserID   string    `json:"default_user_id,omitempty"`
	Status          string    `json:"status,omitempty"`
	EmailConfirmed  bool      `json:"email_confirmed,omitempty"`
	CreditCardAdded bool      `json:"credit_card_added,omitempty"`
	Enabled         bool      `json:"enabled,omitempty"`
}

Account is the owner of Civo resources such as instances, Kubernetes clusters, volumes, etc Really the Account should be defined with Account endpoints, but there aren't any that are publicly-useful

type ApplicationConfiguration added in v0.2.8

type ApplicationConfiguration map[string]string

ApplicationConfiguration is a configuration for installed application

type Charge

type Charge struct {
	Code          string    `json:"code"`
	Label         string    `json:"label"`
	From          time.Time `json:"from"`
	To            time.Time `json:"to"`
	NumHours      int       `json:"num_hours"`
	SizeGigabytes int       `json:"size_gb"`
}

Charge represents a Civo resource with number of hours within the specified billing period

type Client

type Client struct {
	BaseURL          *url.URL
	UserAgent        string
	APIKey           string
	Region           string
	LastJSONResponse string
	// contains filtered or unexported fields
}

Client is the means of connecting to the Civo API service

func NewAdvancedClientForTesting

func NewAdvancedClientForTesting(responses map[string]map[string]string) (*Client, *httptest.Server, error)

NewAdvancedClientForTesting initializes a Client connecting to a local test server and allows for specifying methods

func NewClient

func NewClient(apiKey, region string) (*Client, error)

NewClient initializes a Client connecting to the production API

func NewClientForTesting

func NewClientForTesting(responses map[string]string) (*Client, *httptest.Server, error)

NewClientForTesting initializes a Client connecting to a local test server

func NewClientForTestingWithServer

func NewClientForTestingWithServer(server *httptest.Server) (*Client, error)

NewClientForTestingWithServer initializes a Client connecting to a passed-in local test server

func NewClientWithURL

func NewClientWithURL(apiKey, civoAPIURL, region string) (*Client, error)

NewClientWithURL initializes a Client with a specific API URL

func (*Client) AddAccountToOrganisation added in v0.2.50

func (c *Client) AddAccountToOrganisation(organisationID, organisationToken string) ([]Account, error)

AddAccountToOrganisation sets the link between second, third, etc accounts and the existing organisation

func (*Client) AddTeamMember added in v0.2.50

func (c *Client) AddTeamMember(teamID, userID, permissions, roles string) ([]TeamMember, error)

AddTeamMember adds a team member to the specified team, with permissions and roles (which are combinative)

func (*Client) AttachVolume

func (c *Client) AttachVolume(id string, instance string) (*SimpleResponse, error)

AttachVolume attaches a volume to an instance https://www.civo.com/api/volumes#attach-a-volume-to-an-instance

func (*Client) CreateDNSDomain

func (c *Client) CreateDNSDomain(name string) (*DNSDomain, error)

CreateDNSDomain registers a new Domain

func (*Client) CreateDNSRecord

func (c *Client) CreateDNSRecord(domainID string, r *DNSRecordConfig) (*DNSRecord, error)

CreateDNSRecord creates a new DNS record

func (*Client) CreateInstance

func (c *Client) CreateInstance(config *InstanceConfig) (*Instance, error)

CreateInstance creates a new instance in the account

func (*Client) CreateLoadBalancer

func (c *Client) CreateLoadBalancer(r *LoadBalancerConfig) (*LoadBalancer, error)

CreateLoadBalancer creates a new load balancer

func (*Client) CreateOrganisation added in v0.2.50

func (c *Client) CreateOrganisation(name string) (*Organisation, error)

CreateOrganisation creates an organisation with the current account as the only linked member (errors if it's already linked)

func (*Client) CreateRole added in v0.2.50

func (c *Client) CreateRole(name, permissions string) (*Role, error)

CreateRole creates a new role with a set of permissions for use within an organisation

func (*Client) CreateSnapshot

func (c *Client) CreateSnapshot(name string, r *SnapshotConfig) (*Snapshot, error)

CreateSnapshot create a new or update an old snapshot

func (*Client) CreateTeam added in v0.2.50

func (c *Client) CreateTeam(name, organisationID, accountID string) (*Team, error)

CreateTeam creates a new team in either the account or organisation depending on which field has a non-blank value

func (*Client) CreateWebhook

func (c *Client) CreateWebhook(r *WebhookConfig) (*Webhook, error)

CreateWebhook creates a new webhook

func (*Client) DecodeSimpleResponse

func (c *Client) DecodeSimpleResponse(resp []byte) (*SimpleResponse, error)

DecodeSimpleResponse parses a response body in to a SimpleResponse object

func (*Client) DeleteDNSDomain

func (c *Client) DeleteDNSDomain(d *DNSDomain) (*SimpleResponse, error)

DeleteDNSDomain deletes the Domain that matches the name

func (*Client) DeleteDNSRecord

func (c *Client) DeleteDNSRecord(r *DNSRecord) (*SimpleResponse, error)

DeleteDNSRecord deletes the DNS record

func (*Client) DeleteFirewall

func (c *Client) DeleteFirewall(id string) (*SimpleResponse, error)

DeleteFirewall deletes an firewall

func (*Client) DeleteFirewallRule

func (c *Client) DeleteFirewallRule(id string, ruleID string) (*SimpleResponse, error)

DeleteFirewallRule deletes an firewall

func (*Client) DeleteInstance

func (c *Client) DeleteInstance(id string) (*SimpleResponse, error)

DeleteInstance deletes an instance and frees its resources

func (*Client) DeleteKubernetesCluster

func (c *Client) DeleteKubernetesCluster(id string) (*SimpleResponse, error)

DeleteKubernetesCluster deletes a cluster

func (*Client) DeleteLoadBalancer

func (c *Client) DeleteLoadBalancer(id string) (*SimpleResponse, error)

DeleteLoadBalancer deletes a load balancer

func (*Client) DeleteNetwork

func (c *Client) DeleteNetwork(id string) (*SimpleResponse, error)

DeleteNetwork deletes a private network

func (*Client) DeleteRole added in v0.2.50

func (c *Client) DeleteRole(id string) (*SimpleResponse, error)

DeleteRole removes a non-built-in role from an organisation

func (*Client) DeleteSSHKey added in v0.2.0

func (c *Client) DeleteSSHKey(id string) (*SimpleResponse, error)

DeleteSSHKey deletes an SSH key

func (*Client) DeleteSnapshot

func (c *Client) DeleteSnapshot(name string) (*SimpleResponse, error)

DeleteSnapshot deletes a snapshot

func (*Client) DeleteTeam added in v0.2.50

func (c *Client) DeleteTeam(id string) (*SimpleResponse, error)

DeleteTeam removes a team (and therefore all team member access)

func (*Client) DeleteTemplate added in v0.2.1

func (c *Client) DeleteTemplate(id string) (*SimpleResponse, error)

DeleteTemplate deletes requested template

func (*Client) DeleteVolume

func (c *Client) DeleteVolume(id string) (*SimpleResponse, error)

DeleteVolume deletes a volumes https://www.civo.com/api/volumes#deleting-a-volume

func (*Client) DeleteWebhook

func (c *Client) DeleteWebhook(id string) (*SimpleResponse, error)

DeleteWebhook deletes a webhook

func (*Client) DetachVolume

func (c *Client) DetachVolume(id string) (*SimpleResponse, error)

DetachVolume attach volume from any instances https://www.civo.com/api/volumes#attach-a-volume-to-an-instance

func (*Client) FindDNSDomain

func (c *Client) FindDNSDomain(search string) (*DNSDomain, error)

FindDNSDomain finds a domain name by either part of the ID or part of the name

func (*Client) FindDiskImage added in v0.2.37

func (c *Client) FindDiskImage(search string) (*DiskImage, error)

FindDiskImage finds a disk image by either part of the ID or part of the name

func (*Client) FindFirewall

func (c *Client) FindFirewall(search string) (*Firewall, error)

FindFirewall finds a firewall by either part of the ID or part of the name

func (*Client) FindFirewallRule added in v0.1.7

func (c *Client) FindFirewallRule(firewallID string, search string) (*FirewallRule, error)

FindFirewallRule finds a firewall Rule by ID or part of the same

func (*Client) FindInstance

func (c *Client) FindInstance(search string) (*Instance, error)

FindInstance finds a instance by either part of the ID or part of the hostname

func (*Client) FindInstanceSizes added in v0.2.20

func (c *Client) FindInstanceSizes(search string) (*InstanceSize, error)

FindInstanceSizes finds a instance size name by either part of the ID or part of the name

func (*Client) FindKubernetesCluster

func (c *Client) FindKubernetesCluster(search string) (*KubernetesCluster, error)

FindKubernetesCluster finds a Kubernetes cluster by either part of the ID or part of the name

func (*Client) FindLoadBalancer

func (c *Client) FindLoadBalancer(search string) (*LoadBalancer, error)

FindLoadBalancer finds a load balancer by either part of the ID or part of the name

func (*Client) FindNetwork

func (c *Client) FindNetwork(search string) (*Network, error)

FindNetwork finds a network by either part of the ID or part of the name

func (*Client) FindRegion added in v0.2.24

func (c *Client) FindRegion(search string) (*Region, error)

FindRegion is a function to find a region

func (*Client) FindSSHKey

func (c *Client) FindSSHKey(search string) (*SSHKey, error)

FindSSHKey finds an SSH key by either part of the ID or part of the name

func (*Client) FindSnapshot

func (c *Client) FindSnapshot(search string) (*Snapshot, error)

FindSnapshot finds a snapshot by either part of the ID or part of the name

func (*Client) FindTemplate added in v0.2.14

func (c *Client) FindTemplate(search string) (*Template, error)

FindTemplate finds a template by either part of the ID or part of the code

func (*Client) FindVolume

func (c *Client) FindVolume(search string) (*Volume, error)

FindVolume finds a volume by either part of the ID or part of the name

func (*Client) FindWebhook

func (c *Client) FindWebhook(search string) (*Webhook, error)

FindWebhook finds a webhook by either part of the ID or part of the name

func (*Client) GetDNSDomain

func (c *Client) GetDNSDomain(name string) (*DNSDomain, error)

GetDNSDomain returns the DNS Domain that matches the name

func (*Client) GetDNSRecord

func (c *Client) GetDNSRecord(domainID, domainRecordID string) (*DNSRecord, error)

GetDNSRecord returns the Record that matches the domain ID and domain record ID

func (*Client) GetDefaultNetwork

func (c *Client) GetDefaultNetwork() (*Network, error)

GetDefaultNetwork finds the default private network for an account

func (*Client) GetDefaultRegion added in v0.2.26

func (c *Client) GetDefaultRegion() (*Region, error)

GetDefaultRegion finds the default region for an account

func (*Client) GetDiskImage added in v0.2.37

func (c *Client) GetDiskImage(id string) (*DiskImage, error)

GetDiskImage get one disk image using the id

func (*Client) GetInstance

func (c *Client) GetInstance(id string) (*Instance, error)

GetInstance returns a single Instance by its full ID

func (*Client) GetInstanceConsoleURL added in v0.1.1

func (c *Client) GetInstanceConsoleURL(id string) (string, error)

GetInstanceConsoleURL gets the web URL for an instance's console

func (*Client) GetKubernetesCluster added in v0.2.30

func (c *Client) GetKubernetesCluster(id string) (*KubernetesCluster, error)

GetKubernetesCluster returns a single kubernetes cluster by its full ID

func (*Client) GetOrganisation added in v0.2.50

func (c *Client) GetOrganisation() (*Organisation, error)

GetOrganisation returns the organisation associated with the current account

func (*Client) GetQuota

func (c *Client) GetQuota() (*Quota, error)

GetQuota returns all load balancers owned by the calling API account

func (*Client) GetTemplateByCode

func (c *Client) GetTemplateByCode(code string) (*Template, error)

GetTemplateByCode finds the Template for an account with the specified code

func (*Client) GetVolume added in v0.2.41

func (c *Client) GetVolume(id string) (*Volume, error)

GetVolume finds a volume by the full ID

func (*Client) HardRebootInstance

func (c *Client) HardRebootInstance(id string) (*SimpleResponse, error)

HardRebootInstance harshly reboots an instance (like shutting the power off and booting it again)

func (*Client) ListAccountsInOrganisation added in v0.2.50

func (c *Client) ListAccountsInOrganisation() ([]Account, error)

ListAccountsInOrganisation returns all the accounts in the current account's organisation

func (*Client) ListAllInstances

func (c *Client) ListAllInstances() ([]Instance, error)

ListAllInstances returns all (well, upto 99,999,999 instances) Instances owned by the calling API account

func (*Client) ListAvailableKubernetesVersions

func (c *Client) ListAvailableKubernetesVersions() ([]KubernetesVersion, error)

ListAvailableKubernetesVersions returns all version of kubernetes available

func (*Client) ListCharges

func (c *Client) ListCharges(from, to time.Time) ([]Charge, error)

ListCharges returns all charges for the calling API account

func (*Client) ListDNSDomains

func (c *Client) ListDNSDomains() ([]DNSDomain, error)

ListDNSDomains returns all Domains owned by the calling API account

func (*Client) ListDNSRecords

func (c *Client) ListDNSRecords(dnsDomainID string) ([]DNSRecord, error)

ListDNSRecords returns all the records associated with domainID

func (*Client) ListDiskImages added in v0.2.37

func (c *Client) ListDiskImages() ([]DiskImage, error)

ListDiskImages return all disk image in system

func (*Client) ListFirewallRules

func (c *Client) ListFirewallRules(id string) ([]FirewallRule, error)

ListFirewallRules get all rules for a firewall

func (*Client) ListFirewalls

func (c *Client) ListFirewalls() ([]Firewall, error)

ListFirewalls returns all firewall owned by the calling API account

func (*Client) ListInstanceSizes

func (c *Client) ListInstanceSizes() ([]InstanceSize, error)

ListInstanceSizes returns all availble sizes of instances

func (*Client) ListInstances

func (c *Client) ListInstances(page int, perPage int) (*PaginatedInstanceList, error)

ListInstances returns a page of Instances owned by the calling API account

func (*Client) ListKubernetesClusters

func (c *Client) ListKubernetesClusters() (*PaginatedKubernetesClusters, error)

ListKubernetesClusters returns all cluster of kubernetes in the account

func (*Client) ListKubernetesMarketplaceApplications

func (c *Client) ListKubernetesMarketplaceApplications() ([]KubernetesMarketplaceApplication, error)

ListKubernetesMarketplaceApplications returns all application inside marketplace

func (*Client) ListLoadBalancers

func (c *Client) ListLoadBalancers() ([]LoadBalancer, error)

ListLoadBalancers returns all load balancers owned by the calling API account

func (*Client) ListNetworks

func (c *Client) ListNetworks() ([]Network, error)

ListNetworks list all private networks

func (*Client) ListPermissions added in v0.2.50

func (c *Client) ListPermissions() ([]Permission, error)

ListPermissions returns all permissions available to be assigned to team member

func (*Client) ListRegions

func (c *Client) ListRegions() ([]Region, error)

ListRegions returns all load balancers owned by the calling API account

func (*Client) ListRoles added in v0.2.50

func (c *Client) ListRoles() ([]Role, error)

ListRoles returns all roles (built-in and user defined)

func (*Client) ListSSHKeys

func (c *Client) ListSSHKeys() ([]SSHKey, error)

ListSSHKeys list all SSH key for an account

func (*Client) ListSnapshots

func (c *Client) ListSnapshots() ([]Snapshot, error)

ListSnapshots returns a list of all snapshots within the current account

func (*Client) ListTeamMembers added in v0.2.50

func (c *Client) ListTeamMembers(teamID string) ([]TeamMember, error)

ListTeamMembers returns a list of all team members (and their permissions) in the specified team

func (*Client) ListTeams added in v0.2.50

func (c *Client) ListTeams() ([]Team, error)

ListTeams returns all teams for the current account

func (*Client) ListTemplates added in v0.2.1

func (c *Client) ListTemplates() ([]Template, error)

ListTemplates return all template in system

func (*Client) ListVolumes

func (c *Client) ListVolumes() ([]Volume, error)

ListVolumes returns all volumes owned by the calling API account https://www.civo.com/api/volumes#list-volumes

func (*Client) ListWebhooks

func (c *Client) ListWebhooks() ([]Webhook, error)

ListWebhooks returns a list of all webhook within the current account

func (*Client) MovePublicIPToInstance

func (c *Client) MovePublicIPToInstance(id, ipAddress string) (*SimpleResponse, error)

MovePublicIPToInstance moves a public IP to the specified instance

func (*Client) NewFirewall

func (c *Client) NewFirewall(name, networkid string) (*FirewallResult, error)

NewFirewall creates a new firewall record

func (*Client) NewFirewallRule

func (c *Client) NewFirewallRule(r *FirewallRuleConfig) (*FirewallRule, error)

NewFirewallRule creates a new rule within a firewall

func (*Client) NewInstanceConfig

func (c *Client) NewInstanceConfig() (*InstanceConfig, error)

NewInstanceConfig returns an initialized config for a new instance

func (*Client) NewKubernetesClusters

func (c *Client) NewKubernetesClusters(kc *KubernetesClusterConfig) (*KubernetesCluster, error)

NewKubernetesClusters create a new cluster of kubernetes

func (*Client) NewNetwork

func (c *Client) NewNetwork(label string) (*NetworkResult, error)

NewNetwork creates a new private network

func (*Client) NewSSHKey added in v0.2.0

func (c *Client) NewSSHKey(name string, publicKey string) (*SimpleResponse, error)

NewSSHKey creates a new SSH key record

func (*Client) NewTemplate added in v0.2.1

func (c *Client) NewTemplate(conf *Template) (*SimpleResponse, error)

NewTemplate will create a new template for the current user

func (*Client) NewVolume

func (c *Client) NewVolume(v *VolumeConfig) (*VolumeResult, error)

NewVolume creates a new volume https://www.civo.com/api/volumes#create-a-new-volume

func (*Client) RebootInstance

func (c *Client) RebootInstance(id string) (*SimpleResponse, error)

RebootInstance reboots an instance (short version of HardRebootInstance)

func (*Client) RecycleKubernetesCluster

func (c *Client) RecycleKubernetesCluster(id string, hostname string) (*SimpleResponse, error)

RecycleKubernetesCluster create a new cluster of kubernetes

func (*Client) RemoveTeamMember added in v0.2.50

func (c *Client) RemoveTeamMember(teamID, teamMemberID string) (*SimpleResponse, error)

RemoveTeamMember removes the specified team member from the specified team

func (*Client) RenameFirewall added in v0.1.9

func (c *Client) RenameFirewall(id string, f *FirewallConfig) (*SimpleResponse, error)

RenameFirewall rename firewall

func (*Client) RenameNetwork

func (c *Client) RenameNetwork(label, id string) (*NetworkResult, error)

RenameNetwork renames an existing private network

func (*Client) RenameOrganisation added in v0.2.50

func (c *Client) RenameOrganisation(name string) (*Organisation, error)

RenameOrganisation changes the human set name of the organisation (e.g. for re-branding efforts)

func (*Client) RenameTeam added in v0.2.50

func (c *Client) RenameTeam(teamID, name string) (*Team, error)

RenameTeam changes the human set name for a team

func (*Client) ResizeVolume

func (c *Client) ResizeVolume(id string, size int) (*SimpleResponse, error)

ResizeVolume resizes a volume https://www.civo.com/api/volumes#resizing-a-volume

func (*Client) SendDeleteRequest

func (c *Client) SendDeleteRequest(requestURL string) ([]byte, error)

SendDeleteRequest sends a correctly authenticated delete request to the API server

func (*Client) SendGetRequest

func (c *Client) SendGetRequest(requestURL string) ([]byte, error)

SendGetRequest sends a correctly authenticated get request to the API server

func (*Client) SendPostRequest

func (c *Client) SendPostRequest(requestURL string, params interface{}) ([]byte, error)

SendPostRequest sends a correctly authenticated post request to the API server

func (*Client) SendPutRequest

func (c *Client) SendPutRequest(requestURL string, params interface{}) ([]byte, error)

SendPutRequest sends a correctly authenticated put request to the API server

func (*Client) SetInstanceFirewall

func (c *Client) SetInstanceFirewall(id, firewallID string) (*SimpleResponse, error)

SetInstanceFirewall changes the current firewall for an instance

func (*Client) SetInstanceTags

func (c *Client) SetInstanceTags(i *Instance, tags string) (*SimpleResponse, error)

SetInstanceTags sets the tags for the specified instance

func (*Client) SoftRebootInstance

func (c *Client) SoftRebootInstance(id string) (*SimpleResponse, error)

SoftRebootInstance requests the VM to shut down nicely

func (*Client) StartInstance

func (c *Client) StartInstance(id string) (*SimpleResponse, error)

StartInstance starts the instance booting from the shutdown state

func (*Client) StopInstance

func (c *Client) StopInstance(id string) (*SimpleResponse, error)

StopInstance shuts the power down to the instance

func (*Client) UpdateDNSDomain

func (c *Client) UpdateDNSDomain(d *DNSDomain, name string) (*DNSDomain, error)

UpdateDNSDomain updates the provided domain with name

func (*Client) UpdateDNSRecord added in v0.1.4

func (c *Client) UpdateDNSRecord(r *DNSRecord, rc *DNSRecordConfig) (*DNSRecord, error)

UpdateDNSRecord updates the DNS record

func (*Client) UpdateInstance

func (c *Client) UpdateInstance(i *Instance) (*SimpleResponse, error)

UpdateInstance updates an Instance's hostname, reverse DNS or notes

func (*Client) UpdateKubernetesCluster

func (c *Client) UpdateKubernetesCluster(id string, i *KubernetesClusterConfig) (*KubernetesCluster, error)

UpdateKubernetesCluster update a single kubernetes cluster by its full ID

func (*Client) UpdateLoadBalancer

func (c *Client) UpdateLoadBalancer(id string, r *LoadBalancerConfig) (*LoadBalancer, error)

UpdateLoadBalancer updates a load balancer

func (*Client) UpdateSSHKey added in v0.2.0

func (c *Client) UpdateSSHKey(name string, sshKeyID string) (*SSHKey, error)

UpdateSSHKey update a SSH key record

func (*Client) UpdateTeamMember added in v0.2.50

func (c *Client) UpdateTeamMember(teamID, teamMemberID, permissions, roles string) (*TeamMember, error)

UpdateTeamMember changes the permissions or roles for a specified team member

func (*Client) UpdateTemplate added in v0.2.1

func (c *Client) UpdateTemplate(id string, conf *Template) (*Template, error)

UpdateTemplate will update a template for the current user

func (*Client) UpdateWebhook

func (c *Client) UpdateWebhook(id string, r *WebhookConfig) (*Webhook, error)

UpdateWebhook updates a webhook

func (*Client) UpgradeInstance

func (c *Client) UpgradeInstance(id, newSize string) (*SimpleResponse, error)

UpgradeInstance resizes the instance up to the new specification it's not possible to resize the instance to a smaller size

type Clienter added in v0.2.30

type Clienter interface {
	// Charges
	ListCharges(from, to time.Time) ([]Charge, error)

	// DNS
	ListDNSDomains() ([]DNSDomain, error)
	FindDNSDomain(search string) (*DNSDomain, error)
	CreateDNSDomain(name string) (*DNSDomain, error)
	GetDNSDomain(name string) (*DNSDomain, error)
	UpdateDNSDomain(d *DNSDomain, name string) (*DNSDomain, error)
	DeleteDNSDomain(d *DNSDomain) (*SimpleResponse, error)
	CreateDNSRecord(domainID string, r *DNSRecordConfig) (*DNSRecord, error)
	ListDNSRecords(dnsDomainID string) ([]DNSRecord, error)
	GetDNSRecord(domainID, domainRecordID string) (*DNSRecord, error)
	UpdateDNSRecord(r *DNSRecord, rc *DNSRecordConfig) (*DNSRecord, error)
	DeleteDNSRecord(r *DNSRecord) (*SimpleResponse, error)

	// Firewalls
	ListFirewalls() ([]Firewall, error)
	FindFirewall(search string) (*Firewall, error)
	NewFirewall(name, networkID string) (*FirewallResult, error)
	RenameFirewall(id string, f *FirewallConfig) (*SimpleResponse, error)
	DeleteFirewall(id string) (*SimpleResponse, error)
	NewFirewallRule(r *FirewallRuleConfig) (*FirewallRule, error)
	ListFirewallRules(id string) ([]FirewallRule, error)
	FindFirewallRule(firewallID string, search string) (*FirewallRule, error)
	DeleteFirewallRule(id string, ruleID string) (*SimpleResponse, error)

	// Instances
	ListInstances(page int, perPage int) (*PaginatedInstanceList, error)
	ListAllInstances() ([]Instance, error)
	FindInstance(search string) (*Instance, error)
	GetInstance(id string) (*Instance, error)
	NewInstanceConfig() (*InstanceConfig, error)
	CreateInstance(config *InstanceConfig) (*Instance, error)
	SetInstanceTags(i *Instance, tags string) (*SimpleResponse, error)
	UpdateInstance(i *Instance) (*SimpleResponse, error)
	DeleteInstance(id string) (*SimpleResponse, error)
	RebootInstance(id string) (*SimpleResponse, error)
	HardRebootInstance(id string) (*SimpleResponse, error)
	SoftRebootInstance(id string) (*SimpleResponse, error)
	StopInstance(id string) (*SimpleResponse, error)
	StartInstance(id string) (*SimpleResponse, error)
	GetInstanceConsoleURL(id string) (string, error)
	UpgradeInstance(id, newSize string) (*SimpleResponse, error)
	MovePublicIPToInstance(id, ipAddress string) (*SimpleResponse, error)
	SetInstanceFirewall(id, firewallID string) (*SimpleResponse, error)

	// Instance sizes
	ListInstanceSizes() ([]InstanceSize, error)
	FindInstanceSizes(search string) (*InstanceSize, error)

	// Clusters
	ListKubernetesClusters() (*PaginatedKubernetesClusters, error)
	FindKubernetesCluster(search string) (*KubernetesCluster, error)
	NewKubernetesClusters(kc *KubernetesClusterConfig) (*KubernetesCluster, error)
	GetKubernetesCluster(id string) (*KubernetesCluster, error)
	UpdateKubernetesCluster(id string, i *KubernetesClusterConfig) (*KubernetesCluster, error)
	ListKubernetesMarketplaceApplications() ([]KubernetesMarketplaceApplication, error)
	DeleteKubernetesCluster(id string) (*SimpleResponse, error)
	RecycleKubernetesCluster(id string, hostname string) (*SimpleResponse, error)
	ListAvailableKubernetesVersions() ([]KubernetesVersion, error)

	// Load balancers
	ListLoadBalancers() ([]LoadBalancer, error)
	FindLoadBalancer(search string) (*LoadBalancer, error)
	CreateLoadBalancer(r *LoadBalancerConfig) (*LoadBalancer, error)
	UpdateLoadBalancer(id string, r *LoadBalancerConfig) (*LoadBalancer, error)
	DeleteLoadBalancer(id string) (*SimpleResponse, error)

	// Networks
	GetDefaultNetwork() (*Network, error)
	NewNetwork(label string) (*NetworkResult, error)
	ListNetworks() ([]Network, error)
	FindNetwork(search string) (*Network, error)
	RenameNetwork(label, id string) (*NetworkResult, error)
	DeleteNetwork(id string) (*SimpleResponse, error)

	// Quota
	GetQuota() (*Quota, error)

	// Regions
	ListRegions() ([]Region, error)

	// Snapshots
	CreateSnapshot(name string, r *SnapshotConfig) (*Snapshot, error)
	ListSnapshots() ([]Snapshot, error)
	FindSnapshot(search string) (*Snapshot, error)
	DeleteSnapshot(name string) (*SimpleResponse, error)

	// SSHKeys
	ListSSHKeys() ([]SSHKey, error)
	NewSSHKey(name string, publicKey string) (*SimpleResponse, error)
	UpdateSSHKey(name string, sshKeyID string) (*SSHKey, error)
	FindSSHKey(search string) (*SSHKey, error)
	DeleteSSHKey(id string) (*SimpleResponse, error)

	// Templates
	ListTemplates() ([]Template, error)
	NewTemplate(conf *Template) (*SimpleResponse, error)
	UpdateTemplate(id string, conf *Template) (*Template, error)
	GetTemplateByCode(code string) (*Template, error)
	FindTemplate(search string) (*Template, error)
	DeleteTemplate(id string) (*SimpleResponse, error)

	// DiskImages
	ListDiskImages() ([]DiskImage, error)
	GetDiskImage(id string) (*DiskImage, error)
	FindDiskImage(search string) (*DiskImage, error)

	// Volumes
	ListVolumes() ([]Volume, error)
	GetVolume(id string) (*Volume, error)
	FindVolume(search string) (*Volume, error)
	NewVolume(v *VolumeConfig) (*VolumeResult, error)
	ResizeVolume(id string, size int) (*SimpleResponse, error)
	AttachVolume(id string, instance string) (*SimpleResponse, error)
	DetachVolume(id string) (*SimpleResponse, error)
	DeleteVolume(id string) (*SimpleResponse, error)

	// Webhooks
	CreateWebhook(r *WebhookConfig) (*Webhook, error)
	ListWebhooks() ([]Webhook, error)
	FindWebhook(search string) (*Webhook, error)
	UpdateWebhook(id string, r *WebhookConfig) (*Webhook, error)
	DeleteWebhook(id string) (*SimpleResponse, error)
}

Clienter is the interface the real civogo.Client and civogo.FakeClient implement

type DNSDomain

type DNSDomain struct {
	// The ID of the domain
	ID string `json:"id"`

	// The ID of the account
	AccountID string `json:"account_id"`

	// The Name of the domain
	Name string `json:"name"`
}

DNSDomain represents a domain registered within Civo's infrastructure

type DNSRecord

type DNSRecord struct {
	ID          string        `json:"id"`
	AccountID   string        `json:"account_id,omitempty"`
	DNSDomainID string        `json:"domain_id,omitempty"`
	Name        string        `json:"name,omitempty"`
	Value       string        `json:"value,omitempty"`
	Type        DNSRecordType `json:"type,omitempty"`
	Priority    int           `json:"priority,omitempty"`
	TTL         int           `json:"ttl,omitempty"`
	CreatedAt   time.Time     `json:"created_at,omitempty"`
	UpdatedAt   time.Time     `json:"updated_at,omitempty"`
}

DNSRecord represents a DNS record registered within Civo's infrastructure

type DNSRecordConfig

type DNSRecordConfig struct {
	Type     DNSRecordType `json:"type"`
	Name     string        `json:"name"`
	Value    string        `json:"value"`
	Priority int           `json:"priority"`
	TTL      int           `json:"ttl"`
}

DNSRecordConfig describes the parameters for a new DNS record none of the fields are mandatory and will be automatically set with default values

type DNSRecordType

type DNSRecordType string

DNSRecordType represents the allowed record types: a, cname, mx or txt

type DiskImage added in v0.2.37

type DiskImage struct {
	ID           string `json:"id,omitempty"`
	Name         string `json:"name,omitempty"`
	Version      string `json:"version,omitempty"`
	State        string `json:"state,omitempty"`
	Distribution string `json:"distribution,omitempty"`
	Description  string `json:"description,omitempty"`
	Label        string `json:"label,omitempty"`
}

DiskImage represents a DiskImage for launching instances from

type FakeClient added in v0.2.30

type FakeClient struct {
	LastID                  int64
	Charges                 []Charge
	Domains                 []DNSDomain
	DomainRecords           []DNSRecord
	Firewalls               []Firewall
	FirewallRules           []FirewallRule
	InstanceSizes           []InstanceSize
	Instances               []Instance
	Clusters                []KubernetesCluster
	LoadBalancers           []LoadBalancer
	Networks                []Network
	Snapshots               []Snapshot
	Volumes                 []Volume
	SSHKeys                 []SSHKey
	Webhooks                []Webhook
	Templates               []Template
	DiskImage               []DiskImage
	Quota                   Quota
	Organisation            Organisation
	OrganisationAccounts    []Account
	OrganisationRoles       []Role
	OrganisationTeams       []Team
	OrganisationTeamMembers map[string][]TeamMember
}

FakeClient is a temporary storage structure for use when you don't want to communicate with a real Civo API server

func NewFakeClient added in v0.2.30

func NewFakeClient() (*FakeClient, error)

NewFakeClient initializes a Client that doesn't attach to a

func (*FakeClient) AddAccountToOrganisation added in v0.2.50

func (c *FakeClient) AddAccountToOrganisation(accountID string) ([]Account, error)

AddAccountToOrganisation implemented in a fake way for automated tests

func (*FakeClient) AddTeamMember added in v0.2.50

func (c *FakeClient) AddTeamMember(teamID, userID, permissions, roles string) ([]TeamMember, error)

AddTeamMember implemented in a fake way for automated tests

func (*FakeClient) AttachVolume added in v0.2.30

func (c *FakeClient) AttachVolume(id string, instance string) (*SimpleResponse, error)

AttachVolume implemented in a fake way for automated tests

func (*FakeClient) CreateDNSDomain added in v0.2.30

func (c *FakeClient) CreateDNSDomain(name string) (*DNSDomain, error)

CreateDNSDomain implemented in a fake way for automated tests

func (*FakeClient) CreateDNSRecord added in v0.2.30

func (c *FakeClient) CreateDNSRecord(domainID string, r *DNSRecordConfig) (*DNSRecord, error)

CreateDNSRecord implemented in a fake way for automated tests

func (*FakeClient) CreateInstance added in v0.2.30

func (c *FakeClient) CreateInstance(config *InstanceConfig) (*Instance, error)

CreateInstance implemented in a fake way for automated tests

func (*FakeClient) CreateLoadBalancer added in v0.2.30

func (c *FakeClient) CreateLoadBalancer(r *LoadBalancerConfig) (*LoadBalancer, error)

CreateLoadBalancer implemented in a fake way for automated tests

func (*FakeClient) CreateOrganisation added in v0.2.50

func (c *FakeClient) CreateOrganisation(name string) (*Organisation, error)

CreateOrganisation implemented in a fake way for automated tests

func (*FakeClient) CreateRole added in v0.2.50

func (c *FakeClient) CreateRole(name, permissions string) (*Role, error)

CreateRole implemented in a fake way for automated tests

func (*FakeClient) CreateSnapshot added in v0.2.30

func (c *FakeClient) CreateSnapshot(name string, r *SnapshotConfig) (*Snapshot, error)

CreateSnapshot implemented in a fake way for automated tests

func (*FakeClient) CreateTeam added in v0.2.50

func (c *FakeClient) CreateTeam(name, organisationID, accountID string) (*Team, error)

CreateTeam implemented in a fake way for automated tests

func (*FakeClient) CreateWebhook added in v0.2.30

func (c *FakeClient) CreateWebhook(r *WebhookConfig) (*Webhook, error)

CreateWebhook implemented in a fake way for automated tests

func (*FakeClient) DeleteDNSDomain added in v0.2.30

func (c *FakeClient) DeleteDNSDomain(d *DNSDomain) (*SimpleResponse, error)

DeleteDNSDomain implemented in a fake way for automated tests

func (*FakeClient) DeleteDNSRecord added in v0.2.30

func (c *FakeClient) DeleteDNSRecord(r *DNSRecord) (*SimpleResponse, error)

DeleteDNSRecord implemented in a fake way for automated tests

func (*FakeClient) DeleteFirewall added in v0.2.30

func (c *FakeClient) DeleteFirewall(id string) (*SimpleResponse, error)

DeleteFirewall implemented in a fake way for automated tests

func (*FakeClient) DeleteFirewallRule added in v0.2.30

func (c *FakeClient) DeleteFirewallRule(id string, ruleID string) (*SimpleResponse, error)

DeleteFirewallRule implemented in a fake way for automated tests

func (*FakeClient) DeleteInstance added in v0.2.30

func (c *FakeClient) DeleteInstance(id string) (*SimpleResponse, error)

DeleteInstance implemented in a fake way for automated tests

func (*FakeClient) DeleteKubernetesCluster added in v0.2.30

func (c *FakeClient) DeleteKubernetesCluster(id string) (*SimpleResponse, error)

DeleteKubernetesCluster implemented in a fake way for automated tests

func (*FakeClient) DeleteLoadBalancer added in v0.2.30

func (c *FakeClient) DeleteLoadBalancer(id string) (*SimpleResponse, error)

DeleteLoadBalancer implemented in a fake way for automated tests

func (*FakeClient) DeleteNetwork added in v0.2.30

func (c *FakeClient) DeleteNetwork(id string) (*SimpleResponse, error)

DeleteNetwork implemented in a fake way for automated tests

func (*FakeClient) DeleteRole added in v0.2.50

func (c *FakeClient) DeleteRole(id string) (*SimpleResponse, error)

DeleteRole implemented in a fake way for automated tests

func (*FakeClient) DeleteSSHKey added in v0.2.30

func (c *FakeClient) DeleteSSHKey(id string) (*SimpleResponse, error)

DeleteSSHKey implemented in a fake way for automated tests

func (*FakeClient) DeleteSnapshot added in v0.2.30

func (c *FakeClient) DeleteSnapshot(name string) (*SimpleResponse, error)

DeleteSnapshot implemented in a fake way for automated tests

func (*FakeClient) DeleteTeam added in v0.2.50

func (c *FakeClient) DeleteTeam(id string) (*SimpleResponse, error)

DeleteTeam implemented in a fake way for automated tests

func (*FakeClient) DeleteTemplate added in v0.2.30

func (c *FakeClient) DeleteTemplate(id string) (*SimpleResponse, error)

DeleteTemplate implemented in a fake way for automated tests

func (*FakeClient) DeleteVolume added in v0.2.30

func (c *FakeClient) DeleteVolume(id string) (*SimpleResponse, error)

DeleteVolume implemented in a fake way for automated tests

func (*FakeClient) DeleteWebhook added in v0.2.30

func (c *FakeClient) DeleteWebhook(id string) (*SimpleResponse, error)

DeleteWebhook implemented in a fake way for automated tests

func (*FakeClient) DetachVolume added in v0.2.30

func (c *FakeClient) DetachVolume(id string) (*SimpleResponse, error)

DetachVolume implemented in a fake way for automated tests

func (*FakeClient) FindDNSDomain added in v0.2.30

func (c *FakeClient) FindDNSDomain(search string) (*DNSDomain, error)

FindDNSDomain implemented in a fake way for automated tests

func (*FakeClient) FindDiskImage added in v0.2.37

func (c *FakeClient) FindDiskImage(search string) (*DiskImage, error)

FindDiskImage implemented in a fake way for automated tests

func (*FakeClient) FindFirewall added in v0.2.30

func (c *FakeClient) FindFirewall(search string) (*Firewall, error)

FindFirewall implemented in a fake way for automated tests

func (*FakeClient) FindFirewallRule added in v0.2.30

func (c *FakeClient) FindFirewallRule(firewallID string, search string) (*FirewallRule, error)

FindFirewallRule implemented in a fake way for automated tests

func (*FakeClient) FindInstance added in v0.2.30

func (c *FakeClient) FindInstance(search string) (*Instance, error)

FindInstance implemented in a fake way for automated tests

func (*FakeClient) FindInstanceSizes added in v0.2.30

func (c *FakeClient) FindInstanceSizes(search string) (*InstanceSize, error)

FindInstanceSizes implemented in a fake way for automated tests

func (*FakeClient) FindKubernetesCluster added in v0.2.30

func (c *FakeClient) FindKubernetesCluster(search string) (*KubernetesCluster, error)

FindKubernetesCluster implemented in a fake way for automated tests

func (*FakeClient) FindLoadBalancer added in v0.2.30

func (c *FakeClient) FindLoadBalancer(search string) (*LoadBalancer, error)

FindLoadBalancer implemented in a fake way for automated tests

func (*FakeClient) FindNetwork added in v0.2.30

func (c *FakeClient) FindNetwork(search string) (*Network, error)

FindNetwork implemented in a fake way for automated tests

func (*FakeClient) FindSSHKey added in v0.2.30

func (c *FakeClient) FindSSHKey(search string) (*SSHKey, error)

FindSSHKey implemented in a fake way for automated tests

func (*FakeClient) FindSnapshot added in v0.2.30

func (c *FakeClient) FindSnapshot(search string) (*Snapshot, error)

FindSnapshot implemented in a fake way for automated tests

func (*FakeClient) FindTemplate added in v0.2.30

func (c *FakeClient) FindTemplate(search string) (*Template, error)

FindTemplate implemented in a fake way for automated tests

func (*FakeClient) FindVolume added in v0.2.30

func (c *FakeClient) FindVolume(search string) (*Volume, error)

FindVolume implemented in a fake way for automated tests

func (*FakeClient) FindWebhook added in v0.2.30

func (c *FakeClient) FindWebhook(search string) (*Webhook, error)

FindWebhook implemented in a fake way for automated tests

func (*FakeClient) GetDNSDomain added in v0.2.30

func (c *FakeClient) GetDNSDomain(name string) (*DNSDomain, error)

GetDNSDomain implemented in a fake way for automated tests

func (*FakeClient) GetDNSRecord added in v0.2.30

func (c *FakeClient) GetDNSRecord(domainID, domainRecordID string) (*DNSRecord, error)

GetDNSRecord implemented in a fake way for automated tests

func (*FakeClient) GetDefaultNetwork added in v0.2.30

func (c *FakeClient) GetDefaultNetwork() (*Network, error)

GetDefaultNetwork implemented in a fake way for automated tests

func (*FakeClient) GetDiskImage added in v0.2.37

func (c *FakeClient) GetDiskImage(id string) (*DiskImage, error)

GetDiskImage implemented in a fake way for automated tests

func (*FakeClient) GetInstance added in v0.2.30

func (c *FakeClient) GetInstance(id string) (*Instance, error)

GetInstance implemented in a fake way for automated tests

func (*FakeClient) GetInstanceConsoleURL added in v0.2.30

func (c *FakeClient) GetInstanceConsoleURL(id string) (string, error)

GetInstanceConsoleURL implemented in a fake way for automated tests

func (*FakeClient) GetKubernetesCluster added in v0.2.30

func (c *FakeClient) GetKubernetesCluster(id string) (*KubernetesCluster, error)

GetKubernetesCluster implemented in a fake way for automated tests

func (*FakeClient) GetOrganisation added in v0.2.50

func (c *FakeClient) GetOrganisation() (*Organisation, error)

GetOrganisation implemented in a fake way for automated tests

func (*FakeClient) GetQuota added in v0.2.30

func (c *FakeClient) GetQuota() (*Quota, error)

GetQuota implemented in a fake way for automated tests

func (*FakeClient) GetTemplateByCode added in v0.2.30

func (c *FakeClient) GetTemplateByCode(code string) (*Template, error)

GetTemplateByCode implemented in a fake way for automated tests

func (*FakeClient) GetVolume added in v0.2.41

func (c *FakeClient) GetVolume(id string) (*Volume, error)

GetVolume implemented in a fake way for automated tests

func (*FakeClient) HardRebootInstance added in v0.2.30

func (c *FakeClient) HardRebootInstance(id string) (*SimpleResponse, error)

HardRebootInstance implemented in a fake way for automated tests

func (*FakeClient) ListAccountsInOrganisation added in v0.2.50

func (c *FakeClient) ListAccountsInOrganisation() ([]Account, error)

ListAccountsInOrganisation implemented in a fake way for automated tests

func (*FakeClient) ListAllInstances added in v0.2.30

func (c *FakeClient) ListAllInstances() ([]Instance, error)

ListAllInstances implemented in a fake way for automated tests

func (*FakeClient) ListAvailableKubernetesVersions added in v0.2.30

func (c *FakeClient) ListAvailableKubernetesVersions() ([]KubernetesVersion, error)

ListAvailableKubernetesVersions implemented in a fake way for automated tests

func (*FakeClient) ListCharges added in v0.2.30

func (c *FakeClient) ListCharges(from, to time.Time) ([]Charge, error)

ListCharges implemented in a fake way for automated tests

func (*FakeClient) ListDNSDomains added in v0.2.30

func (c *FakeClient) ListDNSDomains() ([]DNSDomain, error)

ListDNSDomains implemented in a fake way for automated tests

func (*FakeClient) ListDNSRecords added in v0.2.30

func (c *FakeClient) ListDNSRecords(dnsDomainID string) ([]DNSRecord, error)

ListDNSRecords implemented in a fake way for automated tests

func (*FakeClient) ListDiskImages added in v0.2.37

func (c *FakeClient) ListDiskImages() ([]DiskImage, error)

ListDiskImages implemented in a fake way for automated tests

func (*FakeClient) ListFirewallRules added in v0.2.30

func (c *FakeClient) ListFirewallRules(id string) ([]FirewallRule, error)

ListFirewallRules implemented in a fake way for automated tests

func (*FakeClient) ListFirewalls added in v0.2.30

func (c *FakeClient) ListFirewalls() ([]Firewall, error)

ListFirewalls implemented in a fake way for automated tests

func (*FakeClient) ListInstanceSizes added in v0.2.30

func (c *FakeClient) ListInstanceSizes() ([]InstanceSize, error)

ListInstanceSizes implemented in a fake way for automated tests

func (*FakeClient) ListInstances added in v0.2.30

func (c *FakeClient) ListInstances(page int, perPage int) (*PaginatedInstanceList, error)

ListInstances implemented in a fake way for automated tests

func (*FakeClient) ListKubernetesClusters added in v0.2.30

func (c *FakeClient) ListKubernetesClusters() (*PaginatedKubernetesClusters, error)

ListKubernetesClusters implemented in a fake way for automated tests

func (*FakeClient) ListKubernetesMarketplaceApplications added in v0.2.30

func (c *FakeClient) ListKubernetesMarketplaceApplications() ([]KubernetesMarketplaceApplication, error)

ListKubernetesMarketplaceApplications implemented in a fake way for automated tests

func (*FakeClient) ListLoadBalancers added in v0.2.30

func (c *FakeClient) ListLoadBalancers() ([]LoadBalancer, error)

ListLoadBalancers implemented in a fake way for automated tests

func (*FakeClient) ListNetworks added in v0.2.30

func (c *FakeClient) ListNetworks() ([]Network, error)

ListNetworks implemented in a fake way for automated tests

func (*FakeClient) ListPermissions added in v0.2.50

func (c *FakeClient) ListPermissions() ([]Permission, error)

ListPermissions implemented in a fake way for automated tests

func (*FakeClient) ListRegions added in v0.2.30

func (c *FakeClient) ListRegions() ([]Region, error)

ListRegions implemented in a fake way for automated tests

func (*FakeClient) ListRoles added in v0.2.50

func (c *FakeClient) ListRoles() ([]Role, error)

ListRoles implemented in a fake way for automated tests

func (*FakeClient) ListSSHKeys added in v0.2.30

func (c *FakeClient) ListSSHKeys() ([]SSHKey, error)

ListSSHKeys implemented in a fake way for automated tests

func (*FakeClient) ListSnapshots added in v0.2.30

func (c *FakeClient) ListSnapshots() ([]Snapshot, error)

ListSnapshots implemented in a fake way for automated tests

func (*FakeClient) ListTeamMembers added in v0.2.50

func (c *FakeClient) ListTeamMembers(teamID string) ([]TeamMember, error)

ListTeamMembers implemented in a fake way for automated tests

func (*FakeClient) ListTeams added in v0.2.50

func (c *FakeClient) ListTeams() ([]Team, error)

ListTeams implemented in a fake way for automated tests

func (*FakeClient) ListTemplates added in v0.2.30

func (c *FakeClient) ListTemplates() ([]Template, error)

ListTemplates implemented in a fake way for automated tests

func (*FakeClient) ListVolumes added in v0.2.30

func (c *FakeClient) ListVolumes() ([]Volume, error)

ListVolumes implemented in a fake way for automated tests

func (*FakeClient) ListWebhooks added in v0.2.30

func (c *FakeClient) ListWebhooks() ([]Webhook, error)

ListWebhooks implemented in a fake way for automated tests

func (*FakeClient) MovePublicIPToInstance added in v0.2.30

func (c *FakeClient) MovePublicIPToInstance(id, ipAddress string) (*SimpleResponse, error)

MovePublicIPToInstance implemented in a fake way for automated tests

func (*FakeClient) NewFirewall added in v0.2.30

func (c *FakeClient) NewFirewall(name, networkID string) (*FirewallResult, error)

NewFirewall implemented in a fake way for automated tests

func (*FakeClient) NewFirewallRule added in v0.2.30

func (c *FakeClient) NewFirewallRule(r *FirewallRuleConfig) (*FirewallRule, error)

NewFirewallRule implemented in a fake way for automated tests

func (*FakeClient) NewInstanceConfig added in v0.2.30

func (c *FakeClient) NewInstanceConfig() (*InstanceConfig, error)

NewInstanceConfig implemented in a fake way for automated tests

func (*FakeClient) NewKubernetesClusters added in v0.2.30

func (c *FakeClient) NewKubernetesClusters(kc *KubernetesClusterConfig) (*KubernetesCluster, error)

NewKubernetesClusters implemented in a fake way for automated tests

func (*FakeClient) NewNetwork added in v0.2.30

func (c *FakeClient) NewNetwork(label string) (*NetworkResult, error)

NewNetwork implemented in a fake way for automated tests

func (*FakeClient) NewSSHKey added in v0.2.30

func (c *FakeClient) NewSSHKey(name string, publicKey string) (*SimpleResponse, error)

NewSSHKey implemented in a fake way for automated tests

func (*FakeClient) NewTemplate added in v0.2.30

func (c *FakeClient) NewTemplate(conf *Template) (*SimpleResponse, error)

NewTemplate implemented in a fake way for automated tests

func (*FakeClient) NewVolume added in v0.2.30

func (c *FakeClient) NewVolume(v *VolumeConfig) (*VolumeResult, error)

NewVolume implemented in a fake way for automated tests

func (*FakeClient) RebootInstance added in v0.2.30

func (c *FakeClient) RebootInstance(id string) (*SimpleResponse, error)

RebootInstance implemented in a fake way for automated tests

func (*FakeClient) RecycleKubernetesCluster added in v0.2.30

func (c *FakeClient) RecycleKubernetesCluster(id string, hostname string) (*SimpleResponse, error)

RecycleKubernetesCluster implemented in a fake way for automated tests

func (*FakeClient) RemoveTeamMember added in v0.2.50

func (c *FakeClient) RemoveTeamMember(teamID, teamMemberID string) (*SimpleResponse, error)

RemoveTeamMember implemented in a fake way for automated tests

func (*FakeClient) RenameFirewall added in v0.2.30

func (c *FakeClient) RenameFirewall(id string, f *FirewallConfig) (*SimpleResponse, error)

RenameFirewall implemented in a fake way for automated tests

func (*FakeClient) RenameNetwork added in v0.2.30

func (c *FakeClient) RenameNetwork(label, id string) (*NetworkResult, error)

RenameNetwork implemented in a fake way for automated tests

func (*FakeClient) RenameOrganisation added in v0.2.50

func (c *FakeClient) RenameOrganisation(name string) (*Organisation, error)

RenameOrganisation implemented in a fake way for automated tests

func (*FakeClient) RenameTeam added in v0.2.50

func (c *FakeClient) RenameTeam(teamID, name string) (*Team, error)

RenameTeam implemented in a fake way for automated tests

func (*FakeClient) ResizeVolume added in v0.2.30

func (c *FakeClient) ResizeVolume(id string, size int) (*SimpleResponse, error)

ResizeVolume implemented in a fake way for automated tests

func (*FakeClient) SetInstanceFirewall added in v0.2.30

func (c *FakeClient) SetInstanceFirewall(id, firewallID string) (*SimpleResponse, error)

SetInstanceFirewall implemented in a fake way for automated tests

func (*FakeClient) SetInstanceTags added in v0.2.30

func (c *FakeClient) SetInstanceTags(i *Instance, tags string) (*SimpleResponse, error)

SetInstanceTags implemented in a fake way for automated tests

func (*FakeClient) SoftRebootInstance added in v0.2.30

func (c *FakeClient) SoftRebootInstance(id string) (*SimpleResponse, error)

SoftRebootInstance implemented in a fake way for automated tests

func (*FakeClient) StartInstance added in v0.2.30

func (c *FakeClient) StartInstance(id string) (*SimpleResponse, error)

StartInstance implemented in a fake way for automated tests

func (*FakeClient) StopInstance added in v0.2.30

func (c *FakeClient) StopInstance(id string) (*SimpleResponse, error)

StopInstance implemented in a fake way for automated tests

func (*FakeClient) UpdateDNSDomain added in v0.2.30

func (c *FakeClient) UpdateDNSDomain(d *DNSDomain, name string) (*DNSDomain, error)

UpdateDNSDomain implemented in a fake way for automated tests

func (*FakeClient) UpdateDNSRecord added in v0.2.30

func (c *FakeClient) UpdateDNSRecord(r *DNSRecord, rc *DNSRecordConfig) (*DNSRecord, error)

UpdateDNSRecord implemented in a fake way for automated tests

func (*FakeClient) UpdateInstance added in v0.2.30

func (c *FakeClient) UpdateInstance(i *Instance) (*SimpleResponse, error)

UpdateInstance implemented in a fake way for automated tests

func (*FakeClient) UpdateKubernetesCluster added in v0.2.30

func (c *FakeClient) UpdateKubernetesCluster(id string, kc *KubernetesClusterConfig) (*KubernetesCluster, error)

UpdateKubernetesCluster implemented in a fake way for automated tests

func (*FakeClient) UpdateLoadBalancer added in v0.2.30

func (c *FakeClient) UpdateLoadBalancer(id string, lbc *LoadBalancerConfig) (*LoadBalancer, error)

UpdateLoadBalancer implemented in a fake way for automated tests

func (*FakeClient) UpdateSSHKey added in v0.2.30

func (c *FakeClient) UpdateSSHKey(name string, sshKeyID string) (*SSHKey, error)

UpdateSSHKey implemented in a fake way for automated tests

func (*FakeClient) UpdateTeamMember added in v0.2.50

func (c *FakeClient) UpdateTeamMember(teamID, teamMemberID, permissions, roles string) (*TeamMember, error)

UpdateTeamMember implemented in a fake way for automated tests

func (*FakeClient) UpdateTemplate added in v0.2.30

func (c *FakeClient) UpdateTemplate(id string, conf *Template) (*Template, error)

UpdateTemplate implemented in a fake way for automated tests

func (*FakeClient) UpdateWebhook added in v0.2.30

func (c *FakeClient) UpdateWebhook(id string, r *WebhookConfig) (*Webhook, error)

UpdateWebhook implemented in a fake way for automated tests

func (*FakeClient) UpgradeInstance added in v0.2.30

func (c *FakeClient) UpgradeInstance(id, newSize string) (*SimpleResponse, error)

UpgradeInstance implemented in a fake way for automated tests

type Feature added in v0.2.24

type Feature struct {
	Iaas       bool `json:"iaas"`
	Kubernetes bool `json:"kubernetes"`
}

Feature represent a all feature inside a region

type Firewall

type Firewall struct {
	ID             string `json:"id"`
	Name           string `json:"name,omitempty"`
	RulesCount     int    `json:"rules_count,omitempty"`
	InstancesCount int    `json:"instances_count,omitempty"`
	NetworkID      string `json:"network_id,omitempty"`
}

Firewall represents list of rule in Civo's infrastructure

type FirewallConfig

type FirewallConfig struct {
	Name      string `json:"name"`
	Region    string `json:"region"`
	NetworkID string `json:"network_id"`
}

FirewallConfig is how you specify the details when creating a new firewall

type FirewallResult

type FirewallResult struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Result string `json:"result"`
}

FirewallResult is the response from the Civo Firewall APIs

type FirewallRule

type FirewallRule struct {
	ID         string   `json:"id"`
	FirewallID string   `json:"firewall_id"`
	Protocol   string   `json:"protocol"`
	StartPort  string   `json:"start_port"`
	EndPort    string   `json:"end_port"`
	Cidr       []string `json:"cidr"`
	Direction  string   `json:"direction"`
	Label      string   `json:"label,omitempty"`
}

FirewallRule represents a single rule for a given firewall, regarding which ports to open and which protocol, to which CIDR

type FirewallRuleConfig

type FirewallRuleConfig struct {
	FirewallID string   `json:"firewall_id"`
	Region     string   `json:"region"`
	Protocol   string   `json:"protocol"`
	StartPort  string   `json:"start_port"`
	EndPort    string   `json:"end_port"`
	Cidr       []string `json:"cidr"`
	Direction  string   `json:"direction"`
	Label      string   `json:"label,omitempty"`
}

FirewallRuleConfig is how you specify the details when creating a new rule

type HTTPError

type HTTPError struct {
	Code   int
	Status string
	Reason string
}

HTTPError is the error returned when the API fails with an HTTP error

func (HTTPError) Error

func (e HTTPError) Error() string

type Instance

type Instance struct {
	ID                       string    `json:"id,omitempty"`
	OpenstackServerID        string    `json:"openstack_server_id,omitempty"`
	Hostname                 string    `json:"hostname,omitempty"`
	ReverseDNS               string    `json:"reverse_dns,omitempty"`
	Size                     string    `json:"size,omitempty"`
	Region                   string    `json:"region,omitempty"`
	NetworkID                string    `json:"network_id,omitempty"`
	PrivateIP                string    `json:"private_ip,omitempty"`
	PublicIP                 string    `json:"public_ip,omitempty"`
	PseudoIP                 string    `json:"pseudo_ip,omitempty"`
	TemplateID               string    `json:"template_id,omitempty"`
	SourceType               string    `json:"source_type,omitempty"`
	SourceID                 string    `json:"source_id,omitempty"`
	SnapshotID               string    `json:"snapshot_id,omitempty"`
	InitialUser              string    `json:"initial_user,omitempty"`
	InitialPassword          string    `json:"initial_password,omitempty"`
	SSHKey                   string    `json:"ssh_key,omitempty"`
	Status                   string    `json:"status,omitempty"`
	Notes                    string    `json:"notes,omitempty"`
	FirewallID               string    `json:"firewall_id,omitempty"`
	Tags                     []string  `json:"tags,omitempty"`
	CivostatsdToken          string    `json:"civostatsd_token,omitempty"`
	CivostatsdStats          string    `json:"civostatsd_stats,omitempty"`
	CivostatsdStatsPerMinute []string  `json:"civostatsd_stats_per_minute,omitempty"`
	CivostatsdStatsPerHour   []string  `json:"civostatsd_stats_per_hour,omitempty"`
	OpenstackImageID         string    `json:"openstack_image_id,omitempty"`
	RescuePassword           string    `json:"rescue_password,omitempty"`
	VolumeBacked             bool      `json:"volume_backed,omitempty"`
	CPUCores                 int       `json:"cpu_cores,omitempty"`
	RAMMegabytes             int       `json:"ram_mb,omitempty"`
	DiskGigabytes            int       `json:"disk_gb,omitempty"`
	Script                   string    `json:"script,omitempty"`
	CreatedAt                time.Time `json:"created_at,omitempty"`
}

Instance represents a virtual server within Civo's infrastructure

type InstanceConfig

type InstanceConfig struct {
	Count            int      `json:"count"`
	Hostname         string   `json:"hostname"`
	ReverseDNS       string   `json:"reverse_dns"`
	Size             string   `json:"size"`
	Region           string   `json:"region"`
	PublicIPRequired string   `json:"public_ip"`
	NetworkID        string   `json:"network_id"`
	TemplateID       string   `json:"template_id"`
	SourceType       string   `json:"source_type"`
	SourceID         string   `json:"source_id"`
	SnapshotID       string   `json:"snapshot_id"`
	InitialUser      string   `json:"initial_user"`
	SSHKeyID         string   `json:"ssh_key_id"`
	Script           string   `json:"script"`
	Tags             []string `json:"-"`
	TagsList         string   `json:"tags"`
	FirewallID       string   `json:"firewall_id"`
}

InstanceConfig describes the parameters for a new instance none of the fields are mandatory and will be automatically set with default values

type InstanceConsole added in v0.1.1

type InstanceConsole struct {
	URL string `json:"url"`
}

InstanceConsole represents a link to a webconsole for an instances

type InstanceSize

type InstanceSize struct {
	ID            string `json:"id,omitempty"`
	Name          string `json:"name,omitempty"`
	NiceName      string `json:"nice_name,omitempty"`
	CPUCores      int    `json:"cpu_cores,omitempty"`
	RAMMegabytes  int    `json:"ram_mb,omitempty"`
	DiskGigabytes int    `json:"disk_gb,omitempty"`
	Description   string `json:"description,omitempty"`
	Selectable    bool   `json:"selectable,omitempty"`
}

InstanceSize represents an available size for instances to launch

type KubernetesCluster

type KubernetesCluster struct {
	ID                    string                           `json:"id"`
	Name                  string                           `json:"name,omitempty"`
	GeneratedName         string                           `json:"generated_name,omitempty"`
	Version               string                           `json:"version,omitempty"`
	Status                string                           `json:"status,omitempty"`
	Ready                 bool                             `json:"ready,omitempty"`
	NumTargetNode         int                              `json:"num_target_nodes,omitempty"`
	TargetNodeSize        string                           `json:"target_nodes_size,omitempty"`
	BuiltAt               time.Time                        `json:"built_at,omitempty"`
	KubeConfig            string                           `json:"kubeconfig,omitempty"`
	KubernetesVersion     string                           `json:"kubernetes_version,omitempty"`
	APIEndPoint           string                           `json:"api_endpoint,omitempty"`
	MasterIP              string                           `json:"master_ip,omitempty"`
	DNSEntry              string                           `json:"dns_entry,omitempty"`
	UpgradeAvailableTo    string                           `json:"upgrade_available_to,omitempty"`
	Legacy                bool                             `json:"legacy,omitempty"`
	NetworkID             string                           `json:"network_id,omitempty"`
	NameSpace             string                           `json:"namespace,omitempty"`
	Tags                  []string                         `json:"tags,omitempty"`
	CreatedAt             time.Time                        `json:"created_at,omitempty"`
	Instances             []KubernetesInstance             `json:"instances,omitempty"`
	Pools                 []KubernetesPool                 `json:"pools,omitempty"`
	InstalledApplications []KubernetesInstalledApplication `json:"installed_applications,omitempty"`
	FirewallID            string                           `json:"firewall_id,omitempty"`
}

KubernetesCluster is a Kubernetes item inside the cluster

type KubernetesClusterConfig

type KubernetesClusterConfig struct {
	Name              string                        `json:"name,omitempty"`
	Region            string                        `json:"region,omitempty"`
	NumTargetNodes    int                           `json:"num_target_nodes,omitempty"`
	TargetNodesSize   string                        `json:"target_nodes_size,omitempty"`
	KubernetesVersion string                        `json:"kubernetes_version,omitempty"`
	NodeDestroy       string                        `json:"node_destroy,omitempty"`
	NetworkID         string                        `json:"network_id,omitempty"`
	Tags              string                        `json:"tags,omitempty"`
	Pools             []KubernetesClusterPoolConfig `json:"pools,omitempty"`
	Applications      string                        `json:"applications,omitempty"`
	InstanceFirewall  string                        `json:"instance_firewall,omitempty"`
	FirewallRule      string                        `json:"firewall_rule,omitempty"`
}

KubernetesClusterConfig is used to create a new cluster

type KubernetesClusterPoolConfig added in v0.2.44

type KubernetesClusterPoolConfig struct {
	ID    string `json:"id,omitempty"`
	Count int    `json:"count,omitempty"`
	Size  string `json:"size,omitempty"`
}

KubernetesClusterPoolConfig is used to create a new cluster pool

type KubernetesInstalledApplication

type KubernetesInstalledApplication struct {
	Application   string                              `json:"application,omitempty"`
	Name          string                              `json:"name,omitempty"`
	Version       string                              `json:"version,omitempty"`
	Dependencies  []string                            `json:"dependencies,omitempty"`
	Maintainer    string                              `json:"maintainer,omitempty"`
	Description   string                              `json:"description,omitempty"`
	PostInstall   string                              `json:"post_install,omitempty"`
	Installed     bool                                `json:"installed,omitempty"`
	URL           string                              `json:"url,omitempty"`
	Category      string                              `json:"category,omitempty"`
	UpdatedAt     time.Time                           `json:"updated_at,omitempty"`
	ImageURL      string                              `json:"image_url,omitempty"`
	Plan          string                              `json:"plan,omitempty"`
	Configuration map[string]ApplicationConfiguration `json:"configuration,omitempty"`
}

KubernetesInstalledApplication is an application within our marketplace available for installation

type KubernetesInstance

type KubernetesInstance struct {
	ID              string    `json:"id"`
	Hostname        string    `json:"hostname,omitempty"`
	Size            string    `json:"size,omitempty"`
	Region          string    `json:"region,omitempty"`
	SourceType      string    `json:"source_type,omitempty"`
	SourceID        string    `json:"source_id,omitempty"`
	InitialUser     string    `json:"initial_user,omitempty"`
	InitialPassword string    `json:"initial_password,omitempty"`
	Status          string    `json:"status,omitempty"`
	FirewallID      string    `json:"firewall_id,omitempty"`
	PublicIP        string    `json:"public_ip,omitempty"`
	CPUCores        int       `json:"cpu_cores,omitempty"`
	RAMMegabytes    int       `json:"ram_mb,omitempty"`
	DiskGigabytes   int       `json:"disk_gb,omitempty"`
	Tags            []string  `json:"tags,omitempty"`
	CreatedAt       time.Time `json:"created_at,omitempty"`
	CivoStatsdToken string    `json:"civostatsd_token,omitempty"`
}

KubernetesInstance represents a single node/master within a Kubernetes cluster

type KubernetesMarketplaceApplication

type KubernetesMarketplaceApplication struct {
	Name         string                      `json:"name"`
	Title        string                      `json:"title,omitempty"`
	Version      string                      `json:"version"`
	Default      bool                        `json:"default,omitempty"`
	Dependencies []string                    `json:"dependencies,omitempty"`
	Maintainer   string                      `json:"maintainer"`
	Description  string                      `json:"description"`
	PostInstall  string                      `json:"post_install"`
	URL          string                      `json:"url"`
	Category     string                      `json:"category"`
	Plans        []KubernetesMarketplacePlan `json:"plans"`
}

KubernetesMarketplaceApplication is an application within our marketplace available for installation

type KubernetesMarketplacePlan

type KubernetesMarketplacePlan struct {
	Label         string                                 `json:"label"`
	Configuration map[string]KubernetesPlanConfiguration `json:"configuration"`
}

KubernetesMarketplacePlan is a plan for

type KubernetesPlanConfiguration

type KubernetesPlanConfiguration struct {
	Value string `json:"value"`
}

KubernetesPlanConfiguration is a value within a configuration for an application's plan

type KubernetesPool added in v0.2.43

type KubernetesPool struct {
	ID            string               `json:"id"`
	Count         int                  `json:"count,omitempty"`
	Size          string               `json:"size,omitempty"`
	InstanceNames []string             `json:"instance_names,omitempty"`
	Instances     []KubernetesInstance `json:"instances,omitempty"`
}

KubernetesPool represents a single pool within a Kubernetes cluster

type KubernetesVersion

type KubernetesVersion struct {
	Version string `json:"version"`
	Type    string `json:"type"`
	Default bool   `json:"default,omitempty"`
}

KubernetesVersion represents an available version of k3s to install

type LoadBalancer

type LoadBalancer struct {
	ID                      string `json:"id"`
	DefaultHostname         bool   `json:"default_hostname,omitempty"`
	Hostname                string `json:"hostname,omitempty"`
	Protocol                string `json:"protocol,omitempty"`
	Port                    int    `json:"port,omitempty"`
	MaxRequestSize          int    `json:"max_request_size,omitempty"`
	TLSCertificate          string `json:"tls_certificate,omitempty"`
	TLSKey                  string `json:"tls_key,omitempty"`
	Policy                  string `json:"policy,omitempty"`
	HealthCheckPath         string `json:"health_check_path,omitempty"`
	FailTimeout             int    `json:"fail_timeout,omitempty"`
	MaxConns                int    `json:"max_conns,omitempty"`
	IgnoreInvalidBackendTLS bool   `json:"ignore_invalid_backend_tls,omitempty"`
	Backends                []LoadBalancerBackend
}

LoadBalancer represents a load balancer configuration within Civo

type LoadBalancerBackend

type LoadBalancerBackend struct {
	InstanceID string `json:"instance_id"`
	Protocol   string `json:"protocol"`
	Port       int    `json:"port"`
}

LoadBalancerBackend represents a backend instance being load-balanced

type LoadBalancerBackendConfig

type LoadBalancerBackendConfig struct {
	InstanceID string `json:"instance_id"`
	Protocol   string `json:"protocol"`
	Port       int    `json:"port"`
}

LoadBalancerBackendConfig is the configuration for creating backends

type LoadBalancerConfig

type LoadBalancerConfig struct {
	Hostname                string                      `json:"hostname"`
	Region                  string                      `json:"region"`
	Protocol                string                      `json:"protocol"`
	TLSCertificate          string                      `json:"tls_certificate"`
	TLSKey                  string                      `json:"tls_key"`
	Policy                  string                      `json:"policy"`
	Port                    int                         `json:"port"`
	MaxRequestSize          int                         `json:"max_request_size"`
	HealthCheckPath         string                      `json:"health_check_path"`
	FailTimeout             int                         `json:"fail_timeout"`
	MaxConns                int                         `json:"max_conns"`
	IgnoreInvalidBackendTLS bool                        `json:"ignore_invalid_backend_tls"`
	Backends                []LoadBalancerBackendConfig `json:"backends"`
}

LoadBalancerConfig represents a load balancer to be created

type Network

type Network struct {
	ID      string `json:"id"`
	Name    string `json:"name,omitempty"`
	Default bool   `json:"default,omitempty"`
	CIDR    string `json:"cidr,omitempty"`
	Label   string `json:"label,omitempty"`
}

Network represents a private network for instances to connect to

type NetworkResult

type NetworkResult struct {
	ID     string `json:"id"`
	Label  string `json:"label"`
	Result string `json:"result"`
}

NetworkResult represents the result from a network create/update call

type Organisation added in v0.2.50

type Organisation struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	Token     string    `json:"token"`
	CreatedAt time.Time `json:"created_at,omitempty"`
	UpdatedAt time.Time `json:"updated_at,omitempty"`
}

Organisation represents a group of accounts treated as a single entity

type PaginatedInstanceList

type PaginatedInstanceList struct {
	Page    int        `json:"page"`
	PerPage int        `json:"per_page"`
	Pages   int        `json:"pages"`
	Items   []Instance `json:"items"`
}

PaginatedInstanceList returns a paginated list of Instance object

type PaginatedKubernetesClusters added in v0.2.4

type PaginatedKubernetesClusters struct {
	Page    int                 `json:"page"`
	PerPage int                 `json:"per_page"`
	Pages   int                 `json:"pages"`
	Items   []KubernetesCluster `json:"items"`
}

PaginatedKubernetesClusters is a Kubernetes k3s cluster

type Permission added in v0.2.50

type Permission struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
}

Permission represents a permission and the description for it

type Quota

type Quota struct {
	ID                      string `json:"id"`
	DefaultUserID           string `json:"default_user_id"`
	DefaultUserEmailAddress string `json:"default_user_email_address"`
	InstanceCountLimit      int    `json:"instance_count_limit"`
	InstanceCountUsage      int    `json:"instance_count_usage"`
	CPUCoreLimit            int    `json:"cpu_core_limit"`
	CPUCoreUsage            int    `json:"cpu_core_usage"`
	RAMMegabytesLimit       int    `json:"ram_mb_limit"`
	RAMMegabytesUsage       int    `json:"ram_mb_usage"`
	DiskGigabytesLimit      int    `json:"disk_gb_limit"`
	DiskGigabytesUsage      int    `json:"disk_gb_usage"`
	DiskVolumeCountLimit    int    `json:"disk_volume_count_limit"`
	DiskVolumeCountUsage    int    `json:"disk_volume_count_usage"`
	DiskSnapshotCountLimit  int    `json:"disk_snapshot_count_limit"`
	DiskSnapshotCountUsage  int    `json:"disk_snapshot_count_usage"`
	PublicIPAddressLimit    int    `json:"public_ip_address_limit"`
	PublicIPAddressUsage    int    `json:"public_ip_address_usage"`
	SubnetCountLimit        int    `json:"subnet_count_limit"`
	SubnetCountUsage        int    `json:"subnet_count_usage"`
	NetworkCountLimit       int    `json:"network_count_limit"`
	NetworkCountUsage       int    `json:"network_count_usage"`
	SecurityGroupLimit      int    `json:"security_group_limit"`
	SecurityGroupUsage      int    `json:"security_group_usage"`
	SecurityGroupRuleLimit  int    `json:"security_group_rule_limit"`
	SecurityGroupRuleUsage  int    `json:"security_group_rule_usage"`
	PortCountLimit          int    `json:"port_count_limit"`
	PortCountUsage          int    `json:"port_count_usage"`
}

Quota represents the available limits and usage for an account's Civo quota

type Region

type Region struct {
	Code          string  `json:"code"`
	Name          string  `json:"name"`
	Type          string  `json:"type"`
	OutOfCapacity bool    `json:"out_of_capacity"`
	Country       string  `json:"country"`
	CountryName   string  `json:"country_name"`
	Features      Feature `json:"features"`
	Default       bool    `json:"default"`
}

Region represents a geographical/DC region for Civo resources

type Result

type Result string

Result is the result of a SimpleResponse

type Role added in v0.2.50

type Role struct {
	ID          string    `json:"id"`
	Name        string    `json:"name,omitempty"`
	Permissions string    `json:"permissions,omitempty"`
	BuiltIn     bool      `json:"built_in,omitempty"`
	CreatedAt   time.Time `json:"created_at,omitempty"`
	UpdatedAt   time.Time `json:"updated_at,omitempty"`
}

Role represents a set of permissions

type SSHKey

type SSHKey struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Fingerprint string `json:"fingerprint"`
}

SSHKey represents an SSH public key, uploaded to access instances

type SimpleResponse

type SimpleResponse struct {
	ID           string `json:"id"`
	Result       Result `json:"result"`
	ErrorCode    string `json:"code"`
	ErrorReason  string `json:"reason"`
	ErrorDetails string `json:"details"`
}

SimpleResponse is a structure that returns success and/or any error

type Snapshot

type Snapshot struct {
	ID            string    `json:"id"`
	InstanceID    string    `json:"instance_id"`
	Hostname      string    `json:"hostname"`
	Template      string    `json:"template_id"`
	Region        string    `json:"region"`
	Name          string    `json:"name"`
	Safe          int       `json:"safe"`
	SizeGigabytes int       `json:"size_gb"`
	State         string    `json:"state"`
	Cron          string    `json:"cron_timing,omitempty"`
	RequestedAt   time.Time `json:"requested_at,omitempty"`
	CompletedAt   time.Time `json:"completed_at,omitempty"`
}

Snapshot is a backup of an instance

type SnapshotConfig

type SnapshotConfig struct {
	InstanceID string `json:"instance_id"`
	Safe       bool   `json:"safe"`
	Cron       string `json:"cron_timing"`
	Region     string `json:"region"`
}

SnapshotConfig represents the options required for creating a new snapshot

type Team added in v0.2.50

type Team struct {
	ID             string    `json:"id"`
	Name           string    `json:"name,omitempty"`
	OrganisationID string    `json:"organisation_id,omitempty"`
	CreatedAt      time.Time `json:"created_at,omitempty"`
	UpdatedAt      time.Time `json:"updated_at,omitempty"`
}

Team is a named group of users (has many members)

type TeamMember added in v0.2.50

type TeamMember struct {
	ID          string    `json:"id"`
	TeamID      string    `json:"team_id,omitempty"`
	UserID      string    `json:"user_id,omitempty"`
	Permissions string    `json:"permissions,omitempty"`
	Roles       string    `json:"roles,omitempty"`
	CreatedAt   time.Time `json:"created_at,omitempty"`
	UpdatedAt   time.Time `json:"updated_at,omitempty"`
}

TeamMember is a link record between User and Team.

type Template

type Template struct {
	ID               string `json:"id"`
	Code             string `json:"code"`
	Name             string `json:"name"`
	Region           string `json:"region"`
	AccountID        string `json:"account_id,omitempty"`
	ImageID          string `json:"image_id,omitempty"`
	VolumeID         string `json:"volume_id"`
	ShortDescription string `json:"short_description"`
	Description      string `json:"description"`
	DefaultUsername  string `json:"default_username"`
	CloudConfig      string `json:"cloud_config"`
}

Template represents a Template for launching instances from

type Volume

type Volume struct {
	ID            string    `json:"id"`
	Name          string    `json:"name"`
	InstanceID    string    `json:"instance_id"`
	ClusterID     string    `json:"cluster_id"`
	NetworkID     string    `json:"network_id"`
	MountPoint    string    `json:"mountpoint"`
	Status        string    `json:"status"`
	SizeGigabytes int       `json:"size_gb"`
	Bootable      bool      `json:"bootable"`
	CreatedAt     time.Time `json:"created_at"`
}

Volume is a block of attachable storage for our IAAS products https://www.civo.com/api/volumes

type VolumeConfig

type VolumeConfig struct {
	Name          string `json:"name"`
	Namespace     string `json:"namespace"`
	ClusterID     string `json:"cluster_id"`
	NetworkID     string `json:"network_id"`
	Region        string `json:"region"`
	SizeGigabytes int    `json:"size_gb"`
	Bootable      bool   `json:"bootable"`
}

VolumeConfig are the settings required to create a new Volume

type VolumeResult

type VolumeResult struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Result string `json:"result"`
}

VolumeResult is the response from one of our simple API calls

type Webhook

type Webhook struct {
	ID                string   `json:"id"`
	Events            []string `json:"events"`
	URL               string   `json:"url"`
	Secret            string   `json:"secret"`
	Disabled          bool     `json:"disabled"`
	Failures          int      `json:"failures"`
	LasrFailureReason string   `json:"last_failure_reason"`
}

Webhook is a representation of a saved webhook callback from changes in Civo

type WebhookConfig

type WebhookConfig struct {
	Events []string `json:"events"`
	URL    string   `json:"url"`
	Secret string   `json:"secret"`
}

WebhookConfig represents the options required for creating a new webhook

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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