modelarts notebook接口参数调整

This commit is contained in:
tzwang 2023-05-12 15:40:10 +08:00
parent 5d7a6e2700
commit 14068d0ef9
7 changed files with 1139 additions and 1123 deletions

View File

@ -29,7 +29,7 @@ func NewCreateNotebookLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Cr
func (l *CreateNotebookLogic) CreateNotebook(in *modelarts.CreateNotebookReq) (*modelarts.CreateNotebookResp, error) {
var resp modelarts.CreateNotebookResp
createUrl := "https://modelarts.cn-east-3.myhuaweicloud.com/v1/{project_id}/notebooks"
createUrl := "https://modelarts.cn-north-4.myhuaweicloud.com/v1/{project_id}/notebooks"
createUrl = strings.Replace(createUrl, "{project_id}", in.ProjectId, -1)
reqByte, err := json.Marshal(in.Param)
if err != nil {

View File

@ -2,14 +2,10 @@ package logic
import (
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common"
"PCM/common/tool"
"context"
"encoding/json"
"strings"
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/svc"
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
"PCM/common/tool"
"context"
"github.com/zeromicro/go-zero/core/logx"
)
@ -29,16 +25,22 @@ func NewListNotebookLogic(ctx context.Context, svcCtx *svc.ServiceContext) *List
// notebook task
func (l *ListNotebookLogic) ListNotebook(in *modelarts.ListNotebookReq) (*modelarts.ListNotebookResp, error) {
var resp modelarts.ListNotebookResp
resp := &modelarts.ListNotebookResp{}
getUrl := "https://modelarts.cn-north-4.myhuaweicloud.com/v1/{project_id}/notebooks"
getUrl = strings.Replace(getUrl, "{project_id}", in.ProjectId, -1)
token := common.GetToken()
queryMap := tool.ConvertStructToMap(in.Param)
req := tool.GetACHttpRequest()
_, err := req.
SetHeader("x-auth-token", token).
SetPathParam("project_id", in.ProjectId).
SetQueryParams(queryMap).
SetResult(resp).
Get(getUrl)
body, err := tool.HttpClientWithQueries(tool.GET, getUrl, nil, token, *in.Param)
if err != nil {
return nil, err
}
json.Unmarshal(body, &resp)
return &resp, nil
return resp, nil
}

File diff suppressed because it is too large Load Diff

View File

@ -1660,205 +1660,205 @@ message DeleteDataSetResq{
/******************Notebook Start*************************/
message ListNotebookReq{
string projectId = 1; // @gotags: copier:"ProjectId"
string project_id = 1; // @gotags: copier:"ProjectId"
ListNotebookParam param = 2; // @gotags: copier:"Param"
}
message ListNotebookResp{
int32 current = 1; // @gotags: copier:"current"
repeated NotebookResp data = 2; // @gotags: copier:"data"
int32 pages = 3; // @gotags: copier:"pages"
int32 size = 4; // @gotags: copier:"size"
int64 total = 5; // @gotags: copier:"total"
int32 current = 1; // @gotags: copier:"Current"
repeated NotebookResp data = 2; // @gotags: copier:"Data"
int32 pages = 3; // @gotags: copier:"Pages"
int32 size = 4; // @gotags: copier:"Size"
int64 total = 5; // @gotags: copier:"Total"
}
message ListNotebookParam{
string feature = 1; // @gotags: copier:"feature"
int32 limit = 2; // @gotags: copier:"limit"
string name = 3; // @gotags: copier:"name"
string pool_id = 4; // @gotags: copier:"pool_id"
int32 offset = 5; // @gotags: copier:"offset"
string owner = 6; // @gotags: copier:"owner"
string sort_dir = 7; // @gotags: copier:"sort_dir"
string sort_key = 8; // @gotags: copier:"sort_key"
string status = 9; // @gotags: copier:"status"
string workspaceId = 10; // @gotags: copier:"workspaceId"
string feature = 1; // @gotags: copier:"Feature"
int32 limit = 2; // @gotags: copier:"Limit"
string name = 3; // @gotags: copier:"Name"
string pool_id = 4; // @gotags: copier:"PoolId"
int32 offset = 5; // @gotags: copier:"Offset"
string owner = 6; // @gotags: copier:"Owner"
string sort_dir = 7; // @gotags: copier:"SortDir"
string sort_key = 8; // @gotags: copier:"SortKey"
string status = 9; // @gotags: copier:"Status"
string workspaceId = 10; // @gotags: copier:"WorkspaceId"
}
message CreateNotebookReq{
string project_id = 1; // @gotags: copier:"project_id"
CreateNotebookParam param = 2; // @gotags: copier:"param"
string project_id = 1; // @gotags: copier:"ProjectId"
CreateNotebookParam param = 2; // @gotags: copier:"Param"
}
message CreateNotebookResp{
NotebookResp notebookResp = 1; // @gotags: copier:"notebookResp"
NotebookResp notebookResp = 1; // @gotags: copier:"NotebookResp"
}
message CreateNotebookParam{
string description = 1; // @gotags: copier:"description"
int64 duration = 2; // @gotags: copier:"duration"
repeated EndpointsReq endpoints = 3; // @gotags: copier:"endpoints"
string feature = 4; // @gotags: copier:"feature"
string flavor = 5; // @gotags: copier:"flavor"
string image_id = 6; // @gotags: copier:"image_id"
string name = 7; // @gotags: copier:"name"
string pool_id = 8; // @gotags: copier:"pool_id"
VolumeReq volume = 9; // @gotags: copier:"volume"
string workspace_id = 10; // @gotags: copier:"workspace_id"
CustomHooks hooks = 11; // @gotags: copier:"hooks"
LeaseReq lease = 12; // @gotags: copier:"lease"
string description = 1; // @gotags: copier:"Description"
int64 duration = 2; // @gotags: copier:"Duration"
repeated EndpointsReq endpoints = 3; // @gotags: copier:"Endpoints"
string feature = 4; // @gotags: copier:"Feature"
string flavor = 5; // @gotags: copier:"Flavor"
string image_id = 6; // @gotags: copier:"ImageId"
string name = 7; // @gotags: copier:"Name"
string pool_id = 8; // @gotags: copier:"PoolId"
VolumeReq volume = 9; // @gotags: copier:"Volume"
string workspace_id = 10; // @gotags: copier:"WorkspaceId"
CustomHooks hooks = 11; // @gotags: copier:"Hooks"
LeaseReq lease = 12; // @gotags: copier:"Lease"
}
message StartNotebookReq{
string id = 1; // @gotags: copier:"id"
string project_id = 2; // @gotags: copier:"project_id"
StartNotebookParam param = 3; // @gotags: copier:"param"
string id = 1; // @gotags: copier:"Id"
string project_id = 2; // @gotags: copier:"ProjectId"
StartNotebookParam param = 3; // @gotags: copier:"Param"
}
message StartNotebookResp{
NotebookResp notebookResp = 1; // @gotags: copier:"notebookResp"
NotebookResp notebookResp = 1; // @gotags: copier:"NotebookResp"
}
message StartNotebookParam{
int64 duration = 1; // @gotags: copier:"duration"
string type = 2; // @gotags: copier:"type_start_notebook"
int64 duration = 1; // @gotags: copier:"Duration"
string type = 2; // @gotags: copier:"TypeStartNotebook"
}
message StopNotebookReq{
string id = 1; // @gotags: copier:"id"
string project_id = 2; // @gotags: copier:"project_id"
string id = 1; // @gotags: copier:"Id"
string project_id = 2; // @gotags: copier:"ProjectId"
}
message StopNotebookResp{
NotebookResp notebookResp = 1; // @gotags: copier:"notebookResp"
NotebookResp notebookResp = 1; // @gotags: copier:"NotebookResp"
}
message GetNotebookStorageReq{
string instance_id = 1; // @gotags: copier:"instance_id"
string project_id = 2; // @gotags: copier:"project_id"
string instance_id = 1; // @gotags: copier:"InstanceId"
string project_id = 2; // @gotags: copier:"ProjectId"
}
message GetNotebookStorageResp{
int32 current = 1; // @gotags: copier:"current"
repeated DataVolumesRes data = 2; // @gotags: copier:"data"
int32 pages = 3; // @gotags: copier:"pages"
int32 size = 4; // @gotags: copier:"size"
int64 total = 5; // @gotags: copier:"total"
int32 current = 1; // @gotags: copier:"Current"
repeated DataVolumesRes data = 2; // @gotags: copier:"Data"
int32 pages = 3; // @gotags: copier:"Pages"
int32 size = 4; // @gotags: copier:"Size"
int64 total = 5; // @gotags: copier:"Total"
}
message MountNotebookStorageReq{
string instance_id = 1; // @gotags: copier:"instance_id"
string project_id = 2; // @gotags: copier:"project_id"
MountNotebookStorageParam param = 3; // @gotags: copier:"param"
string instance_id = 1; // @gotags: copier:"InstanceId"
string project_id = 2; // @gotags: copier:"ProjectId"
MountNotebookStorageParam param = 3; // @gotags: copier:"Param"
}
message MountNotebookStorageResp{
string category = 1; // @gotags: copier:"category"
string id = 2; // @gotags: copier:"id"
string mount_path = 3; // @gotags: copier:"mount_path"
string status = 4; // @gotags: copier:"status"
string uri = 5; // @gotags: copier:"uri"
string category = 1; // @gotags: copier:"Category"
string id = 2; // @gotags: copier:"Id"
string mount_path = 3; // @gotags: copier:"MountPath"
string status = 4; // @gotags: copier:"Status"
string uri = 5; // @gotags: copier:"Uri"
}
message MountNotebookStorageParam{
string category = 1; // @gotags: copier:"category"
string mount_path = 2; // @gotags: copier:"mount_path"
string uri = 3; // @gotags: copier:"uri"
string category = 1; // @gotags: copier:"Category"
string mount_path = 2; // @gotags: copier:"MountPath"
string uri = 3; // @gotags: copier:"Uri"
}
message DataVolumesRes{
string category = 1; // @gotags: copier:"category"
string id = 2; // @gotags: copier:"id"
string mount_path = 3; // @gotags: copier:"mount_path"
string status = 4; // @gotags: copier:"status"
string uri = 5; // @gotags: copier:"uri"
string category = 1; // @gotags: copier:"Category"
string id = 2; // @gotags: copier:"Id"
string mount_path = 3; // @gotags: copier:"MountPath"
string status = 4; // @gotags: copier:"Status"
string uri = 5; // @gotags: copier:"Uri"
}
message NotebookResp{
repeated JobProgress action_progress = 1; // @gotags: copier:"action_progress"
string description = 2; // @gotags: copier:"description"
repeated EndpointsRes endpoints = 3; // @gotags: copier:"endpoints"
string fail_reason = 4; // @gotags: copier:"fail_reason"
string flavor = 5; // @gotags: copier:"flavor"
string id = 6; // @gotags: copier:"id"
Image image = 7; // @gotags: copier:"image"
Lease lease = 8; // @gotags: copier:"lease"
string name = 9; // @gotags: copier:"name"
Pool pool = 10; // @gotags: copier:"pool"
string status = 11; // @gotags: copier:"status"
string token = 12; // @gotags: copier:"token"
string url = 13; // @gotags: copier:"url"
VolumeRes volume = 14; // @gotags: copier:"volume"
string workspace_id = 15; // @gotags: copier:"workspace_id"
string feature = 16; // @gotags: copier:"feature"
repeated JobProgress action_progress = 1; // @gotags: copier:"ActionProgress"
string description = 2; // @gotags: copier:"Description"
repeated EndpointsRes endpoints = 3; // @gotags: copier:"Endpoints"
string fail_reason = 4; // @gotags: copier:"FailReason"
string flavor = 5; // @gotags: copier:"Flavor"
string id = 6; // @gotags: copier:"Id"
Image image = 7; // @gotags: copier:"Image"
Lease lease = 8; // @gotags: copier:"Lease"
string name = 9; // @gotags: copier:"Name"
Pool pool = 10; // @gotags: copier:"Pool"
string status = 11; // @gotags: copier:"Status"
string token = 12; // @gotags: copier:"Token"
string url = 13; // @gotags: copier:"Url"
VolumeRes volume = 14; // @gotags: copier:"Volume"
string workspace_id = 15; // @gotags: copier:"WorkspaceId"
string feature = 16; // @gotags: copier:"Feature"
}
message JobProgress{
string notebook_id = 1; // @gotags: copier:"notebook_id"
string status = 2; // @gotags: copier:"status"
int32 step = 3; // @gotags: copier:"step"
string step_description = 4; // @gotags: copier:"step_description"
string notebook_id = 1; // @gotags: copier:"NotebookId"
string status = 2; // @gotags: copier:"Status"
int32 step = 3; // @gotags: copier:"Step"
string step_description = 4; // @gotags: copier:"StepDescription"
}
message EndpointsRes{
repeated string allowed_access_ips = 1; // @gotags: copier:"allowed_access_ips"
string dev_service = 2; // @gotags: copier:"dev_service"
repeated string ssh_keys = 3; // @gotags: copier:"ssh_keys"
repeated string allowed_access_ips = 1; // @gotags: copier:"AllowedAccessIps"
string dev_service = 2; // @gotags: copier:"DevService"
repeated string ssh_keys = 3; // @gotags: copier:"SshKeys"
}
message Image{
string arch = 1; // @gotags: copier:"arch"
int64 create_at = 2; // @gotags: copier:"create_at"
string description = 3; // @gotags: copier:"description"
repeated string dev_services = 4; // @gotags: copier:"dev_services"
string id = 5; // @gotags: copier:"id"
string name = 6; // @gotags: copier:"name"
string namespace = 7; // @gotags: copier:"namespace"
string origin = 8; // @gotags: copier:"origin"
repeated string resource_categories = 9; // @gotags: copier:"resource_categories"
string service_type = 10; // @gotags: copier:"service_type"
int64 size = 11; // @gotags: copier:"size"
string status = 12; // @gotags: copier:"status"
string status_message = 13; // @gotags: copier:"status_message"
repeated string support_res_categories = 14; // @gotags: copier:"support_res_categories"
string swr_path = 15; // @gotags: copier:"swr_path"
string tag = 16; // @gotags: copier:"tag"
string type = 17; // @gotags: copier:"type_image"
int64 update_at = 18; // @gotags: copier:"update_at"
string visibility = 19; // @gotags: copier:"visibility"
string workspace_id = 20; // @gotags: copier:"workspace_id"
string arch = 1; // @gotags: copier:"Arch"
int64 create_at = 2; // @gotags: copier:"CreateAt"
string description = 3; // @gotags: copier:"Description"
repeated string dev_services = 4; // @gotags: copier:"DevServices"
string id = 5; // @gotags: copier:"Id"
string name = 6; // @gotags: copier:"Name"
string namespace = 7; // @gotags: copier:"Namespace"
string origin = 8; // @gotags: copier:"Origin"
repeated string resource_categories = 9; // @gotags: copier:"ResourceCategories"
string service_type = 10; // @gotags: copier:"ServiceType"
int64 size = 11; // @gotags: copier:"Size"
string status = 12; // @gotags: copier:"Status"
string status_message = 13; // @gotags: copier:"StatusMessage"
repeated string support_res_categories = 14; // @gotags: copier:"SupportResCategories"
string swr_path = 15; // @gotags: copier:"SwrPath"
string tag = 16; // @gotags: copier:"Tag"
string type = 17; // @gotags: copier:"TypeImage"
int64 update_at = 18; // @gotags: copier:"UpdateAt"
string visibility = 19; // @gotags: copier:"Visibility"
string workspace_id = 20; // @gotags: copier:"WorkspaceId"
}
message Lease{
int64 create_at = 1; // @gotags: copier:"create_at"
int64 duration = 2; // @gotags: copier:"duration"
bool enable = 3; // @gotags: copier:"enable"
string type = 4; // @gotags: copier:"type_lease"
int64 update_at = 5; // @gotags: copier:"update_at"
int64 create_at = 1; // @gotags: copier:"CreateAt"
int64 duration = 2; // @gotags: copier:"Duration"
bool enable = 3; // @gotags: copier:"Enable"
string type = 4; // @gotags: copier:"TypeLease"
int64 update_at = 5; // @gotags: copier:"UpdateAt"
}
message Pool{
string id = 1; // @gotags: copier:"id"
string name = 2; // @gotags: copier:"name"
string id = 1; // @gotags: copier:"Id"
string name = 2; // @gotags: copier:"Name"
}
message VolumeRes{
int64 capacity = 1; // @gotags: copier:"capacity"
string category = 2; // @gotags: copier:"category"
string mount_path = 3; // @gotags: copier:"mount_path"
string ownership = 4; // @gotags: copier:"ownership"
string status = 5; // @gotags: copier:"status"
int64 capacity = 1; // @gotags: copier:"Capacity"
string category = 2; // @gotags: copier:"Category"
string mount_path = 3; // @gotags: copier:"MountPath"
string ownership = 4; // @gotags: copier:"Ownership"
string status = 5; // @gotags: copier:"Status"
}
message EndpointsReq{
repeated string allowed_access_ips = 1; // @gotags: copier:"allowed_access_ips"
string dev_service = 2; // @gotags: copier:"dev_service"
repeated string ssh_keys = 3; // @gotags: copier:"ssh_keys"
repeated string allowed_access_ips = 1; // @gotags: copier:"AllowedAccessIps"
string dev_service = 2; // @gotags: copier:"DevService"
repeated string ssh_keys = 3; // @gotags: copier:"SshKeys"
}
message VolumeReq{
int64 capacity = 1; // @gotags: copier:"capacity"
string category = 2; // @gotags: copier:"category"
string ownership = 3; // @gotags: copier:"ownership"
string uri = 4; // @gotags: copier:"uri"
int64 capacity = 1; // @gotags: copier:"Capacity"
string category = 2; // @gotags: copier:"Category"
string ownership = 3; // @gotags: copier:"Ownership"
string uri = 4; // @gotags: copier:"Uri"
}
message CustomHooks{
ContainerHooks container_hooks = 1; // @gotags: copier:"container_hooks"
ContainerHooks container_hooks = 1; // @gotags: copier:"ContainerHooks"
}
message ContainerHooks{
Config post_start = 1; // @gotags: copier:"post_start"
Config pre_start = 2; // @gotags: copier:"pre_start"
Config post_start = 1; // @gotags: copier:"PostStart"
Config pre_start = 2; // @gotags: copier:"PreStart"
}
message Config{
string script = 1; // @gotags: copier:"script"
string type = 2; // @gotags: copier:"type_config"
string script = 1; // @gotags: copier:"Script"
string type = 2; // @gotags: copier:"TypeConfig"
}
message LeaseReq{
int64 duration = 1; // @gotags: copier:"duration"
string type = 2; // @gotags: copier:"type_lease_req"
int64 duration = 1; // @gotags: copier:"Duration"
string type = 2; // @gotags: copier:"TypeLeaseReq"
}
/******************Notebook End*************************/

View File

@ -1047,198 +1047,198 @@ type (
Param ListNotebookParam `json:"param,optional" copier:"Param"`
}
ListNotebookResp {
Current int32 `json:"current"`
Data []NotebookResp `json:"data"`
Pages int32 `json:"pages"`
Size int32 `json:"size"`
Total int64 `json:"total"`
Current int32 `json:"current" copier:"Current"`
Data []NotebookResp `json:"data" copier:"Data"`
Pages int32 `json:"pages" copier:"Pages"`
Size int32 `json:"size" copier:"Size"`
Total int64 `json:"total" copier:"Total"`
}
ListNotebookParam {
Feature string `json:"feature,optional"`
Limit int32 `json:"limit,optional"`
Name string `json:"name,optional"`
Pool_id string `json:"pool_id,optional"`
Offset int32 `json:"offset,optional"`
Owner string `json:"owner,optional"`
Sort_dir string `json:"sort_dir,optional"`
Sort_key string `json:"sort_key,optional"`
Status string `json:"status,optional"`
WorkspaceId string `json:"workspaceId,optional"`
Feature string `json:"feature,optional" copier:"Feature"`
Limit int32 `json:"limit,optional" copier:"Limit"`
Name string `json:"name,optional" copier:"Name"`
PoolId string `json:"pool_id,optional" copier:"PoolId"`
Offset int32 `json:"offset,optional" copier:"Offset"`
Owner string `json:"owner,optional" copier:"Owner"`
SortDir string `json:"sort_dir,optional" copier:"SortDir"`
SortKey string `json:"sort_key,optional" copier:"SortKey"`
Status string `json:"status,optional" copier:"Status"`
WorkspaceId string `json:"workspaceId,optional" copier:"WorkspaceId"`
}
CreateNotebookReq {
Project_id string `json:"project_id"`
Param CreateNotebookParam `json:"param"`
ProjectId string `json:"project_id" copier:"ProjectId"`
Param CreateNotebookParam `json:"param" copier:"Param"`
}
CreateNotebookResp {
NotebookResp NotebookResp `json:"notebookResp"`
NotebookResp NotebookResp `json:"notebookResp" copier:"NotebookResp"`
}
CreateNotebookParam {
Description string `json:"description"`
Duration int64 `json:"duration"`
Endpoints []EndpointsReq `json:"endpoints"`
Feature string `json:"feature"`
Flavor string `json:"flavor"`
Image_id string `json:"image_id"`
Name string `json:"name"`
Pool_id string `json:"pool_id"`
Volume VolumeReq `json:"volume"`
Workspace_id string `json:"workspace_id"`
Hooks CustomHooks `json:"hooks"`
Lease LeaseReq `json:"lease"`
Description string `json:"description" copier:"Description"`
Duration int64 `json:"duration" copier:"Duration"`
Endpoints []EndpointsReq `json:"endpoints" copier:"Endpoints"`
Feature string `json:"feature" copier:"Feature"`
Flavor string `json:"flavor" copier:"Flavor"`
ImageId string `json:"image_id" copier:"ImageId"`
Name string `json:"name" copier:"Name"`
PoolId string `json:"pool_id" copier:"PoolId"`
Volume VolumeReq `json:"volume" copier:"Volume"`
WorkspaceId string `json:"workspace_id" copier:"WorkspaceId"`
Hooks CustomHooks `json:"hooks" copier:"Hooks"`
Lease LeaseReq `json:"lease" copier:"Lease"`
}
StartNotebookReq {
Id string `json:"id"`
Project_id string `json:"project_id"`
Param StartNotebookParam `json:"param"`
Id string `json:"id" copier:"Id"`
ProjectId string `json:"project_id" copier:"ProjectId"`
Param StartNotebookParam `json:"param" copier:"Param"`
}
StartNotebookResp {
NotebookResp NotebookResp `json:"notebookResp"`
NotebookResp NotebookResp `json:"notebookResp" copier:"NotebookResp"`
}
StartNotebookParam {
Duration int64 `json:"duration"`
Type_start_notebook string `json:"type"`
Duration int64 `json:"duration" copier:"Duration"`
TypeStartNotebook string `json:"type" copier:"TypeStartNotebook"`
}
StopNotebookReq {
Id string `json:"id"`
Project_id string `json:"project_id"`
Id string `json:"id" copier:"Id"`
ProjectId string `json:"project_id" copier:"ProjectId"`
}
StopNotebookResp {
NotebookResp NotebookResp `json:"notebookResp"`
NotebookResp NotebookResp `json:"notebookResp" copier:"NotebookResp"`
}
GetNotebookStorageReq {
Instance_id string `json:"instance_id"`
Project_id string `json:"project_id"`
InstanceId string `json:"instance_id" copier:"InstanceId"`
ProjectId string `json:"project_id" copier:"ProjectId"`
}
GetNotebookStorageResp {
Current int32 `json:"current"`
Data []DataVolumesRes `json:"data"`
Pages int32 `json:"pages"`
Size int32 `json:"size"`
Total int64 `json:"total"`
Current int32 `json:"current" copier:"Current"`
Data []DataVolumesRes `json:"data" copier:"Data"`
Pages int32 `json:"pages" copier:"Pages"`
Size int32 `json:"size" copier:"Size"`
Total int64 `json:"total" copier:"Total"`
}
MountNotebookStorageReq {
Instance_id string `json:"instance_id"`
Project_id string `json:"project_id"`
Param MountNotebookStorageParam `json:"param"`
InstanceId string `json:"instance_id" copier:"InstanceId"`
ProjectId string `json:"project_id" copier:"ProjectId"`
Param MountNotebookStorageParam `json:"param" copier:"Param"`
}
MountNotebookStorageResp {
Category string `json:"category"`
Id string `json:"id"`
Mount_path string `json:"mount_path"`
Status string `json:"status"`
Uri string `json:"uri"`
Category string `json:"category" copier:"Category"`
Id string `json:"id" copier:"Id"`
MountPath string `json:"mount_path" copier:"MountPath"`
Status string `json:"status" copier:"Status"`
Uri string `json:"uri" copier:"Uri"`
}
MountNotebookStorageParam {
Category string `json:"category"`
Mount_path string `json:"mount_path"`
Uri string `json:"uri"`
Category string `json:"category" copier:"Category"`
MountPath string `json:"mount_path" copier:"MountPath"`
Uri string `json:"uri" copier:"Uri"`
}
DataVolumesRes {
Category string `json:"category"`
Id string `json:"id"`
Mount_path string `json:"mount_path"`
Status string `json:"status"`
Uri string `json:"uri"`
Category string `json:"category" copier:"Category"`
Id string `json:"id" copier:"Id"`
MountPath string `json:"mount_path" copier:"MountPath"`
Status string `json:"status" copier:"Status"`
Uri string `json:"uri" copier:"Uri"`
}
NotebookResp {
Action_progress []JobProgress `json:"action_progress"`
Description string `json:"description"`
Endpoints []EndpointsRes `json:"endpoints"`
Fail_reason string `json:"fail_reason"`
Flavor string `json:"flavor"`
Id string `json:"id"`
Image Image `json:"image"`
Lease Lease `json:"lease"`
Name string `json:"name"`
Pool Pool `json:"pool"`
Status string `json:"status"`
Token string `json:"token"`
Url string `json:"url"`
Volume VolumeRes `json:"volume"`
Workspace_id string `json:"workspace_id"`
Feature string `json:"feature"`
ActionProgress []JobProgress `json:"action_progress" copier:"ActionProgress"`
Description string `json:"description" copier:"Description"`
Endpoints []EndpointsRes `json:"endpoints" copier:"Endpoints"`
FailReason string `json:"fail_reason" copier:"FailReason"`
Flavor string `json:"flavor" copier:"Flavor"`
Id string `json:"id" copier:"Id"`
Image Image `json:"image" copier:"Image"`
Lease Lease `json:"lease" copier:"Lease"`
Name string `json:"name" copier:"Name"`
Pool Pool `json:"pool" copier:"Pool"`
Status string `json:"status" copier:"Status"`
Token string `json:"token" copier:"Token"`
Url string `json:"url" copier:"Url"`
Volume VolumeRes `json:"volume" copier:"Volume"`
WorkspaceId string `json:"workspace_id" copier:"WorkspaceId"`
Feature string `json:"feature" copier:"Feature"`
}
JobProgress {
Notebook_id string `json:"notebook_id"`
Status string `json:"status"`
Step int32 `json:"step"`
Step_description string `json:"step_description"`
NotebookId string `json:"notebook_id" copier:"NotebookId"`
Status string `json:"status" copier:"Status"`
Step int32 `json:"step" copier:"Step"`
StepDescription string `json:"step_description" copier:"StepDescription"`
}
EndpointsRes {
Allowed_access_ips []string `json:"allowed_access_ips"`
Dev_service string `json:"dev_service"`
Ssh_keys []string `json:"ssh_keys"`
AllowedAccessIps []string `json:"allowed_access_ips" copier:"AllowedAccessIps"`
DevService string `json:"dev_service" copier:"DevService"`
SshKeys []string `json:"ssh_keys" copier:"SshKeys"`
}
Image {
Arch string `json:"arch"`
Create_at int64 `json:"create_at"`
Description string `json:"description"`
Dev_services []string `json:"dev_services"`
Id string `json:"id"`
Name string `json:"name"`
Namespace string `json:"namespace"`
Origin string `json:"origin"`
Resource_categories []string `json:"resource_categories"`
Service_type string `json:"service_type"`
Size int64 `json:"size"`
Status string `json:"status"`
Status_message string `json:"status_message"`
Support_res_categories []string `json:"support_res_categories"`
Swr_path string `json:"swr_path"`
Tag string `json:"tag"`
Type_image string `json:"type"`
Update_at int64 `json:"update_at"`
Visibility string `json:"visibility"`
Workspace_id string `json:"workspace_id"`
Arch string `json:"arch" copier:"Arch"`
CreateAt int64 `json:"create_at" copier:"CreateAt"`
Description string `json:"description" copier:"Description"`
DevServices []string `json:"dev_services" copier:"DevServices"`
Id string `json:"id" copier:"Id"`
Name string `json:"name" copier:"Name"`
Namespace string `json:"namespace" copier:"Namespace"`
Origin string `json:"origin" copier:"Origin"`
ResourceCategories []string `json:"resource_categories" copier:"ResourceCategories"`
ServiceType string `json:"service_type" copier:"ServiceType"`
Size int64 `json:"size" copier:"Size"`
Status string `json:"status" copier:"Status"`
StatusMessage string `json:"status_message" copier:"StatusMessage"`
SupportResCategories []string `json:"support_res_categories" copier:"SupportResCategories"`
SwrPath string `json:"swr_path" copier:"SwrPath"`
Tag string `json:"tag" copier:"Tag"`
TypeImage string `json:"type" copier:"TypeImage"`
UpdateAt int64 `json:"update_at" copier:"UpdateAt"`
Visibility string `json:"visibility" copier:"Visibility"`
WorkspaceId string `json:"workspace_id" copier:"WorkspaceId"`
}
Lease {
Create_at int64 `json:"create_at"`
Duration int64 `json:"duration"`
Enable bool `json:"enable"`
Type_lease string `json:"type"`
Update_at int64 `json:"update_at"`
CreateAt int64 `json:"create_at" copier:"CreateAt"`
Duration int64 `json:"duration" copier:"Duration"`
Enable bool `json:"enable" copier:"Enable"`
TypeLease string `json:"type" copier:"TypeLease"`
UpdateAt int64 `json:"update_at" copier:"UpdateAt"`
}
Pool {
Id string `json:"id"`
Name string `json:"name"`
Id string `json:"id" copier:"Id"`
Name string `json:"name" copier:"Name"`
}
VolumeRes {
Capacity int64 `json:"capacity"`
Category string `json:"category"`
Mount_path string `json:"mount_path"`
Ownership string `json:"ownership"`
Status string `json:"status"`
Capacity int64 `json:"capacity" copier:"Capacity"`
Category string `json:"category" copier:"Category"`
MountPath string `json:"mount_path" copier:"MountPath"`
Ownership string `json:"ownership" copier:"Ownership"`
Status string `json:"status" copier:"Status"`
}
EndpointsReq {
Allowed_access_ips []string `json:"allowed_access_ips"`
Dev_service string `json:"dev_service"`
Ssh_keys []string `json:"ssh_keys"`
AllowedAccessIps []string `json:"allowed_access_ips" copier:"AllowedAccessIps"`
DevService string `json:"dev_service" copier:"DevService"`
SshKeys []string `json:"ssh_keys" copier:"SshKeys"`
}
VolumeReq {
Capacity int64 `json:"capacity"`
Category string `json:"category"`
Ownership string `json:"ownership"`
Uri string `json:"uri"`
Capacity int64 `json:"capacity" copier:"Capacity"`
Category string `json:"category" copier:"Category"`
Ownership string `json:"ownership" copier:"Ownership"`
Uri string `json:"uri" copier:"Uri"`
}
CustomHooks {
Container_hooks ContainerHooks `json:"container_hooks"`
ContainerHooks ContainerHooks `json:"container_hooks" copier:"ContainerHooks"`
}
ContainerHooks {
Post_start Config `json:"post_start"`
Pre_start Config `json:"pre_start"`
PostStart Config `json:"post_start" copier:"PostStart"`
PreStart Config `json:"pre_start" copier:"PreStart"`
}
Config {
Script string `json:"script"`
Type_config string `json:"type"`
Script string `json:"script" copier:"Script"`
TypeConfig string `json:"type" copier:"TypeConfig"`
}
LeaseReq {
Duration int64 `json:"duration"`
Type_lease_req string `json:"type"`
Duration int64 `json:"duration" copier:"Duration"`
TypeLeaseReq string `json:"type" copier:"TypeLeaseReq"`
}
)
/******************Notebook Type end*************************/

View File

@ -1432,221 +1432,221 @@ type ListNotebookReq struct {
}
type ListNotebookResp struct {
Current int32 `json:"current"`
Data []NotebookResp `json:"data"`
Pages int32 `json:"pages"`
Size int32 `json:"size"`
Total int64 `json:"total"`
Current int32 `json:"current" copier:"Current"`
Data []NotebookResp `json:"data" copier:"Data"`
Pages int32 `json:"pages" copier:"Pages"`
Size int32 `json:"size" copier:"Size"`
Total int64 `json:"total" copier:"Total"`
}
type ListNotebookParam struct {
Feature string `json:"feature,optional"`
Limit int32 `json:"limit,optional"`
Name string `json:"name,optional"`
Pool_id string `json:"pool_id,optional"`
Offset int32 `json:"offset,optional"`
Owner string `json:"owner,optional"`
Sort_dir string `json:"sort_dir,optional"`
Sort_key string `json:"sort_key,optional"`
Status string `json:"status,optional"`
WorkspaceId string `json:"workspaceId,optional"`
Feature string `json:"feature,optional" copier:"Feature"`
Limit int32 `json:"limit,optional" copier:"Limit"`
Name string `json:"name,optional" copier:"Name"`
PoolId string `json:"pool_id,optional" copier:"PoolId"`
Offset int32 `json:"offset,optional" copier:"Offset"`
Owner string `json:"owner,optional" copier:"Owner"`
SortDir string `json:"sort_dir,optional" copier:"SortDir"`
SortKey string `json:"sort_key,optional" copier:"SortKey"`
Status string `json:"status,optional" copier:"Status"`
WorkspaceId string `json:"workspaceId,optional" copier:"WorkspaceId"`
}
type CreateNotebookReq struct {
Project_id string `json:"project_id"`
Param CreateNotebookParam `json:"param"`
ProjectId string `json:"project_id" copier:"ProjectId"`
Param CreateNotebookParam `json:"param" copier:"Param"`
}
type CreateNotebookResp struct {
NotebookResp NotebookResp `json:"notebookResp"`
NotebookResp NotebookResp `json:"notebookResp" copier:"NotebookResp"`
}
type CreateNotebookParam struct {
Description string `json:"description"`
Duration int64 `json:"duration"`
Endpoints []EndpointsReq `json:"endpoints"`
Feature string `json:"feature"`
Flavor string `json:"flavor"`
Image_id string `json:"image_id"`
Name string `json:"name"`
Pool_id string `json:"pool_id"`
Volume VolumeReq `json:"volume"`
Workspace_id string `json:"workspace_id"`
Hooks CustomHooks `json:"hooks"`
Lease LeaseReq `json:"lease"`
Description string `json:"description" copier:"Description"`
Duration int64 `json:"duration" copier:"Duration"`
Endpoints []EndpointsReq `json:"endpoints" copier:"Endpoints"`
Feature string `json:"feature" copier:"Feature"`
Flavor string `json:"flavor" copier:"Flavor"`
ImageId string `json:"image_id" copier:"ImageId"`
Name string `json:"name" copier:"Name"`
PoolId string `json:"pool_id" copier:"PoolId"`
Volume VolumeReq `json:"volume" copier:"Volume"`
WorkspaceId string `json:"workspace_id" copier:"WorkspaceId"`
Hooks CustomHooks `json:"hooks" copier:"Hooks"`
Lease LeaseReq `json:"lease" copier:"Lease"`
}
type StartNotebookReq struct {
Id string `json:"id"`
Project_id string `json:"project_id"`
Param StartNotebookParam `json:"param"`
Id string `json:"id" copier:"Id"`
ProjectId string `json:"project_id" copier:"ProjectId"`
Param StartNotebookParam `json:"param" copier:"Param"`
}
type StartNotebookResp struct {
NotebookResp NotebookResp `json:"notebookResp"`
NotebookResp NotebookResp `json:"notebookResp" copier:"NotebookResp"`
}
type StartNotebookParam struct {
Duration int64 `json:"duration"`
Type_start_notebook string `json:"type"`
Duration int64 `json:"duration" copier:"Duration"`
TypeStartNotebook string `json:"type" copier:"TypeStartNotebook"`
}
type StopNotebookReq struct {
Id string `json:"id"`
Project_id string `json:"project_id"`
Id string `json:"id" copier:"Id"`
ProjectId string `json:"project_id" copier:"ProjectId"`
}
type StopNotebookResp struct {
NotebookResp NotebookResp `json:"notebookResp"`
NotebookResp NotebookResp `json:"notebookResp" copier:"NotebookResp"`
}
type GetNotebookStorageReq struct {
Instance_id string `json:"instance_id"`
Project_id string `json:"project_id"`
InstanceId string `json:"instance_id" copier:"InstanceId"`
ProjectId string `json:"project_id" copier:"ProjectId"`
}
type GetNotebookStorageResp struct {
Current int32 `json:"current"`
Data []DataVolumesRes `json:"data"`
Pages int32 `json:"pages"`
Size int32 `json:"size"`
Total int64 `json:"total"`
Current int32 `json:"current" copier:"Current"`
Data []DataVolumesRes `json:"data" copier:"Data"`
Pages int32 `json:"pages" copier:"Pages"`
Size int32 `json:"size" copier:"Size"`
Total int64 `json:"total" copier:"Total"`
}
type MountNotebookStorageReq struct {
Instance_id string `json:"instance_id"`
Project_id string `json:"project_id"`
Param MountNotebookStorageParam `json:"param"`
InstanceId string `json:"instance_id" copier:"InstanceId"`
ProjectId string `json:"project_id" copier:"ProjectId"`
Param MountNotebookStorageParam `json:"param" copier:"Param"`
}
type MountNotebookStorageResp struct {
Category string `json:"category"`
Id string `json:"id"`
Mount_path string `json:"mount_path"`
Status string `json:"status"`
Uri string `json:"uri"`
Category string `json:"category" copier:"Category"`
Id string `json:"id" copier:"Id"`
MountPath string `json:"mount_path" copier:"MountPath"`
Status string `json:"status" copier:"Status"`
Uri string `json:"uri" copier:"Uri"`
}
type MountNotebookStorageParam struct {
Category string `json:"category"`
Mount_path string `json:"mount_path"`
Uri string `json:"uri"`
Category string `json:"category" copier:"Category"`
MountPath string `json:"mount_path" copier:"MountPath"`
Uri string `json:"uri" copier:"Uri"`
}
type DataVolumesRes struct {
Category string `json:"category"`
Id string `json:"id"`
Mount_path string `json:"mount_path"`
Status string `json:"status"`
Uri string `json:"uri"`
Category string `json:"category" copier:"Category"`
Id string `json:"id" copier:"Id"`
MountPath string `json:"mount_path" copier:"MountPath"`
Status string `json:"status" copier:"Status"`
Uri string `json:"uri" copier:"Uri"`
}
type NotebookResp struct {
Action_progress []JobProgress `json:"action_progress"`
Description string `json:"description"`
Endpoints []EndpointsRes `json:"endpoints"`
Fail_reason string `json:"fail_reason"`
Flavor string `json:"flavor"`
Id string `json:"id"`
Image Image `json:"image"`
Lease Lease `json:"lease"`
Name string `json:"name"`
Pool Pool `json:"pool"`
Status string `json:"status"`
Token string `json:"token"`
Url string `json:"url"`
Volume VolumeRes `json:"volume"`
Workspace_id string `json:"workspace_id"`
Feature string `json:"feature"`
ActionProgress []JobProgress `json:"action_progress" copier:"ActionProgress"`
Description string `json:"description" copier:"Description"`
Endpoints []EndpointsRes `json:"endpoints" copier:"Endpoints"`
FailReason string `json:"fail_reason" copier:"FailReason"`
Flavor string `json:"flavor" copier:"Flavor"`
Id string `json:"id" copier:"Id"`
Image Image `json:"image" copier:"Image"`
Lease Lease `json:"lease" copier:"Lease"`
Name string `json:"name" copier:"Name"`
Pool Pool `json:"pool" copier:"Pool"`
Status string `json:"status" copier:"Status"`
Token string `json:"token" copier:"Token"`
Url string `json:"url" copier:"Url"`
Volume VolumeRes `json:"volume" copier:"Volume"`
WorkspaceId string `json:"workspace_id" copier:"WorkspaceId"`
Feature string `json:"feature" copier:"Feature"`
}
type JobProgress struct {
Notebook_id string `json:"notebook_id"`
Status string `json:"status"`
Step int32 `json:"step"`
Step_description string `json:"step_description"`
NotebookId string `json:"notebook_id" copier:"NotebookId"`
Status string `json:"status" copier:"Status"`
Step int32 `json:"step" copier:"Step"`
StepDescription string `json:"step_description" copier:"StepDescription"`
}
type EndpointsRes struct {
Allowed_access_ips []string `json:"allowed_access_ips"`
Dev_service string `json:"dev_service"`
Ssh_keys []string `json:"ssh_keys"`
AllowedAccessIps []string `json:"allowed_access_ips" copier:"AllowedAccessIps"`
DevService string `json:"dev_service" copier:"DevService"`
SshKeys []string `json:"ssh_keys" copier:"SshKeys"`
}
type Image struct {
Arch string `json:"arch"`
Create_at int64 `json:"create_at"`
Description string `json:"description"`
Dev_services []string `json:"dev_services"`
Id string `json:"id"`
Name string `json:"name"`
Namespace string `json:"namespace"`
Origin string `json:"origin"`
Resource_categories []string `json:"resource_categories"`
Service_type string `json:"service_type"`
Size int64 `json:"size"`
Status string `json:"status"`
Status_message string `json:"status_message"`
Support_res_categories []string `json:"support_res_categories"`
Swr_path string `json:"swr_path"`
Tag string `json:"tag"`
Type_image string `json:"type"`
Update_at int64 `json:"update_at"`
Visibility string `json:"visibility"`
Workspace_id string `json:"workspace_id"`
Arch string `json:"arch" copier:"Arch"`
CreateAt int64 `json:"create_at" copier:"CreateAt"`
Description string `json:"description" copier:"Description"`
DevServices []string `json:"dev_services" copier:"DevServices"`
Id string `json:"id" copier:"Id"`
Name string `json:"name" copier:"Name"`
Namespace string `json:"namespace" copier:"Namespace"`
Origin string `json:"origin" copier:"Origin"`
ResourceCategories []string `json:"resource_categories" copier:"ResourceCategories"`
ServiceType string `json:"service_type" copier:"ServiceType"`
Size int64 `json:"size" copier:"Size"`
Status string `json:"status" copier:"Status"`
StatusMessage string `json:"status_message" copier:"StatusMessage"`
SupportResCategories []string `json:"support_res_categories" copier:"SupportResCategories"`
SwrPath string `json:"swr_path" copier:"SwrPath"`
Tag string `json:"tag" copier:"Tag"`
TypeImage string `json:"type" copier:"TypeImage"`
UpdateAt int64 `json:"update_at" copier:"UpdateAt"`
Visibility string `json:"visibility" copier:"Visibility"`
WorkspaceId string `json:"workspace_id" copier:"WorkspaceId"`
}
type Lease struct {
Create_at int64 `json:"create_at"`
Duration int64 `json:"duration"`
Enable bool `json:"enable"`
Type_lease string `json:"type"`
Update_at int64 `json:"update_at"`
CreateAt int64 `json:"create_at" copier:"CreateAt"`
Duration int64 `json:"duration" copier:"Duration"`
Enable bool `json:"enable" copier:"Enable"`
TypeLease string `json:"type" copier:"TypeLease"`
UpdateAt int64 `json:"update_at" copier:"UpdateAt"`
}
type Pool struct {
Id string `json:"id"`
Name string `json:"name"`
Id string `json:"id" copier:"Id"`
Name string `json:"name" copier:"Name"`
}
type VolumeRes struct {
Capacity int64 `json:"capacity"`
Category string `json:"category"`
Mount_path string `json:"mount_path"`
Ownership string `json:"ownership"`
Status string `json:"status"`
Capacity int64 `json:"capacity" copier:"Capacity"`
Category string `json:"category" copier:"Category"`
MountPath string `json:"mount_path" copier:"MountPath"`
Ownership string `json:"ownership" copier:"Ownership"`
Status string `json:"status" copier:"Status"`
}
type EndpointsReq struct {
Allowed_access_ips []string `json:"allowed_access_ips"`
Dev_service string `json:"dev_service"`
Ssh_keys []string `json:"ssh_keys"`
AllowedAccessIps []string `json:"allowed_access_ips" copier:"AllowedAccessIps"`
DevService string `json:"dev_service" copier:"DevService"`
SshKeys []string `json:"ssh_keys" copier:"SshKeys"`
}
type VolumeReq struct {
Capacity int64 `json:"capacity"`
Category string `json:"category"`
Ownership string `json:"ownership"`
Uri string `json:"uri"`
Capacity int64 `json:"capacity" copier:"Capacity"`
Category string `json:"category" copier:"Category"`
Ownership string `json:"ownership" copier:"Ownership"`
Uri string `json:"uri" copier:"Uri"`
}
type CustomHooks struct {
Container_hooks ContainerHooks `json:"container_hooks"`
ContainerHooks ContainerHooks `json:"container_hooks" copier:"ContainerHooks"`
}
type ContainerHooks struct {
Post_start Config `json:"post_start"`
Pre_start Config `json:"pre_start"`
PostStart Config `json:"post_start" copier:"PostStart"`
PreStart Config `json:"pre_start" copier:"PreStart"`
}
type Config struct {
Script string `json:"script"`
Type_config string `json:"type"`
Script string `json:"script" copier:"Script"`
TypeConfig string `json:"type" copier:"TypeConfig"`
}
type LeaseReq struct {
Duration int64 `json:"duration"`
Type_lease_req string `json:"type"`
Duration int64 `json:"duration" copier:"Duration"`
TypeLeaseReq string `json:"type" copier:"TypeLeaseReq"`
}
type GetVisualizationJobReq struct {

View File

@ -4,6 +4,7 @@ import (
"PCM/adaptor/PCM-CORE/model"
"bytes"
"encoding/json"
"fmt"
"github.com/robfig/cron/v3"
"io"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
@ -117,3 +118,16 @@ func RemoveDuplication_map(arr []string) []string {
}
return arr[:j]
}
func ConvertStructToMap(in interface{}) map[string]string {
out := make(map[string]string)
b, _ := json.Marshal(&in)
var m map[string]interface{}
_ = json.Unmarshal(b, &m)
for k, v := range m {
out[k] = fmt.Sprintf("%v", v)
}
return out
}