client

package
v1.4.0-policy Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogFieldAPI              = "api"
	LogFieldRequestID        = "requestID"
	LogFieldInstanceID       = "instanceID"
	LogFieldSecondaryIPCount = "secondaryIPCount"
	LogFieldENIID            = "eni"
	LogFieldEIPID            = "eip"
	LogFieldPrivateIP        = "privateIP"
	LogFieldVSwitchID        = "vSwitchID"
)

log fields

Variables

This section is empty.

Functions

This section is empty.

Types

type EIP

type EIP interface {
	AllocateEIPAddress(bandwidth, chargeType, isp string) (*vpc.AllocateEipAddressResponse, error)
	AssociateEIPAddress(eipID, eniID, privateIP string) error
	UnAssociateEIPAddress(eipID, eniID, eniIP string) error
	ReleaseEIPAddress(eipID string) error
	AddCommonBandwidthPackageIP(eipID, packageID string) error
}

type ENIStatus

type ENIStatus string

ENIStatus status for eni

const (
	ENIStatusInUse     ENIStatus = "InUse"
	ENIStatusAvailable ENIStatus = "Available"
)

status for ENIStatus

type ENIType

type ENIType string

ENIType eni type

const (
	ENITypePrimary   ENIType = "Primary"
	ENITypeSecondary ENIType = "Secondary"
	ENITypeTrunk     ENIType = "Trunk"
	ENITypeMember    ENIType = "Member"
)

status for ENIType

type OpenAPI

type OpenAPI struct {
	ClientSet credential.Client

	ReadOnlyRateLimiter flowcontrol.RateLimiter
	MutatingRateLimiter flowcontrol.RateLimiter
}

func New

func New(c credential.Client, readOnly, mutating flowcontrol.RateLimiter) (*OpenAPI, error)

func NewAliyun

func NewAliyun(ak, sk, regionID, credentialPath, secretNamespace, secretName string) (*OpenAPI, error)

func (*OpenAPI) AddCommonBandwidthPackageIP added in v1.2.3

func (a *OpenAPI) AddCommonBandwidthPackageIP(eipID, packageID string) error

AddCommonBandwidthPackageIP add EIP to bandwidth package

func (*OpenAPI) AllocateEIPAddress

func (a *OpenAPI) AllocateEIPAddress(bandwidth, chargeType, isp string) (*vpc.AllocateEipAddressResponse, error)

AllocateEIPAddress create EIP

func (*OpenAPI) AssignIpv6Addresses

func (a *OpenAPI) AssignIpv6Addresses(ctx context.Context, eniID string, count int) ([]net.IP, error)

AssignIpv6Addresses assign ipv6 address

func (*OpenAPI) AssignPrivateIPAddress

func (a *OpenAPI) AssignPrivateIPAddress(ctx context.Context, eniID string, count int) ([]net.IP, error)

AssignPrivateIPAddress assign secondary ip

func (*OpenAPI) AssociateEIPAddress

func (a *OpenAPI) AssociateEIPAddress(eipID, eniID, privateIP string) error

AssociateEIPAddress bind eip to ip

func (*OpenAPI) AttachNetworkInterface

func (a *OpenAPI) AttachNetworkInterface(ctx context.Context, eniID, instanceID, trunkENIID string) error

AttachNetworkInterface attach eni

func (*OpenAPI) CreateNetworkInterface

func (a *OpenAPI) CreateNetworkInterface(ctx context.Context, instanceType ENIType, vSwitch string, securityGroups []string, ipCount, ipv6Count int, eniTags map[string]string) (*ecs.CreateNetworkInterfaceResponse, error)

CreateNetworkInterface instanceType Secondary Trunk

func (*OpenAPI) DeleteNetworkInterface

func (a *OpenAPI) DeleteNetworkInterface(ctx context.Context, eniID string) error

DeleteNetworkInterface del eni by id

func (*OpenAPI) DescribeInstanceTypes added in v1.3.0

func (a *OpenAPI) DescribeInstanceTypes(ctx context.Context, types []string) ([]ecs.InstanceType, error)

func (*OpenAPI) DescribeNetworkInterface

func (a *OpenAPI) DescribeNetworkInterface(ctx context.Context, vpcID string, eniID []string, instanceID string, instanceType ENIType, status ENIStatus, tags map[string]string) ([]ecs.NetworkInterfaceSet, error)

DescribeNetworkInterface list eni

func (*OpenAPI) DescribeVSwitchByID

func (a *OpenAPI) DescribeVSwitchByID(ctx context.Context, vSwitchID string) (*vpc.VSwitch, error)

DescribeVSwitchByID get vsw by id

func (*OpenAPI) DetachNetworkInterface

func (a *OpenAPI) DetachNetworkInterface(ctx context.Context, eniID, instanceID, trunkENIID string) error

DetachNetworkInterface detach eni

func (*OpenAPI) ReleaseEIPAddress

func (a *OpenAPI) ReleaseEIPAddress(eipID string) error

ReleaseEIPAddress delete EIP

func (*OpenAPI) RemoveCommonBandwidthPackageIP added in v1.2.3

func (a *OpenAPI) RemoveCommonBandwidthPackageIP(eipID, packageID string) error

RemoveCommonBandwidthPackageIP remove EIP from bandwidth package

func (*OpenAPI) UnAssignIpv6Addresses

func (a *OpenAPI) UnAssignIpv6Addresses(ctx context.Context, eniID string, ips []net.IP) error

UnAssignIpv6Addresses remove ip from eni return ok if 1. eni is released 2. ip is already released 3. release success

func (*OpenAPI) UnAssignPrivateIPAddresses

func (a *OpenAPI) UnAssignPrivateIPAddresses(ctx context.Context, eniID string, ips []net.IP) error

UnAssignPrivateIPAddresses remove ip from eni return ok if 1. eni is released 2. ip is already released 3. release success

func (*OpenAPI) UnAssociateEIPAddress

func (a *OpenAPI) UnAssociateEIPAddress(eipID, eniID, eniIP string) error

UnAssociateEIPAddress un-bind eip

func (*OpenAPI) WaitForNetworkInterface

func (a *OpenAPI) WaitForNetworkInterface(ctx context.Context, eniID string, status ENIStatus, backoff wait.Backoff, ignoreNotExist bool) (*ecs.NetworkInterfaceSet, error)

WaitForNetworkInterface wait status of eni

type VSwitch

type VSwitch interface {
	DescribeVSwitchByID(ctx context.Context, vSwitchID string) (*vpc.VSwitch, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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