云服务器内容精选

  • 约束限制 华为云CloudShell是一款用于管理与运维云资源的网页版Shell工具,通过CloudShell可以完成登录弹性云服务器、连接集群等操作。 用户在使用CloudShell时,同时打开的实例数量和会话数量有如下限制: 表1 约束限制 场景 实例数量 会话数量 连接云服务器 4 10个/实例 连接CCE集群/容器 15 不涉及 命令行工具 1 不涉及 当前不支持iOS系统。 父主题: CloudShell相关操作
  • 响应示例 状态码: 200 successful operation { "results" : [ { "extensions" : [ { "extension_id" : "d45648941sadsadsa_hdsa", "extension_name" : "plugin_for_CodeArtsIDEOnline", "display_name" : "backgroudcolor_setting", "flags" : 8, "last_updated" : "2022-08-31 00:00:00", "published_date" : "2022-08-29 00:00:00", "release_date" : "2022-09-06 00:00:00", "short_description" : "插件的简要描述", "tags" : [ "color", "extention" ], "tag_all_list" : [ "color", "extension", "enhancer" ], "publisher" : { "publisher_id" : 123456, "publisher_name" : "code-huawei", "display_name" : "color-modify", "publisher_status" : "VERIFIED", "email" : "xxx@huawei.com", "web_url" : "www.xxx.huawei.com", "open" : true }, "arch" : [ "x86", "arm" ], "target" : "CodeArts IDE Online", "categories" : [ "backgroud", "color" ], "category_all_list" : [ "backgroud", "color", "script" ], "publish_manager" : { "publisher_id" : 123456, "publisher_name" : "code-huawei", "display_name" : "color-modify", "publisher_status" : "VERIFIED", "email" : "xxx@huawei.com", "web_url" : "www.xxx.huawei.com", "open" : true }, "status" : "NORMAL", "validate_status" : "NONE", "install_count" : 5000, "average_star" : 4.6, "identifier" : "marketplace_plugin", "support_os" : [ "win", "mac os", "linux" ], "support_ide" : 3, "support_ide_info" : "CodeArts IDE Online", "versions" : [ { "id" : "d45648132313", "version" : "version_one", "version_ranking" : 10000, "status" : "PUBLISHED", "version_status" : "PUBLISHED", "asset_uri" : "www.example.com", "last_updated" : "2022-08-31 00:00:00" } ], "extension_statistics" : { "install" : 10000, "stars" : 5 }, "preview" : false, "ext_info" : { "extension_id" : "d45648941sadsadsa_hdsa", "repo_url" : "www.xxxcodehub.com", "help_page" : "www.help.page.com", "website" : "www.index.com", "issue_link" : "www.problem.com", "show_previews" : false }, "platform" : "/opt/**", "check_result" : { "status" : "success" }, "extension_owner" : "huaweistaff" } ], "result_metadata" : [ { "metadata_type" : ".ts", "metadata_items" : [ { "key" : "value" }, { "uuid" : "uuid" } ] } ] } ] }
  • 请求参数 表1 请求Header参数 参数 是否必选 参数类型 描述 X-Auth-Token 否 String 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 表2 请求Body参数 参数 是否必选 参数类型 描述 filters 是 Array of FilterSnake objects 过滤字段 flags 是 Integer 插件flag;通过传递flag参数来进行过滤或其他操作。flag的基础数字是2\4\8\16;传递的参数只能是这四个数字加法组合而成数字 利用它们之间二进制的运算获取的值进行其他操作.比如6=0110=0010+0100也就是2和4的集合flags 表3 FilterSnake 参数 是否必选 参数类型 描述 criteria 否 Array of CriteriaSnake objects 过滤集合 page_number 是 Long 页码 page_size 是 Long 分页大小 sort_by 否 Long 排序字段. 1 修改日期 2 插件名称 3 插件作者名称 枚举值: 1 2 3 sort_order 否 Long 排序顺序. 1 升序 2 降序 枚举值: 1 2 表4 CriteriaSnake 参数 是否必选 参数类型 描述 filter_type 否 Integer 过滤类型 1 按插件Tag过滤 2 按diplayName过滤 3 按publisherId过滤 4 按插件Id过滤 5 按插件分类过滤 7 按照作者名.插件名过滤 8 按Target(客户端)过滤 10 按关键字(客户端输入的)过滤 12 根据flags传入的值来进行过滤,eg:flags=2name就排除flags=2的插件. 13 根据flags传入的值来进行过滤,eg:flags=2name就查询出flags=2的插件 18 按publisherName过滤 19 按publisherDisplayName过滤 102 按照插件状态排除插件 103 按照插件状态过滤出插件 107 supportIdeInfo 108 根据插件ids查询 枚举值: 1 2 3 4 5 7 8 10 12 13 18 19 102 103 107 108 value 否 String 过滤类型对应字段名称
  • 请求示例 创建一个地域在北京,用户名为“name”,邮箱为“email@codeartssnap.com”,组织为“huawei”的用户。 POST https://{endpoint}/v2/aims/codemodelserver/join-request { "region" : "北京", "name" : "name", "email" : "email@codeartssnap.com", "organization" : "huawei", "phone_number" : "13666666666", "invitation_code" : "gouliguojiashengsiyi" }
  • 请求参数 表1 请求Header参数 参数 是否必选 参数类型 描述 x-auth-token 是 String iam x-auth-token 表2 请求Body参数 参数 是否必选 参数类型 描述 region 否 String the region of user name 否 String the name of user email 否 String the email of user organization 否 String the organization of user phone_number 否 String the phone_number of user invitation_code 否 String the invitation_code
  • 响应示例 状态码: 200 OK { "result" : [ { "id" : "cc809483-21b8-473b-bd65-ff87efb261fa", "name" : "Spring Boot Extension Pack", "identifier" : "huawei", "description" : "Spring Boot Extension Pack", "email" : "xuhui80@huawei.com", "status" : true, "publisher_review" : false, "system_review" : false, "official" : false, "is_open" : false, "created_time" : "2022-04-01 09:54:26", "updated_time" : "2023-02-15 15:29:12", "role" : "Owner" }, { "id" : "6251b1ee539f4c02ad4b83daeda81633", "name" : "fast-run-app", "identifier" : "devcloud_cloudide_name_g0", "description" : "fast-run-appc", "email" : "test@qq.com", "web_url" : "", "status" : true, "publisher_review" : false, "system_review" : false, "official" : false, "is_open" : false, "created_time" : "2022-04-01 09:54:26", "updated_time" : "2022-09-08 11:01:10", "role" : "Owner" } ], "status" : "success" }
  • 响应参数 状态码: 200 表3 响应Body参数 参数 参数类型 描述 result Array of PublisherVO objects 返回值 status String 状态 表4 PublisherVO 参数 参数类型 描述 code_repo String 代码地址 created_time String 创建时间 description String 发布商描述 eamap_info String EAMAP注册信息 email String 邮箱 espase_group String espase交流群号 extension_count Long 插件数量 id String 发布商ID identifier String 唯一标志 is_open Boolean 开源发布商,0:非开源; 1:开源; is_org Boolean 发布商或组织,0:发布商; 1:组织; logo_url String 发布商logo member_count Long 成员数量 name String 发布商名称 official Boolean 是否是官方发布商 owners Array of MemberRoleVo objects 成员角色 publisher_review Boolean 是否开启发布商审核,1:开启;0:关闭 role String 角色 status Boolean 状态,0:禁用; 1:正常; suite_count Long 匹配数量 support_url String 支持地址 system_review Boolean 是否忽略系统审核,1:忽略;0:不忽略 updated_time String 更新时间 web_url String 官网地址 表5 MemberRoleVo 参数 参数类型 描述 domain_id String 租户ID extension_count Integer 插件数量 role String 角色名称 role_id Long 角色ID role_value String 发布商或插件ID user_id String 用户ID user_name String 用户名 状态码: 401 表6 响应Body参数 参数 参数类型 描述 error_msg String 错误描述 error_code String 错误码 状态码: 403 表7 响应Body参数 参数 参数类型 描述 error_msg String 错误描述 error_code String 错误码 状态码: 404 表8 响应Body参数 参数 参数类型 描述 error_msg String 错误描述 error_code String 错误码
  • 查询IDE实例列表 指定limit查询IDE实例列表。 GET: https://{endpoint}/v2/instances?limit=10 { "instances" : { "items_before" : 0, "size" : 10, "total_items_count" : 1, "items" : [ { "is_private" : false, "updated_time" : "2020-03-17 15:21:36", "private" : false, "role" : { "role" : "owner", "id" : "1" }, "owner_id" : "0dc311a468024ad5bf18591c8361272a", "description" : "ddd", "cpu_memory" : "2U4G", "domain_name" : "devcloud_cloudide_name_g01", "role_id" : "1", "is_temporary" : false, "stack_id" : "java", "id" : "instancewrqztsgn12imjq7e", "created_time" : "2020-01-06 15:25:04", "owner_name" : "devcloud_cloudide_pwx501764_g01", "refresh_interval" : 30, "display_name" : "test001", "organization_id" : "6251b1ee539f4c02ad4b83daeda81633", "name" : "cloudide-instance4xceoej8vvpn32lx", "platform_id" : 1, "attributes" : { "cpu_limit" : "2", "pvc_quantity" : "5Gi", "memory_limit_bytes" : "4294967296" }, "pvc_quantity" : "5GB", "arch" : "x86", "region" : "cn-north-7", "actions" : [ { "role_id" : "1", "action_cname" : "创建实例", "id" : "166", "actions" : "CREATE_INSTANCE" }, { "role_id" : "1", "action_cname" : "删除实例", "id" : "167", "actions" : "DELETE_INSTANCE" }, { "role_id" : "1", "action_cname" : "更新实例", "id" : "168", "actions" : "UPDATE_INSTANCE" }, { "role_id" : "1", "action_cname" : "查询实例列表", "id" : "169", "actions" : "QUERY_INSTANCE" }, { "role_id" : "1", "action_cname" : "运行实例", "id" : "170", "actions" : "RUN_INSTANCE" } ], "status" : "STOPPED" } ], "empty" : false }, "status" : "success" } 通过limit和关键字过滤查询实例。 如:查询实例名称或描述中含test的实例列表。 GET: https://{endpoint}/v2/instances?limit=10&search=test
  • URI GET /v2/instances 表1 Query参数 参数 是否必选 参数类型 描述 limit 否 Long 每页显示的条目数量最大值为100,最小值为1 offset 否 Long 偏移量,表示从此偏移量开始查询 is_temporary 否 Boolean 是否页面显示(以标签配置为准) label 否 String 标签 search 否 String 关键字查询(根据实例名,描述模糊查询) sort_dir 否 String 排序方式 asc/desc sort_key 否 String 排序字段。 display_name 实例名、status状态、pvc_quantity 存储容量、created_time 创建时间、stack_id 技术栈
  • 响应示例 状态码: 200 OK { "instances" : { "items_before" : 0, "size" : 10, "items" : [ { "updated_time" : "2020-03-17 15:21:36", "private" : false, "owner_id" : "d78cbac186b744899480f25bd022f...", "description" : "ddd", "cpu_memory" : "2U4G", "domain_name" : "IAM_DOMAIN_NAME_A", "is_temporary" : false, "stack_id" : "java", "id" : "instancewrqztsgn12imjq7e", "created_time" : "2020-01-06 15:25:04", "owner_name" : "ide_owner_name", "refresh_interval" : 30, "display_name" : "test001", "organization_id" : "6251b1ee539f4c02ad4b83daeda81633...", "name" : "ide_instance8bmjgqx6vfrb9e9n", "platform_id" : 1, "attributes" : { "cpu_limit" : "2", "pvc_quantity" : "5Gi", "memory_limit_bytes" : "4294967296" }, "pvc_quantity" : "5GB", "arch" : "x86", "region" : "cn-north-7", "status" : "STOPPED", "visitor_id" : "c78cbac186b744899480f25bd022f...", "visitor_name" : "ide_visitor_name", "visitor_domain_name" : "IAM_DOMAIN_NAME_B" } ], "empty" : false }, "status" : "success" }
  • 响应参数 状态码: 200 表2 响应Body参数 参数 参数类型 描述 result AccountStatus object 返回值 status String 状态 表3 AccountStatus 参数 参数类型 描述 cur_org_create_role Boolean 是否有创建实例权限 cur_org_open Boolean 账号所属租户是否开通服务 has_free_trial Boolean 免费试用 show_manage Boolean 是否有管理入口的权限 状态码: 403 表4 响应Body参数 参数 参数类型 描述 error_msg String 错误描述 error_code String 错误码 状态码: 404 表5 响应Body参数 参数 参数类型 描述 error_msg String 错误描述 error_code String 错误码 状态码: 406 表6 响应Body参数 参数 参数类型 描述 error_msg String 错误描述 error_code String 错误码 状态码: 500 表7 响应Body参数 参数 参数类型 描述 error_msg String 错误描述 error_code String 错误码
  • 响应示例 状态码: 200 OK { "instance" : { "created_time" : "2020-01-07 11:25:56", "updated_time" : "2020-03-20 17:14:00", "private" : false, "owner_name" : "ide_owner_name", "refresh_interval" : 30, "owner_id" : "d78cbac186b744899480f25bd022f468...", "description" : "aaa", "cpu_memory" : "1U1G", "display_name" : "chen002", "domain_name" : "IAM_DOMAIN_NAME_A", "is_temporary" : false, "organization_id" : "6251b1ee539f4c02ad4b83daeda81633...", "stack_id" : "python", "name" : "ide-instance8bmjgqx6vfrb9e9n", "platform_id" : 1, "attributes" : { "cpu_limit" : "1", "pvc_quantity" : "5Gi", "memory_limit_bytes" : "1073741824" }, "pvc_quantity" : "5GB", "arch" : "x86", "id" : "instancewc0yk05c8y6jov0v", "region" : "cn-north-7", "status" : "STOPPED", "visitor_id" : "c78cbac186b744899480f25bd022f468...", "visitor_name" : "ide_visitor_name", "visitor_domain_name" : "IAM_DOMAIN_NAME_B" }, "status" : "success" }
  • 响应参数 状态码: 200 表4 响应Body参数 参数 参数类型 描述 result result object 返回值 status String 状态 表5 result 参数 参数类型 描述 link String 链接 arch String cpu架构 x86|arm 枚举值: x86 arm id String 实例id private Boolean 是否私有平台 状态码: 403 表6 响应Body参数 参数 参数类型 描述 error_msg String 错误描述 error_code String 错误码 状态码: 404 表7 响应Body参数 参数 参数类型 描述 error_msg String 错误描述 error_code String 错误码 状态码: 406 表8 响应Body参数 参数 参数类型 描述 error_msg String 错误描述 error_code String 错误码 状态码: 500 表9 响应Body参数 参数 参数类型 描述 error_msg String 错误描述 error_code String 错误码
  • 请求示例 创建IDE实例 POST https://{endpoint}/v2/6251b1ee539f4c02ad4b83daeda81633/instances { "display_name" : "testjava", "stack_id" : "java", "description" : "", "cpu_memory" : "2U4G", "pvc_quantity" : "5GB", "refresh_interval" : "30" }
  • 创建IDE实例 检查实例名是否重复。 GET https://{endpoint}/v2/instances/duplicate?display_name=test 接口相关信息请参考查询IDE实例名是否重复。 确定待创建实例的技术栈。 GET https://{endpoint}/v2/stacks/tag 接口相关信息请参考按region获取标签所有技术栈。 查询所有技术栈,根据实际需要选择技术栈及其对应的规格(CPU、存储)。 { "stack" : { "tags" : [ "Java", "Maven", "CPP", "Vue", "ServiceComb", "Blockchain", "GO", "Node.js", "DCN", "Quantum", "JavaScript", "Ruby", "Python" ], "stack_list" : [ { "id" : 1, "stack_id" : "all", "creator" : "ide", "name" : "All in One", "description" : "支持Java、Python、JS/TS等多种语言", "scope" : "general", "config" : { "recipe" : { "content" : "hishell-all-in-one:alpha", "type" : "dockerimage" }, "attributes" : { "specs" : [ "2U4G" ], "volumes" : [ "5GB", "10GB", "20GB" ] } }, "tags" : [ "Java", "Maven", "CPP", "JavaScript", "Vue", "GO", "Node.js", "Ruby", "Python", "ServiceComb" ], "disable" : false, "arm_config" : { "recipe" : { "content" : "hishell-all-in-one:alpha", "type" : "dockerimage" }, "attributes" : { "specs" : [ "4U8G" ], "volumes" : [ "5GB", "10GB", "20GB" ] } } } ] }, "status" : "success" } stack_id:技术栈id。 config.attributes.specs:技术栈x86架构支持的内存。 config.attributes.volumes:技术栈x86架构支持的存储容量。 arm_config.attributes.specs:技术栈arm架构支持的内存。 arm _config.attributes.volumes:技术栈arm架构支持的存储容量。 查询技术栈费用。 可以参考获取技术栈费用信息,为cpu内存和存储容量价格和。 确定技术栈模板工程。 GET https://{endpoint}/v2/templates?stack_id=all 接口相关信息参考查询技术栈模板工程,根据实际需求选择模板工程。 { "templates" : [ { "template_id" : 5, "name" : "web-java-spring", "source" : { "location" : "git@codehub.alpha.devcloud.inhuawei.com:Demo00226/JavaWeb.git", "type" : "git", "parameters" : { } }, "display_name" : "web-java-spring", "path" : "/web-java-spring", "description" : "A basic example using Spring servlets. The app returns values entered into a submit form.", "project_type" : "maven", "region" : "cn-north-7", "tags" : [ "maven", "spring", "java", "web" ], "arch" : "x86,arm" } ], "status" : "success" } 其中,source.location为模板git仓地址。 创建IDE实例。 org_id:组织id(对应华为云账号的domainId)。 POST https://{endpoint}/v2/{org_id}/instances { "display_name" : "test", "stack_id" : "java", "description" : "", "cpu_memory" : "2U4G", "pvc_quantity" : "5GB", "refresh_interval" : 30 } display_name:实例名称。 stack_id:技术栈id。 cpu_memory:内存。 pvc_quantity:存储容量。 refresh_interval:实例生命周期。 响应如下,表示创建成功。 { "result" : { "link" : "https://****/cloudide/loading?instanceId=mpdrao", "arch" : "x86", "id" : "mpdrao" }, "status" : "success" } id:实例id。 link:实例访问地址。 访问接口返回的link地址,可以进入IDE实例。此处没有获取模板工程,如果要下载模板,可以指定模板git地址scmUrl。 https://****/cloudide/loading?scmName=test&scmUrl=git@***/JavaWeb.git&deleteRepoInfo=true&instanceId=mpdrao