bci

package
v0.9.209 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	URI_PREFIX_v2  = bce.URI_PREFIX + "v2"
	DEFAULT_PREFIX = URI_PREFIX_v2

	DEFAULT_BCI_ENDPOINT = "bci." + bce.DEFAULT_REGION + ".baidubce.com"

	REQUEST_BCI_URL = "/instance"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchDeleteInstanceArgs

type BatchDeleteInstanceArgs struct {
	InstanceIds        []string `json:"instanceIds,omitempty"`
	RelatedReleaseFlag bool     `json:"relatedReleaseFlag,omitempty"`
}

type Capabilities

type Capabilities struct {
	Add  []string `json:"add,omitempty"`
	Drop []string `json:"drop,omitempty"`
}

type Client

type Client struct {
	*bce.BceClient
}

Client of BCI service is a kind of BceClient, so derived from BceClient

func NewClient

func NewClient(ak, sk, endPoint string) (*Client, error)

func (*Client) BatchDeleteInstance

func (c *Client) BatchDeleteInstance(args *BatchDeleteInstanceArgs) error

BatchDeleteInstance - batch delete bcis

PARAMS:

  • args: the arguments to batch delete bcis

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) CreateInstance

func (c *Client) CreateInstance(args *CreateInstanceArgs) (*CreateInstanceResult, error)

CreateInstance - create a bci with the specific parameters

PARAMS:

  • args: the arguments to create a bci

RETURNS:

  • *CreateInstanceResult: the result of create bci
  • error: nil if success otherwise the specific error

func (*Client) DeleteInstance

func (c *Client) DeleteInstance(args *DeleteInstanceArgs) error

DeleteInstance - delete a bci

PARAMS:

  • args: the arguments to delete a bci

RETURNS:

  • error: nil if success otherwise the specific error

func (*Client) GetInstance

func (c *Client) GetInstance(args *GetInstanceArgs) (*GetInstanceResult, error)

GetInstance - query bci detail with the specific parameters

PARAMS:

  • args: the arguments to list all bci

RETURNS:

  • *GetInstanceResult: the result of query bci detail
  • error: nil if success otherwise the specific error

func (*Client) ListInstances

func (c *Client) ListInstances(args *ListInstanceArgs) (*ListInstanceResult, error)

ListInstance - list all bcis with the specific parameters

PARAMS:

  • args: the arguments to list all bcis

RETURNS:

  • *ListInstanceResult: the result of list all bcis
  • error: nil if success otherwise the specific error

type ConfigFileDetail

type ConfigFileDetail struct {
	Path string `json:"path,omitempty"`
	File string `json:"file,omitempty"`
}

type ConfigFileVolume

type ConfigFileVolume struct {
	Name        string             `json:"name,omitempty"`
	DefaultMode int                `json:"defaultMode,omitempty"`
	ConfigFiles []ConfigFileDetail `json:"configFiles,omitempty"`
}

type Container

type Container struct {
	Name            string                    `json:"name"`
	Image           string                    `json:"image"`
	Memory          float64                   `json:"memory,omitempty"`
	CPU             float64                   `json:"cpu,omitempty"`
	GPU             float64                   `json:"gpu,omitempty"`
	WorkingDir      string                    `json:"workingDir"`
	ImagePullPolicy string                    `json:"imagePullPolicy,omitempty"`
	Commands        []string                  `json:"commands,omitempty"`
	Args            []string                  `json:"args,omitempty"`
	VolumeMounts    []VolumeMount             `json:"volumeMounts,omitempty"`
	Ports           []Port                    `json:"ports,omitempty"`
	EnvironmentVars []Environment             `json:"environmentVars,omitempty"`
	LivenessProbe   *Probe                    `json:"livenessProbe,omitempty"`
	ReadinessProbe  *Probe                    `json:"readinessProbe,omitempty"`
	StartupProbe    *Probe                    `json:"startupProbe,omitempty"`
	Stdin           bool                      `json:"stdin,omitempty"`
	StdinOnce       bool                      `json:"stdinOnce,omitempty"`
	Tty             bool                      `json:"tty,omitempty"`
	SecurityContext *ContainerSecurityContext `json:"securityContext,omitempty"`
}

type ContainerDetailModel

type ContainerDetailModel struct {
	Name            string           `json:"name,omitempty"`
	Image           string           `json:"image,omitempty"`
	CPU             float64          `json:"cpu,omitempty"`
	GPU             float64          `json:"gpu,omitempty"`
	Memory          float64          `json:"memory,omitempty"`
	WorkingDir      string           `json:"workingDir"`
	ImagePullPolicy string           `json:"imagePullPolicy,omitempty"`
	Commands        []string         `json:"commands,omitempty"`
	Args            []string         `json:"args,omitempty"`
	Ports           []Port           `json:"ports,omitempty"`
	VolumeMounts    []VolumeMount    `json:"volumeMounts,omitempty"`
	Envs            []Environment    `json:"envs,omitempty"`
	CreateTime      string           `json:"createTime,omitempty"`
	UpdateTime      string           `json:"updateTime,omitempty"`
	DeleteTime      string           `json:"deleteTime,omitempty"`
	PreviousState   *ContainerStatus `json:"previousState,omitempty"`
	CurrentState    *ContainerStatus `json:"currentState,omitempty"`
	Ready           bool             `json:"ready,omitempty"`
	RestartCount    int              `json:"restartCount,omitempty"`
}

type ContainerSecurityContext

type ContainerSecurityContext struct {
	Capabilities           *Capabilities `json:"capabilities,omitempty"`
	RunAsUser              int64         `json:"runAsUser,omitempty"`
	RunAsGroup             int64         `json:"runAsGroup,omitempty"`
	RunAsNonRoot           bool          `json:"runAsNonRoot,omitempty"`
	ReadOnlyRootFilesystem bool          `json:"readOnlyRootFilesystem,omitempty"`
}

type ContainerStatus

type ContainerStatus struct {
	State        string `json:"state,omitempty"`
	Reason       string `json:"reason,omitempty"`
	Message      string `json:"message,omitempty"`
	StartTime    string `json:"startTime,omitempty"`
	FinishTime   string `json:"finishTime,omitempty"`
	DetailStatus string `json:"detailStatus,omitempty"`
	ExitCode     int    `json:"exitCode,omitempty"`
}

type CreateInstanceArgs

type CreateInstanceArgs struct {
	ClientToken                   string                    `json:"-"`
	Name                          string                    `json:"name"`
	ZoneName                      string                    `json:"zoneName,omitempty"`
	SecurityGroupIds              []string                  `json:"securityGroupIds,omitempty"`
	SubnetIds                     []string                  `json:"subnetIds,omitempty"`
	RestartPolicy                 string                    `json:"restartPolicy,omitempty"`
	EipIp                         string                    `json:"eipIp,omitempty"`
	AutoCreateEip                 bool                      `json:"autoCreateEip,omitempty"`
	EipName                       string                    `json:"eipName,omitempty"`
	EipRouteType                  string                    `json:"eipRouteType,omitempty"`
	EipBandwidthInMbps            int                       `json:"eipBandwidthInMbps,omitempty"`
	EipBillingMethod              string                    `json:"eipBillingMethod,omitempty"`
	GPUType                       string                    `json:"gpuType,omitempty"`
	TerminationGracePeriodSeconds int64                     `json:"terminationGracePeriodSeconds,omitempty"`
	HostName                      string                    `json:"hostName,omitempty"`
	Tags                          []Tag                     `json:"tags,omitempty"`
	ImageRegistryCredentials      []ImageRegistryCredential `json:"imageRegistryCredentials,omitempty"`
	Containers                    []Container               `json:"containers,omitempty"`
	InitContainers                []Container               `json:"initContainers,omitempty"`
	Volume                        *Volume                   `json:"volume,omitempty"`
}

type CreateInstanceResult

type CreateInstanceResult struct {
	InstanceId string `json:"instanceId,omitempty"`
}

type DeleteInstanceArgs

type DeleteInstanceArgs struct {
	InstanceId         string `json:"instanceId"`
	RelatedReleaseFlag bool   `json:"relatedReleaseFlag,omitempty"`
}

type EmptyDirVolume

type EmptyDirVolume struct {
	Name      string  `json:"name,omitempty"`
	Medium    string  `json:"medium,omitempty"`
	SizeLimit float64 `json:"sizeLimit,omitempty"`
}

type Environment

type Environment struct {
	Key   string `json:"key,omitempty"`
	Value string `json:"value,omitempty"`
}

type ExecAction

type ExecAction struct {
	Command []string `json:"command,omitempty"`
}

type GRPCAction

type GRPCAction struct {
	Port    int    `json:"port,omitempty"`
	Service string `josn:"service,omitempty"`
}

type GetInstanceArgs

type GetInstanceArgs struct {
	InstanceId string `json:"instanceId"`
}

type GetInstanceResult

type GetInstanceResult struct {
	Instance *InstanceDetailModel `json:"instance,omitempty"`
}

type HTTPGetAction

type HTTPGetAction struct {
	Path        string      `json:"path,omitempty"`
	Port        int         `json:"port,omitempty"`
	Scheme      string      `json:"scheme,omitempty"`
	Host        string      `json:"host,omitempty"`
	HTTPHeaders *HTTPHeader `json:"httpHeaders,omitempty"`
}

type HTTPHeader

type HTTPHeader struct {
	Name  string `json:"name,omitempty"`
	Value string `json:"value,omitempty"`
}

type ImageRegistryCredential

type ImageRegistryCredential struct {
	Server   string `json:"server,omitempty"`
	UserName string `json:"userName,omitempty"`
	Password string `json:"password,omitempty"`
}

type InstanceDetailModel

type InstanceDetailModel struct {
	InstanceModel
	Volume         *Volume                `json:"volume,omitempty"`
	Containers     []ContainerDetailModel `json:"containers,omitempty"`
	InitContainers []ContainerDetailModel `json:"initContainers,omitempty"`
	SecurityGroups []SecurityGroupModel   `json:"securityGroups,omitempty"`
	Vpc            *VpcModel              `json:"vpc,omitempty"`
	Subnet         *SubnetModel           `json:"subnet,omitempty"`
}

type InstanceModel

type InstanceModel struct {
	InstanceId      string  `json:"instanceId,omitempty"`
	InstanceName    string  `json:"instanceName,omitempty"`
	Status          string  `json:"status,omitempty"`
	ZoneName        string  `json:"zoneName,omitempty"`
	CPUType         string  `json:"cpuType,omitempty"`
	GPUType         string  `json:"gpuType,omitempty"`
	Cpu             float64 `json:"cpu,omitempty"`
	Memory          float64 `json:"memory,omitempty"`
	BandwidthInMbps int     `json:"bandwidthInMbps,omitempty"`
	InternalIp      string  `json:"internalIp,omitempty"`
	PublicIp        string  `json:"publicIp,omitempty"`
	CreateTime      string  `json:"createTime,omitempty"`
	UpdateTime      string  `json:"updateTime,omitempty"`
	DeleteTime      string  `json:"deleteTime,omitempty"`
	RestartPolicy   string  `json:"restartPolicy,omitempty"`
	Tags            []Tag   `json:"tags,omitempty"`
}

type ListInstanceArgs

type ListInstanceArgs struct {
	KeywordType string `json:"keywordType,omitempty"`
	Keyword     string `json:"keyword,omitempty"`
	Marker      string `json:"marker,omitempty"`
	MaxKeys     int    `json:"maxKeys,omitempty"`
}

type ListInstanceResult

type ListInstanceResult struct {
	Marker      string          `json:"marker,omitempty"`
	IsTruncated bool            `json:"isTruncated,omitempty"`
	NextMarker  string          `json:"nextMarker,omitempty"`
	MaxKeys     int             `json:"maxKeys,omitempty"`
	Result      []InstanceModel `json:"result,omitempty"`
}

type NfsVolume

type NfsVolume struct {
	Name     string `json:"name,omitempty"`
	Server   string `json:"server,omitempty"`
	Path     string `json:"path,omitempty"`
	ReadOnly bool   `json:"readOnly,omitempty"`
}

type Port

type Port struct {
	Name     string `json:"name,omitempty"`
	Port     int    `json:"port,omitempty"`
	Protocol string `json:"protocol,omitempty"`
}

type Probe

type Probe struct {
	InitialDelaySeconds           int              `json:"initialDelaySeconds,omitempty"`
	TimeoutSeconds                int              `json:"timeoutSeconds,omitempty"`
	PeriodSeconds                 int              `json:"periodSeconds,omitempty"`
	SuccessThreshold              int              `json:"successThreshold,omitempty"`
	FailureThreshold              int              `json:"failureThreshold,omitempty"`
	TerminationGracePeriodSeconds int64            `json:"terminationGracePeriodSeconds,omitempty"`
	HTTPGet                       *HTTPGetAction   `json:"httpGet,omitempty"`
	TCPSocket                     *TCPSocketAction `json:"tcpSocket,omitempty"`
	Exec                          *ExecAction      `json:"exec,omitempty"`
	GRPC                          *GRPCAction      `json:"grpc,omitempty"`
}

type SecurityGroupModel

type SecurityGroupModel struct {
	SecurityGroupId string `json:"securityGroupId,omitempty"`
	Name            string `json:"name,omitempty"`
	Description     string `json:"description,omitempty"`
	VpcId           string `json:"vpcId,omitempty"`
}

type SubnetModel

type SubnetModel struct {
	SubnetId    string `json:"subnetId,omitempty"`
	Name        string `json:"name,omitempty"`
	Cidr        string `json:"cidr,omitempty"`
	VpcId       string `json:"vpcId,omitempty"`
	SubnetType  string `json:"subnetType,omitempty"`
	Description string `json:"description,omitempty"`
	CreateTime  string `json:"createTime,omitempty"`
}

type TCPSocketAction

type TCPSocketAction struct {
	Port int    `json:"port,omitempty"`
	Host string `json:"host,omitempty"`
}

type Tag

type Tag struct {
	TagKey   string `json:"tagKey,omitempty"`
	TagValue string `json:"tagValue,omitempty"`
}

type Volume

type Volume struct {
	Nfs        []NfsVolume        `json:"nfs,omitempty"`
	EmptyDir   []EmptyDirVolume   `json:"emptyDir,omitempty"`
	ConfigFile []ConfigFileVolume `json:"configFile,omitempty"`
}

type VolumeMount

type VolumeMount struct {
	Name      string `json:"name,omitempty"`
	Type      string `json:"type,omitempty"`
	MountPath string `json:"mountPath,omitempty"`
	ReadOnly  bool   `json:"readOnly,omitiempty"`
}

type VpcModel

type VpcModel struct {
	VpcId       string `json:"vpcId,omitempty"`
	Name        string `json:"name,omitempty"`
	Cidr        string `json:"cidr,omitempty"`
	CreateTime  string `json:"createTime,omitempty"`
	Description string `json:"description,omitempty"`
	IsDefault   bool   `json:"isDefault,omitempty"`
}

Jump to

Keyboard shortcuts

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