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

ECS

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

基于Nova v2 API的SDK接口如下,调用方式举例如下:conn.compute.create_server()

Interface

Method

API

Flavor Operations

find_flavor(self, name_or_id, ignore_missing=True)

  • name:

    GET /v2/{project_id}/flavors

    链接

  • id:

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

    链接

get_flavor(self, flavor)

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

链接

query_flavor_extra_specs(self, flavor_id)

GET /v2/{project_id}/flavors/{flavors_id}/os-extra_specs

链接

flavors(self, details=True, **query)

GET /v2/{project_id}/flavors/detail

链接

Image Operations

delete_image(self, image, ignore_missing=True)

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

链接

find_image(self, name_or_id, ignore_missing=True)

name:

GET /v2/{project_id}/images

链接

Image_id:

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

链接

get_image(self, image)

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

链接

images(self, details=True, **query)

GET /v2/{project_id}/images/detail

链接

get_image_metadata(self, image)

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

链接

Keypair Operations

create_keypair(self, **attrs)

POST /v2/{project_id}/os-keypairs

链接

delete_keypair(self, keypair, ignore_missing=True)

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

链接

get_keypair(self, keypair)

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

链接

find_keypair(self, name, ignore_missing=True)

Keypair_name:

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

链接

Name:

GET /v2/{project_id}/os-keypairs

链接

keypairs(self)

GET /v2/{project_id}/os-keypairs

链接

Server Operations

create_server(self, **attrs)

POST /v2/{project_id}/servers

链接

delete_server(self, server, ignore_missing=True, force=False)

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

链接

find_server(self, name_or_id, ignore_missing=True)

Name:

GET /v2/{project_id}/servers

链接

Server_id:

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

链接

get_server(self, server)

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

链接

servers(self, details=True, **query)

  • details=True:

    GET /v2/{project_id}/servers/detail

    链接

  • details=False:

    GET /v2/{project_id}/servers

    链接

create_server_image(self, server, name, metadata=None)

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

链接

add_floating_ip_to_server(self, server, address, fixed_address=None)

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

链接

remove_floating_ip_from_server(self, server, address)

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

链接

lock_server(self, server)

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

链接

unlock_server(self, server)

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

链接

start_server(self, server)

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

链接

stop_server(self, server)

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

链接

wait_for_server(self, server, status='ACTIVE', failures=['ERROR'], interval=2, wait=120)

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

链接

instance_actions(self, server_id)

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

链接

get_instance_action(self, server_id, request_id)

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

链接

get_server_console_output(self, server_id, lines)

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

链接

Server Interface Operations

create_server_interface(self, server, **attrs)

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

链接

delete_server_interface(self, server_interface, server=None, ignore_missing=True)

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

链接

get_server_interface(self, server_interface, server=None)

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

链接

server_interfaces(self, server)

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

链接

Server IPs Operations

server_ips(self, server, network_label=None)

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

链接

Availability Zone Operations

availability_zones(self, details=False)

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

链接

Server Group Operations

create_server_group(self, **attrs)

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

链接

delete_server_group(self, server_group, ignore_missing=True)

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

链接

find_server_group(self, name_or_id, ignore_missing=True)

Name:

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

链接

Server_group_id:

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

链接

get_server_group(self, server_group)

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

链接

Quota Operations

get_limits(self)

GET /v2/{project_id}/limits

链接

query_quota(self, project_id)

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

链接

query_quota_default(self, project_id)

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

链接

Volume Attachment Operations

delete_volume_attachment(self, volume_attachment, server, force_del=False, ignore_missing=True)

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

链接

volume_attachments(self, server)

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

链接

get_volume_attachment(self, volume_attachment, server)

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

链接

create_volume_attachment(self, server, **attrs)

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

链接

Metadata Operations

get_server_metadata(self, server, key=None)

  • Key=None:

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

    链接

  • Key !=None:

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

    链接

update_server_metadata(self, server, key, value)

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

链接

set_server_metadata(self, server, **metadata)

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

链接

delete_server_metadata(self, server, keys)

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

链接

基于ECS v1.1 API的SDK接口如下,调用方式举例:conn.ecs.create_server_ext()

Interface

Method

API

Server Operations

create_server_ext(self, **data)

POST /v1.1/{project_id}/cloudservers

链接

resize_server_ext(self, server_id, **data)

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

链接

基于ECS v1 API的SDK接口如下,调用方式举例:conn.ecs.get_server()

Interface

Method

API

Server Operations

get_server(self, server_id)

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

链接

servers(self, **query)

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

链接

get_autorecovery(self, server_id)

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

链接

config_autorecovery(self, server_id, autorecovery)

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

链接

Flavor Operations

flavors(self, **query)

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

链接

Quota Operations

quotas(self)

GET /v1/{project_id}/cloudservers/limits

链接

Server Tag Operations

create_server_tags(self, server_id, **data)

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

链接

delete_server_tags(self, server_id, **data)

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

链接

get_server_tags(self, server_id)

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

链接

get_project_tags(self)

GET /v1/{project_id}/cloudservers/tags

链接

分享:

    相关文档

    相关产品

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

提交成功!

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

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

*必选

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

字符长度不能超过200

提交反馈 取消

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

跳转到云社区