Help Center > > Developer Guide> Mapping Between API and SDK> Python> ECS

ECS

Updated at: Jan 02, 2020 GMT+08:00

The SDK interfaces based on the Nova v2 API are as follows. Invocation example: 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, paginated=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, paginated=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}

The SDK interfaces based on the ECS v1 API are as follows. Invocation example: conn.ecs.get_server()

Interface

Method

API

Server Operations

get_server(self, server_id)

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

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

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

def batch_change_os_server(self, **data)

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

(Currently, no API link is available.)

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

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel