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) { func (l *CreateNotebookLogic) CreateNotebook(in *modelarts.CreateNotebookReq) (*modelarts.CreateNotebookResp, error) {
var resp modelarts.CreateNotebookResp 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) createUrl = strings.Replace(createUrl, "{project_id}", in.ProjectId, -1)
reqByte, err := json.Marshal(in.Param) reqByte, err := json.Marshal(in.Param)
if err != nil { if err != nil {

View File

@ -2,14 +2,10 @@ package logic
import ( import (
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/internal/common" "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/internal/svc"
"PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts" "PCM/adaptor/PCM-AI/PCM-MODELARTS/rpc/modelarts"
"PCM/common/tool"
"context"
"github.com/zeromicro/go-zero/core/logx" "github.com/zeromicro/go-zero/core/logx"
) )
@ -29,16 +25,22 @@ func NewListNotebookLogic(ctx context.Context, svcCtx *svc.ServiceContext) *List
// notebook task // notebook task
func (l *ListNotebookLogic) ListNotebook(in *modelarts.ListNotebookReq) (*modelarts.ListNotebookResp, error) { 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 := "https://modelarts.cn-north-4.myhuaweicloud.com/v1/{project_id}/notebooks"
getUrl = strings.Replace(getUrl, "{project_id}", in.ProjectId, -1)
token := common.GetToken() 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 { if err != nil {
return nil, err 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*************************/ /******************Notebook Start*************************/
message ListNotebookReq{ message ListNotebookReq{
string projectId = 1; // @gotags: copier:"ProjectId" string project_id = 1; // @gotags: copier:"ProjectId"
ListNotebookParam param = 2; // @gotags: copier:"Param" ListNotebookParam param = 2; // @gotags: copier:"Param"
} }
message ListNotebookResp{ message ListNotebookResp{
int32 current = 1; // @gotags: copier:"current" int32 current = 1; // @gotags: copier:"Current"
repeated NotebookResp data = 2; // @gotags: copier:"data" repeated NotebookResp data = 2; // @gotags: copier:"Data"
int32 pages = 3; // @gotags: copier:"pages" int32 pages = 3; // @gotags: copier:"Pages"
int32 size = 4; // @gotags: copier:"size" int32 size = 4; // @gotags: copier:"Size"
int64 total = 5; // @gotags: copier:"total" int64 total = 5; // @gotags: copier:"Total"
} }
message ListNotebookParam{ message ListNotebookParam{
string feature = 1; // @gotags: copier:"feature" string feature = 1; // @gotags: copier:"Feature"
int32 limit = 2; // @gotags: copier:"limit" int32 limit = 2; // @gotags: copier:"Limit"
string name = 3; // @gotags: copier:"name" string name = 3; // @gotags: copier:"Name"
string pool_id = 4; // @gotags: copier:"pool_id" string pool_id = 4; // @gotags: copier:"PoolId"
int32 offset = 5; // @gotags: copier:"offset" int32 offset = 5; // @gotags: copier:"Offset"
string owner = 6; // @gotags: copier:"owner" string owner = 6; // @gotags: copier:"Owner"
string sort_dir = 7; // @gotags: copier:"sort_dir" string sort_dir = 7; // @gotags: copier:"SortDir"
string sort_key = 8; // @gotags: copier:"sort_key" string sort_key = 8; // @gotags: copier:"SortKey"
string status = 9; // @gotags: copier:"status" string status = 9; // @gotags: copier:"Status"
string workspaceId = 10; // @gotags: copier:"workspaceId" string workspaceId = 10; // @gotags: copier:"WorkspaceId"
} }
message CreateNotebookReq{ message CreateNotebookReq{
string project_id = 1; // @gotags: copier:"project_id" string project_id = 1; // @gotags: copier:"ProjectId"
CreateNotebookParam param = 2; // @gotags: copier:"param" CreateNotebookParam param = 2; // @gotags: copier:"Param"
} }
message CreateNotebookResp{ message CreateNotebookResp{
NotebookResp notebookResp = 1; // @gotags: copier:"notebookResp" NotebookResp notebookResp = 1; // @gotags: copier:"NotebookResp"
} }
message CreateNotebookParam{ message CreateNotebookParam{
string description = 1; // @gotags: copier:"description" string description = 1; // @gotags: copier:"Description"
int64 duration = 2; // @gotags: copier:"duration" int64 duration = 2; // @gotags: copier:"Duration"
repeated EndpointsReq endpoints = 3; // @gotags: copier:"endpoints" repeated EndpointsReq endpoints = 3; // @gotags: copier:"Endpoints"
string feature = 4; // @gotags: copier:"feature" string feature = 4; // @gotags: copier:"Feature"
string flavor = 5; // @gotags: copier:"flavor" string flavor = 5; // @gotags: copier:"Flavor"
string image_id = 6; // @gotags: copier:"image_id" string image_id = 6; // @gotags: copier:"ImageId"
string name = 7; // @gotags: copier:"name" string name = 7; // @gotags: copier:"Name"
string pool_id = 8; // @gotags: copier:"pool_id" string pool_id = 8; // @gotags: copier:"PoolId"
VolumeReq volume = 9; // @gotags: copier:"volume" VolumeReq volume = 9; // @gotags: copier:"Volume"
string workspace_id = 10; // @gotags: copier:"workspace_id" string workspace_id = 10; // @gotags: copier:"WorkspaceId"
CustomHooks hooks = 11; // @gotags: copier:"hooks" CustomHooks hooks = 11; // @gotags: copier:"Hooks"
LeaseReq lease = 12; // @gotags: copier:"lease" LeaseReq lease = 12; // @gotags: copier:"Lease"
} }
message StartNotebookReq{ message StartNotebookReq{
string id = 1; // @gotags: copier:"id" string id = 1; // @gotags: copier:"Id"
string project_id = 2; // @gotags: copier:"project_id" string project_id = 2; // @gotags: copier:"ProjectId"
StartNotebookParam param = 3; // @gotags: copier:"param" StartNotebookParam param = 3; // @gotags: copier:"Param"
} }
message StartNotebookResp{ message StartNotebookResp{
NotebookResp notebookResp = 1; // @gotags: copier:"notebookResp" NotebookResp notebookResp = 1; // @gotags: copier:"NotebookResp"
} }
message StartNotebookParam{ message StartNotebookParam{
int64 duration = 1; // @gotags: copier:"duration" int64 duration = 1; // @gotags: copier:"Duration"
string type = 2; // @gotags: copier:"type_start_notebook" string type = 2; // @gotags: copier:"TypeStartNotebook"
} }
message StopNotebookReq{ message StopNotebookReq{
string id = 1; // @gotags: copier:"id" string id = 1; // @gotags: copier:"Id"
string project_id = 2; // @gotags: copier:"project_id" string project_id = 2; // @gotags: copier:"ProjectId"
} }
message StopNotebookResp{ message StopNotebookResp{
NotebookResp notebookResp = 1; // @gotags: copier:"notebookResp" NotebookResp notebookResp = 1; // @gotags: copier:"NotebookResp"
} }
message GetNotebookStorageReq{ message GetNotebookStorageReq{
string instance_id = 1; // @gotags: copier:"instance_id" string instance_id = 1; // @gotags: copier:"InstanceId"
string project_id = 2; // @gotags: copier:"project_id" string project_id = 2; // @gotags: copier:"ProjectId"
} }
message GetNotebookStorageResp{ message GetNotebookStorageResp{
int32 current = 1; // @gotags: copier:"current" int32 current = 1; // @gotags: copier:"Current"
repeated DataVolumesRes data = 2; // @gotags: copier:"data" repeated DataVolumesRes data = 2; // @gotags: copier:"Data"
int32 pages = 3; // @gotags: copier:"pages" int32 pages = 3; // @gotags: copier:"Pages"
int32 size = 4; // @gotags: copier:"size" int32 size = 4; // @gotags: copier:"Size"
int64 total = 5; // @gotags: copier:"total" int64 total = 5; // @gotags: copier:"Total"
} }
message MountNotebookStorageReq{ message MountNotebookStorageReq{
string instance_id = 1; // @gotags: copier:"instance_id" string instance_id = 1; // @gotags: copier:"InstanceId"
string project_id = 2; // @gotags: copier:"project_id" string project_id = 2; // @gotags: copier:"ProjectId"
MountNotebookStorageParam param = 3; // @gotags: copier:"param" MountNotebookStorageParam param = 3; // @gotags: copier:"Param"
} }
message MountNotebookStorageResp{ message MountNotebookStorageResp{
string category = 1; // @gotags: copier:"category" string category = 1; // @gotags: copier:"Category"
string id = 2; // @gotags: copier:"id" string id = 2; // @gotags: copier:"Id"
string mount_path = 3; // @gotags: copier:"mount_path" string mount_path = 3; // @gotags: copier:"MountPath"
string status = 4; // @gotags: copier:"status" string status = 4; // @gotags: copier:"Status"
string uri = 5; // @gotags: copier:"uri" string uri = 5; // @gotags: copier:"Uri"
} }
message MountNotebookStorageParam{ message MountNotebookStorageParam{
string category = 1; // @gotags: copier:"category" string category = 1; // @gotags: copier:"Category"
string mount_path = 2; // @gotags: copier:"mount_path" string mount_path = 2; // @gotags: copier:"MountPath"
string uri = 3; // @gotags: copier:"uri" string uri = 3; // @gotags: copier:"Uri"
} }
message DataVolumesRes{ message DataVolumesRes{
string category = 1; // @gotags: copier:"category" string category = 1; // @gotags: copier:"Category"
string id = 2; // @gotags: copier:"id" string id = 2; // @gotags: copier:"Id"
string mount_path = 3; // @gotags: copier:"mount_path" string mount_path = 3; // @gotags: copier:"MountPath"
string status = 4; // @gotags: copier:"status" string status = 4; // @gotags: copier:"Status"
string uri = 5; // @gotags: copier:"uri" string uri = 5; // @gotags: copier:"Uri"
} }
message NotebookResp{ message NotebookResp{
repeated JobProgress action_progress = 1; // @gotags: copier:"action_progress" repeated JobProgress action_progress = 1; // @gotags: copier:"ActionProgress"
string description = 2; // @gotags: copier:"description" string description = 2; // @gotags: copier:"Description"
repeated EndpointsRes endpoints = 3; // @gotags: copier:"endpoints" repeated EndpointsRes endpoints = 3; // @gotags: copier:"Endpoints"
string fail_reason = 4; // @gotags: copier:"fail_reason" string fail_reason = 4; // @gotags: copier:"FailReason"
string flavor = 5; // @gotags: copier:"flavor" string flavor = 5; // @gotags: copier:"Flavor"
string id = 6; // @gotags: copier:"id" string id = 6; // @gotags: copier:"Id"
Image image = 7; // @gotags: copier:"image" Image image = 7; // @gotags: copier:"Image"
Lease lease = 8; // @gotags: copier:"lease" Lease lease = 8; // @gotags: copier:"Lease"
string name = 9; // @gotags: copier:"name" string name = 9; // @gotags: copier:"Name"
Pool pool = 10; // @gotags: copier:"pool" Pool pool = 10; // @gotags: copier:"Pool"
string status = 11; // @gotags: copier:"status" string status = 11; // @gotags: copier:"Status"
string token = 12; // @gotags: copier:"token" string token = 12; // @gotags: copier:"Token"
string url = 13; // @gotags: copier:"url" string url = 13; // @gotags: copier:"Url"
VolumeRes volume = 14; // @gotags: copier:"volume" VolumeRes volume = 14; // @gotags: copier:"Volume"
string workspace_id = 15; // @gotags: copier:"workspace_id" string workspace_id = 15; // @gotags: copier:"WorkspaceId"
string feature = 16; // @gotags: copier:"feature" string feature = 16; // @gotags: copier:"Feature"
} }
message JobProgress{ message JobProgress{
string notebook_id = 1; // @gotags: copier:"notebook_id" string notebook_id = 1; // @gotags: copier:"NotebookId"
string status = 2; // @gotags: copier:"status" string status = 2; // @gotags: copier:"Status"
int32 step = 3; // @gotags: copier:"step" int32 step = 3; // @gotags: copier:"Step"
string step_description = 4; // @gotags: copier:"step_description" string step_description = 4; // @gotags: copier:"StepDescription"
} }
message EndpointsRes{ message EndpointsRes{
repeated string allowed_access_ips = 1; // @gotags: copier:"allowed_access_ips" repeated string allowed_access_ips = 1; // @gotags: copier:"AllowedAccessIps"
string dev_service = 2; // @gotags: copier:"dev_service" string dev_service = 2; // @gotags: copier:"DevService"
repeated string ssh_keys = 3; // @gotags: copier:"ssh_keys" repeated string ssh_keys = 3; // @gotags: copier:"SshKeys"
} }
message Image{ message Image{
string arch = 1; // @gotags: copier:"arch" string arch = 1; // @gotags: copier:"Arch"
int64 create_at = 2; // @gotags: copier:"create_at" int64 create_at = 2; // @gotags: copier:"CreateAt"
string description = 3; // @gotags: copier:"description" string description = 3; // @gotags: copier:"Description"
repeated string dev_services = 4; // @gotags: copier:"dev_services" repeated string dev_services = 4; // @gotags: copier:"DevServices"
string id = 5; // @gotags: copier:"id" string id = 5; // @gotags: copier:"Id"
string name = 6; // @gotags: copier:"name" string name = 6; // @gotags: copier:"Name"
string namespace = 7; // @gotags: copier:"namespace" string namespace = 7; // @gotags: copier:"Namespace"
string origin = 8; // @gotags: copier:"origin" string origin = 8; // @gotags: copier:"Origin"
repeated string resource_categories = 9; // @gotags: copier:"resource_categories" repeated string resource_categories = 9; // @gotags: copier:"ResourceCategories"
string service_type = 10; // @gotags: copier:"service_type" string service_type = 10; // @gotags: copier:"ServiceType"
int64 size = 11; // @gotags: copier:"size" int64 size = 11; // @gotags: copier:"Size"
string status = 12; // @gotags: copier:"status" string status = 12; // @gotags: copier:"Status"
string status_message = 13; // @gotags: copier:"status_message" string status_message = 13; // @gotags: copier:"StatusMessage"
repeated string support_res_categories = 14; // @gotags: copier:"support_res_categories" repeated string support_res_categories = 14; // @gotags: copier:"SupportResCategories"
string swr_path = 15; // @gotags: copier:"swr_path" string swr_path = 15; // @gotags: copier:"SwrPath"
string tag = 16; // @gotags: copier:"tag" string tag = 16; // @gotags: copier:"Tag"
string type = 17; // @gotags: copier:"type_image" string type = 17; // @gotags: copier:"TypeImage"
int64 update_at = 18; // @gotags: copier:"update_at" int64 update_at = 18; // @gotags: copier:"UpdateAt"
string visibility = 19; // @gotags: copier:"visibility" string visibility = 19; // @gotags: copier:"Visibility"
string workspace_id = 20; // @gotags: copier:"workspace_id" string workspace_id = 20; // @gotags: copier:"WorkspaceId"
} }
message Lease{ message Lease{
int64 create_at = 1; // @gotags: copier:"create_at" int64 create_at = 1; // @gotags: copier:"CreateAt"
int64 duration = 2; // @gotags: copier:"duration" int64 duration = 2; // @gotags: copier:"Duration"
bool enable = 3; // @gotags: copier:"enable" bool enable = 3; // @gotags: copier:"Enable"
string type = 4; // @gotags: copier:"type_lease" string type = 4; // @gotags: copier:"TypeLease"
int64 update_at = 5; // @gotags: copier:"update_at" int64 update_at = 5; // @gotags: copier:"UpdateAt"
} }
message Pool{ message Pool{
string id = 1; // @gotags: copier:"id" string id = 1; // @gotags: copier:"Id"
string name = 2; // @gotags: copier:"name" string name = 2; // @gotags: copier:"Name"
} }
message VolumeRes{ message VolumeRes{
int64 capacity = 1; // @gotags: copier:"capacity" int64 capacity = 1; // @gotags: copier:"Capacity"
string category = 2; // @gotags: copier:"category" string category = 2; // @gotags: copier:"Category"
string mount_path = 3; // @gotags: copier:"mount_path" string mount_path = 3; // @gotags: copier:"MountPath"
string ownership = 4; // @gotags: copier:"ownership" string ownership = 4; // @gotags: copier:"Ownership"
string status = 5; // @gotags: copier:"status" string status = 5; // @gotags: copier:"Status"
} }
message EndpointsReq{ message EndpointsReq{
repeated string allowed_access_ips = 1; // @gotags: copier:"allowed_access_ips" repeated string allowed_access_ips = 1; // @gotags: copier:"AllowedAccessIps"
string dev_service = 2; // @gotags: copier:"dev_service" string dev_service = 2; // @gotags: copier:"DevService"
repeated string ssh_keys = 3; // @gotags: copier:"ssh_keys" repeated string ssh_keys = 3; // @gotags: copier:"SshKeys"
} }
message VolumeReq{ message VolumeReq{
int64 capacity = 1; // @gotags: copier:"capacity" int64 capacity = 1; // @gotags: copier:"Capacity"
string category = 2; // @gotags: copier:"category" string category = 2; // @gotags: copier:"Category"
string ownership = 3; // @gotags: copier:"ownership" string ownership = 3; // @gotags: copier:"Ownership"
string uri = 4; // @gotags: copier:"uri" string uri = 4; // @gotags: copier:"Uri"
} }
message CustomHooks{ message CustomHooks{
ContainerHooks container_hooks = 1; // @gotags: copier:"container_hooks" ContainerHooks container_hooks = 1; // @gotags: copier:"ContainerHooks"
} }
message ContainerHooks{ message ContainerHooks{
Config post_start = 1; // @gotags: copier:"post_start" Config post_start = 1; // @gotags: copier:"PostStart"
Config pre_start = 2; // @gotags: copier:"pre_start" Config pre_start = 2; // @gotags: copier:"PreStart"
} }
message Config{ message Config{
string script = 1; // @gotags: copier:"script" string script = 1; // @gotags: copier:"Script"
string type = 2; // @gotags: copier:"type_config" string type = 2; // @gotags: copier:"TypeConfig"
} }
message LeaseReq{ message LeaseReq{
int64 duration = 1; // @gotags: copier:"duration" int64 duration = 1; // @gotags: copier:"Duration"
string type = 2; // @gotags: copier:"type_lease_req" string type = 2; // @gotags: copier:"TypeLeaseReq"
} }
/******************Notebook End*************************/ /******************Notebook End*************************/

View File

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

View File

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

View File

@ -4,6 +4,7 @@ import (
"PCM/adaptor/PCM-CORE/model" "PCM/adaptor/PCM-CORE/model"
"bytes" "bytes"
"encoding/json" "encoding/json"
"fmt"
"github.com/robfig/cron/v3" "github.com/robfig/cron/v3"
"io" "io"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
@ -117,3 +118,16 @@ func RemoveDuplication_map(arr []string) []string {
} }
return arr[:j] 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
}