services

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InstanceStatusStopped           = "SHUTOFF"
	InstanceStatusRunning           = "ACTIVE"
	DefaultSecurityGroupDescription = "Automatically created by docker-machine for OTC"
)

Instance statuses

View Source
const (
	// ClusterTypeECS default cluster type for ECS
	ClusterTypeECS = "VirtualMachine"
	// ClusterTypeBMS default cluster type for BMS
	ClusterTypeBMS = "BareMetal"

	// ContainerNetworkModeOverlay default cluster network overlay
	ContainerNetworkModeOverlay = "overlay_l2"
	// ContainerNetworkModeUnderlay default cluster network underlay
	ContainerNetworkModeUnderlay = "underlay_ipvlan"
	// ContainerNetworkModeVPC default cluster network mode
	ContainerNetworkModeVPC = "vpc-router"

	// ClusterAvailable default cluster state
	ClusterAvailable = "Available"
	// NodeActive default node state
	NodeActive = "Active"

	// EulerOSVersion default os version
	EulerOSVersion = "EulerOS 2.5"
)
View Source
const LBStateActive = "ACTIVE"

LBStateActive default

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Provider *golangsdk.ProviderClient

	ECS       *golangsdk.ServiceClient
	ComputeV2 *golangsdk.ServiceClient
	ImsV2     *golangsdk.ServiceClient
	NetworkV2 *golangsdk.ServiceClient
	VPC       *golangsdk.ServiceClient
	CCE       *golangsdk.ServiceClient
	// contains filtered or unexported fields
}

Client contains service clients

func NewClient added in v0.3.0

func NewClient(prefix string) (*Client, error)

NewClient - creates new client

func NewCloudClient added in v0.3.0

func NewCloudClient(cloud *openstack.Cloud) *Client

NewCloudClient - creates new cloud client

func (*Client) AddTags added in v0.2.3

func (c *Client) AddTags(instanceID string, serverTags []string) error

AddTags - add tags to instance

func (*Client) Authenticate

func (c *Client) Authenticate() error

Authenticate - authenticate client in the cloud with token (either directly or via username/password)

func (*Client) BindFloatingIP

func (c *Client) BindFloatingIP(floatingIP, instanceID string) error

BindFloatingIP binds floating IP to instance

func (*Client) BindFloatingIPToPort added in v0.3.0

func (c *Client) BindFloatingIPToPort(floatingIP, portID string) error

BindFloatingIPToPort binds floating IP to networking port

func (*Client) CreateCluster added in v0.3.0

func (c *Client) CreateCluster(opts *CreateClusterOpts) (*clusters.Clusters, error)

CreateCluster create CCE cluster and wait until it is available

func (*Client) CreateECSInstance added in v0.3.0

func (c *Client) CreateECSInstance(opts cloudservers.CreateOptsBuilder, timeoutSeconds int) (string, error)

CreateECSInstance - create new ECS instance

func (*Client) CreateEIP added in v0.2.2

func (c *Client) CreateEIP(opts *ElasticIPOpts) (*eips.PublicIp, error)

CreateEIP creates new eip

func (*Client) CreateInstance

func (c *Client) CreateInstance(opts *ExtendedServerOpts) (*servers.Server, error)

CreateInstance creates new ECS

func (*Client) CreateKeyPair

func (c *Client) CreateKeyPair(name string, publicKey string) (*keypairs.KeyPair, error)

CreateKeyPair creates new key pair from given public key string

func (*Client) CreateLBListener added in v0.3.0

func (c *Client) CreateLBListener(opts *listeners.CreateOpts) (*listeners.Listener, error)

CreateLBListener creates listener

func (*Client) CreateLBMember added in v0.3.0

func (c *Client) CreateLBMember(poolID string, opts *pools.CreateMemberOpts) (*pools.Member, error)

CreateLBMember creates load balancer member

func (*Client) CreateLBMonitor added in v0.3.0

func (c *Client) CreateLBMonitor(opts *monitors.CreateOpts) (*monitors.Monitor, error)

CreateLBMonitor creates load balancer health monitor

func (*Client) CreateLBPool added in v0.3.0

func (c *Client) CreateLBPool(opts *pools.CreateOpts) (*pools.Pool, error)

CreateLBPool creates load balancer pool

func (*Client) CreateLoadBalancer added in v0.3.0

func (c *Client) CreateLoadBalancer(opts *loadbalancers.CreateOpts) (*loadbalancers.LoadBalancer, error)

CreateLoadBalancer creating new ELBv2

func (*Client) CreateNodes added in v0.3.0

func (c *Client) CreateNodes(opts *CreateNodesOpts, count int) ([]string, error)

CreateNodes create `count` nodes and wait until they are active

func (*Client) CreateSecurityGroup

func (c *Client) CreateSecurityGroup(securityGroupName string, ports ...PortRange) (*secgroups.SecurityGroup, error)

CreateSecurityGroup creates new sec group and returns group ID

func (*Client) CreateServerGroup added in v0.3.0

func (c *Client) CreateServerGroup(opts *servergroups.CreateOpts) (*servergroups.ServerGroup, error)

CreateServerGroup - creates server group

func (*Client) CreateSubnet

func (c *Client) CreateSubnet(vpcID string, subnetName string) (*subnets.Subnet, error)

CreateSubnet creates new Subnet and set Driver.SubnetID

func (*Client) CreateVPC

func (c *Client) CreateVPC(vpcName string) (*vpcs.Vpc, error)

CreateVPC creates new VPC by d.VpcName

func (*Client) DeleteCluster added in v0.3.0

func (c *Client) DeleteCluster(clusterID string) error

DeleteCluster removes cluster

func (*Client) DeleteECSInstance added in v0.3.0

func (c *Client) DeleteECSInstance(instanceID string) error

DeleteECSInstance deletes ecs

func (*Client) DeleteFloatingIP

func (c *Client) DeleteFloatingIP(floatingIP string) error

DeleteFloatingIP releases floating IP

func (*Client) DeleteInstance

func (c *Client) DeleteInstance(instanceID string) error

DeleteInstance removes existing ECS instance

func (*Client) DeleteKeyPair

func (c *Client) DeleteKeyPair(name string) error

DeleteKeyPair removes existing key pair

func (*Client) DeleteLBListener added in v0.3.0

func (c *Client) DeleteLBListener(id string) error

DeleteLBListener deletes listener

func (*Client) DeleteLBMember added in v0.3.0

func (c *Client) DeleteLBMember(poolID, memberID string) error

DeleteLBMember deletes load balancer member

func (*Client) DeleteLBMonitor added in v0.3.0

func (c *Client) DeleteLBMonitor(id string) error

DeleteLBMonitor deletes load balancer health monitor

func (*Client) DeleteLBPool added in v0.3.0

func (c *Client) DeleteLBPool(id string) error

DeleteLBPool deletes load balancer pool

func (*Client) DeleteLoadBalancer added in v0.3.0

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

DeleteLoadBalancer removes existing load balancer

func (*Client) DeleteNodes added in v0.3.0

func (c *Client) DeleteNodes(clusterID string, nodeIDs []string) error

DeleteNodes deletes all given nodes

func (*Client) DeleteSecurityGroup

func (c *Client) DeleteSecurityGroup(securityGroupID string) error

DeleteSecurityGroup deletes managed security group

func (*Client) DeleteServerGroup added in v0.3.0

func (c *Client) DeleteServerGroup(id string) error

DeleteServerGroup - deletes server group

func (*Client) DeleteSubnet

func (c *Client) DeleteSubnet(vpcID string, subnetID string) error

DeleteSubnet removes subnet from VPC

func (*Client) DeleteVPC

func (c *Client) DeleteVPC(vpcID string) error

DeleteVPC removes existing VPC

func (*Client) FindFlavor

func (c *Client) FindFlavor(flavorName string) (string, error)

FindFlavor resolves `Flavor ID` for given `Flavor Name`

func (*Client) FindFloatingIP

func (c *Client) FindFloatingIP(floatingIP string) (addressID string, err error)

FindFloatingIP finds given floating IP and returns ID

func (*Client) FindImage

func (c *Client) FindImage(imageName string) (string, error)

FindImage resolve image ID by given image Name

func (*Client) FindInstance

func (c *Client) FindInstance(name string) (string, error)

FindInstance returns instance ID by instance Name

func (*Client) FindKeyPair

func (c *Client) FindKeyPair(name string) (string, error)

FindKeyPair searches for key pair and returns public key

func (*Client) FindSecurityGroups added in v0.1.2

func (c *Client) FindSecurityGroups(secGroups []string) ([]string, error)

FindSecurityGroups get slice of security group IDs from given security group names

func (*Client) FindServerGroup added in v0.2.3

func (c *Client) FindServerGroup(groupName string) (result string, err error)

FindServerGroup - get server group

func (*Client) FindSubnet

func (c *Client) FindSubnet(vpcID string, subnetName string) (string, error)

FindSubnet find subnet by name in given VPC and return ID

func (*Client) FindVPC

func (c *Client) FindVPC(vpcName string) (string, error)

FindVPC find VPC in list by its name and return VPC ID

func (*Client) GetCluster added in v0.3.0

func (c *Client) GetCluster(clusterID string) (*clusters.Clusters, error)

GetCluster cluster details

func (*Client) GetClusterCertificate added in v0.3.0

func (c *Client) GetClusterCertificate(clusterID string) (*clusters.Certificate, error)

GetClusterCertificate cluster certificate

func (*Client) GetECSStatus added in v0.3.0

func (c *Client) GetECSStatus(instanceID string) (*cloudservers.CloudServer, error)

GetECSStatus returns current ecs status

func (*Client) GetEIPStatus added in v0.2.2

func (c *Client) GetEIPStatus(eipID string) (string, error)

GetEIPStatus get status of ip

func (*Client) GetInstanceSG added in v0.3.2

func (c *Client) GetInstanceSG(instanceID string) ([]secgroups.SecurityGroup, error)

GetInstanceSG get details of ECS instance security groups

func (*Client) GetInstanceStatus

func (c *Client) GetInstanceStatus(instanceID string) (*servers.Server, error)

GetInstanceStatus returns instance details by instance ID

func (*Client) GetLBMemberStatus added in v0.3.0

func (c *Client) GetLBMemberStatus(poolID, memberID string) (*pools.Member, error)

GetLBMemberStatus get load balancer member status

func (*Client) GetLoadBalancerDetails added in v0.3.0

func (c *Client) GetLoadBalancerDetails(id string) (*loadbalancers.LoadBalancer, error)

GetLoadBalancerDetails fetches load balancer data

func (*Client) GetNodesStatus added in v0.3.0

func (c *Client) GetNodesStatus(clusterID string, nodeIDs []string) ([]*nodes.Status, error)

GetNodesStatus returns statuses of given nodes

func (*Client) GetPublicKey

func (c *Client) GetPublicKey(keyPairName string) ([]byte, error)

GetPublicKey returns public key data from keypair

func (*Client) GetServerEIP added in v0.3.3

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

GetServerEIP - get floating ip by instance ID

func (*Client) GetSubnetStatus

func (c *Client) GetSubnetStatus(subnetID string) (*subnets.Subnet, error)

GetSubnetStatus returns details of subnet by ID

func (*Client) GetVPCDetails

func (c *Client) GetVPCDetails(vpcID string) (*vpcs.Vpc, error)

GetVPCDetails returns details of VPC

func (*Client) InitCCE added in v0.3.0

func (c *Client) InitCCE() error

InitCCE initializes CCE service

func (*Client) InitCompute

func (c *Client) InitCompute() error

InitCompute initializes Compute v2 service

func (*Client) InitECS added in v0.3.0

func (c *Client) InitECS() error

InitECS initializes Compute v1 (ECS) service

func (*Client) InitIms added in v0.3.0

func (c *Client) InitIms() error

InitIms initializes IMS v2 service

func (*Client) InitNetworkV2 added in v0.3.0

func (c *Client) InitNetworkV2() error

InitNetworkV2 initializes OpenStack Neutron client

func (*Client) InitVPC added in v0.3.0

func (c *Client) InitVPC() error

InitVPC initializes VPC v1 service

func (*Client) InstanceBindToIP

func (c *Client) InstanceBindToIP(instanceID string, ip string) (bool, error)

InstanceBindToIP checks if instance has IP bind

func (*Client) NewServiceClient added in v0.3.0

func (c *Client) NewServiceClient(service string) (*golangsdk.ServiceClient, error)

NewServiceClient is a convenience function to get a new service client.

func (*Client) ReleaseEIP added in v0.3.0

func (c *Client) ReleaseEIP(opts eips.ListOpts) error

ReleaseEIP releases new eip

func (*Client) RestartInstance

func (c *Client) RestartInstance(instanceID string) error

RestartInstance restarts ECS instance

func (*Client) SecurityGroupExist added in v0.3.2

func (c *Client) SecurityGroupExist(id string) bool

SecurityGroupExist check if security group still exist

func (*Client) StartInstance

func (c *Client) StartInstance(instanceID string) error

StartInstance starts existing ECS instance

func (*Client) StopInstance

func (c *Client) StopInstance(instanceID string) error

StopInstance stops existing ECS instance

func (*Client) Token added in v0.3.0

func (c *Client) Token() (string, error)

Token - get token

func (*Client) UnbindFloatingIP

func (c *Client) UnbindFloatingIP(floatingIP, instanceID string) error

UnbindFloatingIP unbinds floating IP to instance

func (*Client) UpdateCluster added in v0.3.0

func (c *Client) UpdateCluster(clusterID string, opts *clusters.UpdateSpec) error

UpdateCluster updates cluster description

func (*Client) WaitForEIPActive added in v0.2.2

func (c *Client) WaitForEIPActive(eipID string) error

WaitForEIPActive wait for ip to be active

func (*Client) WaitForGroupDeleted added in v0.2.1

func (c *Client) WaitForGroupDeleted(securityGroupID string) error

WaitForGroupDeleted polls sec group until it returns 404

func (*Client) WaitForInstanceStatus

func (c *Client) WaitForInstanceStatus(instanceID string, status string) error

WaitForInstanceStatus waits for instance to be in given status

func (*Client) WaitForSubnetStatus

func (c *Client) WaitForSubnetStatus(subnetID string, status string) error

WaitForSubnetStatus waits for subnet to be in given status

func (*Client) WaitForVPCStatus

func (c *Client) WaitForVPCStatus(vpcID, status string) error

WaitForVPCStatus waits until VPC is in given status

type CreateClusterOpts added in v0.3.0

type CreateClusterOpts struct {
	Metadata
	Name               string
	Description        string
	ClusterType        string                        // required, VirtualMachine or BareMetal
	ClusterVersion     string                        // optional, uses latest available version by default
	FlavorID           string                        // required, one of CCE flavour
	VpcID              string                        // required
	SubnetID           string                        // required
	HighwaySubnetID    string                        // optional, used for BMS
	ContainerNetwork   clusters.ContainerNetworkSpec // required, `Mode` should be one of ContainerNetworkMode const
	AuthenticationMode string                        // required, recommended: rbac
	BillingMode        int
	MultiAZ            bool
	FloatingIP         string
	ExtendParam        map[string]string
}

CreateClusterOpts cluster structure

type CreateNodesOpts added in v0.3.0

type CreateNodesOpts struct {
	Metadata
	Name             string
	ClusterID        string             // required
	Region           string             // required, project name actually
	FlavorID         string             // required
	AvailabilityZone string             // required
	KeyPair          string             // required
	RootVolume       nodes.VolumeSpec   // required, 40G+
	DataVolumes      []nodes.VolumeSpec // at least one is required required, 100G+
	Os               string             // by default EulerOS 2.5
	MaxPods          int
	PreInstall       string
	PostInstall      string
	EipCount         int
	EipOpts          ElasticIPOpts
	BillingMode      int
	PublicKey        string
	ChargingMode     int
	PerformanceType  string
	OrderID          string
	ProductID        string
}

CreateNodesOpts node structure

type DiskOpts added in v0.2.2

type DiskOpts struct {
	SourceID string
	Size     int
	Type     string
}

DiskOpts contains source, size and type of disk

type ElasticIPOpts added in v0.2.2

type ElasticIPOpts struct {
	IPType        string
	BandwidthSize int
	BandwidthType string
}

ElasticIPOpts structure

type ExtendedServerOpts added in v0.2.3

type ExtendedServerOpts struct {
	*servers.CreateOpts
	SubnetID      string
	FixedIP       string
	KeyPairName   string
	DiskOpts      *DiskOpts
	ServerGroupID string
}

ExtendedServerOpts server opts struct

type Metadata added in v0.3.0

type Metadata struct {
	Labels      map[string]string
	Annotations map[string]string
}

Metadata cluster metadata

type PortRange added in v0.2.1

type PortRange struct {
	From int
	To   int
}

PortRange is simple sec rule port range container

Jump to

Keyboard shortcuts

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