dev

package
v0.9.272 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultVersion = "v2"
	DefaultUrl     = "/"

	ApiCreateDevInstance               = "CreateDevInstance"
	ApiDescribeDevInstance             = "DescribeDevInstance"
	ApiDescribeDevInstances            = "DescribeDevInstances"
	ApiModifyDevInstance               = "ModifyDevInstance"
	ApiStartDevInstance                = "StartDevInstance"
	ApiStopDevInstance                 = "StopDevInstance"
	ApiDeleteDevInstance               = "DeleteDevInstance"
	ApiTimedStopDevInstance            = "TimedStopDevInstance"
	ApiDescribeDevInstanceEvents       = "DescribeDevInstanceEvents"
	ApiCreateDevInstanceImagePackJob   = "CreateDevInstanceImagePackJob"
	ApiDescribeDevInstanceImagePackJob = "DescribeDevInstanceImagePackJob"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Access

type Access struct {
	BLBID     string     `json:"blbId" validate:"required"`
	SSHEnable bool       `json:"sshEnable"`
	SSHRSAKey string     `json:"sshRSAPubKey"`
	PortInfo  []PortInfo `json:"portInfo" validate:"required"`
}

type BOS

type BOS struct {
	SourcePath string `json:"sourcePath" validate:"required"`
}

type CDS

type CDS struct {
	Capacity int32 `json:"capacity" validate:"required"`
}

type CFS

type CFS struct {
	InstanceID string `json:"instanceId" validate:"required"`
	SourcePath string `json:"sourcePath" validate:"required"`
	MountPoint string `json:"mountPoint" validate:"required"`
}

type Client

type Client struct {
	client.Client
}

func NewClient

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

NewClient make the aihc dev client with default configuration.

func NewClientWithSTS

func NewClientWithSTS(accessKey, secretKey, sessionToken, endPoint string) (*Client, error)

NewClientWithSTS make the aihc dev client with STS configuration.

func (*Client) CreateDevInstance

func (c *Client) CreateDevInstance(args *CreateDevInstanceArgs) (*CreateDevInstanceResult, error)

CreateDevInstance 创建开发机实例

func (*Client) CreateDevInstanceImagePackJob

func (c *Client) CreateDevInstanceImagePackJob(args *CreateDevInstanceImagePackJobArgs) (*CreateDevInstanceImagePackJobResult, error)

CreateDevInstanceImagePackJob 创建镜像任务

func (*Client) DeleteDevInstance

func (c *Client) DeleteDevInstance(args *DeleteDevInstanceArgs) (*DeleteDevInstanceResult, error)

DeleteDevInstance 删除开发机

func (*Client) DevInstanceImagePackJobDetail

func (c *Client) DevInstanceImagePackJobDetail(args *DevInstanceImagePackJobDetailArgs) (*DevInstanceImagePackJobDetailResult, error)

DevInstanceImagePackJobDetail 查询镜像任务详情

func (*Client) GetBceClient

func (c *Client) GetBceClient() *bce.BceClient

func (*Client) ListDevInstance

func (c *Client) ListDevInstance(args *ListDevInstanceArgs) (*ListDevInstanceResult, error)

ListDevInstance 查询开发机列表

func (*Client) ListDevInstanceEvent

func (c *Client) ListDevInstanceEvent(args *ListDevInstanceEventArgs) (*ListDevInstanceEventResult, error)

ListDevInstanceEvent 查询开发机事件

func (*Client) QueryDevInstanceDetail

func (c *Client) QueryDevInstanceDetail(args *QueryDevInstanceDetailArgs) (*QueryDevInstanceDetailResult, error)

QueryDevInstanceDetail 查询开发机详情

func (*Client) SetBceClient

func (c *Client) SetBceClient(client *bce.BceClient)

func (*Client) StartDevInstance

func (c *Client) StartDevInstance(args *StartDevInstanceArgs) (*StartDevInstanceResult, error)

StartDevInstance 启动开发机实例

func (*Client) StopDevInstance

func (c *Client) StopDevInstance(args *StopDevInstanceArgs) (*StopDevInstanceResult, error)

StopDevInstance 停止开发机实例

func (*Client) TimedStopDevInstance

func (c *Client) TimedStopDevInstance(args *TimedStopDevInstanceArgs) (*TimedStopDevInstanceResult, error)

TimedStopDevInstance 定时停止开发机

func (*Client) UpdateDevInstance

func (c *Client) UpdateDevInstance(args *CreateDevInstanceArgs) (*CreateDevInstanceResult, error)

UpdateDevInstance 更新开发机配置

type CommonResp added in v0.9.267

type CommonResp struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

CommonResp 包装 OpenAPI 错误字段;嵌入到 Result 中以便统一探测 HTTP 200 中的业务错误

type CreateDevInstanceArgs

type CreateDevInstanceArgs struct {
	Name         string           `json:"name" validate:"required"`
	Id           string           `json:"id"`
	Conf         *DevInstanceConf `json:"conf" validate:"required"`
	VisibleScope *VisibleScope    `json:"visibleScope"`
	Notify       *Notify          `json:"notify"`
	IsPublicMgmt bool             `json:"isPublicMgmt"`
	Creator      string           `json:"creator" validate:"required"`
	CreatorID    string           `json:"creatorId" validate:"required"`
}

type CreateDevInstanceImagePackJobArgs

type CreateDevInstanceImagePackJobArgs struct {
	ImageName     string `json:"imageName" validate:"required"`
	ImageTag      string `json:"imageTag" validate:"required"`
	Registry      string `json:"registry" validate:"required"`
	Namespace     string `json:"namespace" validate:"required"`
	Username      string `json:"username" validate:"required"`
	Password      string `json:"password" validate:"required"`
	DevInstanceID string `json:"devInstanceId" validate:"required"`
}

type CreateDevInstanceImagePackJobResult

type CreateDevInstanceImagePackJobResult struct {
	CommonResp
	ImagePackJobId string `json:"imagePackJobId"`
	DevInstanceId  string `json:"devInstanceId"`
	RequestId      string `json:"requestId"`
}

func CreateDevInstanceImagePackJob

func CreateDevInstanceImagePackJob(cli bce.Client, reqBody *bce.Body) (*CreateDevInstanceImagePackJobResult, error)

type CreateDevInstanceResult

type CreateDevInstanceResult struct {
	CommonResp
	DevInstanceId string `json:"devInstanceId"`
	RequestId     string `json:"requestId"`
}

func CreateDevInstance

func CreateDevInstance(cli bce.Client, reqBody *bce.Body) (*CreateDevInstanceResult, error)

func UpdateDevInstance

func UpdateDevInstance(cli bce.Client, reqBody *bce.Body) (*CreateDevInstanceResult, error)

type Dataset

type Dataset struct {
	DatasetID        string      `json:"datasetId"`
	VersionID        string      `json:"versionId"`
	StorageType      string      `json:"storageType"`
	PFS              *DatasetPFS `json:"pfs"`
	DefaultMountPath string      `json:"defaultMountPath"`
}

type DatasetPFS

type DatasetPFS struct {
	ClientID      string   `json:"clientID"`
	InstanceType  string   `json:"instanceType"`
	Region        string   `json:"region"`
	InstanceID    string   `json:"instanceId"`
	ClusterIP     string   `json:"clusterIP"`
	MountTargetID []string `json:"mountTargetId"`
	HostMountPath string   `json:"hostMountPath"`
	SrcPath       string   `json:"srcPath"`
}

type DeleteDevInstanceArgs

type DeleteDevInstanceArgs struct {
	DevInstanceId string `json:"devInstanceId"`
}

type DeleteDevInstanceResult

type DeleteDevInstanceResult struct {
	CommonResp
	DevInstanceId string `json:"devInstanceId"`
	RequestId     string `json:"requestId"`
}

func DeleteDevInstance

func DeleteDevInstance(cli bce.Client, args *DeleteDevInstanceArgs) (*DeleteDevInstanceResult, error)

type DevInstanceBrief

type DevInstanceBrief struct {
	Name             string     `json:"name"`
	ID               string     `json:"id"`
	ResourcePoolId   string     `json:"resourcePoolId"`
	ResourcePoolName string     `json:"resourcePoolName"`
	QueueName        string     `json:"queueName"`
	ImageURL         string     `json:"imageUrl"`
	Resources        *Resources `json:"resources"`
	AccountId        string     `json:"accountId"`
	Creator          string     `json:"creator"`
	CreatorID        string     `json:"creatorId"`
	Region           string     `json:"region"`
	Version          string     `json:"version"`
	Status           int32      `json:"status"`
	StatusReason     string     `json:"statusReason"`
	CreatedAt        int32      `json:"createdAt"`
	UpdatedAt        int32      `json:"updatedAt"`
}

type DevInstanceConf

type DevInstanceConf struct {
	ResourcePool *ResourcePool     `json:"resourcePool" validate:"required"`
	Resources    *Resources        `json:"resources" validate:"required"`
	Image        *Image            `json:"image" validate:"required"`
	Access       *Access           `json:"access"`
	ScheduleConf *ScheduleConf     `json:"scheduleConf"`
	WorkspaceDir string            `json:"workspaceDir"`
	Envs         map[string]string `json:"envs"`
	StartCmd     string            `json:"startCmd"`
	VolumnConfs  []*VolumnConf     `json:"volumnConfs" validate:"required"`
	UpdatedAt    int32             `json:"updatedAt"`
}

type DevInstanceDetail

type DevInstanceDetail struct {
	Name string `json:"name"`
	ID   string `json:"id"`

	Conf                 *DevInstanceConf            `json:"conf"`
	ServiceInstanceInfo  *ServiceInstanceInfo        `json:"serviceInstanceInfo"`
	LoginInfo            *LoginInfo                  `json:"loginInfo"`
	Notify               *Notify                     `json:"notify"`
	VisibleScope         *VisibleScope               `json:"visibleScope"`
	TimedStopDevInstance *TimedStopDevInstanceDetail `json:"timedStopDevInstance"`
	IsPublicMgmt         bool                        `json:"isPublicMgmt"`

	AccountId    string `json:"accountId"`
	Creator      string `json:"creator"`
	CreatorID    string `json:"creatorId"`
	Region       string `json:"region"`
	Version      string `json:"version"`
	Status       int32  `json:"status"`
	StatusReason string `json:"statusReason"`
	CreatedAt    int32  `json:"createdAt"`
	UpdatedAt    int32  `json:"updatedAt"`
}

type DevInstanceImagePackJobDetailArgs

type DevInstanceImagePackJobDetailArgs struct {
	ImagePackJobId string `json:"imagePackJobId"`
	DevInstanceId  string `json:"devInstanceId"`
}

type DevInstanceImagePackJobDetailResult

type DevInstanceImagePackJobDetailResult struct {
	CommonResp
	ImagePackJobDetail ImagePackJobDetail `json:"devInstanceImagePackJob"`

	RequestId string `json:"requestId"`
}

type Event

type Event struct {
	Reason         string `json:"reason"`         // 原因
	Message        string `json:"message"`        // 详细信息
	FirstTimestamp int32  `json:"firstTimestamp"` // 首次出现时间(建议使用time.Time类型)
	LastTimestamp  int32  `json:"lastTimestamp"`  // 最后出现时间(建议使用time.Time类型)
	Count          int32  `json:"count"`          // 出现次数
	Type           string `json:"type"`           // 事件类型
}

type Image

type Image struct {
	ImageType int32  `json:"imageType"`
	ImageURL  string `json:"imageUrl" validate:"required"`
	Username  string `json:"username"`
	Password  string `json:"password"`
}

type ImagePackJobDetail

type ImagePackJobDetail struct {
	Id            string `json:"id"`
	DevInstanceId string `json:"devInstanceId"`
	ImageName     string `json:"imageName"`
	ImageTag      string `json:"imageTag"`
	Registry      string `json:"registry"`
	Namespace     string `json:"namespace"`
	Status        int32  `json:"status"`
	CreatedAt     int32  `json:"createdAt"`
	UpdatedAt     int32  `json:"updatedAt"`
}

type ListDevInstanceArgs

type ListDevInstanceArgs struct {
	QueryKey       string `json:"queryKey"`
	QueryVal       string `json:"queryVal"`
	ResourcePoolId string `json:"resourcePoolID"`
	QueueName      string `json:"queueName"`
	OnlyMyDevs     bool   `json:"onlyMyDevs"`
	PageNumber     int    `json:"pageNumber"`
	PageSize       int    `json:"pageSize"`
	Status         string `json:"status"`
	OrderBy        string `json:"orderBy"`
	Order          string `json:"order"`
}

type ListDevInstanceEventArgs

type ListDevInstanceEventArgs struct {
	DevInstanceId string `json:"devInstanceId"`
	PageNumber    int    `json:"pageNumber"`
	PageSize      int    `json:"pageSize"`
	StartTime     string `json:"startTime"`
	EndTime       string `json:"endTime"`
	EventType     string `json:"eventType"`
	Message       string `json:"message"`
}

type ListDevInstanceEventResult

type ListDevInstanceEventResult struct {
	CommonResp
	Events     []*Event `json:"events"`
	TotalCount int32    `json:"totalCount"`
	RequestId  string   `json:"requestId"`
}

type ListDevInstanceResult

type ListDevInstanceResult struct {
	CommonResp
	DevInstances []*DevInstanceBrief `json:"devInstances"`
	TotalCount   int32               `json:"totalCount"`
	RequestId    string              `json:"requestId"`
}

func ListDevInstance

func ListDevInstance(cli bce.Client, args *ListDevInstanceArgs) (*ListDevInstanceResult, error)

type LoginInfo

type LoginInfo struct {
	Jupyter Url `json:"jupyter"`
	Vscode  Url `json:"vscode"`
}

type Notify

type Notify struct {
	NotifyRuleID string `json:"notifyRuleId" validate:"required"`
	IsOpen       bool   `json:"isOpen"`
}

type PFS

type PFS struct {
	InstanceID string `json:"instanceId" validate:"required"`
	SourcePath string `json:"sourcePath" validate:"required"`
}

type PortInfo

type PortInfo struct {
	Name       string `json:"name" validate:"required"`
	Port       int32  `json:"port" validate:"required"`
	AccessPort int32  `json:"accessPort" validate:"required"`
}

type QueryDevInstanceDetailArgs

type QueryDevInstanceDetailArgs struct {
	DevInstanceId string `json:"devInstanceId"`
}

type QueryDevInstanceDetailResult

type QueryDevInstanceDetailResult struct {
	CommonResp
	DevInstance DevInstanceDetail `json:"devInstance"`
	RequestId   string            `json:"requestId"`
}

type ResourcePool

type ResourcePool struct {
	ResourcePoolType string `json:"resourcePoolType"`
	ResourcePoolID   string `json:"resourcePoolId"`
	ResourcePoolName string `json:"resourcePoolName"`
	QueueName        string `json:"queueName" validate:"required"`
}

type Resources

type Resources struct {
	AcceleratorType  string `json:"acceleratorType"`
	AcceleratorCount int32  `json:"acceleratorCount"`
	CPUs             int32  `json:"cpus" validate:"required"`
	Memory           int32  `json:"memory" validate:"required"`
	ShmSize          int32  `json:"shmSize"`
}

type ScheduleConf

type ScheduleConf struct {
	CPUNodeAffinity bool   `json:"cpuNodeAffinity"`
	Priority        string `json:"priority"`
}

type ServiceInstanceInfo

type ServiceInstanceInfo struct {
	NodeIP            string `json:"nodeIP"`
	PodName           string `json:"podName"`
	ServiceInstanceId string `json:"serviceInstanceId"`
	InternalIP        string `json:"internalIP"`
	PublicIP          string `json:"publicIP"`
}

type StartDevInstanceArgs

type StartDevInstanceArgs struct {
	DevInstanceId string `json:"devInstanceId"`
}

type StartDevInstanceResult

type StartDevInstanceResult struct {
	CommonResp
	DevInstanceId string `json:"devInstanceId"`
	RequestId     string `json:"requestId"`
}

func StartDevInstance

func StartDevInstance(cli bce.Client, args *StartDevInstanceArgs) (*StartDevInstanceResult, error)

type StopDevInstanceArgs

type StopDevInstanceArgs struct {
	DevInstanceId string `json:"devInstanceId"`
}

type StopDevInstanceResult

type StopDevInstanceResult struct {
	CommonResp
	DevInstanceId string `json:"devInstanceId"`
	RequestId     string `json:"requestId"`
}

func StopDevInstance

func StopDevInstance(cli bce.Client, args *StopDevInstanceArgs) (*StopDevInstanceResult, error)

type TimedStopDevInstanceArgs

type TimedStopDevInstanceArgs struct {
	DevInstanceId string `json:"devInstanceId" validate:"required"`
	DelaySec      int32  `json:"delaySec"`
	Enable        bool   `json:"enable"`
}

type TimedStopDevInstanceDetail

type TimedStopDevInstanceDetail struct {
	StartTime int32 `json:"startTime"`
	DelaySec  int32 `json:"delaySec"`
}

type TimedStopDevInstanceResult

type TimedStopDevInstanceResult struct {
	CommonResp
	DevInstanceId string `json:"devInstanceId"`
	RequestId     string `json:"requestId"`
}

func TimedStopDevInstance

func TimedStopDevInstance(cli bce.Client, reqBody *bce.Body) (*TimedStopDevInstanceResult, error)

type Url

type Url struct {
	URL string `json:"url"`
}

type VisibleScope

type VisibleScope struct {
	Type int32 `json:"type"`
}

type VolumnConf

type VolumnConf struct {
	VolumnType string   `json:"volumnType" validate:"required"`
	PFS        *PFS     `json:"pfs"`
	Dataset    *Dataset `json:"dataset"`
	CFS        *CFS     `json:"cfs"`
	CDS        *CDS     `json:"cds"`
	BOS        *BOS     `json:"bos"`
	MountPath  string   `json:"mountPath" validate:"required"`
	ReadOnly   bool     `json:"readOnly"`
}

Jump to

Keyboard shortcuts

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