文档首页 > > 开发指南> API & SDK 对应关系> Go> ECS

ECS

分享
更新时间: 2019/11/15 GMT+08:00

基于ECS v1 API的SDK接口如下,调用方式请参考示例代码。

Interface

Method

API

CloudServers

GetJobResult(client *gophercloud.ServiceClient, id string)

GET /v1/{project_id}/jobs/{job_id}

链接

GetServerRecoveryStatus(client *gophercloud.ServiceClient, serverID string)

GET /v1/{project_id}/cloudservers/{server_id}/autorecovery

链接

ConfigServerRecovery(client *gophercloud.ServiceClient, serverID string, opts string)

PUT /v1/{project_id}/cloudservers/{server_id}/autorecovery

链接

Get(client *gophercloud.ServiceClient, serverID string)

GET /v1/{project_id}/cloudservers/{server_id}

链接

ListDetail(client *gophercloud.ServiceClient, opts ListOptsBuilder)

GET /v1/{project_id}/cloudservers/detail{?flavor,name,status,limit,offset,not-tags,reservation_id,enterprise_project_id,tags}

链接

BatchStart(client *gophercloud.ServiceClient, opts BatchStartOpts)

POST /v1/{project_id}/cloudservers/action

链接

BatchReboot(client *gophercloud.ServiceClient, opts BatchRebootOpts)

POST /v1/{project_id}/cloudservers/action

链接

BatchStop(client *gophercloud.ServiceClient, opts BatchStopOpts)

POST /v1/{project_id}/cloudservers/action

链接

BatchUpdate(client *gophercloud.ServiceClient, opts BatchUpdateOpts)

PUT /v1/{project_id}/cloudservers/server-name

链接

Tags

BatchCreateServerTags(client *gophercloud.ServiceClient, serverID string, opts BatchTagCreateOptsBuilder)

POST /v1/{project_id}/cloudservers/{server_id}/tags/action

链接

BatchDeleteServerTags(client *gophercloud.ServiceClient, serverID string, opts BatchTagDeleteOptsBuilder)

POST /v1/{project_id}/cloudservers/{server_id}/tags/action

链接

ListProjectTags(client *gophercloud.ServiceClient)

GET /v1/{project_id}/cloudservers/tags

链接

ListServerTags(client *gophercloud.ServiceClient, serverID string)

GET /v1/{project_id}/cloudservers/{server_id}/tags

链接

基于ECS v2 API的SDK接口如下,调用方式请参考示例代码。

Interface

Method

API

CloudServers

ReinstallOS(client *gophercloud.ServiceClient, serverID string, opts ReinstallOptsBuilder)

POST /v2/{project_id}/cloudservers/{server_id}/reinstallos

链接

基于Nova v2 API的SDK接口如下,调用方式请参考示例代码。

Interface

Method

API

Servers

Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder)

POST /v2/{project_id}/servers

链接

List(client *gophercloud.ServiceClient, opts ListOptsBuilder)

GET /v2/{project_id}/servers/detail

链接

Get(client *gophercloud.ServiceClient, id string)

GET /v2/{project_id}/servers/{server_id}

链接

Update(client *gophercloud.ServiceClient, id string, opts UpdateOptsBuilder)

PUT /v2/{project_id}/servers/{server_id}

链接

Delete(client *gophercloud.ServiceClient, id string)

DELETE /v2/{project_id}/servers/{server_id}

链接

Resize(client *gophercloud.ServiceClient, id string, opts ResizeOptsBuilder)

POST /v2/{project_id}/servers/{server_id}/action

链接

ConfirmResize(client *gophercloud.ServiceClient, id string)

POST /v2/{project_id}/servers/{server_id}/action

链接

RevertResize(client *gophercloud.ServiceClient, id string)

POST /v2/{project_id}/servers/{server_id}/action

链接

Start(client *gophercloud.ServiceClient, id string)

POST /v2/{project_id}/servers/{server_id}/action

链接

Stop(client *gophercloud.ServiceClient, id string)

POST /v2/{project_id}/servers/{server_id}/action

链接

Create(client *gophercloud.ServiceClient, opts servers.CreateOptsBuilder)

POST /v2/{project_id}/os-volumes_boot

链接

Reboot(client *gophercloud.ServiceClient, id string, opts RebootOptsBuilder)

POST /v2/{project_id}/servers/{server_id}/action

链接

ResetMetadata(client *gophercloud.ServiceClient, id string, opts ResetMetadataOptsBuilder)

PUT /v2/{project_id}/servers/{server_id}/metadata

链接

Metadata(client *gophercloud.ServiceClient, id string)

GET /v2/{project_id}/servers/{server_id}/metadata

链接

UpdateMetadata(client *gophercloud.ServiceClient, id string, opts UpdateMetadataOptsBuilder)

POST /v2/{project_id}/servers/{server_id}/metadata

链接

Metadatum(client *gophercloud.ServiceClient, id, key string)

GET /v2/{project_id}/servers/{server_id}/metadata/{key}

链接

DeleteMetadatum(client *gophercloud.ServiceClient, id, key string)

DELETE /v2/{project_id}/servers/{server_id}/metadata/{key}

链接

ListInstanceActions(client *gophercloud.ServiceClient, serverID string)

GET /v2/{project_id}/servers/{server_id}/os-instance-actions

链接

GetInstanceActions(client *gophercloud.ServiceClient, serverID string, RequestID string)

GET /v2/{project_id}/servers/{server_id}/os-instance-actions/{request_id}

链接

GetConsoleLog(client *gophercloud.ServiceClient, id string, length string)

POST /v2/{project_id}/servers/{server_id}/action

链接

Interface

List(client *gophercloud.ServiceClient, serverID string)

GET /v2/{project_id}/servers/{server_id}/os-interface

链接

Get(client *gophercloud.ServiceClient, serverID, portID string)

GET /v2/{project_id}/servers/{server_id}/os-interface/{id}

链接

Create(client *gophercloud.ServiceClient, serverID string, opts CreateOptsBuilder)

POST /v2/{project_id}/servers/{server_id}/os-interface

链接

Delete(client *gophercloud.ServiceClient, serverID, portID string)

DELETE /v2/{project_id}/servers/{server_id}/os-interface/{id}

链接

Flavors

ListDetail(client *gophercloud.ServiceClient, opts ListOptsBuilder)

GET /v2/{project_id}/flavors/detail

链接

Get(client *gophercloud.ServiceClient, id string)

GET /v2/{project_id}/flavors/{flavor_id}

链接

Images

ListDetail(client *gophercloud.ServiceClient, opts ListOptsBuilder)

GET /v2/{project_id}/images/detail

链接

Delete(client *gophercloud.ServiceClient, id string)

DELETE /v2/{project_id}/images/{image_id}

链接

Get(client *gophercloud.ServiceClient, id string)

GET /v2/{project_id}/images/{image_id}

链接

Key Pairs

Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder)

POST /v2/{project_id}/os-keypairs

链接

Get(client *gophercloud.ServiceClient, name string)

GET /v2/{project_id}/os-keypairs/{keypair_name}

链接

Delete(client *gophercloud.ServiceClient, name string)

DELETE /v2/{project_id}/os-keypairs/{keypair_name}

链接

List(client *gophercloud.ServiceClient)

GET /v2/{project_id}/os-keypairs

链接

Quotas

GetLimits(client *gophercloud.ServiceClient)

GET /v2/{project_id}/limits

链接

Get(client *gophercloud.ServiceClient, tenantID string)

GET /v2/{project_id}/os-quota-sets/{project_id}

链接

GetDefault(client *gophercloud.ServiceClient, ProjectID string)

GET /v2/{project_id}/os-quota-sets/{project_id}/defaults

链接

Volumeattach

List(client *gophercloud.ServiceClient, serverID string)

GET /v2/{project_id}/servers/{server_id}/os-volume_attachments

链接

Create(client *gophercloud.ServiceClient, serverID string, opts CreateOptsBuilder)

POST /v2/{project_id}/servers/{server_id}/os-volume_attachments

链接

Get(client *gophercloud.ServiceClient, serverID, attachmentID string)

GET /v2/{project_id}/servers/{server_id}/os-volume_attachments/{volume_id}

链接

Delete(client *gophercloud.ServiceClient, serverID, attachmentID string)

DELETE /v2/{project_id}/servers/{server_id}/os-volume_attachments/{volume_id}

链接

DeleteWithFlag(client *gophercloud.ServiceClient, serverID, volumeID string, deleteFlag int)

DELETE /v2/{project_id}/servers/{server_id}/os-volume_attachments/{volume_id}?delete_flag={delete_flag}

链接

分享:

    相关文档

    相关产品

文档是否有解决您的问题?

提交成功!

非常感谢您的反馈,我们会继续努力做到更好!

反馈提交失败,请稍后再试!

*必选

请至少选择或填写一项反馈信息

字符长度不能超过200

提交反馈 取消

如您有其它疑问,您也可以通过华为云社区问答频道来与我们联系探讨

跳转到云社区