notebook

package
v0.0.0-...-63319d1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MPL-2.0, Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusInit         = "INIT"
	StatusCreating     = "CREATING"
	StatusStarting     = "STARTING"
	StatusStopping     = "STOPPING"
	StatusDeleting     = "DELETING"
	StatusRunning      = "RUNNING"
	StatusStopped      = "STOPPED"
	StatusSnapshotting = "SNAPSHOTTING"
	StatusCreateFailed = "CREATE_FAILED"
	StatusStartFailed  = "START_FAILED"
	StatusDeleteFailed = "DELETE_FAILED"
	StatusError        = "ERROR"
	StatusDeleted      = "DELETED"
	StatusFrozen       = "FROZEN"
)

Variables

View Source
var RequestOpts = golangsdk.RequestOpts{
	MoreHeaders: map[string]string{"Content-Type": "application/json", "X-Language": "en-us"},
}

Functions

func ListImages

func ListImages(c *golangsdk.ServiceClient, opts ListImageOpts) (*pagination.Pager, error)

func ListSwitchableFlavors

func ListSwitchableFlavors(c *golangsdk.ServiceClient, id string) (*flavorResp, error)

Types

type AscendInfo

type AscendInfo struct {
	Npu       int    `json:"npu"`
	NpuMemory string `json:"npu_memory"`
	Type      string `json:"type"`
}

type BillingInfo

type BillingInfo struct {
	Code    string `json:"code"`
	UnitNum int    `json:"unit_num"`
}

type CreateOpts

type CreateOpts struct {
	Name        string         `json:"name" required:"true"`
	Flavor      string         `json:"flavor" required:"true"`
	ImageId     string         `json:"image_id" required:"true"`
	Volume      VolumeReq      `json:"volume" required:"true"`
	Description string         `json:"description,omitempty"`
	Duration    *int           `json:"duration,omitempty"`
	Endpoints   []EndpointsReq `json:"endpoints,omitempty"`
	Feature     string         `json:"feature,omitempty"`
	PoolId      string         `json:"pool_id,omitempty"`
	WorkspaceId string         `json:"workspace_id,omitempty"`
}

type Endpoints

type Endpoints struct {
	AllowedAccessIps []string `json:"allowed_access_ips"`
	Service          string   `json:"service"`
	KeyPairNames     []string `json:"key_pair_names"`
	Uri              string   `json:"uri"`
}

type EndpointsReq

type EndpointsReq struct {
	AllowedAccessIps []string `json:"allowed_access_ips,omitempty"`
	Service          string   `json:"service,omitempty"`
	KeyPairNames     []string `json:"key_pair_names,omitempty"`
}

type Flavor

type Flavor struct {
	Arch        string      `json:"arch"`
	Ascend      AscendInfo  `json:"ascend"`
	Billing     BillingInfo `json:"billing"`
	Category    string      `json:"category"`
	Description string      `json:"description"`
	Feature     string      `json:"feature"`
	Free        bool        `json:"free"`
	Gpu         GPUInfo     `json:"gpu"`
	Id          string      `json:"id"`
	Memory      int         `json:"memory"`
	Name        string      `json:"name"`
	SoldOut     bool        `json:"sold_out"`
	Storages    []string    `json:"storages"`
	Vcpus       int         `json:"vcpus"`
}

type GPUInfo

type GPUInfo struct {
	Gpu       int    `json:"gpu"`
	GpuMemory string `json:"gpu_memory"`
	Type      string `json:"type"`
}

type Image

type Image struct {
	Id      string `json:"id"`
	Name    string `json:"name"`
	SwrPath string `json:"swr_path"`
	Type    string `json:"type"`
}

type ImageDetail

type ImageDetail struct {
	Id          string `json:"id"`
	Name        string `json:"name"`
	SwrPath     string `json:"swr_path"`
	Type        string `json:"type"`
	Description string `json:"description"`
	Arch        string `json:"arch"`
}

func ExtractImages

func ExtractImages(r pagination.Page) ([]ImageDetail, error)

type ImagePage

type ImagePage struct {
	pagination.OffsetPageBase
}

func (ImagePage) IsEmpty

func (current ImagePage) IsEmpty() (bool, error)

IsEmpty checks whether a ImagePage struct is empty.

func (ImagePage) NextPageURL

func (current ImagePage) NextPageURL() (string, error)

NextPageURL generates the URL for the page of results after this one.

type ImagesResp

type ImagesResp struct {
	Current int           `json:"current"`
	Data    []ImageDetail `json:"data"`
	Pages   int           `json:"pages"`
	Size    int           `json:"size"`
	Total   int           `json:"total"`
}

type JobProgress

type JobProgress struct {
	NotebookId      string `json:"notebook_id"`
	Status          string `json:"status"`
	Step            int    `json:"step"`
	StepDescription string `json:"step_description"`
}

type Lease

type Lease struct {
	CreateAt int  `json:"create_at"`
	Duration int  `json:"duration"`
	Enable   bool `json:"enable"`
	UpdateAt int  `json:"update_at"`
}

func UpdateLease

func UpdateLease(c *golangsdk.ServiceClient, id string, duration int) (*Lease, error)

type ListImageOpts

type ListImageOpts struct {
	Limit       int    `q:"limit,omitempty"`
	Name        string `q:"name,omitempty"`
	Namespace   string `q:"namespace,omitempty"`
	Offset      int    `q:"offset,omitempty"`
	SortDir     string `q:"sort_dir,omitempty"`
	SortKey     string `q:"sort_key,omitempty"`
	Type        string `q:"type,omitempty"`
	WorkspaceId string `q:"workspace_id,omitempty"`
}

type ListNotebooks

type ListNotebooks struct {
	Current int        `json:"current"`
	Data    []Notebook `json:"data"`
	Pages   int        `json:"pages"`
	Size    int        `json:"size"`
	Total   int        `json:"total"`
}

func List

func List(c *golangsdk.ServiceClient, opts ListOpts) (*ListNotebooks, error)

type ListOpts

type ListOpts struct {
	Feature     string `q:"feature,omitempty"`
	Limit       int    `q:"limit,omitempty"`
	Name        string `q:"name,omitempty"`
	Offset      int    `q:"offset,omitempty"`
	Owner       string `q:"owner,omitempty"`
	SortDir     string `q:"sort_dir,omitempty"`
	SortKey     string `q:"sort_key,omitempty"`
	Status      string `q:"status,omitempty"`
	WorkspaceId string `q:"workspaceId,omitempty"`
}

type ModelartsError

type ModelartsError struct {
	ErrorCode string `json:"error_code"`
	ErrorMsg  string `json:"error_msg"`
}

type MountStorage

type MountStorage struct {
	Category  string `json:"category"`
	Id        string `json:"id"`
	MountPath string `json:"mount_path"`
	Status    string `json:"status"`
	Uri       string `json:"uri"`
}

func DeleteMount

func DeleteMount(c *golangsdk.ServiceClient, id, storageId string) (*MountStorage, error)

func GetMount

func GetMount(c *golangsdk.ServiceClient, id, storageId string) (*MountStorage, error)

func Mount

func Mount(c *golangsdk.ServiceClient, id string, opts MountStorageOpts) (*MountStorage, error)

type MountStorageListResp

type MountStorageListResp struct {
	Current int            `json:"current"`
	Data    []MountStorage `json:"data"`
	Pages   int            `json:"pages"`
	Size    int            `json:"size"`
	Total   int            `json:"total"`
}

func ListMounts

func ListMounts(c *golangsdk.ServiceClient, id string) (*MountStorageListResp, error)

type MountStorageOpts

type MountStorageOpts struct {
	Category  string `json:"category"`
	MountPath string `json:"mount_path"`
	Uri       string `json:"uri"`
}

type Notebook

type Notebook struct {
	ActionProgress []JobProgress `json:"action_progress"`
	Description    string        `json:"description"`
	Endpoints      []Endpoints   `json:"endpoints"`
	FailReason     string        `json:"fail_reason"`
	Feature        string        `json:"feature"`
	Flavor         string        `json:"flavor"`
	Id             string        `json:"id"`
	Image          Image         `json:"image"`
	Lease          Lease         `json:"lease"`
	Name           string        `json:"name"`
	Pool           PoolRes       `json:"pool"`
	Status         string        `json:"status"`
	Token          string        `json:"token"`
	Url            string        `json:"url"`
	Volume         VolumeRes     `json:"volume"`
	WorkspaceId    string        `json:"workspace_id"`
	CreateAt       int           `json:"create_at"`
	UpdateAt       int           `json:"update_at"`
}

func Create

func Create(c *golangsdk.ServiceClient, opts CreateOpts) (*Notebook, error)

func Delete

func Delete(c *golangsdk.ServiceClient, id string) (*Notebook, error)

func Get

func Get(c *golangsdk.ServiceClient, id string) (*Notebook, error)

func Start

func Start(c *golangsdk.ServiceClient, id string, duration int) (*Notebook, error)

func Stop

func Stop(c *golangsdk.ServiceClient, id string) (*Notebook, error)

func Update

func Update(c *golangsdk.ServiceClient, id string, opts UpdateOpts) (*Notebook, error)

type PoolRes

type PoolRes struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

type UpdateOpts

type UpdateOpts struct {
	Description    *string        `json:"description,omitempty"`
	Endpoints      []EndpointsReq `json:"endpoints,omitempty"`
	Flavor         string         `json:"flavor,omitempty"`
	ImageId        string         `json:"image_id,omitempty"`
	Name           string         `json:"name,omitempty"`
	StorageNewSize *int           `json:"storage_new_size,omitempty"`
}

type VolumeReq

type VolumeReq struct {
	Category  string `json:"category" required:"true"`
	Ownership string `json:"ownership" required:"true"`
	Capacity  *int   `json:"capacity,omitempty"`
	Uri       string `json:"uri,omitempty"`
}

type VolumeRes

type VolumeRes struct {
	Capacity  int    `json:"capacity"`
	Category  string `json:"category"`
	MountPath string `json:"mount_path"`
	Ownership string `json:"ownership"`
	Status    string `json:"status"`
}

Jump to

Keyboard shortcuts

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