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

ECS

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

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

Interface

Method

API

ComputeFloatingIPService

ActionResponse addFloatingIP(Server server, String ipAddress)

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

链接

ActionResponse addFloatingIP(Server server, String fixedIpAddress, String ipAddress)

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

链接

FloatingIP allocateIP(String pool)

POST /v2/{project_id}/os-floating-ips

链接

ActionResponse deallocateIP(String id)

DELETE /v2/{project_id}/os-floating-ips/{floating_ip_id}

链接

List<? extends FloatingIP> list()

GET /v2/{project_id}/os-floating-ips

链接

ActionResponse removeFloatingIP(Server server, String ipAddress)

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

链接

ComputeImageService

ActionResponse delete(String imageId)

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

链接

Image get(String imageId)

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

链接

List<? extends Image> list()

GET /v2/{project_id}/images/detail

链接

List<? extends Image> list(boolean detailed)

  • detailed=true:

    GET /v2/{project_id}/images/detail

    链接

  • detailed=false:

    GET /v2/{project_id}/images

    链接

ComputeSecurityGroupService

SecGroupExtension create(String name, String description)

POST /v2/{project_id}/os-security-groups

链接

SecGroupExtension.Rule createRule(SecGroupExtension.Rule rule)

POST /v2/{project_id}/os-security-group-rules

链接

ActionResponse delete(String securityGroupId)

DELETE /v2/{project_id}/os-security-groups/{security_group}

链接

ActionResponse deleteRule(String ruleId)

DELETE /v2/{project_id}/os-security-group-rules/{security_group_rule_id}

链接

SecGroupExtension get(String securityGroupId)

GET /v2/{project_id}/os-security-groups/{security_group_id}

链接

List<? extends SecGroupExtension> list()

GET /v2/{project_id}/os-security-groups

链接

SecGroupExtension update(String securityGroupId, String name, String description)

PUT /v2/{project_id}/os-security-groups/{security_group_id}

链接

FlavorService

Flavor get(String flavorId)

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

链接

List<? extends Flavor> list()

GET /v2/{project_id}/flavors/detail

链接

KeypairService

Keypair create(String name, String publicKey)

POST /v2/{project_id}/os-keypairs

链接

ActionResponse delete(String name)

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

链接

Keypair get(String name)

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

链接

List<? extends Keypair> list()

GET /v2/{project_id}/os-keypairs

链接

InstanceActionsService

List<? extends InstanceAction> list(String serverId)

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

链接

InstanceAction get(String serverId, String requestId)

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

链接

QuotaSetService

QuotaSet get(String tenantId)

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

链接

QuotaSet get(String tenantId, String userId)

GET /v2/{project_id}/os-quota-sets/{project_id}?user_id={user_id}

链接

Limits limits()

GET /v2/{project_id}/limits

链接

getDefault(String tenantId)

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

链接

ServerGroupService

ServerGroup create(String name, String policy)

POST /v2/{project_id}/os-server-groups

链接

ActionResponse delete(String id)

DELETE /v2/{project_id}/os-server-groups/{server_group_id}

链接

ServerGroup get(String id)

GET /v2/{project_id}/os-server-groups/{server_group_id}

链接

List<? extends ServerGroup> list()

GET /v2/{project_id}/os-server-groups

链接

ServerService

VolumeAttachment getAttachVolume(String serverId, String volumeId)

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

链接

List<? extends VolumeAttachment> listAttachedVolumes(String serverId)

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

链接

ActionResponse action(String serverId, Action action)

Executes the specified Action such as RESUME, PAUSE, START, STOP …

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

链接(START)

链接(STOP)

ActionResponse stop(String serverId, StopType type)

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

链接

VolumeAttachment attachVolume(String serverId, String volumeId, String device)

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

链接

Server boot(ServerCreate server)

POST /v2/{project_id}/servers

链接

Server bootAndWaitActive(ServerCreate server, int maxWaitTime)

POST /v2/{project_id}/servers

链接

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

链接

ActionResponse confirmResize(String serverId)

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

链接

String createSnapshot(String serverId, String snapshotName)

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

链接

ActionResponse delete(String serverId)

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

链接

ActionResponse deleteMetadataItem(String serverId, String key)

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

链接

ActionResponse detachVolume(String serverId, String attachmentId)

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

链接

ActionResponse detachVolume(String serverId, String volumeId, int deleteFlag)

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

链接

Server get(String serverId)

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

链接

Map<String,String> getMetadata(String serverId)

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

链接

List<? extends Server> list()

GET /v2/{project_id}/servers/detail

链接

List<? extends Server> list(boolean detail)

  • detail=true:

    GET /v2/{project_id}/servers/detail

    链接

  • detail=false:

    GET /v2/{project_id}/servers

    链接

List<? extends Server> list(Map<String,String> filteringParams)

GET /v2/{project_id}/servers/detail{?changes-since,image,flavor,name,status,host,limit,marker}

链接

ActionResponse reboot(String serverId, RebootType type)

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

链接

ActionResponse resize(String serverId, String flavorId)

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

链接

ActionResponse revertResize(String serverId)

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

链接

Server update(String serverId, ServerUpdateOptions options)

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

链接

Map<String,String> updateMetadata(String serverId, Map<String,String> metadata)

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

链接

Server waitForServerStatus(String serverId, Server.Status status, int maxWait, TimeUnit maxWaitUnit)

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

链接

List<? extends Server> list(boolean detail , Map<String, String> filteringParams)

  • detail = true:

GET /v2/{project_id}/servers/detail{?changes-since,image,flavor,name,status,limit,marker,not-tags,reservation_id,ip}

链接

  • detail = false:

GET /v2/{project_id}/servers{?changes-since,image,flavor,name,status,limit,marker,not-tags,reservation_id}

链接

String getConsoleOutput(String serverId, int numLines)

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

链接

Map<String, String> getMetadataItem(String serverId, String key)

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

链接

Map<String, String> setMetadataItem(String serverId, String key, String value)

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

链接

InterfaceService (ext)

InterfaceAttachment create(String serverId, String portId)

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

链接

InterfaceAttachment create(String serverId, NovaInterfaceAttachmentCreate novaInterfaceAttachmentCreate)

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

链接

ActionResponse detach(String serverId, String attachmentId)

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

链接

InterfaceAttachment get(String serverId, String attachmentId)

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

链接

List<? extends InterfaceAttachment> list(String serverId)

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

链接

ZoneService(ext)

List<? extends AvailabilityZone> list()

GET /v2/{project_id}/os-availability-zone

链接

ServerTagService链接

NovaServerTag list(String serverId)

GET /v2.1/{project_id}/servers/{server_id}/tags

链接

NovaServerTag addTags(String serverId, NovaServerTag tags)

PUT /v2.1/{project_id}/servers/{server_id}/tags

链接

ActionResponse delete(String serverId, String tag)

DELETE /v2.1/{project_id}/servers/{server_id}/tags

链接

ActionResponse check(String serverId, String tag)

GET /v2.1/{project_id}/servers/{server_id}/tags/{tag}

链接

ActionResponse addSingle(String serverId, String tag)

PUT /v2.1/{project_id}/servers/{server_id}/tags/{tag}

链接

ActionResponse deleteAll(String serverId)

DELETE /v2.1/{project_id}/servers/{server_id}/tags/{tag}

链接

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

Interface

Method

API

CloudServerService

String create(ServerCreate creation)

POST /v1/{project_id}/cloudservers

链接

List<CloudServer> list()

GET /v1/{project_id}/cloudservers/detail

链接

CloudServers listWithCount()

GET /v1/{project_id}/cloudservers/detail

链接

CloudServer get(String serverId)

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

链接

String resize(ResizeServer resize,String serverId)

POST /v1/{project_id}/cloudservers/{server_id}/resize

链接

String delete(List<String> serverIds, boolean deletePublicIp, boolean deleteVolume)

POST /v1/{project_id}/cloudservers/delete

链接

String stop(List<String> serverIds, StopType type)

POST /v1/{project_id}/cloudservers/action

链接

String reboot(List<String> serverIds, RebootType type)

POST /v1/{project_id}/cloudservers/action

链接

String start(List<String> serverIds)

POST /v1/{project_id}/cloudservers/action

链接

List<CloudServer> list(Map<String, String> filteringParams)

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

链接

CloudServers listWithCount(Map<String, String> filteringParams)

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

链接

List<Flavor> getSpecifications(String availabilityZone)

GET /v1/{project_id}/cloudservers/flavors{?availability_zone}

链接

CloudAbsoluteLimit limits()

GET /v1/{project_id}/cloudservers/limits

链接

SupportAutoRecovery getAutoRecovery(String serverId)

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

链接

ActionResponse manageAutoRecovery(String serverId, SupportAutoRecovery supportAutoRecovery)

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

链接

JobService

Job get(String jobId)

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

链接

TagService

ActionResponse add(String serverId, List<ServerTags>

serverTags)

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

链接

ActionResponse delete(String serverId, List<ServerTags>

serverTags)

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

链接

CloudServerTag list(String serverId)

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

链接

ProjectTag listProjectTags()

GET /v1/{project_id}/cloudservers/tags

链接

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

Interface

Method

API

CloudServerV2Service

AsyncJobEntity reinstallOS(OSReinstall osReinstall, String serverId)

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

链接

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

Interface

Method

API

CloudServerService

AsyncRespEntity create(ServerCreate creation)

POST /v1.1/{project_id}/cloudservers

链接

AsyncRespEntity resize(ResizeServer resize,String serverId)

POST /v1.1/{project_id}/cloudservers/{server_id}/resize

链接

分享:

    相关文档

    相关产品

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

提交成功!

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

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

*必选

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

字符长度不能超过200

提交反馈 取消

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

跳转到云社区