client

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DigitalOceanClient

type DigitalOceanClient struct {
	Client *godo.Client
}

DigitalOceanClient manages communication with DigitalOcean V2 API.

func (*DigitalOceanClient) CreateDatabaseUser

func (do *DigitalOceanClient) CreateDatabaseUser(ctx context.Context, name string, databaseCreateUserRequest *godo.DatabaseCreateUserRequest) (*godo.DatabaseUser, *godo.Response, error)

CreateDatabaseUser will create a new database user

func (*DigitalOceanClient) CreateDroplet

func (do *DigitalOceanClient) CreateDroplet(ctx context.Context, createRequest *godo.DropletCreateRequest) (*godo.Droplet, *godo.Response, error)

CreateDroplet creates a new droplet.

func (*DigitalOceanClient) CreateSSHKey

func (do *DigitalOceanClient) CreateSSHKey(ctx context.Context, keyCreateRequest *godo.KeyCreateRequest) (*godo.Key, *godo.Response, error)

CreateSSHKey adds an SSH Key

func (*DigitalOceanClient) DeleteDatabaseClusterUser

func (do *DigitalOceanClient) DeleteDatabaseClusterUser(ctx context.Context, clusterID string, name string) (*godo.Response, error)

DeleteDatabaseClusterUser will delete an existing database user

func (*DigitalOceanClient) DeleteSSHKeyByID

func (do *DigitalOceanClient) DeleteSSHKeyByID(ctx context.Context, keyID int) (*godo.Response, error)

DeleteSSHKeyByID deletes an SSH key by its ID

func (*DigitalOceanClient) GetKubeConfig

func (do *DigitalOceanClient) GetKubeConfig(ctx context.Context, clusterID string) (*godo.KubernetesClusterConfig, *godo.Response, error)

GetKubeConfig returns a Kubernetes config file for the specified cluster.

func (*DigitalOceanClient) GetKubernetesClusterUpgrades

func (do *DigitalOceanClient) GetKubernetesClusterUpgrades(ctx context.Context, clusterID string) ([]*godo.KubernetesVersion, *godo.Response, error)

GetKubernetesClusterUpgrades retrieves versions a Kubernetes cluster can be upgraded to

func (*DigitalOceanClient) GetSSHKeyByID

func (do *DigitalOceanClient) GetSSHKeyByID(ctx context.Context, keyID int) (*godo.Key, *godo.Response, error)

GetSSHKeyByID retrieves an SSH key by ID

func (*DigitalOceanClient) ListDatabaseClusterBackups

func (do *DigitalOceanClient) ListDatabaseClusterBackups(ctx context.Context, clusterID string, listOptions *godo.ListOptions) ([]godo.DatabaseBackup, *godo.Response, error)

ListDatabaseClusterBackups returns a list of the current backups of a database

func (*DigitalOceanClient) ListDatabaseClusterUsers

func (do *DigitalOceanClient) ListDatabaseClusterUsers(ctx context.Context, clusterID string, listOptions *godo.ListOptions) ([]godo.DatabaseUser, *godo.Response, error)

ListDatabaseClusterUsers returns all database users for the database

func (*DigitalOceanClient) ListDatabaseClusters

func (do *DigitalOceanClient) ListDatabaseClusters(ctx context.Context, listOptions *godo.ListOptions) ([]godo.Database, *godo.Response, error)

ListDatabaseClusters returns a list of the Database Clusters visible with the caller's API token

func (*DigitalOceanClient) ListDatabasesInCluster

func (do *DigitalOceanClient) ListDatabasesInCluster(ctx context.Context, clusterID string, opts *godo.ListOptions) ([]godo.DatabaseDB, *godo.Response, error)

ListDatabasesInCluster returns a lists of databases in a cluster

func (*DigitalOceanClient) ListDomains

func (do *DigitalOceanClient) ListDomains(ctx context.Context, listOptions *godo.ListOptions) ([]godo.Domain, *godo.Response, error)

ListDomains lists all domains.

func (*DigitalOceanClient) ListDroplets

func (do *DigitalOceanClient) ListDroplets(ctx context.Context, listOptions *godo.ListOptions) ([]godo.Droplet, *godo.Response, error)

ListDroplets lists all droplets.

func (*DigitalOceanClient) ListImageDistributions

func (do *DigitalOceanClient) ListImageDistributions(ctx context.Context, listOptions *godo.ListOptions) ([]godo.Image, *godo.Response, error)

ListImageDistributions lists available images

func (*DigitalOceanClient) ListKubernetesClusterNodePools

func (do *DigitalOceanClient) ListKubernetesClusterNodePools(ctx context.Context, clusterID string, opts *godo.ListOptions) ([]*godo.KubernetesNodePool, *godo.Response, error)

ListKubernetesClusterNodePools lists all NodePools in a Kubernetes cluster

func (*DigitalOceanClient) ListKubernetesClusterNodes

func (do *DigitalOceanClient) ListKubernetesClusterNodes(ctx context.Context, clusterID string, opts *godo.ListOptions) ([]*K8sNode, *godo.Response, error)

ListKubernetesClusterNodes lists all nodes in a Kubernetes cluster

func (*DigitalOceanClient) ListKubernetesClusters

func (do *DigitalOceanClient) ListKubernetesClusters(ctx context.Context, listOptions *godo.ListOptions) ([]*godo.KubernetesCluster, *godo.Response, error)

ListKubernetesClusters lists all kubernetes clusters

func (*DigitalOceanClient) ListRegions

func (do *DigitalOceanClient) ListRegions(ctx context.Context, listOptions *godo.ListOptions) ([]godo.Region, *godo.Response, error)

ListRegions lists the available regions

func (*DigitalOceanClient) ListSSHKeys

func (do *DigitalOceanClient) ListSSHKeys(ctx context.Context, listOptions *godo.ListOptions) ([]godo.Key, *godo.Response, error)

ListSSHKeys lists all SSH keys

func (*DigitalOceanClient) ListSizes

func (do *DigitalOceanClient) ListSizes(ctx context.Context, listOptions *godo.ListOptions) ([]godo.Size, *godo.Response, error)

ListSizes lists droplet sizes

func (*DigitalOceanClient) PowerCycleDroplet

func (do *DigitalOceanClient) PowerCycleDroplet(ctx context.Context, dropletID int) (*godo.Action, *godo.Response, error)

PowerCycleDroplet powers off a droplet then powers it back on

func (*DigitalOceanClient) RebootDroplet

func (do *DigitalOceanClient) RebootDroplet(ctx context.Context, dropletID int) (*godo.Action, *godo.Response, error)

RebootDroplet reboots a droplet

func (*DigitalOceanClient) RenameDroplet

func (do *DigitalOceanClient) RenameDroplet(ctx context.Context, dropletID int, newName string) (*godo.Action, *godo.Response, error)

RenameDroplet renames a droplet

func (*DigitalOceanClient) ShutdownDroplet

func (do *DigitalOceanClient) ShutdownDroplet(ctx context.Context, dropletID int) (*godo.Action, *godo.Response, error)

ShutdownDroplet shuts down a droplet

func (*DigitalOceanClient) UpgradeKubernetesCluster

func (do *DigitalOceanClient) UpgradeKubernetesCluster(ctx context.Context, clusterID string, upgradeRequest *godo.KubernetesClusterUpgradeRequest) (*godo.Response, error)

UpgradeKubernetesCluster upgrades a Kubernetes cluster to a new version. Valid upgrade versions for a given cluster can be retrieved with `GetKubernetesClusterUpgrades`.

type DigitalOceanService

type DigitalOceanService interface {
	CreateDatabaseUser(ctx context.Context, userName string, databaseCreateUserRequest *godo.DatabaseCreateUserRequest) (*godo.DatabaseUser, *godo.Response, error)
	DeleteDatabaseClusterUser(ctx context.Context, clusterID string, userName string) (*godo.Response, error)
	ListDatabaseClusterUsers(ctx context.Context, clusterID string, listOptions *godo.ListOptions) ([]godo.DatabaseUser, *godo.Response, error)
	ListDatabasesInCluster(ctx context.Context, clusterID string, listOptions *godo.ListOptions) ([]godo.DatabaseDB, *godo.Response, error)
	ListDatabaseClusters(ctx context.Context, listOptions *godo.ListOptions) ([]godo.Database, *godo.Response, error)
	ListDatabaseClusterBackups(ctx context.Context, clusterID string, listOptions *godo.ListOptions) ([]godo.DatabaseBackup, *godo.Response, error)

	ListDomains(ctx context.Context, listOptions *godo.ListOptions) ([]godo.Domain, *godo.Response, error)

	CreateDroplet(ctx context.Context, createRequest *godo.DropletCreateRequest) (*godo.Droplet, *godo.Response, error)
	ListDroplets(ctx context.Context, listOptions *godo.ListOptions) ([]godo.Droplet, *godo.Response, error)
	PowerCycleDroplet(ctx context.Context, dropletID int) (*godo.Action, *godo.Response, error)
	RebootDroplet(ctx context.Context, dropletID int) (*godo.Action, *godo.Response, error)
	RenameDroplet(ctx context.Context, dropletID int, newName string) (*godo.Action, *godo.Response, error)
	ShutdownDroplet(ctx context.Context, dropletID int) (*godo.Action, *godo.Response, error)

	CreateSSHKey(ctx context.Context, keyCreateRequest *godo.KeyCreateRequest) (*godo.Key, *godo.Response, error)
	DeleteSSHKeyByID(ctx context.Context, keyID int) (*godo.Response, error)
	ListSSHKeys(ctx context.Context, listOptions *godo.ListOptions) ([]godo.Key, *godo.Response, error)
	GetSSHKeyByID(ctx context.Context, keyID int) (*godo.Key, *godo.Response, error)

	ListKubernetesClusters(ctx context.Context, listOptions *godo.ListOptions) ([]*godo.KubernetesCluster, *godo.Response, error)
	ListKubernetesClusterNodePools(ctx context.Context, clusterID string, opts *godo.ListOptions) ([]*godo.KubernetesNodePool, *godo.Response, error)
	ListKubernetesClusterNodes(ctx context.Context, clusterID string, opts *godo.ListOptions) ([]*K8sNode, *godo.Response, error)
	GetKubernetesClusterUpgrades(ctx context.Context, clusterID string) ([]*godo.KubernetesVersion, *godo.Response, error)
	GetKubeConfig(ctx context.Context, clusterID string) (*godo.KubernetesClusterConfig, *godo.Response, error)
	UpgradeKubernetesCluster(ctx context.Context, clusterID string, upgradeRequest *godo.KubernetesClusterUpgradeRequest) (*godo.Response, error)

	ListRegions(ctx context.Context, listOptions *godo.ListOptions) ([]godo.Region, *godo.Response, error)
	ListSizes(ctx context.Context, listOptions *godo.ListOptions) ([]godo.Size, *godo.Response, error)
	ListImageDistributions(ctx context.Context, listOptions *godo.ListOptions) ([]godo.Image, *godo.Response, error)
}

DigitalOceanService is an interface for interfacing with the DigitalOcean API endpoints

type K8sNode

type K8sNode struct {
	*godo.KubernetesNode
	NodePoolName string
}

K8sNode represents a node in a Kubernetes cluster with the node pool name

type TokenSource

type TokenSource struct {
	AccessToken string
}

TokenSource contains the access token used for authentication

func (*TokenSource) Token

func (t *TokenSource) Token() (*oauth2.Token, error)

Token returns the access token

Jump to

Keyboard shortcuts

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