• CLI

sdk
  1. Help Center
  2. CLI
  3. Developer Guide
  4. Mapping Between API and SDK
  5. Python
  6. ECS

ECS

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)

GET /flavors List Flavors

get_flavor(self, flavor)

GET /flavors/{flavor_id} Show Flavor Details

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

GET /flavors/detail List Flavors

Image Operations

delete_image(self, image, ignore_missing=True)

DELETE /images/{image_id} Delete Image

find_image(self, name_or_id, ignore_missing=True)

GET /images List Images

get_image(self, image)

GET /images/{image_id} Show Image Details

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

GET /images/detail

get_image_metadata(self, image)

GET /images/{image_id}/metadata List Image Metadata

Keypair Operations

create_keypair(self, **attrs)

POST /os-keypairs

delete_keypair(self, keypair, ignore_missing=True)

DELETE /os-keypairs/{keypair_name}

get_keypair(self, keypair)

GET /os-keypairs/{keypair_name}

find_keypair(self, name_or_id, ignore_missing=True)

GET /os-keypairs

keypairs(self)

GET /os-keypairs

Server Operations

create_server(self, **attrs)

POST /servers Create Server

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

DELETE /servers/{server_id} Delete Server

find_server(self, name_or_id, ignore_missing=True)

GET /servers List Servers

get_server(self, server)

GET /servers/{server_id} Show Server Details

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

GET /servers List Servers

update_server(self, server, **attrs)

PUT /servers/{server_id} Update Server

reboot_server(self, server, reboot_type)

POST /servers/{server_id}/action Reboot Server (reboot Action)

rebuild_server(self, server, name, admin_password, **attrs)

POST /servers/{server_id}/action Rebuild Server (rebuild Action)

resize_server(self, server, flavor)

POST /servers/{server_id}/action Resize Server (resize Action)

confirm_server_resize(self, server)

POST /servers/{server_id}/action Confirm Resized Server (confirmResize Action)

revert_server_resize(self, server)

POST /servers/{server_id}/action Revert Resized Server (revertResize Action)

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

POST /servers/{server_id}/action Create Image (createImage Action)

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

POST /servers/{server_id}/action Add (Associate) Floating Ip (addFloatingIp Action)

remove_floating_ip_from_server(self, server, address)

POST /servers/{server_id}/action Remove (Disassociate) Floating Ip (removeFloatingIp Action)

lock_server(self, server)

POST

/servers/{server_id}/action

Lock Server (lock Action)

unlock_server(self, server)

POST

/servers/{server_id}/action

Unlock Server (unlock Action)

start_server(self, server)

POST /servers/{server_id}/action Start Server (os-start Action)

stop_server(self, server)

POST /servers/{server_id}/action Stop Server (os-stop Action)

get_server_metadata(self, server)

GET /servers/{server_id}/metadata List All Metadata

set_server_metadata(self, server, **metadata)

POST /servers/{server_id}/metadata Create or Update Metadata Items

delete_server_metadata(self, server, keys)

DELETE /servers/{server_id}/metadata/{key} Delete Metadata Item

wait_for_server(self, server, status='ACTIVE', failures=['ERROR'],

GET /servers/{server_id} Show Server Details

Server Interface Operations

create_server_interface(self, server, **attrs)

POST /servers/{server_id}/os-interface Create Interface

delete_server_interface(self, server_interface, server=None,

DELETE /servers/{server_id}/os-interface/{port_id} Detach Interface

get_server_interface(self, server_interface, server=None)

GET /servers/{server_id}/os-interface/{port_id} Show Port Interface Details

server_interfaces(self, server)

GET /servers/{server_id}/os-interface List Port Interfaces

Server IPs

server_ips(self, server, network_label=None)

GET /servers/{server_id}/ips List Ips

Availability Zone Operations

availability_zones(self, details=False)

GET /os-availability-zone Get Availability Zone Information

Server Group Operations

create_server_group(self, **attrs)

POST /os-server-groups Create Server Group

delete_server_group(self, server_group, ignore_missing=True)

DELETE /os-server-groups/{server_group_id} Delete Server Group

find_server_group(self, name_or_id, ignore_missing=True)

GET /os-server-groups List Server Groups

get_server_group(self, server_group)

GET /os-server-groups/{server_group_id} Show Server Group Details

The SDK interfaces based on the ECS v1.1 API are as follows.

Invocation example: 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