v2

package
v0.46.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2021 License: Apache-2.0 Imports: 11 Imported by: 40

Documentation

Overview

Package v2 is the new Exoscale client API binding. Reference: https://openapi-v2.exoscale.com/

Index

Constants

This section is empty.

Variables

View Source
var ErrClientConfig = errors.New("client configuration error")

Functions

This section is empty.

Types

type AntiAffinityGroup added in v0.44.0

type AntiAffinityGroup struct {
	Description string
	ID          string
	Name        string
}

AntiAffinityGroup represents an Anti-Affinity Group.

type Client

type Client struct {
	*papi.ClientWithResponses
	// contains filtered or unexported fields
}

Client represents an Exoscale API client.

func NewClient

func NewClient(apiKey, apiSecret string, opts ...ClientOpt) (*Client, error)

NewClient returns a new Exoscale API client, or an error if one couldn't be initialized.

func (*Client) CreateAntiAffinityGroup added in v0.44.0

func (c *Client) CreateAntiAffinityGroup(ctx context.Context, zone string,
	antiAffinityGroup *AntiAffinityGroup) (*AntiAffinityGroup, error)

CreateAntiAffinityGroup creates an Anti-Affinity Group in the specified zone.

func (*Client) CreateElasticIP added in v0.45.0

func (c *Client) CreateElasticIP(ctx context.Context, zone string, elasticIP *ElasticIP) (*ElasticIP, error)

CreateElasticIP creates an Elastic IP in the specified zone.

func (*Client) CreateInstancePool added in v0.44.0

func (c *Client) CreateInstancePool(ctx context.Context, zone string, instancePool *InstancePool) (*InstancePool, error)

CreateInstancePool creates an Instance Pool in the specified zone.

func (*Client) CreateNetworkLoadBalancer

func (c *Client) CreateNetworkLoadBalancer(ctx context.Context, zone string,
	nlb *NetworkLoadBalancer) (*NetworkLoadBalancer, error)

CreateNetworkLoadBalancer creates a Network Load Balancer instance in the specified zone.

func (*Client) CreatePrivateNetwork added in v0.44.0

func (c *Client) CreatePrivateNetwork(ctx context.Context, zone string,
	privateNetwork *PrivateNetwork) (*PrivateNetwork, error)

CreatePrivateNetwork creates a Private Network in the specified zone.

func (*Client) CreateSKSCluster

func (c *Client) CreateSKSCluster(ctx context.Context, zone string, cluster *SKSCluster) (*SKSCluster, error)

CreateSKSCluster creates a SKS cluster in the specified zone.

func (*Client) CreateSecurityGroup added in v0.44.0

func (c *Client) CreateSecurityGroup(ctx context.Context, zone string,
	securityGroup *SecurityGroup) (*SecurityGroup, error)

CreateSecurityGroup creates a Security Group.

func (*Client) DeleteAntiAffinityGroup added in v0.44.0

func (c *Client) DeleteAntiAffinityGroup(ctx context.Context, zone, id string) error

DeleteAntiAffinityGroup deletes the specified Anti-Affinity Group in the specified zone.

func (*Client) DeleteElasticIP added in v0.45.0

func (c *Client) DeleteElasticIP(ctx context.Context, zone, id string) error

DeleteElasticIP deletes the specified Elastic IP in the specified zone.

func (*Client) DeleteInstancePool added in v0.44.0

func (c *Client) DeleteInstancePool(ctx context.Context, zone, id string) error

DeleteInstancePool deletes the specified Instance Pool in the specified zone.

func (*Client) DeleteNetworkLoadBalancer

func (c *Client) DeleteNetworkLoadBalancer(ctx context.Context, zone, id string) error

DeleteNetworkLoadBalancer deletes the specified Network Load Balancer instance in the specified zone.

func (*Client) DeletePrivateNetwork added in v0.44.0

func (c *Client) DeletePrivateNetwork(ctx context.Context, zone, id string) error

DeletePrivateNetwork deletes the specified Private Network in the specified zone.

func (*Client) DeleteSKSCluster

func (c *Client) DeleteSKSCluster(ctx context.Context, zone, id string) error

DeleteSKSCluster deletes the specified SKS cluster in the specified zone.

func (*Client) DeleteSecurityGroup added in v0.44.0

func (c *Client) DeleteSecurityGroup(ctx context.Context, zone, id string) error

DeleteSecurityGroup deletes the specified Security Group in the specified zone.

func (*Client) GetAntiAffinityGroup added in v0.44.0

func (c *Client) GetAntiAffinityGroup(ctx context.Context, zone, id string) (*AntiAffinityGroup, error)

GetAntiAffinityGroup returns the Anti-Affinity Group corresponding to the specified ID in the specified zone.

func (*Client) GetElasticIP added in v0.45.0

func (c *Client) GetElasticIP(ctx context.Context, zone, id string) (*ElasticIP, error)

GetElasticIP returns the Elastic IP corresponding to the specified ID in the specified zone.

func (*Client) GetInstancePool added in v0.44.0

func (c *Client) GetInstancePool(ctx context.Context, zone, id string) (*InstancePool, error)

GetInstancePool returns the Instance Pool corresponding to the specified ID in the specified zone.

func (*Client) GetNetworkLoadBalancer

func (c *Client) GetNetworkLoadBalancer(ctx context.Context, zone, id string) (*NetworkLoadBalancer, error)

GetNetworkLoadBalancer returns the Network Load Balancer instance corresponding to the specified ID in the specified zone.

func (*Client) GetPrivateNetwork added in v0.44.0

func (c *Client) GetPrivateNetwork(ctx context.Context, zone, id string) (*PrivateNetwork, error)

GetPrivateNetwork returns the Private Network corresponding to the specified ID in the specified zone.

func (*Client) GetSKSCluster

func (c *Client) GetSKSCluster(ctx context.Context, zone, id string) (*SKSCluster, error)

GetSKSCluster returns the SKS cluster corresponding to the specified ID in the specified zone.

func (*Client) GetSecurityGroup added in v0.44.0

func (c *Client) GetSecurityGroup(ctx context.Context, zone, id string) (*SecurityGroup, error)

GetSecurityGroup returns the Security Group corresponding to the specified ID in the specified zone.

func (*Client) ListAntiAffinityGroups added in v0.44.0

func (c *Client) ListAntiAffinityGroups(ctx context.Context, zone string) ([]*AntiAffinityGroup, error)

ListAntiAffinityGroups returns the list of existing Anti-Affinity Groups in the specified zone.

func (*Client) ListElasticIPs added in v0.45.0

func (c *Client) ListElasticIPs(ctx context.Context, zone string) ([]*ElasticIP, error)

ListElasticIPs returns the list of existing Elastic IPs in the specified zone.

func (*Client) ListInstancePools added in v0.44.0

func (c *Client) ListInstancePools(ctx context.Context, zone string) ([]*InstancePool, error)

ListInstancePools returns the list of existing Instance Pools in the specified zone.

func (*Client) ListNetworkLoadBalancers

func (c *Client) ListNetworkLoadBalancers(ctx context.Context, zone string) ([]*NetworkLoadBalancer, error)

ListNetworkLoadBalancers returns the list of existing Network Load Balancers in the specified zone.

func (*Client) ListPrivateNetworks added in v0.44.0

func (c *Client) ListPrivateNetworks(ctx context.Context, zone string) ([]*PrivateNetwork, error)

ListPrivateNetworks returns the list of existing Private Networks in the specified zone.

func (*Client) ListSKSClusterVersions

func (c *Client) ListSKSClusterVersions(ctx context.Context) ([]string, error)

ListSKSClusterVersions returns the list of Kubernetes versions supported during SKS cluster creation.

func (*Client) ListSKSClusters

func (c *Client) ListSKSClusters(ctx context.Context, zone string) ([]*SKSCluster, error)

ListSKSClusters returns the list of existing SKS clusters in the specified zone.

func (*Client) ListSecurityGroups added in v0.44.0

func (c *Client) ListSecurityGroups(ctx context.Context, zone string) ([]*SecurityGroup, error)

ListSecurityGroups returns the list of existing Security Groups.

func (*Client) ListZones

func (c *Client) ListZones(ctx context.Context) ([]string, error)

ListZones returns the list of Exoscale zones.

func (*Client) UpdateElasticIP added in v0.45.0

func (c *Client) UpdateElasticIP(ctx context.Context, zone string, elasticIP *ElasticIP) error

UpdateElasticIP updates the specified Elastic IP in the specified zone.

func (*Client) UpdateInstancePool added in v0.44.0

func (c *Client) UpdateInstancePool(ctx context.Context, zone string, instancePool *InstancePool) error

UpdateInstancePool updates the specified Instance Pool in the specified zone.

func (*Client) UpdateNetworkLoadBalancer

func (c *Client) UpdateNetworkLoadBalancer(ctx context.Context, zone string,
	nlb *NetworkLoadBalancer) (*NetworkLoadBalancer, error)

UpdateNetworkLoadBalancer updates the specified Network Load Balancer instance in the specified zone.

func (*Client) UpdatePrivateNetwork added in v0.44.0

func (c *Client) UpdatePrivateNetwork(ctx context.Context, zone string, privateNetwork *PrivateNetwork) error

UpdatePrivateNetwork updates the specified Private Network in the specified zone.

func (*Client) UpdateSKSCluster

func (c *Client) UpdateSKSCluster(ctx context.Context, zone string, cluster *SKSCluster) error

UpdateSKSCluster updates the specified SKS cluster in the specified zone.

func (*Client) UpgradeSKSCluster

func (c *Client) UpgradeSKSCluster(ctx context.Context, zone, id, version string) error

UpgradeSKSCluster upgrades the SKS cluster corresponding to the specified ID in the specified zone to the requested Kubernetes version.

type ClientOpt

type ClientOpt func(*Client) error

ClientOpt represents a function setting Exoscale API client option.

func ClientOptCond added in v0.44.0

func ClientOptCond(fc func() bool, opt ClientOpt) ClientOpt

ClientOptCond returns the specified ClientOpt if the fc function bool result evaluates to true, otherwise returns a no-op ClientOpt.

func ClientOptWithAPIEndpoint

func ClientOptWithAPIEndpoint(v string) ClientOpt

ClientOptWithAPIEndpoint returns a ClientOpt overriding the default Exoscale API endpoint.

func ClientOptWithHTTPClient

func ClientOptWithHTTPClient(v *http.Client) ClientOpt

ClientOptWithHTTPClient returns a ClientOpt overriding the default http.Client. Note: the Exoscale API client will chain additional middleware (http.RoundTripper) on the HTTP client internally, which can alter the HTTP requests and responses. If you don't want any other middleware than the ones currently set to your HTTP client, you should duplicate it and pass a copy instead.

func ClientOptWithTimeout

func ClientOptWithTimeout(v time.Duration) ClientOpt

ClientOptWithTimeout returns a ClientOpt overriding the default client timeout.

func ClientOptWithTrace added in v0.44.0

func ClientOptWithTrace() ClientOpt

ClientOptWithTrace returns a ClientOpt enabling HTTP request/reponse tracing.

type ElasticIP added in v0.45.0

type ElasticIP struct {
	Description string `reset:"description"`
	Healthcheck *ElasticIPHealthcheck
	ID          string
	IPAddress   net.IP
	// contains filtered or unexported fields
}

ElasticIP represents an Elastic IP.

func (*ElasticIP) ResetField added in v0.45.0

func (e *ElasticIP) ResetField(ctx context.Context, field interface{}) error

ResetField resets the specified Elastic IP field to its default value. The value expected for the field parameter is a pointer to the ElasticIP field to reset.

type ElasticIPHealthcheck added in v0.45.0

type ElasticIPHealthcheck struct {
	Interval      time.Duration
	Mode          string
	Port          uint16
	StrikesFail   int64
	StrikesOK     int64
	TLSSNI        string
	TLSSkipVerify bool
	Timeout       time.Duration
	URI           string
}

ElasticIPHealthcheck represents an Elastic IP healthcheck.

type InstancePool added in v0.44.0

type InstancePool struct {
	AntiAffinityGroupIDs []string `reset:"anti-affinity-groups"`
	Description          string   `reset:"description"`
	DiskSize             int64
	ElasticIPIDs         []string `reset:"elastic-ips"`
	ID                   string
	IPv6Enabled          bool
	InstanceIDs          []string
	InstanceTypeID       string
	ManagerID            string
	Name                 string
	PrivateNetworkIDs    []string `reset:"private-networks"`
	SSHKey               string   `reset:"ssh-key"`
	SecurityGroupIDs     []string `reset:"security-groups"`
	Size                 int64
	State                string
	TemplateID           string
	UserData             string `reset:"user-data"`
	// contains filtered or unexported fields
}

InstancePool represents an Instance Pool.

func (*InstancePool) EvictMembers added in v0.44.0

func (i *InstancePool) EvictMembers(ctx context.Context, members []string) error

EvictMembers evicts the specified members (identified by their Compute instance ID) from the Instance Pool.

func (*InstancePool) ResetField added in v0.44.0

func (i *InstancePool) ResetField(ctx context.Context, field interface{}) error

ResetField resets the specified Instance Pool field to its default value. The value expected for the field parameter is a pointer to the InstancePool field to reset.

func (*InstancePool) Scale added in v0.44.0

func (i *InstancePool) Scale(ctx context.Context, instances int64) error

Scale scales the Instance Pool to the specified number of instances.

type NetworkLoadBalancer

type NetworkLoadBalancer struct {
	CreatedAt   time.Time
	Description string
	ID          string
	IPAddress   net.IP
	Name        string
	Services    []*NetworkLoadBalancerService
	State       string
	// contains filtered or unexported fields
}

NetworkLoadBalancer represents a Network Load Balancer instance.

func (*NetworkLoadBalancer) AddService

AddService adds a service to the Network Load Balancer instance.

func (*NetworkLoadBalancer) DeleteService

func (nlb *NetworkLoadBalancer) DeleteService(ctx context.Context, svc *NetworkLoadBalancerService) error

DeleteService deletes the specified service from the Network Load Balancer instance.

func (*NetworkLoadBalancer) UpdateService

func (nlb *NetworkLoadBalancer) UpdateService(ctx context.Context, svc *NetworkLoadBalancerService) error

UpdateService updates the specified Network Load Balancer service.

type NetworkLoadBalancerServerStatus

type NetworkLoadBalancerServerStatus struct {
	InstanceIP net.IP
	Status     string
}

NetworkLoadBalancerServerStatus represents a Network Load Balancer service target server status.

type NetworkLoadBalancerService

type NetworkLoadBalancerService struct {
	Description       string
	Healthcheck       NetworkLoadBalancerServiceHealthcheck
	HealthcheckStatus []*NetworkLoadBalancerServerStatus
	ID                string
	InstancePoolID    string
	Name              string
	Port              uint16
	Protocol          string
	State             string
	Strategy          string
	TargetPort        uint16
}

NetworkLoadBalancerService represents a Network Load Balancer service.

type NetworkLoadBalancerServiceHealthcheck

type NetworkLoadBalancerServiceHealthcheck struct {
	Interval time.Duration
	Mode     string
	Port     uint16
	Retries  int64
	TLSSNI   string
	Timeout  time.Duration
	URI      string
}

NetworkLoadBalancerServiceHealthcheck represents a Network Load Balancer service healthcheck.

type PrivateNetwork added in v0.44.0

type PrivateNetwork struct {
	Description string
	EndIP       net.IP
	ID          string
	Name        string
	Netmask     net.IP
	StartIP     net.IP
}

PrivateNetwork represents a Private Network.

type SKSCluster

type SKSCluster struct {
	AddOns       []string
	CNI          string
	CreatedAt    time.Time
	Description  string `reset:"description"`
	Endpoint     string
	ID           string
	Name         string
	Nodepools    []*SKSNodepool
	ServiceLevel string
	State        string
	Version      string
	// contains filtered or unexported fields
}

SKSCluster represents a SKS cluster.

func (*SKSCluster) AddNodepool

func (c *SKSCluster) AddNodepool(ctx context.Context, np *SKSNodepool) (*SKSNodepool, error)

AddNodepool adds a Nodepool to the SKS cluster.

func (*SKSCluster) AuthorityCert added in v0.46.0

func (c *SKSCluster) AuthorityCert(ctx context.Context, authority string) (string, error)

AuthorityCert returns the SKS cluster base64-encoded certificate content for the specified authority.

func (*SKSCluster) DeleteNodepool

func (c *SKSCluster) DeleteNodepool(ctx context.Context, np *SKSNodepool) error

DeleteNodepool deletes the specified Nodepool from the SKS cluster.

func (*SKSCluster) EvictNodepoolMembers

func (c *SKSCluster) EvictNodepoolMembers(ctx context.Context, np *SKSNodepool, members []string) error

EvictNodepoolMembers evicts the specified members (identified by their Compute instance ID) from the SKS cluster Nodepool.

func (*SKSCluster) RequestKubeconfig

func (c *SKSCluster) RequestKubeconfig(ctx context.Context, user string, groups []string,
	d time.Duration) (string, error)

RequestKubeconfig returns a base64-encoded kubeconfig content for the specified user name, optionally associated to specified groups for a duration d (default API-set TTL applies if not specified). Fore more information: https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/

func (*SKSCluster) ResetField added in v0.44.0

func (c *SKSCluster) ResetField(ctx context.Context, field interface{}) error

ResetField resets the specified SKS cluster field to its default value. The value expected for the field parameter is a pointer to the SKSCluster field to reset.

func (*SKSCluster) ResetNodepoolField added in v0.44.0

func (c *SKSCluster) ResetNodepoolField(ctx context.Context, np *SKSNodepool, field interface{}) error

ResetNodepoolField resets the specified SKS Nodepool field to its default value. The value expected for the field parameter is a pointer to the SKSNodepool field to reset.

func (*SKSCluster) RotateCCMCredentials added in v0.46.0

func (c *SKSCluster) RotateCCMCredentials(ctx context.Context) error

RotateCCMCredentials rotates the Exoscale IAM credentials managed by the SKS control plane for the Kubernetes Exoscale Cloud Controller Manager.

func (*SKSCluster) ScaleNodepool

func (c *SKSCluster) ScaleNodepool(ctx context.Context, np *SKSNodepool, nodes int64) error

ScaleNodepool scales the SKS cluster Nodepool to the specified number of Kubernetes Nodes.

func (*SKSCluster) UpdateNodepool

func (c *SKSCluster) UpdateNodepool(ctx context.Context, np *SKSNodepool) error

UpdateNodepool updates the specified SKS cluster Nodepool.

type SKSNodepool

type SKSNodepool struct {
	AntiAffinityGroupIDs []string `reset:"anti-affinity-groups"`
	CreatedAt            time.Time
	Description          string `reset:"description"`
	DiskSize             int64
	ID                   string
	InstancePoolID       string
	InstanceTypeID       string
	Name                 string
	SecurityGroupIDs     []string `reset:"security-groups"`
	Size                 int64
	State                string
	TemplateID           string
	Version              string
}

SKSNodepool represents a SKS Nodepool.

type SecurityGroup added in v0.44.0

type SecurityGroup struct {
	Description string
	ID          string
	Name        string
	Rules       []*SecurityGroupRule
	// contains filtered or unexported fields
}

SecurityGroup represents a Security Group.

func (*SecurityGroup) AddRule added in v0.44.0

AddRule adds a rule to the Security Group.

func (*SecurityGroup) DeleteRule added in v0.44.0

func (s *SecurityGroup) DeleteRule(ctx context.Context, rule *SecurityGroupRule) error

DeleteRule deletes the specified rule from the Security Group.

type SecurityGroupRule added in v0.44.0

type SecurityGroupRule struct {
	Description     string
	EndPort         uint16
	FlowDirection   string
	ICMPCode        uint8
	ICMPType        uint8
	ID              string
	Network         *net.IPNet
	Protocol        string
	SecurityGroupID string
	StartPort       uint16
}

SecurityGroupRule represents a Security Group rule.

Directories

Path Synopsis
Package api implements low-level primitives for interacting with the Exoscale API.
Package api implements low-level primitives for interacting with the Exoscale API.
internal
public-api
Package publicapi provides primitives to interact the openapi HTTP API.
Package publicapi provides primitives to interact the openapi HTTP API.

Jump to

Keyboard shortcuts

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