civocloud

package
v0.0.0-...-fd14076 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const ResultSuccess = "success"

ResultSuccess represents a successful SimpleResponse

Variables

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

Functions

This section is empty.

Types

type ApplicationConfiguration

type ApplicationConfiguration map[string]string

ApplicationConfiguration is a configuration for installed application

type Client

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

Client is the means of connecting to the Civo API service

func NewAdvancedClientForTesting

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

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

func NewClient

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

NewClient initializes a Client connecting to the production API

func NewClientForTesting

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

NewClientForTesting initializes a Client connecting to a local test server

func NewClientForTestingWithServer

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

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

func NewClientWithURL

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

NewClientWithURL initializes a Client with a specific API URL

func (*Client) CreateInstance

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

CreateInstance creates a new instance in the account

func (*Client) DecodeSimpleResponse

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

DecodeSimpleResponse parses a response body in to a SimpleResponse object

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

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

DeleteKubernetesClusterPoolInstance deletes a instance from pool

func (*Client) DeleteNetwork

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

DeleteNetwork deletes a private network

func (*Client) FindDiskImage

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

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

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

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

FindKubernetesClusterPool finds a pool by either part of the ID

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

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

GetDefaultNetwork finds the default private network for an account

func (*Client) GetDiskImage

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

GetDiskImage get one disk image using the id

func (*Client) GetDiskImageByName

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

GetDiskImageByName finds the DiskImage for an account with the specified code

func (*Client) GetInstance

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

GetInstance returns a single Instance by its full ID

func (*Client) GetInstanceConsoleURL

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

GetInstanceConsoleURL gets the web URL for an instance's console

func (*Client) GetKubernetesCluster

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

GetKubernetesCluster returns a single kubernetes cluster by its full ID

func (*Client) GetKubernetesClusterPool

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

GetKubernetesClusterPool returns a pool for a kubernetes cluster

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

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

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

func (*Client) ListAvailableKubernetesVersions

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

ListAvailableKubernetesVersions returns all version of kubernetes available

func (*Client) ListDiskImages

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

ListDiskImages return all disk image in system

func (*Client) ListInstanceSizes

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

ListInstanceSizes returns all available sizes of instances TODO: Rename to Size because this return all size (k8s, vm, database, kfaas)

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

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

ListKubernetesClusterInstances returns all cluster instances

func (*Client) ListKubernetesClusterPools

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

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

ListNetworks list all private networks

func (*Client) MovePublicIPToInstance

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

MovePublicIPToInstance moves a public IP to the specified instance

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

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

RenameNetwork renames an existing private network

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

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

UpdateKubernetesClusterPool updates a pool for a kubernetes cluster

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 DiskImage

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 HTTPError

type HTTPError struct {
	Code   int
	Status string
	Reason string
}

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

func (HTTPError) Error

func (e HTTPError) Error() string

type Instance

type Instance struct {
	ID                       string    `json:"id,omitempty"`
	OpenstackServerID        string    `json:"openstack_server_id,omitempty"`
	Hostname                 string    `json:"hostname,omitempty"`
	ReverseDNS               string    `json:"reverse_dns,omitempty"`
	Size                     string    `json:"size,omitempty"`
	Region                   string    `json:"region,omitempty"`
	NetworkID                string    `json:"network_id,omitempty"`
	PrivateIP                string    `json:"private_ip,omitempty"`
	PublicIP                 string    `json:"public_ip,omitempty"`
	PseudoIP                 string    `json:"pseudo_ip,omitempty"`
	TemplateID               string    `json:"template_id,omitempty"`
	SourceType               string    `json:"source_type,omitempty"`
	SourceID                 string    `json:"source_id,omitempty"`
	SnapshotID               string    `json:"snapshot_id,omitempty"`
	InitialUser              string    `json:"initial_user,omitempty"`
	InitialPassword          string    `json:"initial_password,omitempty"`
	SSHKey                   string    `json:"ssh_key,omitempty"`
	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"`
}

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

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

InstanceConsole represents a link to a webconsole for an instances

type InstanceSize

type InstanceSize struct {
	Type              string `json:"type,omitempty"`
	Name              string `json:"name,omitempty"`
	NiceName          string `json:"nice_name,omitempty"`
	CPUCores          int    `json:"cpu_cores,omitempty"`
	GPUCount          int    `json:"gpu_count,omitempty"`
	GPUType           string `json:"gpu_type,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

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

type KubernetesClusterPoolUpdateConfig struct {
	ID               string            `json:"id,omitempty"`
	Count            int               `json:"count,omitempty"`
	Size             string            `json:"size,omitempty"`
	Labels           map[string]string `json:"labels,omitempty"`
	Taints           []corev1.Taint    `json:"taints,omitempty"`
	PublicIPNodePool bool              `json:"public_ip_node_pool,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

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"`
	Labels           map[string]string    `json:"labels,omitempty"`
	Taints           []corev1.Taint       `json:"taints,omitempty"`
	PublicIPNodePool bool                 `json:"public_ip_node_pool,omitempty"`
	Region           string               `json:"region,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 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 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

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 RequiredPools

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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