api

package
v0.0.0-...-774bb41 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

+k8s:deepcopy-gen=package,register +deepequal-gen=package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetNodeIDName

func GetNodeIDName(id string) string

func IDToNamespaceName

func IDToNamespaceName(id string) (string, string)

IDToNamespaceName Restore ID to namespace and name

func ISPodID

func ISPodID(id string) bool

func NodePoolID

func NodePoolID(name, uuid string) string

NodePoolID This ID represents the IP used by the node pool

func PodID

func PodID(owner string) string

PodID owner format with namespace/name

Types

type AcquireIPByPurposeRequest

type AcquireIPByPurposeRequest struct {
	ID               string `json:"id,omitempty" binding:"required"`
	Region           string `json:"Region,omitempty" binding:"required"`
	Purpose          string `json:"purpose,omitempty" binding:"required"`
	VPC              string `json:"vpc,omitempty"`
	Gateway          string `json:"gateway,omitempty"`
	ISP              string `json:"isp,omitempty"`
	IPVersion        int    `json:"ipVersion,omitempty"`
	SpecificIP       string `json:"specificIP,omitempty" `
	SpecificIPSuffix string `json:"specificIPSuffix,omitempty" `
}

申请IP +k8s:deepcopy-gen=false +deepequal-gen=false

type AcquireIPBySubnetRequest

type AcquireIPBySubnetRequest struct {
	ID               string `json:"id,omitempty" binding:"required"`
	Region           string `json:"Region,omitempty" binding:"required"`
	SpecificIP       string `json:"specificIP,omitempty" `
	SpecificIPSuffix string `json:"specificIPSuffix,omitempty"`
	Subnet           string `json:"subnet,omitempty" binding:"required"`
}

+k8s:deepcopy-gen=false +deepequal-gen=false

func (*AcquireIPBySubnetRequest) SetRegion

func (req *AcquireIPBySubnetRequest) SetRegion(region string)

type AllocatedIP

type AllocatedIP struct {
	ID        string `json:"id,omitempty"`
	IP        string `json:"ip,omitempty"`
	Mask      string `json:"mask,omitempty"`
	CIDR      string `json:"cidr,omitempty"`
	GW        string `json:"gw,omitempty"`
	NatGW     string `json:"natGW,omitempty"`
	Subnet    string `json:"subnet,omitempty"`
	Region    string `json:"Region,omitempty"`
	VPC       string `json:"vpc,omitempty"`
	ISP       string `json:"isp,omitempty"`
	IPVersion int    `json:"ipVersion,omitempty"`
	Purpose   string `json:"purpose,omitempty"`
	VlanID    int    `json:"vlanID,omitempty"`
}

+k8s:deepcopy-gen=false +deepequal-gen=false

type AllocatedIPResponse

type AllocatedIPResponse struct {
	ErrorResponse `json:",inline"`
	AllocatedIP   AllocatedIP `json:"allocatedIP,omitempty"`
}

+k8s:deepcopy-gen=false +deepequal-gen=false

type BatchAcquireIPByPurposeRequest

type BatchAcquireIPByPurposeRequest struct {
	ID        string `json:"id,omitempty" binding:"required"`
	Region    string `json:"Region,omitempty" binding:"required"`
	Count     int    `json:"count,omitempty" binding:"required"`
	Purpose   string `json:"purpose,omitempty" binding:"required"`
	VPC       string `json:"vpc,omitempty"`
	Gateway   string `json:"gateway,omitempty"`
	ISP       string `json:"isp,omitempty"`
	IPVersion int    `json:"ipVersion,omitempty"`
}

+k8s:deepcopy-gen=false +deepequal-gen=false

type BatchAcquireIPBySubnetRequest

type BatchAcquireIPBySubnetRequest struct {
	ID     string `json:"id,omitempty" binding:"required"`
	Region string `json:"Region,omitempty" binding:"required"`
	Count  int    `json:"count,omitempty" binding:"required"`
	Subnet string `json:"subnet,omitempty" binding:"required"`
}

批量申请IP +k8s:deepcopy-gen=false +deepequal-gen=false

func (*BatchAcquireIPBySubnetRequest) SetRegion

func (req *BatchAcquireIPBySubnetRequest) SetRegion(region string)

type BatchReleaseIPRequest

type BatchReleaseIPRequest struct {
	VPC    string   `json:"vpc,omitempty" binding:"required"`
	Region string   `json:"Region,omitempty" binding:"required"`
	IPs    []string `json:"ips,omitempty"`
}

批量释放IP +k8s:deepcopy-gen=false +deepequal-gen=false

func (*BatchReleaseIPRequest) SetRegion

func (req *BatchReleaseIPRequest) SetRegion(region string)

type Client

type Client interface {
	IPAllocateClient
	SubnetClient
}

+k8s:deepcopy-gen=false +deepequal-gen=false

func NewClient

func NewClient(host, region, userAgent string) (Client, error)

type ErrorResponse

type ErrorResponse struct {
	StatusCode               int
	Code, Message, RequestID string
}

+k8s:deepcopy-gen=false +deepequal-gen=false

func (*ErrorResponse) IsSuccess

func (receiver *ErrorResponse) IsSuccess() bool

func (*ErrorResponse) SetCode

func (receiver *ErrorResponse) SetCode(code int)

type IPAllocateClient

type IPAllocateClient interface {
	// AcquireIPBySubnet 指定网段申请IP
	//Request
	//* Method: POST
	//* URL: /ipam/v1/acquire_ip_by_subnet
	//* Headers: Content-Type:application/json
	//* Body: AcquireIPBySubnetRequest
	AcquireIPBySubnet(ctx context.Context, req AcquireIPBySubnetRequest) (*AllocatedIPResponse, error)
	// BatchAcquireIPBySubnet 指定网段批量申请IP
	//目前未实现将ID视为token做幂等处理,在请求失败时,可能会造成IP已分配但无人使用的问题。
	//Request
	//* Method: POST
	//* URL: /ipam/v1/batch_acquire_ip_by_subnet
	//* Headers: Content-Type:application/json
	//* Body: BatchAcquireIPBySubnetRequest
	BatchAcquireIPBySubnet(ctx context.Context, req BatchAcquireIPBySubnetRequest) (*ListAllocatedIPResponse, error)

	// BatchReleaseIP 批量释放IP
	//Request
	//* Method: POST
	//* URL: /ipam/v1/batch_release_ip
	//* Headers: Content-Type:application/json
	//* Body: BatchReleaseIPRequest
	BatchReleaseIP(ctx context.Context, req BatchReleaseIPRequest) error

	// AllocatedIPs 查询已分配IP
	//Request
	//* Method: PUT
	//* URL: /ipam/v1/allocated_ips/:Region
	//* Headers: Content-Type:application/json
	//* Params:
	//  * ListAllocatedIPRequest (详见数据结构)
	AllocatedIPs(ctx context.Context) (*ListAllocatedIPResponse, error)
}

IPAllocateClient Client to private cloud base https://ku.baidu-int.com/knowledge/HFVrC7hq1Q/bPDEaFBbnd/04hxQCVwYK/ntxk1F6-P7lVRi#anchor-4b444560-5383-11ed-9d27-81f612d08f43 group.POST("/acquire_ip_by_subnet", h.AcquireIPBySubnet) group.POST("/acquire_ip_by_purpose", h.AcquireIPByPurpose) group.POST("/release_ip", h.ReleaseIP) group.POST("/batch_acquire_ip_by_subnet", h.BatchAcquireIPBySubnet) group.POST("/batch_acquire_ip_by_purpose", h.BatchAcquireIPByPurpose) group.POST("/batch_release_ip", h.BatchReleaseIP) group.GET("/allocated_ips/:Region/:id", h.GetAllocatedIP) group.GET("/allocated_ips/:Region", h.ListAllocatedIP) +k8s:deepcopy-gen=false +deepequal-gen=false

type ListAllocatedIPRequest

type ListAllocatedIPRequest struct {
	Region    string `json:"Region,omitempty"`
	Subnet    string `json:"subnet,omitempty"`
	VPC       string `json:"vpc,omitempty"`
	ISP       string `json:"isp,omitempty"`
	IPVersion int    `json:"ipVersion,omitempty"`
	CIDR      string `json:"cidr,omitempty"`
	Purpose   string `json:"purpose,omitempty"`
}

查询已申请IP +k8s:deepcopy-gen=false +deepequal-gen=false

func (*ListAllocatedIPRequest) SetRegion

func (req *ListAllocatedIPRequest) SetRegion(region string)

type ListAllocatedIPResponse

type ListAllocatedIPResponse struct {
	ErrorResponse `json:",inline"`
	AllocatedIPs  []AllocatedIP `json:"allocatedIPs,omitempty"`
}

+k8s:deepcopy-gen=false +deepequal-gen=false

type ListSubnetRequest

type ListSubnetRequest struct {
	Region     string `json:"Region,omitempty"`
	VPC        string `json:"vpc,omitempty"`
	Purpose    string `json:"purpose,omitempty"`
	Gateway    string `json:"gateway,omitempty"`
	ISP        string `json:"isp,omitempty"`
	IPVersion  int    `json:"ipVersion,omitempty"`
	MustEnable bool   `json:"mustEnable,omitempty"`
	WithShared bool   `json:"withShared,omitempty"`
}

+k8s:deepcopy-gen=false +deepequal-gen=false

func (*ListSubnetRequest) SetRegion

func (req *ListSubnetRequest) SetRegion(region string)

type ListSubnetResponse

type ListSubnetResponse struct {
	ErrorResponse `json:",inline"`
	Subnets       []*Subnet `json:"subnets,omitempty"`
}

+k8s:deepcopy-gen=false +deepequal-gen=false

type PrivateCloudBaseClient

type PrivateCloudBaseClient struct {
	Region string
	// contains filtered or unexported fields
}

+k8s:deepcopy-gen=false +deepequal-gen=false

func (*PrivateCloudBaseClient) AcquireIPBySubnet

func (*PrivateCloudBaseClient) AllocatedIPs

func (*PrivateCloudBaseClient) BatchAcquireIPBySubnet

func (*PrivateCloudBaseClient) BatchReleaseIP

func (*PrivateCloudBaseClient) CreateSubnet

func (p *PrivateCloudBaseClient) CreateSubnet(ctx context.Context, subnet Subnet) (*SubnetResponse, error)

func (*PrivateCloudBaseClient) ListSubnets

type ResponseInterface

type ResponseInterface interface {
	IsSuccess() bool
	SetCode(code int)
}

+k8s:deepcopy-gen=false +deepequal-gen=false

type SetRegion

type SetRegion interface {
	SetRegion(region string)
}

+k8s:deepcopy-gen=false +deepequal-gen=false

type Subnet

type Subnet struct {
	Name       string `json:"name,omitempty"  binding:"required"`
	Region     string `json:"Region,omitempty"  binding:"required"`
	VPC        string `json:"vpc,omitempty"  binding:"required"`
	Purpose    string `json:"purpose,omitempty"  binding:"required"`
	ISP        string `json:"isp,omitempty"`
	IPVersion  int    `json:"ipVersion,omitemptyn"  binding:"required"`
	RangeStart string `json:"rangeStart,omitempty"`
	RangeEnd   string `json:"rangeEnd,omitempty"`
	Excludes   string `json:"excludes,omitempty"`
	CIDR       string `json:"cidr,omitempty"  binding:"required"`
	Gateway    string `json:"gateway,omitempty"`
	NatGW      string `json:"natGW,omitempty"`
	VlanID     int    `json:"vlanID,omitempty"`
	Priority   int    `json:"priority,omitempty"`
	Enable     bool   `json:"enable,omitempty"`
}

网段管理 +k8s:deepcopy-gen=true +deepequal-gen=true

func (*Subnet) DeepCopy

func (in *Subnet) DeepCopy() *Subnet

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Subnet.

func (*Subnet) DeepCopyInto

func (in *Subnet) DeepCopyInto(out *Subnet)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Subnet) DeepEqual

func (in *Subnet) DeepEqual(other *Subnet) bool

DeepEqual is an autogenerated deepequal function, deeply comparing the receiver with other. in must be non-nil.

type SubnetClient

type SubnetClient interface {
	// CreateSubnet 创建网段
	//Request
	//* Method: POST
	//* URL: /ipam/v1/subnets
	//* Headers: Content-Type:application/json
	// GetIPPool GET /v1/ippool/{{poolname}}
	CreateSubnet(ctx context.Context, subnet Subnet) (*SubnetResponse, error)

	// group.GET("/subnets/:Region", h.ListSubnet)
	ListSubnets(ctx context.Context) (*ListSubnetResponse, error)
}

SubnetClient to private cloud base https://ku.baidu-int.com/knowledge/HFVrC7hq1Q/bPDEaFBbnd/04hxQCVwYK/ntxk1F6-P7lVRi#anchor-4b444560-5383-11ed-9d27-81f612d08f43 +k8s:deepcopy-gen=false +deepequal-gen=false

type SubnetResponse

type SubnetResponse struct {
	ErrorResponse `json:",inline"`
	Subnet        Subnet `json:"subnet,omitempty"`
}

+k8s:deepcopy-gen=false +deepequal-gen=false

type SubnetUpdateRequest

type SubnetUpdateRequest struct {
	Subnet
	VlanID   string `json:"vlanID,omitempty"`
	Enable   string `json:"enable,omitempty"`
	Priority string `json:"priority,omitempty"`
}

+k8s:deepcopy-gen=false +deepequal-gen=false

Directories

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

Jump to

Keyboard shortcuts

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