civogo

package module
v0.2.94 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: MIT Imports: 15 Imported by: 78

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 a region. Then you can use public methods to interact with Civo's API.

Authentication

You will need both an API key and a region code to create a new client.

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.

For the region code, use any region you know exists, e.g. LON1. See the API documentation for details.

package main

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

const (
    apiKey = "mykeygoeshere"
    regionCode = "LON1"
)

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

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")

	DatabaseClusterPoolNotFoundError                       = constError("DatabaseClusterPoolNotFound")
	DatabaseClusterPoolInstanceNotFoundError               = constError("DatabaseClusterPoolInstanceNotFound")
	DatabaseClusterPoolInstanceDeleteFailedError           = constError("DatabaseClusterPoolInstanceDeleteFailed")
	DatabaseClusterPoolNoSufficientInstancesAvailableError = constError("DatabaseClusterPoolNoSufficientInstancesAvailable")

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

	DatabaseLoadBalancerSaveError      = constError("DatabaseLoadBalancerSaveError")
	DatabaseLoadBalancerDeleteError    = constError("DatabaseLoadBalancerDeleteError")
	DatabaseLoadBalancerUpdateError    = constError("DatabaseLoadBalancerUpdateError")
	DatabaseLoadBalancerDuplicateError = constError("DatabaseLoadBalancerDuplicateError")
	DatabaseLoadBalancerExistsError    = constError("DatabaseLoadBalancerExistsError")
	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

View Source
var ErrAppDomainNotFound = fmt.Errorf("domain not found")

ErrAppDomainNotFound is returned when the domain is not found

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 Actions added in v0.2.90

type Actions struct {
	// Action is one of "assign", "unassign"
	Action       string `json:"action"`
	AssignToID   string `json:"assign_to_id"`
	AssignToType string `json:"assign_to_type"`
}

Actions for IP

type Application added in v0.2.76

type Application struct {
	Name        string        `json:"name" validate:"required"`
	ID          string        `json:"id"`
	NetworkID   string        `json:"network_id" validate:"required"`
	Description string        `json:"description"`
	Image       string        `json:"image"`
	Size        string        `json:"size"`
	ProcessInfo []ProcessInfo `json:"process_info,omitempty"`
	Domains     []string      `json:"domains,omitempty"`
	SSHKeyIDs   []string      `json:"ssh_key_ids,omitempty"`
	Config      []EnvVar      `json:"config,omitempty"`
	// Status can be one of:
	// - "building":  Implies platform is building
	// - "available": Implies platform is available to accept image
	// - "ready": Implies app is ready
	Status string `json:"status"`
}

Application is the struct for the Application model

type ApplicationConfig added in v0.2.76

type ApplicationConfig struct {
	Name        string   `json:"name" validate:"required"`
	NetworkID   string   `json:"network_id" validate:"required"`
	Description string   `json:"description"`
	Size        string   `json:"size"`
	SSHKeyIDs   []string `json:"ssh_key_ids,omitempty"`
}

ApplicationConfig describes the parameters for a new CivoApp

type ApplicationConfiguration added in v0.2.8

type ApplicationConfiguration map[string]string

ApplicationConfiguration is a configuration for installed application

type AssignedTo added in v0.2.90

type AssignedTo struct {
	ID string `json:"id"`
	// Type can be one of the following:
	// - instance
	// - loadbalancer
	Type string `json:"type"`
	Name string `json:"name"`
}

AssignedTo represents IP assigned to resource

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 []ConfigAdvanceClientForTesting) (*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) AssignIP added in v0.2.90

func (c *Client) AssignIP(id, resourceID, resourceType string) (*SimpleResponse, error)

AssignIP assigns a reserved IP to a Civo resource

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) CreateApplication added in v0.2.76

func (c *Client) CreateApplication(config *ApplicationConfig) (*Application, error)

CreateApplication creates a new application

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) CreateTeam added in v0.2.50

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

CreateTeam creates a new team in the account

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) DeleteApplication added in v0.2.76

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

DeleteApplication deletes an application

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) DeleteIP added in v0.2.90

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

DeleteIP deletes an IP

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) DeleteKubernetesClusterPoolInstance added in v0.2.75

func (c *Client) DeleteKubernetesClusterPoolInstance(cid, pid, id string) (*SimpleResponse, error)

DeleteKubernetesClusterPoolInstance deletes a instance from pool

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) DeleteObjectStore added in v0.2.83

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

DeleteObjectStore deletes an objectstore

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) 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) 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) FindApplication added in v0.2.76

func (c *Client) FindApplication(search string) (*Application, error)

FindApplication finds an application by either part of the ID or part of the name

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) FindIP added in v0.2.90

func (c *Client) FindIP(search string) (*IP, error)

FindIP finds an reserved IP by name or by IP

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) FindKubernetesClusterInstance added in v0.2.61

func (c *Client) FindKubernetesClusterInstance(clusterID, search string) (*Instance, error)

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

func (*Client) FindKubernetesClusterPool added in v0.2.75

func (c *Client) FindKubernetesClusterPool(cid, search string) (*KubernetesPool, error)

FindKubernetesClusterPool finds a pool by either part of the ID

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) FindObjectStore added in v0.2.83

func (c *Client) FindObjectStore(search string) (*ObjectStore, error)

FindObjectStore finds an objectstore by name or by accesskeyID

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) FindTeam added in v0.2.63

func (c *Client) FindTeam(search string) (*Team, error)

FindTeam finds a team by either part of the ID or part of the name

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) GetAccountID added in v0.2.80

func (c *Client) GetAccountID() string

GetAccountID returns the account ID

func (*Client) GetApplication added in v0.2.76

func (c *Client) GetApplication(id string) (*Application, error)

GetApplication returns an application by ID

func (*Client) GetApplicationLogAuth added in v0.2.82

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

GetApplicationLogAuth returns an application log auth

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) GetDiskImageByName added in v0.2.57

func (c *Client) GetDiskImageByName(name string) (*DiskImage, error)

GetDiskImageByName finds the DiskImage for an account with the specified code

func (*Client) GetIP added in v0.2.90

func (c *Client) GetIP(id string) (*IP, error)

GetIP finds an reserved IP by the full 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) GetKubernetesClusterPool added in v0.2.75

func (c *Client) GetKubernetesClusterPool(cid, pid string) (*KubernetesPool, error)

GetKubernetesClusterPool returns a pool for a kubernetes cluster

func (*Client) GetLoadBalancer added in v0.2.61

func (c *Client) GetLoadBalancer(id string) (*LoadBalancer, error)

GetLoadBalancer returns a load balancer

func (*Client) GetObjectStore added in v0.2.83

func (c *Client) GetObjectStore(id string) (*ObjectStore, error)

GetObjectStore finds an objectstore by the 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) GetUserEverything added in v0.2.56

func (c *Client) GetUserEverything(userID string) (*UserEverything, error)

GetUserEverything returns the organisation associated with the current account

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) ListAccounts added in v0.2.80

func (c *Client) ListAccounts() (*PaginatedAccounts, error)

ListAccounts lists all accounts

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) ListApplications added in v0.2.76

func (c *Client) ListApplications() (*PaginatedApplications, error)

ListApplications returns all applications in that specific region

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) ListIPs added in v0.2.90

func (c *Client) ListIPs() (*PaginatedIPs, error)

ListIPs returns all reserved IPs in that specific region

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) ListKubernetesClusterInstances added in v0.2.61

func (c *Client) ListKubernetesClusterInstances(id string) ([]Instance, error)

ListKubernetesClusterInstances returns all cluster instances

func (*Client) ListKubernetesClusterPools added in v0.2.75

func (c *Client) ListKubernetesClusterPools(cid string) ([]KubernetesPool, error)

ListKubernetesClusterPools returns all the pools for a kubernetes cluster

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) ListObjectStores added in v0.2.83

func (c *Client) ListObjectStores() (*PaginatedObjectstores, error)

ListObjectStores returns all objectstores in that specific region

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) 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) 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) NewApplicationConfig added in v0.2.76

func (c *Client) NewApplicationConfig() (*ApplicationConfig, error)

NewApplicationConfig returns an initialized config for a new application

func (*Client) NewFirewall

func (c *Client) NewFirewall(name, networkid string, CreateRules *bool) (*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) NewIP added in v0.2.90

func (c *Client) NewIP(v *CreateIPRequest) (*IP, error)

NewIP creates a new IP

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) NewObjectStore added in v0.2.83

func (c *Client) NewObjectStore(v *CreateObjectStoreRequest) (*ObjectStore, error)

NewObjectStore creates a new objectstore

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) 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) UnassignIP added in v0.2.90

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

UnassignIP unassigns a reserved IP from a Civo resource UnassignIP is an idempotent operation. If you unassign on a unassigned IP, it will return a 200 OK.

func (*Client) UpdateApplication added in v0.2.76

func (c *Client) UpdateApplication(id string, application *UpdateApplicationRequest) (*Application, error)

UpdateApplication updates an application

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) UpdateIP added in v0.2.90

func (c *Client) UpdateIP(id string, v *UpdateIPRequest) (*IP, error)

UpdateIP updates an IP

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) UpdateKubernetesClusterPool added in v0.2.77

func (c *Client) UpdateKubernetesClusterPool(cid, pid string, config *KubernetesClusterPoolUpdateConfig) (*KubernetesPool, error)

UpdateKubernetesClusterPool updates a pool for a kubernetes cluster

func (*Client) UpdateLoadBalancer

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

UpdateLoadBalancer updates a load balancer

func (*Client) UpdateObjectStore added in v0.2.83

func (c *Client) UpdateObjectStore(id string, v *UpdateObjectStoreRequest) (*ObjectStore, error)

UpdateObjectStore updates an objectstore

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) 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, CreateRules *bool) (*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)
	ListKubernetesClusterInstances(id string) ([]Instance, error)
	FindKubernetesClusterInstance(clusterID, search string) (*Instance, error)

	//Pools
	ListKubernetesClusterPools(cid string) ([]KubernetesPool, error)
	GetKubernetesClusterPool(cid, pid string) (*KubernetesPool, error)
	FindKubernetesClusterPool(cid, search string) (*KubernetesPool, error)
	DeleteKubernetesClusterPoolInstance(cid, pid, id string) (*SimpleResponse, error)
	UpdateKubernetesClusterPool(cid, pid string, config *KubernetesClusterPoolUpdateConfig) (*KubernetesPool, 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)

	// 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)

	// 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)

	// Reserved IPs
	ListIPs() (*PaginatedIPs, error)
	FindIP(search string) (*IP, error)
	GetIP(id string) (*IP, error)
	NewIP(v *CreateIPRequest) (*IP, error)
	UpdateIP(id string, v *UpdateIPRequest) (*IP, error)
	DeleteIP(id string) (*SimpleResponse, error)
	AssignIP(id, resourceID, resourceType string) (*SimpleResponse, error)
	UnassignIP(id string) (*SimpleResponse, error)

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

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

type ConfigAdvanceClientForTesting added in v0.2.86

type ConfigAdvanceClientForTesting struct {
	Method string
	Value  []ValueAdvanceClientForTesting
}

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

type CreateIPRequest added in v0.2.90

type CreateIPRequest struct {
	// Name is an optional parameter. If not provided, name will be the IP address
	Name string `json:"name,omitempty"`
}

CreateIPRequest is a struct for creating an IP

type CreateObjectStoreRequest added in v0.2.83

type CreateObjectStoreRequest struct {
	Name            string `json:"name,omitempty"`
	MaxSizeGB       int    `json:"max_size_gb" validate:"required"`
	Prefix          string `json:"prefix,omitempty"`
	AccessKeyID     string `json:"access_key_id,omitempty"`
	SecretAccessKey string `json:"secret_access_key,omitempty"`
	Region          string `json:"region"`
}

CreateObjectStoreRequest holds the request to create a new object storage

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 EnvVar added in v0.2.76

type EnvVar struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

EnvVar holds key-value pairs for an application

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
	IP                      []IP
	Networks                []Network
	Volumes                 []Volume
	SSHKeys                 []SSHKey
	Webhooks                []Webhook
	DiskImage               []DiskImage
	Quota                   Quota
	Organisation            Organisation
	OrganisationAccounts    []Account
	OrganisationRoles       []Role
	OrganisationTeams       []Team
	OrganisationTeamMembers map[string][]TeamMember
	LoadBalancers           []LoadBalancer
	Pools                   []KubernetesPool
}

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) AssignIP added in v0.2.93

func (c *FakeClient) AssignIP(id, resourceID, resourceType string) (*SimpleResponse, error)

AssignIP assigns a fake IP

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) CreateTeam added in v0.2.50

func (c *FakeClient) CreateTeam(name 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) DeleteIP added in v0.2.93

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

DeleteIP deletes a fake IP

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) DeleteKubernetesClusterPoolInstance added in v0.2.75

func (c *FakeClient) DeleteKubernetesClusterPoolInstance(cid, pid, id string) (*SimpleResponse, error)

DeleteKubernetesClusterPoolInstance 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) 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) 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) FindIP added in v0.2.93

func (c *FakeClient) FindIP(search string) (*IP, error)

FindIP finds a fake IP

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) FindKubernetesClusterInstance added in v0.2.68

func (c *FakeClient) FindKubernetesClusterInstance(clusterID, search string) (*Instance, error)

FindKubernetesClusterInstance implemented in a fake way for automated tests

func (*FakeClient) FindKubernetesClusterPool added in v0.2.75

func (c *FakeClient) FindKubernetesClusterPool(cid, search string) (*KubernetesPool, error)

FindKubernetesClusterPool 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) 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) GetIP added in v0.2.93

func (c *FakeClient) GetIP(id string) (*IP, error)

GetIP returns a fake IP

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) GetKubernetesClusterPool added in v0.2.75

func (c *FakeClient) GetKubernetesClusterPool(cid, pid string) (*KubernetesPool, error)

GetKubernetesClusterPool implemented in a fake way for automated tests

func (*FakeClient) GetLoadBalancer added in v0.2.68

func (c *FakeClient) GetLoadBalancer(id string) (*LoadBalancer, error)

GetLoadBalancer 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) 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) ListIPs added in v0.2.93

func (c *FakeClient) ListIPs() (*PaginatedIPs, error)

ListIPs returns a list of fake IPs

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) ListKubernetesClusterInstances added in v0.2.68

func (c *FakeClient) ListKubernetesClusterInstances(id string) ([]Instance, error)

ListKubernetesClusterInstances implemented in a fake way for automated tests

func (*FakeClient) ListKubernetesClusterPools added in v0.2.75

func (c *FakeClient) ListKubernetesClusterPools(cid string) ([]KubernetesPool, error)

ListKubernetesClusterPools 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) 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) 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, CreateRules *bool) (*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) NewIP added in v0.2.93

func (c *FakeClient) NewIP(v *CreateIPRequest) (*IP, error)

NewIP creates a fake IP

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) 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) UnassignIP added in v0.2.93

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

UnassignIP unassigns a fake IP

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) UpdateIP added in v0.2.93

func (c *FakeClient) UpdateIP(id string, v *UpdateIPRequest) (*IP, error)

UpdateIP updates a fake IP

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) UpdateKubernetesClusterPool added in v0.2.77

func (c *FakeClient) UpdateKubernetesClusterPool(cid, pid string, config *KubernetesClusterPoolUpdateConfig) (*KubernetesPool, error)

UpdateKubernetesClusterPool implemented in a fake way for automated tests

func (*FakeClient) UpdateLoadBalancer added in v0.2.30

func (c *FakeClient) UpdateLoadBalancer(id string, r *LoadBalancerUpdateConfig) (*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) 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"`
	InstanceCount     int    `json:"instance_count"`
	ClusterCount      int    `json:"cluster_count"`
	LoadBalancerCount int    `json:"loadbalancer_count"`
	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"`
	// CreateRules if not send the value will be nil, that mean the default rules will be created
	CreateRules *bool `json:"create_rules,omitempty"`
}

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"`
	Action     string   `json:"action"`
	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"`
	Action     string   `json:"action"`
	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 IP added in v0.2.90

type IP struct {
	ID         string     `json:"id"`
	Name       string     `json:"name,omitempty"`
	IP         string     `json:"ip,omitempty"`
	AssignedTo AssignedTo `json:"assigned_to,omitempty"`
}

IP represents a serialized structure

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"`
	SSHKeyID                 string    `json:"ssh_key_id,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"`
	ReservedIPID             string    `json:"reserved_ip_id,omitempty"`
	ReservedIPName           string    `json:"reserved_ip_name,omitempty"`
	ReservedIP               string    `json:"reserved_ip,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"`
	TransferTerabytes int    `json:"transfer_tb,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"`
	RequiredPools         []RequiredPools                  `json:"required_pools,omitempty"`
	InstalledApplications []KubernetesInstalledApplication `json:"installed_applications,omitempty"`
	FirewallID            string                           `json:"firewall_id,omitempty"`
	CNIPlugin             string                           `json:"cni_plugin,omitempty"`
	CCMInstalled          string                           `json:"ccm_installed,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"`
	CNIPlugin         string                        `json:"cni_plugin,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 KubernetesClusterPoolUpdateConfig added in v0.2.81

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

KubernetesClusterPoolUpdateConfig 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"`
	Name                         string                `json:"name"`
	Algorithm                    string                `json:"algorithm"`
	Backends                     []LoadBalancerBackend `json:"backends"`
	ExternalTrafficPolicy        string                `json:"external_traffic_policy,omitempty"`
	SessionAffinity              string                `json:"session_affinity,omitempty"`
	SessionAffinityConfigTimeout int32                 `json:"session_affinity_config_timeout,omitempty"`
	EnableProxyProtocol          string                `json:"enable_proxy_protocol,omitempty"`
	PublicIP                     string                `json:"public_ip"`
	PrivateIP                    string                `json:"private_ip"`
	FirewallID                   string                `json:"firewall_id"`
	ClusterID                    string                `json:"cluster_id,omitempty"`
	State                        string                `json:"state"`
	ReservedIPID                 string                `json:"reserved_ip_id,omitempty"`
	ReservedIPName               string                `json:"reserved_ip_name,omitempty"`
	ReservedIP                   string                `json:"reserved_ip,omitempty"`
}

LoadBalancer represents a load balancer configuration within Civo

type LoadBalancerBackend

type LoadBalancerBackend struct {
	IP              string `json:"ip"`
	Protocol        string `json:"protocol,omitempty"`
	SourcePort      int32  `json:"source_port"`
	TargetPort      int32  `json:"target_port"`
	HealthCheckPort int32  `json:"health_check_port,omitempty"`
}

LoadBalancerBackend represents a backend instance being load-balanced

type LoadBalancerBackendConfig

type LoadBalancerBackendConfig struct {
	IP              string `json:"ip"`
	Protocol        string `json:"protocol,omitempty"`
	SourcePort      int32  `json:"source_port"`
	TargetPort      int32  `json:"target_port"`
	HealthCheckPort int32  `json:"health_check_port,omitempty"`
}

LoadBalancerBackendConfig is the configuration for creating backends

type LoadBalancerConfig

type LoadBalancerConfig struct {
	Region                       string                      `json:"region"`
	Name                         string                      `json:"name"`
	NetworkID                    string                      `json:"network_id,omitempty"`
	Algorithm                    string                      `json:"algorithm,omitempty"`
	Backends                     []LoadBalancerBackendConfig `json:"backends"`
	ExternalTrafficPolicy        string                      `json:"external_traffic_policy,omitempty"`
	SessionAffinity              string                      `json:"session_affinity,omitempty"`
	SessionAffinityConfigTimeout int32                       `json:"session_affinity_config_timeout,omitempty"`
	EnableProxyProtocol          string                      `json:"enable_proxy_protocol,omitempty"`
	ClusterID                    string                      `json:"cluster_id,omitempty"`
	FirewallID                   string                      `json:"firewall_id,omitempty"`
	FirewallRules                string                      `json:"firewall_rule,omitempty"`
}

LoadBalancerConfig represents a load balancer to be created

type LoadBalancerUpdateConfig added in v0.2.61

type LoadBalancerUpdateConfig struct {
	Region                       string                      `json:"region"`
	Name                         string                      `json:"name,omitempty"`
	Algorithm                    string                      `json:"algorithm,omitempty"`
	Backends                     []LoadBalancerBackendConfig `json:"backends,omitempty"`
	ExternalTrafficPolicy        string                      `json:"external_traffic_policy,omitempty"`
	SessionAffinity              string                      `json:"session_affinity,omitempty"`
	SessionAffinityConfigTimeout int32                       `json:"session_affinity_config_timeout,omitempty"`
	EnableProxyProtocol          string                      `json:"enable_proxy_protocol,omitempty"`
	FirewallID                   string                      `json:"firewall_id,omitempty"`
}

LoadBalancerUpdateConfig represents a load balancer to be updated

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"`
	Status  string `json:"status,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 ObjectStore added in v0.2.83

type ObjectStore struct {
	ID                  string `json:"id"`
	Name                string `json:"name"`
	GeneratedName       string `json:"generated_name"`
	MaxObjects          int    `json:"max_objects"`
	MaxSize             string `json:"max_size"`
	AccessKeyID         string `json:"access_key_id"`
	SecretAccessKey     string `json:"secret_access_key"`
	ObjectStoreEndpoint string `json:"objectstore_endpoint"`
	Status              string `json:"status"`
}

ObjectStore is the struct for the ObjectStore model

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 PaginatedAccounts added in v0.2.80

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

PaginatedAccounts returns a paginated list of Account object

type PaginatedApplications added in v0.2.76

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

PaginatedApplications returns a paginated list of Application object

type PaginatedIPs added in v0.2.90

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

PaginatedIPs is a paginated list of IPs

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 PaginatedObjectstores added in v0.2.88

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

PaginatedObjectstores is a paginated list of Objectstores

type Permission added in v0.2.50

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

Permission represents a permission and the description for it

type ProcessInfo added in v0.2.76

type ProcessInfo struct {
	ProcessType  string `json:"processType"`
	ProcessCount int    `json:"processCount"`
}

ProcessInfo contains the information about the process obtained from Procfile

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"`
	LoadBalancerCountLimit  int    `json:"loadbalancer_count_limit"`
	LoadBalancerCountUsage  int    `json:"loadbalancer_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 RequiredPools added in v0.2.74

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

RequiredPools returns the required pools for a given Kubernetes cluster

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 Team added in v0.2.50

type Team struct {
	ID        string    `json:"id"`
	Name      string    `json:"name,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 UpdateApplicationRequest added in v0.2.76

type UpdateApplicationRequest struct {
	Name        string        `json:"name"`
	Advanced    bool          `json:"advanced"`
	Image       string        `json:"image" `
	Description string        `json:"description"`
	ProcessInfo []ProcessInfo `json:"process_info"`
	Size        string        `json:"size" schema:"size"`
	SSHKeyIDs   []string      `json:"ssh_key_ids" `
	Config      []EnvVar      `json:"config"`
	Domains     []string      `json:"domains"`
}

UpdateApplicationRequest is the struct for the UpdateApplication request

type UpdateIPRequest added in v0.2.90

type UpdateIPRequest struct {
	Name string `json:"name" validate:"required"`
}

UpdateIPRequest is a struct for creating an IP

type UpdateObjectStoreRequest added in v0.2.83

type UpdateObjectStoreRequest struct {
	MaxSizeGB       int    `json:"max_size_gb"`
	AccessKeyID     string `json:"access_key_id,omitempty"`
	SecretAccessKey string `json:"secret_access_key,omitempty"`
	Region          string `json:"region,omitempty"`
}

UpdateObjectStoreRequest holds the request to update a specified object storage's details

type User added in v0.2.56

type User struct {
	ID               string    `json:"id"`
	FirstName        string    `json:"first_name"`
	LastName         string    `json:"last_name"`
	CreatedAt        time.Time `json:"created_at"`
	UpdatedAt        time.Time `json:"updated_at"`
	CompanyName      string    `json:"company_name"`
	EmailAddress     string    `json:"email_address"`
	Status           string    `json:"status"`
	Flags            string    `json:"flags"`
	Token            string    `json:"token"`
	MarketingAllowed int       `json:"marketing_allowed"`
	DefaultAccountID string    `json:"default_account_id"`
	// DefaultAccountID string      `json:"account_id"`
	PasswordDigest   string `json:"password_digest"`
	Partner          string `json:"partner"`
	PartnerUserID    string `json:"partner_user_id"`
	ReferralID       string `json:"referral_id"`
	LastChosenRegion string `json:"last_chosen_region"`
}

User is the user struct

type UserEverything added in v0.2.56

type UserEverything struct {
	User          User
	Accounts      []Account
	Organisations []Organisation
	Teams         []Team
	Roles         []Role
}

UserEverything is the combination structure for all team related data for the current user and account

type ValueAdvanceClientForTesting added in v0.2.86

type ValueAdvanceClientForTesting struct {
	RequestBody  string
	URL          string
	ResponseBody string
}

ValueAdvanceClientForTesting is a struct that holds the URL and the request body

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