client

package
v1.8.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	LogFieldAPI              = "api"
	LogFieldRequestID        = "requestID"
	LogFieldInstanceID       = "instanceID"
	LogFieldSecondaryIPCount = "secondaryIPCount"
	LogFieldENIID            = "eni"
	LogFieldIPs              = "ips"
	LogFieldEIPID            = "eip"
	LogFieldPrivateIP        = "privateIP"
	LogFieldVSwitchID        = "vSwitchID"
	LogFieldSgID             = "securityGroupID"
	LogFieldResourceGroupID  = "resourceGroupID"
)

log fields

View Source
const (
	ENIStatusInUse     string = "InUse"
	ENIStatusAvailable string = "Available"
)

status for eni

View Source
const (
	ENITypePrimary   string = "Primary"
	ENITypeSecondary string = "Secondary"
	ENITypeTrunk     string = "Trunk"
	ENITypeMember    string = "Member"
)
View Source
const EIPInstanceTypeNetworkInterface = "NetworkInterface"
View Source
const (
	ENITrafficModeRDMA string = "HighPerformance"
)

Variables

This section is empty.

Functions

func SetGetLimit added in v1.8.0

func SetGetLimit(fn GetLimitFunc)

Types

type EFLO added in v1.8.0

type EFLO interface {
	GetNodeInfoForPod(ctx context.Context, nodeID string) (*eflo.Content, error)
}

type GetLimitFunc added in v1.8.0

type GetLimitFunc func(a interface{}, instanceType string) (*Limits, error)
var GetLimit GetLimitFunc

type Limits added in v1.8.0

type Limits struct {
	// Adapters specifies the maximum number of interfaces that can be
	// attached to the instance
	Adapters int

	// TotalAdapters maximum number of interfaces that can be
	// attached to the instance
	TotalAdapters int

	// IPv4PerAdapter is the maximum number of ipv4 addresses per adapter/interface
	IPv4PerAdapter int

	// IPv6PerAdapter is the maximum number of ipv6 addresses per adapter/interface
	IPv6PerAdapter int

	// MemberAdapterLimit is the number interfaces that type is member
	MemberAdapterLimit int

	// MaxMemberAdapterLimit is the limit to use member
	MaxMemberAdapterLimit int

	// ERdmaAdapters specifies the maximum number of erdma interfaces
	ERdmaAdapters int

	InstanceBandwidthRx int

	InstanceBandwidthTx int
}

Limits specifies the IPAM relevant instance limits

func DefaultGetLimit added in v1.8.0

func DefaultGetLimit(client interface{}, instanceType string) (*Limits, error)

DefaultGetLimit returns the instance limits of a particular instance type. // https://www.alibabacloud.com/help/doc-detail/25620.htm if instanceType is empty will list all instanceType and warm the cache, no error and Limits will return

func EfloGetLimit added in v1.8.0

func EfloGetLimit(client interface{}, instanceType string) (*Limits, error)

func (*Limits) ERDMARes added in v1.8.0

func (l *Limits) ERDMARes() int

func (*Limits) ExclusiveENIPod added in v1.8.0

func (l *Limits) ExclusiveENIPod() int

func (*Limits) MaximumTrunkPod added in v1.8.0

func (l *Limits) MaximumTrunkPod() int

func (*Limits) MultiIPPod added in v1.8.0

func (l *Limits) MultiIPPod() int

func (*Limits) SupportIPv6 added in v1.8.0

func (l *Limits) SupportIPv6() bool

func (*Limits) SupportMultiIPIPv6 added in v1.8.0

func (l *Limits) SupportMultiIPIPv6() bool

func (*Limits) TrunkPod added in v1.8.0

func (l *Limits) TrunkPod() int

type NetworkInterface added in v1.4.1

type NetworkInterface struct {
	Status             string             `json:"status,omitempty"`
	MacAddress         string             `json:"mac_address,omitempty"`
	NetworkInterfaceID string             `json:"network_interface_id,omitempty"`
	VSwitchID          string             `json:"v_switch_id,omitempty"`
	PrivateIPAddress   string             `json:"private_ip_address,omitempty"`
	PrivateIPSets      []ecs.PrivateIpSet `json:"private_ip_sets"`
	ZoneID             string             `json:"zone_id,omitempty"`
	SecurityGroupIDs   []string           `json:"security_group_ids,omitempty"`
	ResourceGroupID    string             `json:"resource_group_id,omitempty"`
	IPv6Set            []ecs.Ipv6Set      `json:"ipv6_set,omitempty"`
	Tags               []ecs.Tag          `json:"tags,omitempty"`

	// fields for DescribeNetworkInterface
	Type                        string `json:"type,omitempty"`
	InstanceID                  string `json:"instance_id,omitempty"`
	TrunkNetworkInterfaceID     string `json:"trunk_network_interface_id,omitempty"`
	NetworkInterfaceTrafficMode string `json:"network_interface_traffic_mode"`
	DeviceIndex                 int    `json:"device_index,omitempty"`
	CreationTime                string `json:"creation_time,omitempty"`
}

NetworkInterface openAPI result for ecs.CreateNetworkInterfaceResponse and ecs.NetworkInterfaceSet

func FromCreateResp added in v1.4.1

func FromDescribeResp added in v1.4.1

func FromDescribeResp(in *ecs.NetworkInterfaceSet) *NetworkInterface

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 (*OpenAPI) AssignIpv6Addresses

func (a *OpenAPI) AssignIpv6Addresses(ctx context.Context, eniID string, count int, idempotentKey string) ([]netip.Addr, error)

AssignIpv6Addresses assign ipv6 address

func (*OpenAPI) AssignLeniPrivateIPAddress added in v1.8.0

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

func (*OpenAPI) AssignPrivateIPAddress

func (a *OpenAPI) AssignPrivateIPAddress(ctx context.Context, eniID string, count int, idempotentKey string) ([]netip.Addr, error)

AssignPrivateIPAddress assign secondary ip

func (*OpenAPI) AttachNetworkInterface

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

AttachNetworkInterface attach eni

func (*OpenAPI) CreateElasticNetworkInterface added in v1.8.0

func (a *OpenAPI) CreateElasticNetworkInterface(zoneID, nodeID, vSwitchID, securityGroupID string) (string, string, error)

func (*OpenAPI) CreateNetworkInterface

func (a *OpenAPI) CreateNetworkInterface(ctx context.Context, trunk, erdma bool, vSwitch string, securityGroups []string, resourceGroupID string, ipCount, ipv6Count int, eniTags map[string]string) (*NetworkInterface, error)

CreateNetworkInterface instanceType Secondary Trunk

func (*OpenAPI) DeleteElasticNetworkInterface added in v1.8.0

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

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 string, status string, tags map[string]string) ([]*NetworkInterface, error)

DescribeNetworkInterface list eni

func (*OpenAPI) DetachNetworkInterface

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

DetachNetworkInterface detach eni

func (*OpenAPI) GetElasticNetworkInterface added in v1.8.0

func (a *OpenAPI) GetElasticNetworkInterface(eniID string) (*eflo.Content, error)

func (*OpenAPI) GetNodeInfoForPod added in v1.8.0

func (a *OpenAPI) GetNodeInfoForPod(ctx context.Context, nodeID string) (*eflo.Content, error)

func (*OpenAPI) ListElasticNetworkInterfaces added in v1.8.0

func (a *OpenAPI) ListElasticNetworkInterfaces(ctx context.Context, zoneID, nodeID, eniID string) (*eflo.Content, error)

func (*OpenAPI) ListLeniPrivateIPAddresses added in v1.8.0

func (a *OpenAPI) ListLeniPrivateIPAddresses(ctx context.Context, eniID, ipName, ipAddress string) (*eflo.Content, error)

func (*OpenAPI) ModifyNetworkInterfaceAttribute added in v1.4.1

func (a *OpenAPI) ModifyNetworkInterfaceAttribute(ctx context.Context, eniID string, securityGroupIDs []string) error

func (*OpenAPI) UnAssignIpv6Addresses

func (a *OpenAPI) UnAssignIpv6Addresses(ctx context.Context, eniID string, ips []netip.Addr) 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 []netip.Addr) error

UnAssignPrivateIPAddresses remove ip from eni return ok if 1. eni is released 2. ip is already released 3. release success for primaryIP err is InvalidIp.IpUnassigned

func (*OpenAPI) UnassignLeniPrivateIPAddress added in v1.8.0

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

func (*OpenAPI) WaitForNetworkInterface

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

WaitForNetworkInterface wait status of eni

type VPC added in v1.8.0

type VPC 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