utils

package
v0.0.0-...-693654f Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(s []string, el string) bool

Types

type Client

type Client struct {
	*sdkgo.APIClient
	// contains filtered or unexported fields
}

func (*Client) CreateAttachNIC

func (c *Client) CreateAttachNIC(datacenterId, serverId, name string, dhcp bool, lanId int32, ips *[]string) (*sdkgo.Nic, error)

func (*Client) CreateAttachVolume

func (c *Client) CreateAttachVolume(datacenterId, serverId string, volProperties *ClientVolumeProperties) (*sdkgo.Volume, error)

func (*Client) CreateDatacenter

func (c *Client) CreateDatacenter(name, location string) (*sdkgo.Datacenter, error)

func (*Client) CreateIpBlock

func (c *Client) CreateIpBlock(size int32, location string) (*sdkgo.IpBlock, error)

func (*Client) CreateLan

func (c *Client) CreateLan(datacenterId, name string, public bool) (*sdkgo.LanPost, error)

func (*Client) CreateNat

func (c *Client) CreateNat(datacenterId, name string, publicIps, flowlogs, natRules []string, lansToGateways map[string][]string, sourceSubnet string, skipDefaultRules bool) (*sdkgo.NatGateway, error)

func (*Client) CreateServer

func (c *Client) CreateServer(datacenterId string, server sdkgo.Server) (*sdkgo.Server, error)

func (*Client) GetDatacenter

func (c *Client) GetDatacenter(datacenterId string) (*sdkgo.Datacenter, error)

func (*Client) GetDatacenters

func (c *Client) GetDatacenters() (*sdkgo.Datacenters, error)

func (*Client) GetImageById

func (c *Client) GetImageById(imageId string) (*sdkgo.Image, error)

func (*Client) GetImages

func (c *Client) GetImages() (*sdkgo.Images, error)

func (*Client) GetIpBlockIps

func (c *Client) GetIpBlockIps(ipBlock *sdkgo.IpBlock) (*[]string, error)

func (*Client) GetLan

func (c *Client) GetLan(datacenterId, LanId string) (*sdkgo.Lan, error)

func (*Client) GetLans

func (c *Client) GetLans(datacenterId string) (*sdkgo.Lans, error)

func (*Client) GetLocationById

func (c *Client) GetLocationById(regionId, locationId string) (*sdkgo.Location, error)

func (*Client) GetNat

func (c *Client) GetNat(datacenterId, natId string) (*sdkgo.NatGateway, error)

func (*Client) GetNats

func (c *Client) GetNats(datacenterId string) (*sdkgo.NatGateways, error)

func (*Client) GetNic

func (c *Client) GetNic(datacenterId, ServerId, NicId string) (*sdkgo.Nic, error)

func (*Client) GetServer

func (c *Client) GetServer(datacenterId, serverId string, depth int32) (*sdkgo.Server, error)

func (*Client) GetTemplates

func (c *Client) GetTemplates() (*sdkgo.Templates, error)

func (*Client) PatchNat

func (c *Client) PatchNat(datacenterId, natId, name string, publicIps []string, lansToGateways []sdkgo.NatGatewayLanProperties) (*sdkgo.NatGateway, error)

func (*Client) RemoveDatacenter

func (c *Client) RemoveDatacenter(datacenterId string) error

func (*Client) RemoveIpBlock

func (c *Client) RemoveIpBlock(ipBlockId string) error

func (*Client) RemoveLan

func (c *Client) RemoveLan(datacenterId, lanId string) error

func (*Client) RemoveNat

func (c *Client) RemoveNat(datacenterId, natId string) error

func (*Client) RemoveNic

func (c *Client) RemoveNic(datacenterId, serverId, nicId string) error

func (*Client) RemoveServer

func (c *Client) RemoveServer(datacenterId, serverId string) error

func (*Client) RemoveVolume

func (c *Client) RemoveVolume(datacenterId, volumeId string) error

func (*Client) RestartServer

func (c *Client) RestartServer(datacenterId, serverId string) error

func (*Client) ResumeServer

func (c *Client) ResumeServer(datacenterId, serverId string) error

func (*Client) StartServer

func (c *Client) StartServer(datacenterId, serverId string) error

func (*Client) StopServer

func (c *Client) StopServer(datacenterId, serverId string) error

func (*Client) SuspendServer

func (c *Client) SuspendServer(datacenterId, serverId string) error

func (*Client) UpdateCloudInitFile

func (c *Client) UpdateCloudInitFile(
	cloudInitYAML string, key string, values []interface{}, single_value bool, behaviour string,
) (string, error)

func (*Client) WaitForNicIpChange

func (c *Client) WaitForNicIpChange(datacenterId, serverId, nicId string, timeout int) error

type ClientService

type ClientService interface {
	UpdateCloudInitFile(cloudInitYAML string, key string, value []interface{}, single_value bool, behaviour string) (string, error)
	CreateIpBlock(size int32, location string) (*ionoscloud.IpBlock, error)
	GetIpBlockIps(ipBlock *ionoscloud.IpBlock) (*[]string, error)
	RemoveIpBlock(ipBlockId string) error
	CreateDatacenter(name, location string) (*ionoscloud.Datacenter, error)
	GetDatacenter(datacenterId string) (*ionoscloud.Datacenter, error)
	GetDatacenters() (*ionoscloud.Datacenters, error)
	RemoveDatacenter(datacenterId string) error
	CreateLan(datacenterId, name string, public bool) (*ionoscloud.LanPost, error)
	RemoveLan(datacenterId, lanId string) error

	CreateNat(datacenterId, name string, publicIps, flowlogs, natRules []string, lansToGateways map[string][]string, sourceSubnet string, skipDefaultRules bool) (*ionoscloud.NatGateway, error)
	PatchNat(datacenterId, natId, name string, publicIps []string, lansToGateways []ionoscloud.NatGatewayLanProperties) (*ionoscloud.NatGateway, error)
	GetNat(datacenterId string, natId string) (*ionoscloud.NatGateway, error)
	GetNats(datacenterId string) (*ionoscloud.NatGateways, error)
	RemoveNat(datacenterId, natId string) error

	CreateServer(datacenterId string, server ionoscloud.Server) (*ionoscloud.Server, error)
	GetServer(datacenterId, serverId string, depth int32) (*ionoscloud.Server, error)
	GetLan(datacenterId, LanId string) (*ionoscloud.Lan, error)
	GetLans(datacenterId string) (*ionoscloud.Lans, error)
	GetNic(datacenterId, ServerId, NicId string) (*ionoscloud.Nic, error)
	GetTemplates() (*ionoscloud.Templates, error)
	StartServer(datacenterId, serverId string) error
	ResumeServer(datacenterId, serverId string) error
	StopServer(datacenterId, serverId string) error
	SuspendServer(datacenterId, serverId string) error
	RestartServer(datacenterId, serverId string) error
	RemoveServer(datacenterId, serverId string) error
	RemoveVolume(datacenterId, volumeId string) error
	RemoveNic(datacenterId, serverId, nicId string) error
	GetLocationById(regionId, locationId string) (*ionoscloud.Location, error)
	GetImages() (*ionoscloud.Images, error)
	GetImageById(imageId string) (*ionoscloud.Image, error)
	WaitForNicIpChange(datacenterId, ServerId, NicId string, timeout int) error
}

func New

func New(ctx context.Context, name, password, token, url, httpUserAgent string) ClientService

type ClientVolumeProperties

type ClientVolumeProperties struct {
	DiskType      string
	Name          string
	ImageId       string
	ImageAlias    string
	ImagePassword string
	Zone          string
	SshKey        string
	UserData      string
	DiskSize      float32
}

type NatRuleMaker

type NatRuleMaker struct {
	// contains filtered or unexported fields
}

NatRuleMaker 's objective is to easily create many NatGatewayRules with similar properties but different open ports

func NewNRM

func NewNRM(publicIp, srcSubnet, targetSubnet *string) NatRuleMaker

func (*NatRuleMaker) Make

func (nrm *NatRuleMaker) Make() *[]sdkgo.NatGatewayRule

func (*NatRuleMaker) OpenPort

func (nrm *NatRuleMaker) OpenPort(protocol string, port int32) *NatRuleMaker

func (*NatRuleMaker) OpenPorts

func (nrm *NatRuleMaker) OpenPorts(protocol string, start int32, end int32) *NatRuleMaker

Directories

Path Synopsis
Package mock_utils is a generated GoMock package.
Package mock_utils is a generated GoMock package.

Jump to

Keyboard shortcuts

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