7. APIs code

7.1. Command Specifications

7.1.1. user

class kamaki.cli.commands.astakos.user_authenticate(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Authenticate a user Get user information (e.g., unique account name) from token Token should be set in settings: * check if a token is set /config whoami cloud.default.token * permanently set a token /config set cloud.default.token <token> Token can also be provided as a parameter (In case of another named cloud, use its name instead of default)

description = 'Authenticate a user'
long_description = ' Get user information (e.g., unique account name) from token\n Token should be set in settings:\n * check if a token is set /config whoami cloud.default.token\n * permanently set a token /config set cloud.default.token <token>\n Token can also be provided as a parameter\n (In case of another named cloud, use its name instead of default)\n '
main(custom_token=None)[source]
syntax = '[custom token]'
class kamaki.cli.commands.astakos.user_list(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

List all authenticated users

description = 'List all authenticated users'
long_description = ''
main()[source]
syntax = ''
class kamaki.cli.commands.astakos.user_set(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Set session user by id To enrich your options, authenticate more users: /user authenticate <other user token> To list authenticated users /user list To get the current session user /user whoami

description = 'Set session user by id'
long_description = ' To enrich your options, authenticate more users:\n /user authenticate <other user token>\n To list authenticated users\n /user list\n To get the current session user\n /user whoami\n '
main(uuid)[source]
syntax = '<uuid>'
class kamaki.cli.commands.astakos.user_whoami(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Get current session user information

description = 'Get current session user information'
long_description = ''
main()[source]
syntax = ''

7.1.2. cyclades (server, flavor, network)

class kamaki.cli.commands.cyclades.PersonalityArgument(help='', parsed_name=None, default=[])[source]
terms = (('local-path', 'contents'), ('server-path', 'path'), ('owner', 'owner'), ('group', 'group'), ('mode', 'mode'))
value[source]
class kamaki.cli.commands.cyclades.flavor_info(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Detailed information on a hardware flavor To get a list of available flavors and flavor ids, try /flavor list

description = 'Detailed information on a hardware flavor'
long_description = ' To get a list of available flavors and flavor ids, try /flavor list\n '
main(flavor_id)[source]
syntax = '<flavor id>'
class kamaki.cli.commands.cyclades.flavor_list(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

List available hardware flavors

PERMANENTS = ('id', 'name')
arguments = {'ram': <kamaki.cli.argument.ValueArgument object at 0x2857090>, 'enum': <kamaki.cli.argument.FlagArgument object at 0x2857050>, 'detail': <kamaki.cli.argument.FlagArgument object at 0x2853e10>, 'vcpus': <kamaki.cli.argument.ValueArgument object at 0x28570d0>, 'limit': <kamaki.cli.argument.IntArgument object at 0x2853f50>, 'disk_template': <kamaki.cli.argument.ValueArgument object at 0x28571d0>, 'disk': <kamaki.cli.argument.ValueArgument object at 0x2857150>, 'more': <kamaki.cli.argument.FlagArgument object at 0x2853fd0>}
description = 'List available hardware flavors'
long_description = ''
main()[source]
syntax = ''
class kamaki.cli.commands.cyclades.ip_attach(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Attach a floating IP to a server

description = 'Attach a floating IP to a server'
long_description = ' '
main(server_id, IP)[source]
syntax = '<server id> <IP>'
class kamaki.cli.commands.cyclades.ip_detach(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Detach a floating IP from a server

description = 'Detach a floating IP from a server'
long_description = ' '
main(server_id, IP)[source]
syntax = '<server id> <IP>'
class kamaki.cli.commands.cyclades.ip_info(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Details for an IP

description = 'Details for an IP'
long_description = ''
main(IP)[source]
syntax = '<IP>'
class kamaki.cli.commands.cyclades.ip_list(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

List reserved floating IPs

description = 'List reserved floating IPs'
long_description = ''
main()[source]
syntax = ''
class kamaki.cli.commands.cyclades.ip_pools(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

List pools of floating IPs

description = 'List pools of floating IPs'
long_description = ''
main()[source]
syntax = ''
class kamaki.cli.commands.cyclades.ip_release(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Release a floating IP The release IP is “returned” to the IP pool it came from.

description = 'Release a floating IP'
long_description = ' The release IP is "returned" to the IP pool it came from.\n '
main(IP)[source]
syntax = '<IP>'
class kamaki.cli.commands.cyclades.ip_reserve(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Reserve a floating IP An IP is reserved from an IP pool. The default IP pool is chosen automatically, but there is the option if specifying an explicit IP pool.

arguments = {'pool': <kamaki.cli.argument.ValueArgument object at 0x28596d0>}
description = 'Reserve a floating IP'
long_description = ' An IP is reserved from an IP pool. The default IP pool is chosen\n automatically, but there is the option if specifying an explicit IP pool.\n '
main(requested_IP=None)[source]
syntax = '[requested IP]'
class kamaki.cli.commands.cyclades.network_connect(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Connect a server to a network

description = 'Connect a server to a network'
long_description = ''
main(server_id, network_id)[source]
syntax = '<server id> <network id>'
class kamaki.cli.commands.cyclades.network_create(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Create an (unconnected) network

arguments = {'dhcp': <kamaki.cli.argument.FlagArgument object at 0x2857d50>, 'cidr': <kamaki.cli.argument.ValueArgument object at 0x2857bd0>, 'type': <kamaki.cli.argument.ValueArgument object at 0x2857dd0>, 'gateway': <kamaki.cli.argument.ValueArgument object at 0x2857cd0>, 'wait': <kamaki.cli.argument.FlagArgument object at 0x2857e10>}
description = 'Create an (unconnected) network'
long_description = ''
main(name)[source]
syntax = '<name>'
class kamaki.cli.commands.cyclades.network_delete(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Delete a network

arguments = {'wait': <kamaki.cli.argument.FlagArgument object at 0x2857fd0>}
description = 'Delete a network'
long_description = ''
main(network_id)[source]
syntax = '<network id>'
class kamaki.cli.commands.cyclades.network_disconnect(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Disconnect a nic that connects a server to a network Nic ids are listed as “attachments” in detailed network information To get detailed network information: /network info <network id>

description = 'Disconnect a nic that connects a server to a network'
long_description = ' Nic ids are listed as "attachments" in detailed network information\n To get detailed network information: /network info <network id>\n '
main(nic_id)[source]
syntax = '<nic id>'
class kamaki.cli.commands.cyclades.network_info(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Detailed information on a network To get a list of available networks and network ids, try /network list

description = 'Detailed information on a network'
long_description = ' To get a list of available networks and network ids, try /network list\n '
main(network_id)[source]
syntax = '<network id>'
class kamaki.cli.commands.cyclades.network_list(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

List networks

PERMANENTS = ('id', 'name')
arguments = {'status': <kamaki.cli.argument.ValueArgument object at 0x2857690>, 'no_dhcp': <kamaki.cli.argument.FlagArgument object at 0x2857850>, 'enum': <kamaki.cli.argument.FlagArgument object at 0x2857650>, 'private': <kamaki.cli.argument.FlagArgument object at 0x2857750>, 'type': <kamaki.cli.argument.ValueArgument object at 0x2857b50>, 'cidr': <kamaki.cli.argument.ValueArgument object at 0x2857a50>, 'gateway': <kamaki.cli.argument.ValueArgument object at 0x2857950>, 'user_id': <kamaki.cli.argument.ValueArgument object at 0x28578d0>, 'cidr6': <kamaki.cli.argument.ValueArgument object at 0x2857ad0>, 'detail': <kamaki.cli.argument.FlagArgument object at 0x2857490>, 'gateway6': <kamaki.cli.argument.ValueArgument object at 0x28579d0>, 'limit': <kamaki.cli.argument.IntArgument object at 0x2857590>, 'dhcp': <kamaki.cli.argument.FlagArgument object at 0x28577d0>, 'user_name': <kamaki.cli.argument.ValueArgument object at 0x2857910>, 'public': <kamaki.cli.argument.FlagArgument object at 0x28576d0>, 'more': <kamaki.cli.argument.FlagArgument object at 0x2857610>}
description = 'List networks'
long_description = ''
main()[source]
syntax = ''
class kamaki.cli.commands.cyclades.network_rename(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Set the name of a network

description = 'Set the name of a network'
long_description = ''
main(network_id, new_name)[source]
syntax = '<network id> <new name>'
class kamaki.cli.commands.cyclades.network_wait(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Wait for server to finish [PENDING, ACTIVE, DELETED]

arguments = {'timeout': <kamaki.cli.argument.IntArgument object at 0x2859450>}
description = 'Wait for server to finish [PENDING, ACTIVE, DELETED]'
long_description = ''
main(network_id, current_status='PENDING')[source]
syntax = '<network id> [current status]'
class kamaki.cli.commands.cyclades.server_addr(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

List the addresses of all network interfaces on a virtual server

arguments = {'enum': <kamaki.cli.argument.FlagArgument object at 0x28534d0>}
description = 'List the addresses of all network interfaces on a virtual server'
long_description = ''
main(server_id)[source]
syntax = '<server id>'
class kamaki.cli.commands.cyclades.server_console(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Get a VNC console to access an existing virtual server Console connection information provided (at least): - host: (url or address) a VNC host - port: (int) the gateway to enter virtual server on host - password: for VNC authorization

description = 'Get a VNC console to access an existing virtual server'
long_description = ' Console connection information provided (at least):\n - host: (url or address) a VNC host\n - port: (int) the gateway to enter virtual server on host\n - password: for VNC authorization\n '
main(server_id)[source]
syntax = '<server id>'
class kamaki.cli.commands.cyclades.server_create(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Create a server (aka Virtual Machine) Parameters: - name: (single quoted text) - flavor id: Hardware flavor. Pick one from: /flavor list - image id: OS images. Pick one from: /image list

arguments = {'wait': <kamaki.cli.argument.FlagArgument object at 0x355a510>, 'cluster_size': <kamaki.cli.argument.IntArgument object at 0x355a590>, 'personality': <kamaki.cli.commands.cyclades.PersonalityArgument object at 0x355a410>}
description = 'Create a server (aka Virtual Machine)'
long_description = ' Parameters:\n - name: (single quoted text)\n - flavor id: Hardware flavor. Pick one from: /flavor list\n - image id: OS images. Pick one from: /image list\n '
main(name, flavor_id, image_id)[source]
syntax = '<name> <flavor id> <image id>'
class kamaki.cli.commands.cyclades.server_delete(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Delete a virtual server

arguments = {'cluster': <kamaki.cli.argument.FlagArgument object at 0x355a8d0>, 'wait': <kamaki.cli.argument.FlagArgument object at 0x355a790>}
description = 'Delete a virtual server'
long_description = ''
main(server_id_or_cluster_prefix)[source]
syntax = '<server id or cluster prefix>'
class kamaki.cli.commands.cyclades.server_firewall(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Manage virtual server firewall profiles for public networks

description = 'Manage virtual server firewall profiles for public networks'
long_description = ''
syntax = ''
class kamaki.cli.commands.cyclades.server_firewall_get(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Get the firewall profile for a virtual servers’ public network

description = "Get the firewall profile for a virtual servers' public network"
long_description = ''
main(server_id)[source]
syntax = '<server id>'
class kamaki.cli.commands.cyclades.server_firewall_set(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Set the firewall profile on virtual server public network Values for profile: - DISABLED: Shutdown firewall - ENABLED: Firewall in normal mode - PROTECTED: Firewall in secure mode

arguments = {'timeout': <kamaki.cli.argument.IntArgument object at 0x2853250>, 'wait': <kamaki.cli.argument.FlagArgument object at 0x2853190>}
description = 'Set the firewall profile on virtual server public network'
long_description = ' Values for profile:\n - DISABLED: Shutdown firewall\n - ENABLED: Firewall in normal mode\n - PROTECTED: Firewall in secure mode\n '
main(server_id, profile)[source]
syntax = '<server id> <profile>'
class kamaki.cli.commands.cyclades.server_info(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Detailed information on a Virtual Machine Contains: - name, id, status, create/update dates - network interfaces - metadata (e.g., os, superuser) and diagnostics - hardware flavor and os image ids

description = 'Detailed information on a Virtual Machine'
long_description = ' Contains:\n - name, id, status, create/update dates\n - network interfaces\n - metadata (e.g., os, superuser) and diagnostics\n - hardware flavor and os image ids\n '
main(server_id)[source]
syntax = '<server id>'
class kamaki.cli.commands.cyclades.server_list(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

List virtual servers accessible by user Use filtering arguments (e.g., –name-like) to manage long server lists

PERMANENTS = ('id', 'name')
arguments = {'status': <kamaki.cli.argument.ValueArgument object at 0x355a150>, 'enum': <kamaki.cli.argument.FlagArgument object at 0x3553fd0>, 'user_id': <kamaki.cli.argument.ValueArgument object at 0x355a0d0>, 'since': <kamaki.cli.argument.DateArgument object at 0x3553f10>, 'detail': <kamaki.cli.argument.FlagArgument object at 0x3553e50>, 'image_id': <kamaki.cli.argument.ValueArgument object at 0x355a090>, 'meta': <kamaki.cli.argument.KeyValueArgument object at 0x355a190>, 'limit': <kamaki.cli.argument.IntArgument object at 0x3553f50>, 'flavor_id': <kamaki.cli.argument.ValueArgument object at 0x355a050>, 'user_name': <kamaki.cli.argument.ValueArgument object at 0x355a110>, 'meta_like': <kamaki.cli.argument.KeyValueArgument object at 0x355a1d0>, 'more': <kamaki.cli.argument.FlagArgument object at 0x3553f90>}
description = 'List virtual servers accessible by user'
long_description = ' Use filtering arguments (e.g., --name-like) to manage long server lists\n '
main()[source]
syntax = ''
class kamaki.cli.commands.cyclades.server_metadata(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Manage Server metadata (key:value pairs of server attributes)

description = 'Manage Server metadata (key:value pairs of server attributes)'
long_description = ''
syntax = ''
class kamaki.cli.commands.cyclades.server_metadata_delete(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Delete virtual server metadata

description = 'Delete virtual server metadata'
long_description = ''
main(server_id, key)[source]
syntax = '<server id> <key>'
class kamaki.cli.commands.cyclades.server_metadata_list(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Get server metadata

description = 'Get server metadata'
long_description = ''
main(server_id, key='')[source]
syntax = '<server id> [key]'
class kamaki.cli.commands.cyclades.server_metadata_set(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Set / update virtual server metadata Metadata should be given in key/value pairs in key=value format For example: /server metadata set <server id> key1=value1 key2=value2 Old, unreferenced metadata will remain intact

description = 'Set / update virtual server metadata'
long_description = ' Metadata should be given in key/value pairs in key=value format\n For example: /server metadata set <server id> key1=value1 key2=value2\n Old, unreferenced metadata will remain intact\n '
main(server_id, *key_equals_val)[source]
syntax = '<server id> <key_equals_val ...>'
class kamaki.cli.commands.cyclades.server_reboot(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Reboot a virtual server

arguments = {'hard': <kamaki.cli.argument.FlagArgument object at 0x355a910>, 'type': <kamaki.cli.argument.ValueArgument object at 0x355aa10>, 'wait': <kamaki.cli.argument.FlagArgument object at 0x355aa50>}
description = 'Reboot a virtual server'
long_description = ''
main(server_id)[source]
syntax = '<server id>'
class kamaki.cli.commands.cyclades.server_rename(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Set/update a virtual server name virtual server names are not unique, therefore multiple servers may share the same name

description = 'Set/update a virtual server name'
long_description = ' virtual server names are not unique, therefore multiple servers may share\n the same name\n '
main(server_id, new_name)[source]
syntax = '<server id> <new name>'
class kamaki.cli.commands.cyclades.server_resize(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Set a different flavor for an existing server To get server ids and flavor ids: /server list /flavor list

description = 'Set a different flavor for an existing server'
long_description = ' To get server ids and flavor ids:\n /server list\n /flavor list\n '
main(server_id, flavor_id)[source]
syntax = '<server id> <flavor id>'
class kamaki.cli.commands.cyclades.server_shutdown(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Shutdown an active virtual server

arguments = {'wait': <kamaki.cli.argument.FlagArgument object at 0x355ac90>}
description = 'Shutdown an active virtual server'
long_description = ''
main(server_id)[source]
syntax = '<server id>'
class kamaki.cli.commands.cyclades.server_start(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Start an existing virtual server

arguments = {'wait': <kamaki.cli.argument.FlagArgument object at 0x355ab10>}
description = 'Start an existing virtual server'
long_description = ''
main(server_id)[source]
syntax = '<server id>'
class kamaki.cli.commands.cyclades.server_stats(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Get virtual server statistics

description = 'Get virtual server statistics'
long_description = ''
main(server_id)[source]
syntax = '<server id>'
class kamaki.cli.commands.cyclades.server_wait(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Wait for server to finish [BUILD, STOPPED, REBOOT, ACTIVE]

arguments = {'timeout': <kamaki.cli.argument.IntArgument object at 0x2853c50>}
description = 'Wait for server to finish [BUILD, STOPPED, REBOOT, ACTIVE]'
long_description = ''
main(server_id, current_status='BUILD')[source]
syntax = '<server id> [current status]'

7.1.3. pithos (file)

class kamaki.cli.commands.pithos.RangeArgument(help='', parsed_name=None, default=None)[source]
Value type:string of the form <start>-<end> where <start> and <end> are integers
Value returns:the input string, after type checking <start> and <end>
value[source]
class kamaki.cli.commands.pithos.SharingArgument(help='', parsed_name=None, default=None)[source]

Set sharing (read and/or write) groups . :value type: “read=term1,term2,... write=term1,term2,...” . :value returns: {‘read’:[‘term1’, ‘term2’, ...], . ‘write’:[‘term1’, ‘term2’, ...]}

value[source]
class kamaki.cli.commands.pithos.file_append(arguments={}, auth_base=None, cloud=None)[source]

Append local file to (existing) remote object The remote object should exist. If the remote object is a directory, it is transformed into a file. In the later case, objects under the directory remain intact.

arguments = {'progress_bar': <kamaki.cli.argument.ProgressBarArgument object at 0x3f7e410>}
description = 'Append local file to (existing) remote object'
long_description = ' The remote object should exist.\n If the remote object is a directory, it is transformed into a file.\n In the later case, objects under the directory remain intact.\n '
main(local_path, container___path)[source]
syntax = '<local path> <container:path>'
class kamaki.cli.commands.pithos.file_cat(arguments={}, auth_base=None, cloud=None)[source]

Print remote file contents to console

arguments = {'object_version': <kamaki.cli.argument.ValueArgument object at 0x3f8da50>, 'if_none_match': <kamaki.cli.argument.ValueArgument object at 0x3f8d910>, 'if_modified_since': <kamaki.cli.argument.DateArgument object at 0x3f8d990>, 'if_match': <kamaki.cli.argument.ValueArgument object at 0x3f8d890>, 'if_unmodified_since': <kamaki.cli.argument.DateArgument object at 0x3f8d9d0>, 'range': <kamaki.cli.commands.pithos.RangeArgument object at 0x3f8d790>}
description = 'Print remote file contents to console'
long_description = ''
main(container___path)[source]
syntax = '<container:path>'
class kamaki.cli.commands.pithos.file_containerlimit(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Container size limit commands

description = 'Container size limit commands'
long_description = ''
syntax = ''
class kamaki.cli.commands.pithos.file_containerlimit_get(arguments={}, auth_base=None, cloud=None)[source]

Get container size limit

arguments = {'in_bytes': <kamaki.cli.argument.FlagArgument object at 0x3f8e910>}
description = 'Get container size limit'
long_description = ''
main(container=None)[source]
syntax = '[container]'
class kamaki.cli.commands.pithos.file_containerlimit_set(arguments={}, auth_base=None, cloud=None)[source]

Set new storage limit for a container By default, the limit is set in bytes Users may specify a different unit, e.g: /file containerlimit set 2.3GB mycontainer Valid units: B, KiB (1024 B), KB (1000 B), MiB, MB, GiB, GB, TiB, TB To set container limit to “unlimited”, use 0

description = 'Set new storage limit for a container'
long_description = ' By default, the limit is set in bytes\n Users may specify a different unit, e.g:\n /file containerlimit set 2.3GB mycontainer\n Valid units: B, KiB (1024 B), KB (1000 B), MiB, MB, GiB, GB, TiB, TB\n To set container limit to "unlimited", use 0\n '
main(limit, container=None)[source]
syntax = '<limit> [container]'
class kamaki.cli.commands.pithos.file_copy(arguments={}, auth_base=None, cloud=None)[source]

Copy objects from container to (another) container Semantics: copy cont:path dir . transfer path as dir/path copy cont:path cont2: . trasnfer all <obj> prefixed with path to container cont2 copy cont:path [cont2:]path2 . transfer path to path2 Use options: 1. <container1>:<path1> [container2:]<path2> : if container2 is not given, destination is container1:path2 2. <container>:<path1> <path2> : make a copy in the same container 3. Can use –container= instead of <container1>

arguments = {'suffix_replace': <kamaki.cli.argument.ValueArgument object at 0x3f7e990>, 'suffix': <kamaki.cli.argument.ValueArgument object at 0x3f7ea50>, 'recursive': <kamaki.cli.argument.FlagArgument object at 0x3f7e290>, 'add_prefix': <kamaki.cli.argument.ValueArgument object at 0x3f7ea10>, 'add_suffix': <kamaki.cli.argument.ValueArgument object at 0x3f7e390>, 'prefix': <kamaki.cli.argument.FlagArgument object at 0x3f7e9d0>, 'prefix_replace': <kamaki.cli.argument.ValueArgument object at 0x3f7ea90>, 'content_type': <kamaki.cli.argument.ValueArgument object at 0x3f7e250>, 'source_version': <kamaki.cli.argument.ValueArgument object at 0x3f7ef90>, 'destination_account': <kamaki.cli.argument.ValueArgument object at 0x3f7e210>, 'public': <kamaki.cli.argument.ValueArgument object at 0x3f7e090>, 'destination_container': <kamaki.cli.argument.ValueArgument object at 0x3f7e2d0>}
description = 'Copy objects from container to (another) container'
long_description = ' Semantics:\n copy cont:path dir\n . transfer path as dir/path\n copy cont:path cont2:\n . trasnfer all <obj> prefixed with path to container cont2\n copy cont:path [cont2:]path2\n . transfer path to path2\n Use options:\n 1. <container1>:<path1> [container2:]<path2> : if container2 is not given,\n destination is container1:path2\n 2. <container>:<path1> <path2> : make a copy in the same container\n 3. Can use --container= instead of <container1>\n '
main(source_container___path, destination_container___path=None)[source]
syntax = '<source container:path> [destination container:path]'
class kamaki.cli.commands.pithos.file_create(arguments={}, auth_base=None, cloud=None)[source]

Create a container

arguments = {'meta': <kamaki.cli.argument.KeyValueArgument object at 0x3f72d50>, 'limit': <kamaki.cli.argument.IntArgument object at 0x3f72cd0>, 'versioning': <kamaki.cli.argument.ValueArgument object at 0x3f72bd0>}
description = 'Create a container'
long_description = ''
main(container=None)[source]
syntax = '[container]'
class kamaki.cli.commands.pithos.file_delete(arguments={}, auth_base=None, cloud=None)[source]

Delete a container [or an object] How to delete a non-empty container: - empty the container: /file delete -R <container> - delete it: /file delete <container> . Semantics of directory deletion: .a preserve the contents: /file delete <container>:<directory> . objects of the form dir/filename can exist with a dir object .b delete contents: /file delete -R <container>:<directory> . all dir/* objects are affected, even if dir does not exist . To restore a deleted object OBJ in a container CONT: - get object versions: /file versions CONT:OBJ . and choose the version to be restored - restore the object: /file copy –source-version=<version> CONT:OBJ OBJ

arguments = {'delimiter': <kamaki.cli.argument.ValueArgument object at 0x3f77050>, 'until': <kamaki.cli.argument.DateArgument object at 0x3f77910>, 'yes': <kamaki.cli.argument.FlagArgument object at 0x3f77e10>, 'recursive': <kamaki.cli.argument.FlagArgument object at 0x3f77e50>}
description = 'Delete a container [or an object]'
long_description = ' How to delete a non-empty container:\n - empty the container: /file delete -R <container>\n - delete it: /file delete <container>\n .\n Semantics of directory deletion:\n .a preserve the contents: /file delete <container>:<directory>\n . objects of the form dir/filename can exist with a dir object\n .b delete contents: /file delete -R <container>:<directory>\n . all dir/* objects are affected, even if dir does not exist\n .\n To restore a deleted object OBJ in a container CONT:\n - get object versions: /file versions CONT:OBJ\n . and choose the version to be restored\n - restore the object: /file copy --source-version=<version> CONT:OBJ OBJ\n '
main(container____path__=None)[source]
syntax = '[container[:path]]'
class kamaki.cli.commands.pithos.file_download(arguments={}, auth_base=None, cloud=None)[source]

Download remote object as local file If local destination is a directory: * download <container>:<path> <local dir> -R will download all files on <container> prefixed as <path>, to <local dir>/<full path> (or <local dir><full path> in windows) * download <container>:<path> <local dir> will download only one file<path> ATTENTION: to download cont:dir1/dir2/file there must exist objects cont:dir1 and cont:dir1/dir2 of type application/directory To create directory objects, use /file mkdir

arguments = {'object_version': <kamaki.cli.argument.ValueArgument object at 0x3f8de50>, 'recursive': <kamaki.cli.argument.FlagArgument object at 0x3f8df90>, 'if_modified_since': <kamaki.cli.argument.DateArgument object at 0x3f8dd90>, 'progress_bar': <kamaki.cli.argument.ProgressBarArgument object at 0x3f8df10>, 'poolsize': <kamaki.cli.argument.IntArgument object at 0x3f8ded0>, 'resume': <kamaki.cli.argument.FlagArgument object at 0x3f8db10>, 'range': <kamaki.cli.commands.pithos.RangeArgument object at 0x3f8dc50>, 'if_match': <kamaki.cli.argument.ValueArgument object at 0x3f8dc90>, 'if_unmodified_since': <kamaki.cli.argument.DateArgument object at 0x3f8ddd0>, 'if_none_match': <kamaki.cli.argument.ValueArgument object at 0x3f8dd10>}
description = 'Download remote object as local file'
long_description = ' If local destination is a directory:\n * download <container>:<path> <local dir> -R\n will download all files on <container> prefixed as <path>,\n to <local dir>/<full path> (or <local dir>\\<full path> in windows)\n * download <container>:<path> <local dir>\n will download only one file<path>\n ATTENTION: to download cont:dir1/dir2/file there must exist objects\n cont:dir1 and cont:dir1/dir2 of type application/directory\n To create directory objects, use /file mkdir\n '
main(container___path, local_path=None)[source]
syntax = '<container:path> [local path]'
class kamaki.cli.commands.pithos.file_group(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Manage access groups and group members

description = 'Manage access groups and group members'
long_description = ''
syntax = ''
class kamaki.cli.commands.pithos.file_group_delete(arguments={}, auth_base=None, cloud=None)[source]

Delete a user group

description = 'Delete a user group'
long_description = ''
main(groupname)[source]
syntax = '<groupname>'
class kamaki.cli.commands.pithos.file_group_list(arguments={}, auth_base=None, cloud=None)[source]

list all groups and group members

description = 'list all groups and group members'
long_description = ''
main()[source]
syntax = ''
class kamaki.cli.commands.pithos.file_group_set(arguments={}, auth_base=None, cloud=None)[source]

Set a user group

description = 'Set a user group'
long_description = ''
main(groupname, *users)[source]
syntax = '<groupname> <users ...>'
class kamaki.cli.commands.pithos.file_hashmap(arguments={}, auth_base=None, cloud=None)[source]

Get the hash-map of an object

arguments = {'object_version': <kamaki.cli.argument.ValueArgument object at 0x3f77bd0>, 'if_match': <kamaki.cli.argument.ValueArgument object at 0x3f77fd0>, 'if_unmodified_since': <kamaki.cli.argument.DateArgument object at 0x3f77cd0>, 'if_none_match': <kamaki.cli.argument.ValueArgument object at 0x3f77b50>, 'if_modified_since': <kamaki.cli.argument.DateArgument object at 0x3f77d50>}
description = 'Get the hash-map of an object'
long_description = ''
main(container___path)[source]
syntax = '<container:path>'
class kamaki.cli.commands.pithos.file_info(arguments={}, auth_base=None, cloud=None)[source]

Get detailed information for user account, containers or objects to get account info: /file info to get container info: /file info <container> to get object info: /file info <container>:<path>

arguments = {'object_version': <kamaki.cli.argument.ValueArgument object at 0x3f77b90>}
description = 'Get detailed information for user account, containers or objects'
long_description = ' to get account info: /file info\n to get container info: /file info <container>\n to get object info: /file info <container>:<path>\n '
main(container____path__=None)[source]
syntax = '[container[:path]]'
class kamaki.cli.commands.pithos.file_list(arguments={}, auth_base=None, cloud=None)[source]

List containers, object trees or objects in a directory Use with: 1 no parameters : containers in current account 2. one parameter (container) or –container : contents of container 3. <container>:<prefix> or –container=<container> <prefix>: objects in . container starting with prefix

arguments = {'recursive': <kamaki.cli.argument.FlagArgument object at 0x3f728d0>, 'format': <kamaki.cli.argument.ValueArgument object at 0x3f72790>, 'if_modified_since': <kamaki.cli.argument.ValueArgument object at 0x3f72650>, 'enum': <kamaki.cli.argument.FlagArgument object at 0x3f72890>, 'exact_match': <kamaki.cli.argument.FlagArgument object at 0x3f72850>, 'detail': <kamaki.cli.argument.FlagArgument object at 0x41f9750>, 'delimiter': <kamaki.cli.argument.ValueArgument object at 0x3f72550>, 'meta': <kamaki.cli.argument.ValueArgument object at 0x3f72610>, 'limit': <kamaki.cli.argument.IntArgument object at 0x3f72490>, 'shared': <kamaki.cli.argument.FlagArgument object at 0x3f727d0>, 'marker': <kamaki.cli.argument.ValueArgument object at 0x3f724d0>, 'path': <kamaki.cli.argument.ValueArgument object at 0x3f725d0>, 'if_unmodified_since': <kamaki.cli.argument.ValueArgument object at 0x3f72690>, 'until': <kamaki.cli.argument.DateArgument object at 0x3f72710>, 'more': <kamaki.cli.argument.FlagArgument object at 0x3f72810>}
description = 'List containers, object trees or objects in a directory'
long_description = ' Use with:\n 1 no parameters : containers in current account\n 2. one parameter (container) or --container : contents of container\n 3. <container>:<prefix> or --container=<container> <prefix>: objects in\n . container starting with prefix\n '
main(container____path__=None)[source]
print_containers(container_list)[source]
print_objects(object_list)[source]
syntax = '[container[:path]]'
class kamaki.cli.commands.pithos.file_manifest(arguments={}, auth_base=None, cloud=None)[source]

Create a remote file of uploaded parts by manifestation Remains functional for compatibility with OOS Storage. Users are advised to use the upload command instead. Manifestation is a compliant process for uploading large files. The files have to be chunked in smalled files and uploaded as <prefix><increment> where increment is 1, 2, ... Finally, the manifest command glues partial files together in one file named <prefix> The upload command is faster, easier and more intuitive than manifest

arguments = {'sharing': <kamaki.cli.commands.pithos.SharingArgument object at 0x3f8d190>, 'etag': <kamaki.cli.argument.ValueArgument object at 0x3f7e890>, 'content_type': <kamaki.cli.argument.ValueArgument object at 0x3f8d110>, 'content_disposition': <kamaki.cli.argument.ValueArgument object at 0x3f8d090>, 'public': <kamaki.cli.argument.FlagArgument object at 0x3f8d1d0>, 'content_encoding': <kamaki.cli.argument.ValueArgument object at 0x3f7e850>}
description = 'Create a remote file of uploaded parts by manifestation'
long_description = ' Remains functional for compatibility with OOS Storage. Users are advised\n to use the upload command instead.\n Manifestation is a compliant process for uploading large files. The files\n have to be chunked in smalled files and uploaded as <prefix><increment>\n where increment is 1, 2, ...\n Finally, the manifest command glues partial files together in one file\n named <prefix>\n The upload command is faster, easier and more intuitive than manifest\n '
main(container___path)[source]
syntax = '<container:path>'
class kamaki.cli.commands.pithos.file_metadata(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Metadata are attached on objects. They are formed as key:value pairs. They can have arbitary values.

description = 'Metadata are attached on objects. They are formed as key:value pairs.'
long_description = ' They can have arbitary values.\n '
syntax = ''
class kamaki.cli.commands.pithos.file_metadata_delete(arguments={}, auth_base=None, cloud=None)[source]

Delete metadata with given key from account, container or object - to get metadata of current account: /file metadata get - to get metadata of a container: /file metadata get <container> - to get metadata of an object: /file metadata get <container>:<path>

description = 'Delete metadata with given key from account, container or object'
long_description = ' - to get metadata of current account: /file metadata get\n - to get metadata of a container: /file metadata get <container>\n - to get metadata of an object: /file metadata get <container>:<path>\n '
main(metakey, container____path__=None)[source]
syntax = '<metakey> [container[:path]]'
class kamaki.cli.commands.pithos.file_metadata_get(arguments={}, auth_base=None, cloud=None)[source]

Get metadata for account, containers or objects

arguments = {'object_version': <kamaki.cli.argument.ValueArgument object at 0x3f8e090>, 'until': <kamaki.cli.argument.DateArgument object at 0x3f8e0d0>, 'detail': <kamaki.cli.argument.FlagArgument object at 0x3f77810>}
description = 'Get metadata for account, containers or objects'
long_description = ''
main(container____path__=None)[source]
syntax = '[container[:path]]'
class kamaki.cli.commands.pithos.file_metadata_set(arguments={}, auth_base=None, cloud=None)[source]

Set a piece of metadata for account, container or object

description = 'Set a piece of metadata for account, container or object'
long_description = ''
main(metakey, metaval, container____path__=None)[source]
syntax = '<metakey> <metaval> [container[:path]]'
class kamaki.cli.commands.pithos.file_mkdir(arguments={}, auth_base=None, cloud=None)[source]

Create a directory Kamaki hanldes directories the same way as OOS Storage and Pithos+: A directory is an object with type “application/directory” An object with path dir/name can exist even if dir does not exist or even if dir is a non directory object. Users can modify dir ‘ without affecting the dir/name object in any way.

description = 'Create a directory'
long_description = ' Kamaki hanldes directories the same way as OOS Storage and Pithos+:\n A directory is an object with type "application/directory"\n An object with path dir/name can exist even if dir does not exist\n or even if dir is a non directory object. Users can modify dir \'\n without affecting the dir/name object in any way.\n '
main(container___directory)[source]
syntax = '<container:directory>'
class kamaki.cli.commands.pithos.file_move(arguments={}, auth_base=None, cloud=None)[source]

Move/rename objects from container to (another) container Semantics: move cont:path dir . rename path as dir/path move cont:path cont2: . trasnfer all <obj> prefixed with path to container cont2 move cont:path [cont2:]path2 . transfer path to path2 Use options: 1. <container1>:<path1> [container2:]<path2> : if container2 is not given, destination is container1:path2 2. <container>:<path1> <path2> : move in the same container 3. Can use –container= instead of <container1>

arguments = {'suffix_replace': <kamaki.cli.argument.ValueArgument object at 0x3f7eed0>, 'suffix': <kamaki.cli.argument.ValueArgument object at 0x3f7ed50>, 'recursive': <kamaki.cli.argument.FlagArgument object at 0x3f7ec90>, 'add_prefix': <kamaki.cli.argument.ValueArgument object at 0x3f7ed10>, 'add_suffix': <kamaki.cli.argument.ValueArgument object at 0x3f7ee90>, 'prefix': <kamaki.cli.argument.FlagArgument object at 0x3f7ecd0>, 'prefix_replace': <kamaki.cli.argument.ValueArgument object at 0x3f7ef10>, 'content_type': <kamaki.cli.argument.ValueArgument object at 0x3f7ec10>, 'destination_account': <kamaki.cli.argument.ValueArgument object at 0x3f7eb10>, 'public': <kamaki.cli.argument.ValueArgument object at 0x3f7eb90>, 'destination_container': <kamaki.cli.argument.ValueArgument object at 0x3f7e950>}
description = 'Move/rename objects from container to (another) container'
long_description = ' Semantics:\n move cont:path dir\n . rename path as dir/path\n move cont:path cont2:\n . trasnfer all <obj> prefixed with path to container cont2\n move cont:path [cont2:]path2\n . transfer path to path2\n Use options:\n 1. <container1>:<path1> [container2:]<path2> : if container2 is not given,\n destination is container1:path2\n 2. <container>:<path1> <path2> : move in the same container\n 3. Can use --container= instead of <container1>\n '
main(source_container___path, destination_container___path=None)[source]
syntax = '<source container:path> [destination container:path]'
class kamaki.cli.commands.pithos.file_overwrite(arguments={}, auth_base=None, cloud=None)[source]

Overwrite part (from start to end) of a remote file overwrite local-path container 10 20 . will overwrite bytes from 10 to 20 of a remote file with the same name . as local-path basename overwrite local-path container:path 10 20 . will overwrite as above, but the remote file is named path

arguments = {'progress_bar': <kamaki.cli.argument.ProgressBarArgument object at 0x3f7e710>}
description = 'Overwrite part (from start to end) of a remote file'
long_description = ' overwrite local-path container 10 20\n . will overwrite bytes from 10 to 20 of a remote file with the same name\n . as local-path basename\n overwrite local-path container:path 10 20\n . will overwrite as above, but the remote file is named path\n '
main(local_path, container___path, start, end)[source]
syntax = '<local path> <container:path> <start> <end>'
class kamaki.cli.commands.pithos.file_permissions(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Manage user and group accessibility for objects Permissions are lists of users and user groups. There are read and write permissions. Users and groups with write permission have also read permission.

description = 'Manage user and group accessibility for objects'
long_description = ' Permissions are lists of users and user groups. There are read and write\n permissions. Users and groups with write permission have also read\n permission.\n '
syntax = ''
class kamaki.cli.commands.pithos.file_permissions_delete(arguments={}, auth_base=None, cloud=None)[source]

Delete all permissions set on object To modify permissions, use /file permissions set

description = 'Delete all permissions set on object'
long_description = ' To modify permissions, use /file permissions set\n '
main(container___path)[source]
syntax = '<container:path>'
class kamaki.cli.commands.pithos.file_permissions_get(arguments={}, auth_base=None, cloud=None)[source]

Get read and write permissions of an object

description = 'Get read and write permissions of an object'
long_description = ''
main(container___path)[source]
print_permissions(permissions_dict, out)[source]
syntax = '<container:path>'
class kamaki.cli.commands.pithos.file_permissions_set(arguments={}, auth_base=None, cloud=None)[source]

Set permissions for an object New permissions overwrite existing permissions. Permission format: - read=<username>[,usergroup[,...]] - write=<username>[,usegroup[,...]] E.g. to give read permissions for file F to users A and B and write for C: . /file permissions set F read=A,B write=C To share with everybody, use ‘*’ instead of a user id or group. E.g. to make file F available to all pithos users: . /file permissions set F read=* E.g. to make file F available for editing to all pithos users: . /file permissions set F write=*

description = 'Set permissions for an object'
format_permission_dict(*args, **kwargs)[source]
long_description = " New permissions overwrite existing permissions.\n Permission format:\n - read=<username>[,usergroup[,...]]\n - write=<username>[,usegroup[,...]]\n E.g. to give read permissions for file F to users A and B and write for C:\n . /file permissions set F read=A,B write=C\n To share with everybody, use '*' instead of a user id or group.\n E.g. to make file F available to all pithos users:\n . /file permissions set F read=*\n E.g. to make file F available for editing to all pithos users:\n . /file permissions set F write=*\n "
main(container___path, *permissions)[source]
syntax = '<container:path> <permissions ...>'
class kamaki.cli.commands.pithos.file_publish(arguments={}, auth_base=None, cloud=None)[source]

Publish the object and print the public url

description = 'Publish the object and print the public url'
long_description = ''
main(container___path)[source]
syntax = '<container:path>'
class kamaki.cli.commands.pithos.file_purge(arguments={}, auth_base=None, cloud=None)[source]

Delete a container and release related data blocks Non-empty containers can not purged. To purge a container with content: . /file delete -R <container> . objects are deleted, but data blocks remain on server . /file purge <container> . container and data blocks are released and deleted

arguments = {'yes': <kamaki.cli.argument.FlagArgument object at 0x3f770d0>, 'force': <kamaki.cli.argument.FlagArgument object at 0x3f771d0>}
description = 'Delete a container and release related data blocks'
long_description = ' Non-empty containers can not purged.\n To purge a container with content:\n . /file delete -R <container>\n . objects are deleted, but data blocks remain on server\n . /file purge <container>\n . container and data blocks are released and deleted\n '
main(container=None)[source]
syntax = '[container]'
class kamaki.cli.commands.pithos.file_quota(arguments={}, auth_base=None, cloud=None)[source]

Get account quota

arguments = {'in_bytes': <kamaki.cli.argument.FlagArgument object at 0x3f8e8d0>}
description = 'Get account quota'
long_description = ''
main(custom_uuid=None)[source]
syntax = '[custom uuid]'
class kamaki.cli.commands.pithos.file_sharers(arguments={}, auth_base=None, cloud=None)[source]

List the accounts that share objects with current user

arguments = {'marker': <kamaki.cli.argument.ValueArgument object at 0x3f8efd0>, 'detail': <kamaki.cli.argument.FlagArgument object at 0x3f8e3d0>}
description = 'List the accounts that share objects with current user'
long_description = ''
main()[source]
syntax = ''
class kamaki.cli.commands.pithos.file_touch(arguments={}, auth_base=None, cloud=None)[source]

Create an empty object (file) If object exists, this command will reset it to 0 length

arguments = {'content_type': <kamaki.cli.argument.ValueArgument object at 0x41f9c90>}
description = 'Create an empty object (file)'
long_description = ' If object exists, this command will reset it to 0 length\n '
main(container___path)[source]
syntax = '<container:path>'
class kamaki.cli.commands.pithos.file_truncate(arguments={}, auth_base=None, cloud=None)[source]

Truncate remote file up to a size (default is 0)

description = 'Truncate remote file up to a size (default is 0)'
long_description = ''
main(container___path, size=0)[source]
syntax = '<container:path> [size]'
class kamaki.cli.commands.pithos.file_unpublish(arguments={}, auth_base=None, cloud=None)[source]

Unpublish an object

description = 'Unpublish an object'
long_description = ''
main(container___path)[source]
syntax = '<container:path>'
class kamaki.cli.commands.pithos.file_upload(arguments={}, auth_base=None, cloud=None)[source]

Upload a file

arguments = {'unchunked': <kamaki.cli.argument.FlagArgument object at 0x3f8d350>, 'sharing': <kamaki.cli.commands.pithos.SharingArgument object at 0x3f8d550>, 'recursive': <kamaki.cli.argument.FlagArgument object at 0x3f8d6d0>, 'progress_bar': <kamaki.cli.argument.ProgressBarArgument object at 0x3f8d610>, 'poolsize': <kamaki.cli.argument.IntArgument object at 0x3f8d5d0>, 'etag': <kamaki.cli.argument.ValueArgument object at 0x3f8d310>, 'content_encoding': <kamaki.cli.argument.ValueArgument object at 0x3f8d3d0>, 'content_type': <kamaki.cli.argument.ValueArgument object at 0x3f8d4d0>, 'use_hashes': <kamaki.cli.argument.FlagArgument object at 0x3f8d210>, 'content_disposition': <kamaki.cli.argument.ValueArgument object at 0x3f8d450>, 'public': <kamaki.cli.argument.FlagArgument object at 0x3f8d590>, 'overwrite': <kamaki.cli.argument.FlagArgument object at 0x3f8d690>}
description = 'Upload a file'
long_description = ''
main(local_path, container____path__=None)[source]
syntax = '<local path> [container[:path]]'
class kamaki.cli.commands.pithos.file_versioning(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Manage the versioning scheme of current pithos user account

description = 'Manage the versioning scheme of current pithos user account'
long_description = ''
syntax = ''
class kamaki.cli.commands.pithos.file_versioning_get(arguments={}, auth_base=None, cloud=None)[source]

Get versioning for account or container

description = 'Get versioning for account or container'
long_description = ''
main(container)[source]
syntax = '<container>'
class kamaki.cli.commands.pithos.file_versioning_set(arguments={}, auth_base=None, cloud=None)[source]

Set versioning mode (auto, none) for account or container

description = 'Set versioning mode (auto, none) for account or container'
long_description = ''
main(versioning, container)[source]
syntax = '<versioning> <container>'
class kamaki.cli.commands.pithos.file_versions(arguments={}, auth_base=None, cloud=None)[source]

Get the list of object versions Deleted objects may still have versions that can be used to restore it and get information about its previous state. The version number can be used in a number of other commands, like info, copy, move, meta. See these commands for more information, e.g., /file info -h

description = 'Get the list of object versions'
long_description = ' Deleted objects may still have versions that can be used to restore it and\n get information about its previous state.\n The version number can be used in a number of other commands, like info,\n copy, move, meta. See these commands for more information, e.g.,\n /file info -h\n '
main(container___path)[source]
syntax = '<container:path>'
version_print(versions, out)[source]

7.1.4. image

class kamaki.cli.commands.image.image_compute(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Cyclades/Compute API image commands

description = 'Cyclades/Compute API image commands'
long_description = ''
syntax = ''
class kamaki.cli.commands.image.image_compute_delete(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Delete an image (WARNING: image file is also removed)

description = 'Delete an image (WARNING: image file is also removed)'
long_description = ''
main(image_id)[source]
syntax = '<image id>'
class kamaki.cli.commands.image.image_compute_info(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Get detailed information on an image

description = 'Get detailed information on an image'
long_description = ''
main(image_id)[source]
syntax = '<image id>'
class kamaki.cli.commands.image.image_compute_list(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

List images

PERMANENTS = ('id', 'name')
arguments = {'user_id': <kamaki.cli.argument.ValueArgument object at 0x3875d90>, 'enum': <kamaki.cli.argument.FlagArgument object at 0x3875d50>, 'detail': <kamaki.cli.argument.FlagArgument object at 0x3875ad0>, 'meta': <kamaki.cli.argument.KeyValueArgument object at 0x3875e10>, 'limit': <kamaki.cli.argument.IntArgument object at 0x3875c90>, 'user_name': <kamaki.cli.argument.ValueArgument object at 0x3875dd0>, 'meta_like': <kamaki.cli.argument.KeyValueArgument object at 0x3875e50>, 'more': <kamaki.cli.argument.FlagArgument object at 0x3875d10>}
description = 'List images'
long_description = ''
main()[source]
syntax = ''
class kamaki.cli.commands.image.image_compute_properties(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Manage properties related to OS installation in an image

description = 'Manage properties related to OS installation in an image'
long_description = ''
syntax = ''
class kamaki.cli.commands.image.image_compute_properties_delete(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Delete a property from an image

description = 'Delete a property from an image'
long_description = ''
main(image_id, key)[source]
syntax = '<image id> <key>'
class kamaki.cli.commands.image.image_compute_properties_get(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Get an image property

description = 'Get an image property'
long_description = ''
main(image_id, key)[source]
syntax = '<image id> <key>'
class kamaki.cli.commands.image.image_compute_properties_list(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

List all image properties

description = 'List all image properties'
long_description = ''
main(image_id)[source]
syntax = '<image id>'
class kamaki.cli.commands.image.image_compute_properties_set(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Add / update a set of properties for an image properties must be given in the form key=value, e.v. /image compute properties set <image-id> key1=val1 key2=val2

description = 'Add / update a set of properties for an image'
long_description = ' properties must be given in the form key=value, e.v.\n /image compute properties set <image-id> key1=val1 key2=val2\n '
main(image_id, *key_equals_value)[source]
syntax = '<image id> <key_equals_value ...>'
class kamaki.cli.commands.image.image_info(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Get image metadata Image metadata include: - image file information (location, size, etc.) - image information (id, name, etc.) - image os properties (os, fs, etc.)

description = 'Get image metadata'
long_description = ' Image metadata include:\n - image file information (location, size, etc.)\n - image information (id, name, etc.)\n - image os properties (os, fs, etc.)\n '
main(image_id)[source]
syntax = '<image id>'
class kamaki.cli.commands.image.image_list(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

List images accessible by user

PERMANENTS = ('id', 'name', 'status', 'container_format', 'disk_format', 'size')
arguments = {'status': <kamaki.cli.argument.ValueArgument object at 0x3d05310>, 'owner_name': <kamaki.cli.argument.ValueArgument object at 0x3d050d0>, 'prop_like': <kamaki.cli.argument.KeyValueArgument object at 0x3d05c90>, 'size_max': <kamaki.cli.argument.IntArgument object at 0x3d05450>, 'enum': <kamaki.cli.argument.FlagArgument object at 0x3d05a50>, 'disk_format': <kamaki.cli.argument.ValueArgument object at 0x3d053d0>, 'detail': <kamaki.cli.argument.FlagArgument object at 0x3d056d0>, 'prop': <kamaki.cli.argument.KeyValueArgument object at 0x3d05c50>, 'size_min': <kamaki.cli.argument.IntArgument object at 0x3d054d0>, 'limit': <kamaki.cli.argument.IntArgument object at 0x3d05d50>, 'container_format': <kamaki.cli.argument.ValueArgument object at 0x3d05050>, 'owner': <kamaki.cli.argument.ValueArgument object at 0x3d057d0>, 'order': <kamaki.cli.argument.ValueArgument object at 0x3d052d0>, 'more': <kamaki.cli.argument.FlagArgument object at 0x3d05c10>}
description = 'List images accessible by user'
long_description = ''
main()[source]
syntax = ''
class kamaki.cli.commands.image.image_members(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Manage members. Members of an image are users who can modify it

description = 'Manage members. Members of an image are users who can modify it'
long_description = ''
syntax = ''
class kamaki.cli.commands.image.image_members_add(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Add a member to an image

description = 'Add a member to an image'
long_description = ''
main(image_id, member_id)[source]
syntax = '<image id> <member id>'
class kamaki.cli.commands.image.image_members_delete(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Remove a member from an image

description = 'Remove a member from an image'
long_description = ''
main(image_id, member)[source]
syntax = '<image id> <member>'
class kamaki.cli.commands.image.image_members_list(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

List members of an image

description = 'List members of an image'
long_description = ''
main(image_id)[source]
syntax = '<image id>'
class kamaki.cli.commands.image.image_members_set(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Set the members of an image

description = 'Set the members of an image'
long_description = ''
main(image_id, *member_ids)[source]
syntax = '<image id> <member_ids ...>'
class kamaki.cli.commands.image.image_meta(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Manage image metadata and custom properties

description = 'Manage image metadata and custom properties'
long_description = ''
syntax = ''
class kamaki.cli.commands.image.image_meta_delete(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Remove/empty image metadata and/or custom properties

arguments = {'status': <kamaki.cli.argument.FlagArgument object at 0x3d05f50>, 'container_format': <kamaki.cli.argument.FlagArgument object at 0x3d05ed0>, 'disk_format': <kamaki.cli.argument.FlagArgument object at 0x3d05190>, 'properties': <kamaki.cli.argument.RepeatableArgument object at 0x3d05990>}
description = 'Remove/empty image metadata and/or custom properties'
long_description = ''
main(image_id)[source]
syntax = '<image id>'
class kamaki.cli.commands.image.image_meta_set(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Add / update metadata and properties for an image The original image preserves the values that are not affected

arguments = {'status': <kamaki.cli.argument.ValueArgument object at 0x3d05d90>, 'name': <kamaki.cli.argument.ValueArgument object at 0x3d05950>, 'container_format': <kamaki.cli.argument.ValueArgument object at 0x3d05910>, 'disk_format': <kamaki.cli.argument.ValueArgument object at 0x3d05250>, 'properties': <kamaki.cli.argument.KeyValueArgument object at 0x3d05a10>, 'publish': <kamaki.cli.argument.FlagArgument object at 0x3d05dd0>, 'unpublish': <kamaki.cli.argument.FlagArgument object at 0x3d05f90>}
description = 'Add / update metadata and properties for an image'
long_description = ' The original image preserves the values that are not affected\n '
main(image_id)[source]
syntax = '<image id>'
class kamaki.cli.commands.image.image_register(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

(Re)Register an image file to an Image service The image file must be stored at a pithos repository Some metadata can be set by user (e.g., disk-format) while others are set only automatically (e.g., image id). There are also some custom user metadata, called properties. A register command creates a remote meta file at . <container>:<image path>.meta Users may download and edit this file and use it to re-register one or more images. In case of a meta file, runtime arguments for metadata or properties override meta file settings.

arguments = {'owner_name': <kamaki.cli.argument.ValueArgument object at 0x3875090>, 'container': <kamaki.cli.argument.ValueArgument object at 0x3875350>, 'uuid': <kamaki.cli.argument.ValueArgument object at 0x3875390>, 'progress_bar': <kamaki.cli.argument.ProgressBarArgument object at 0x3875410>, 'metafile': <kamaki.cli.argument.ValueArgument object at 0x3875250>, 'local_image_path': <kamaki.cli.argument.ValueArgument object at 0x38753d0>, 'disk_format': <kamaki.cli.argument.ValueArgument object at 0x3875050>, 'metafile_force': <kamaki.cli.argument.FlagArgument object at 0x3875290>, 'no_metafile_upload': <kamaki.cli.argument.FlagArgument object at 0x38752d0>, 'container_format': <kamaki.cli.argument.ValueArgument object at 0x3d05ad0>, 'is_public': <kamaki.cli.argument.FlagArgument object at 0x3875150>, 'checksum': <kamaki.cli.argument.ValueArgument object at 0x51c2050>, 'properties': <kamaki.cli.argument.KeyValueArgument object at 0x3875110>, 'size': <kamaki.cli.argument.IntArgument object at 0x38751d0>}
container_info_cache = {}
description = '(Re)Register an image file to an Image service'
long_description = ' The image file must be stored at a pithos repository\n Some metadata can be set by user (e.g., disk-format) while others are set\n only automatically (e.g., image id). There are also some custom user\n metadata, called properties.\n A register command creates a remote meta file at\n . <container>:<image path>.meta\n Users may download and edit this file and use it to re-register one or more\n images.\n In case of a meta file, runtime arguments for metadata or properties\n override meta file settings.\n '
main(name, container___image_path)[source]
syntax = '<name> <container:image path>'
class kamaki.cli.commands.image.image_shared(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

List images shared by a member

description = 'List images shared by a member'
long_description = ''
main(member_id_or_username)[source]
syntax = '<member id or username>'
class kamaki.cli.commands.image.image_unregister(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Unregister an image (does not delete the image file)

description = 'Unregister an image (does not delete the image file)'
long_description = ''
main(image_id)[source]
syntax = '<image id>'

7.1.5. Kamaki commands

7.1.5.1. config

class kamaki.cli.commands.config.config_delete(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Delete a configuration option Default values are not removed by default. To alter this behavior in a session, use –default.

arguments = {'default': <kamaki.cli.argument.FlagArgument object at 0x4e6ca90>}
description = 'Delete a configuration option'
long_description = ' Default values are not removed by default. To alter this behavior in a\n session, use --default.\n '
main(option)[source]
syntax = '<option>'
class kamaki.cli.commands.config.config_get(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Show a configuration option About options: . syntax: [group.]option . example: global.log_file . special case: <option> is equivalent to global.<option> . configuration file syntax: . [group] . option=value . (more options can be set per group) . . special case: named clouds. . example: cloud.demo.url . E.g. for a cloud “demo”: . [cloud “demo”] . url = <http://single/authentication/url/for/demo/site> . token = <auth_token_from_demo_site>

description = 'Show a configuration option'
long_description = 'About options: \n. syntax: [group.]option \n. example: global.log_file \n. special case: <option> is equivalent to global.<option> \n. configuration file syntax: \n. [group] \n. option=value \n. (more options can be set per group) \n. \n. special case: named clouds. \n. example: cloud.demo.url \n. E.g. for a cloud "demo": \n. [cloud "demo"] \n. url = <http://single/authentication/url/for/demo/site> \n. token = <auth_token_from_demo_site>'
main(option)[source]
syntax = '<option>'
class kamaki.cli.commands.config.config_list(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

List all configuration options FAQ: Q: I haven’t set any options! A: Defaults are used (override with /config set ) Q: There are more options than I have set A: Default options remain if not explicitly replaced or deleted

description = 'List all configuration options'
long_description = " FAQ:\n Q: I haven't set any options!\n A: Defaults are used (override with /config set )\n Q: There are more options than I have set\n A: Default options remain if not explicitly replaced or deleted\n "
main()[source]
syntax = ''
class kamaki.cli.commands.config.config_set(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Set a configuration option About options: . syntax: [group.]option . example: global.log_file . special case: <option> is equivalent to global.<option> . configuration file syntax: . [group] . option=value . (more options can be set per group) . . special case: named clouds. . example: cloud.demo.url . E.g. for a cloud “demo”: . [cloud “demo”] . url = <http://single/authentication/url/for/demo/site> . token = <auth_token_from_demo_site>

description = 'Set a configuration option'
long_description = 'About options: \n. syntax: [group.]option \n. example: global.log_file \n. special case: <option> is equivalent to global.<option> \n. configuration file syntax: \n. [group] \n. option=value \n. (more options can be set per group) \n. \n. special case: named clouds. \n. example: cloud.demo.url \n. E.g. for a cloud "demo": \n. [cloud "demo"] \n. url = <http://single/authentication/url/for/demo/site> \n. token = <auth_token_from_demo_site>'
main(option, value)[source]
syntax = '<option> <value>'

7.1.5.2. history

class kamaki.cli.commands.history.history_clean(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Clean up history (permanent)

description = 'Clean up history (permanent)'
long_description = ''
main()[source]
syntax = ''
class kamaki.cli.commands.history.history_run(arguments={}, auth_base=None, cmd_tree=None)[source]

Run previously executed command(s) Use with: . 1. <order-id> : pick the <order-id>th command . 2. <order-id-1>-<order-id-2> : pick all commands ordered in the range . [<order-id-1> - <order-id-2>] . - Use negative integers to count from the end of the list, e.g.,: . -2 means : the command before the last one . -2-5 means : last 2 commands + the first 5 . -5–2 mean . - to find order ids for commands try /history show.

description = 'Run previously executed command(s)'
long_description = ' Use with:\n . 1. <order-id> : pick the <order-id>th command\n . 2. <order-id-1>-<order-id-2> : pick all commands ordered in the range\n . [<order-id-1> - <order-id-2>]\n . - Use negative integers to count from the end of the list, e.g.,:\n . -2 means : the command before the last one\n . -2-5 means : last 2 commands + the first 5\n . -5--2 mean\n . - to find order ids for commands try /history show.\n '
main(*command_ids)[source]
syntax = ' <command_ids ...>'
class kamaki.cli.commands.history.history_show(arguments={}, auth_base=None, cloud=None, _in=None, _out=None, _err=None)[source]

Show intersession command history — - With no parameters : pick all commands in history records - With: . 1. <order-id> : pick the <order-id>th command . 2. <order-id-1>-<order-id-2> : pick all commands ordered in the range . [<order-id-1> - <order-id-2>] . - the above can be mixed and repeated freely, separated by spaces . e.g., pick 2 4-7 -3 . - Use negative integers to count from the end of the list, e.g.,: . -2 means : the command before the last one . -2-5 means : last 2 commands + the first 5 . -5–2 means : the last 5 commands except the last 2

arguments = {'limit': <kamaki.cli.argument.IntArgument object at 0x4c15a90>, 'match': <kamaki.cli.argument.ValueArgument object at 0x4c15b50>}
description = 'Show intersession command history'
long_description = ' ---\n - With no parameters : pick all commands in history records\n - With:\n . 1. <order-id> : pick the <order-id>th command\n . 2. <order-id-1>-<order-id-2> : pick all commands ordered in the range\n . [<order-id-1> - <order-id-2>]\n . - the above can be mixed and repeated freely, separated by spaces\n . e.g., pick 2 4-7 -3\n . - Use negative integers to count from the end of the list, e.g.,:\n . -2 means : the command before the last one\n . -2-5 means : last 2 commands + the first 5\n . -5--2 means : the last 5 commands except the last 2\n '
main(*cmd_ids)[source]
syntax = ' <cmd_ids ...>'

7.2. Command Line Interfaces

7.2.1. argument

class kamaki.cli.argument.Argument(arity, help=None, parsed_name=None, default=None)[source]

Bases: object

An argument that can be parsed from command line or otherwise. This is the top-level Argument class. It is suggested to extent this class into more specific argument types.

update_parser(parser, name)[source]

Update argument parser with self info

value[source]
class kamaki.cli.argument.ArgumentParseManager(exe, arguments=None)[source]

Bases: object

Manage (initialize and update) an ArgumentParser object

arguments[source]
Returns:(dict) arguments the parser should be aware of
parse(new_args=None)[source]

Parse user input

parsed[source]

(Namespace) parser-matched terms

syntax[source]

The command syntax (useful for help messages, descriptions, etc)

unparsed[source]

(list) parser-unmatched terms

update_arguments(new_arguments)[source]

Add to / update existing arguments

Parameters:new_arguments – (dict)
update_parser(arguments=None)[source]

Load argument specifications to parser

Parameters:arguments – if not given, update self.arguments instead
class kamaki.cli.argument.CommaSeparatedListArgument(help='', parsed_name=None, default=None)[source]

Bases: kamaki.cli.argument.ValueArgument

Value type:string
Value returns:list of the comma separated values
value[source]
class kamaki.cli.argument.ConfigArgument(help, parsed_name=('-c', '--config'))[source]

Bases: kamaki.cli.argument.Argument

Manage a kamaki configuration (file)

cli_specs[source]
get(group, term)[source]

Get a configuration setting from the Config object

get_cloud(cloud, option)[source]
get_global(option)[source]
groups[source]
value[source]
class kamaki.cli.argument.DateArgument(help='', parsed_name=None, default=None)[source]

Bases: kamaki.cli.argument.ValueArgument

DATE_FORMAT = '%a %b %d %H:%M:%S %Y'
INPUT_FORMATS = ['%a %b %d %H:%M:%S %Y', '%d-%m-%Y', '%H:%M:%S %d-%m-%Y']
format_date(datestr)[source]
formated[source]
timestamp[source]
value[source]
class kamaki.cli.argument.FlagArgument(help='', parsed_name=None, default=False)[source]

Bases: kamaki.cli.argument.Argument

Value :true if set, false otherwise
class kamaki.cli.argument.IntArgument(help='', parsed_name=None, default=None)[source]

Bases: kamaki.cli.argument.ValueArgument

value[source]

integer (type checking)

class kamaki.cli.argument.KeyValueArgument(help='', parsed_name=None, default=[])[source]

Bases: kamaki.cli.argument.Argument

A Key=Value Argument that can be repeated

Syntax :–<arg> key1=value1 –<arg> key2=value2 ...
value[source]
Returns:(dict) {key1: val1, key2: val2, ...}
class kamaki.cli.argument.ProgressBarArgument(help='', parsed_name='', default=True)[source]

Bases: kamaki.cli.argument.FlagArgument

Manage a progress bar

clone()[source]

Get a modifiable copy of this bar

finish()[source]

Stop progress bar, return terminal cursor to user

get_generator(message, message_len=25, countdown=False, timeout=100)[source]

Get a generator to handle progress of the bar (gen.next())

class kamaki.cli.argument.RepeatableArgument(help='', parsed_name=None, default=[])[source]

Bases: kamaki.cli.argument.Argument

A value argument that can be repeated

class kamaki.cli.argument.RuntimeConfigArgument(config_arg, help='', parsed_name=None, default=None)[source]

Bases: kamaki.cli.argument.Argument

Set a run-time setting option (not persistent)

value[source]
class kamaki.cli.argument.ValueArgument(help='', parsed_name=None, default=None)[source]

Bases: kamaki.cli.argument.Argument

Value type:string
Value returns:given value or default
class kamaki.cli.argument.VersionArgument(help='', parsed_name=None, default=False)[source]

Bases: kamaki.cli.argument.FlagArgument

A flag argument with that prints current version

value[source]

bool

7.2.2. command_shell

class kamaki.cli.command_shell.Shell(completekey='tab', stdin=None, stdout=None)[source]

Bases: cmd.Cmd

Kamaki interactive shell

auth_base = None
cloud = None
cmd_tree = None
cmdloop()[source]
do_exit(line)[source]
do_shell(line)[source]
doc_header[source]
emptyline()[source]
greet(version, username='', userid='')[source]
path[source]
postcmd(post, line)[source]
precmd(line)[source]
run(auth_base, cloud, parser, path='')[source]
set_prompt(new_prompt)[source]
undoc_header = 'interactive shell commands:'

7.2.3. command_tree

class kamaki.cli.command_tree.Command(path, help=' ', subcommands={}, cmd_class=None, long_help='')[source]

Bases: object

Store a command and the next-level (2 levels)

add_subcmd(subcmd)[source]
cmd_class = None
contains(name)[source]

Check if a name is a direct child of self

get_subcmd(name)[source]
help = ' '
is_command[source]
name[source]
parent_path[source]
parse_out(args)[source]

Find the deepest subcommand matching a series of terms but stop the first time a term doesn’t match

Parameters:args – (list) terms to match commands against
Returns:(parsed out command, the rest of the arguments)
Raises TypeError:
 if args is not inalterable
path = None
pretty_print(recursive=False)[source]
subcommands = {}
class kamaki.cli.command_tree.CommandTree(name, description='', long_description='')[source]

Bases: object

add_command(command_path, description=None, cmd_class=None, long_description='')[source]
add_tree(new_tree)[source]
exclude(groups_to_exclude=[])[source]
find_best_match(terms)[source]

Find a command that best matches a given list of terms

Parameters:terms – (list of str) match against paths in cmd_tree, e.g., [‘aa’, ‘bb’, ‘cc’] matches aa_bb_cc
Returns:(Command, list) the matching command, the remaining terms or None
get_command(path)[source]
get_subcommands(path=None)[source]
has_command(path)[source]
pretty_print(group=None)[source]
subnames(path=None)[source]

7.2.4. config

class kamaki.cli.config.Config(path=None, with_defaults=True)[source]

Bases: ConfigParser.RawConfigParser

get(section, option)[source]
Parameters:
  • section – (str) HINT: for clouds, use cloud.<section>
  • option – (str)
Returns:

(str) the value stored at section: {option: value}

get_cloud(cloud, option)[source]
Parameters:
  • cloud – (str) cloud alias
  • option – (str) option in cloud section
Returns:

(str) the value assigned on this option

Raises KeyError:
 

if cloud or cloud’s option does not exist

guess_version()[source]
Returns:(float) version of the config file or 0.9 if unrecognized
items(section, include_defaults=True)[source]
keys(section, include_defaults=True)[source]
override(section, option, value)[source]
pretty_print(out=<open file '<stdout>', mode 'w' at 0x2ad439aa61e0>)[source]
reload()[source]
remove_from_cloud(cloud, option)[source]
remove_option(section, option, also_remove_default=False)[source]
rescue_old_file(err=<open file '<stderr>', mode 'w' at 0x2ad439aa6270>)[source]
set(section, option, value)[source]
Parameters:
  • section – (str) HINT: for remotes use cloud.<section>
  • option – (str)
  • value – str
set_cloud(cloud, option, value)[source]
write()[source]
exception kamaki.cli.config.InvalidCloudNameError(msg='')[source]

Bases: ConfigParser.Error

A valid cloud name must pass through this regex: ([~@#$:.-w]+)

7.2.5. errors

exception kamaki.cli.errors.CLIBaseUrlError(message='', details=[], importance=2, service=None)[source]

Bases: kamaki.cli.errors.CLIError

exception kamaki.cli.errors.CLICmdSpecError(message='Command Specification Error', details=[], importance=0)[source]

Bases: kamaki.cli.errors.CLIError

exception kamaki.cli.errors.CLIError(message, details=[], importance=0)[source]

Bases: exceptions.Exception

exception kamaki.cli.errors.CLIInvalidArgument(message='Invalid Argument', details=[], importance=1)[source]

Bases: kamaki.cli.errors.CLISyntaxError

exception kamaki.cli.errors.CLISyntaxError(message='Syntax Error', details=[], importance=1)[source]

Bases: kamaki.cli.errors.CLIError

exception kamaki.cli.errors.CLIUnimplemented(message="I 'M SORRY, DAVE.nI 'M AFRAID I CAN'T DO THAT.", details=[' _ |', ' _-- --_ |', ' -- -- |', ' -- . -- |', ' -_ _- |', ' -_ _- |', ' - |'], importance=3)[source]

Bases: kamaki.cli.errors.CLIError

exception kamaki.cli.errors.CLIUnknownCommand(message='Unknown Command', details=[], importance=1)[source]

Bases: kamaki.cli.errors.CLIError

kamaki.cli.errors.raiseCLIError(err, message='', importance=0, details=[])[source]
Parameters:
  • err – (Exception) the original error message, if None, a new CLIError is born which is conceptually bind to raiser
  • message – (str) a custom error message that overrides err’s
  • importance – (int) instruction to called application (e.g. for coloring printed error messages)
  • details – (list) various information on the error
Raises CLIError:
 

it is the purpose of this method

7.2.6. history

class kamaki.cli.history.History(filepath)[source]

Bases: object

add(line)[source]
clean()[source]
get(match_terms=None, limit=0)[source]
retrieve(cmd_id)[source]
Parameters:cmd_id – (int) the id of the command to retrieve can be positive or negative, zero values are ignored
Returns:(str) the stored command record without the id

7.2.7. utils

kamaki.cli.utils.ask_user(msg, true_resp=('y', ), out=<open file '<stdout>', mode 'w' at 0x2ad439aa61e0>, user_in=<open file '<stdin>', mode 'r' at 0x2ad439aa6150>)[source]

Print msg and read user response

Parameters:true_resp – (tuple of chars)
Returns:(bool) True if reponse in true responses, False otherwise
kamaki.cli.utils.dict2file(d, f, depth=0)[source]
kamaki.cli.utils.filter_dicts_by_dict(list_of_dicts, filters, exact_match=True, case_sensitive=False)[source]
Parameters:
  • list_of_dicts – (list) each dict contains “raw” key-value pairs
  • filters – (dict) filters in key-value form
  • exact_match – (bool) if false, check if the filter value is part of the actual value
  • case_sensitive – (bool) revers to values only (not keys)
Returns:

(list) only the dicts that match all filters

kamaki.cli.utils.format_size(size, decimal_factors=False)[source]
kamaki.cli.utils.get_path_size(testpath)[source]
kamaki.cli.utils.guess_mime_type(filename, default_content_type='application/octet-stream', default_encoding=None)[source]
kamaki.cli.utils.list2file(l, f, depth=1)[source]
kamaki.cli.utils.pretty_keys(d, delim='_', recursive=False)[source]

<term>delim<term> to <term> <term> transformation

kamaki.cli.utils.print_dict(d, exclude=(), indent=0, with_enumeration=False, recursive_enumeration=False, out=<open file '<stdout>', mode 'w' at 0x2ad439aa61e0>)[source]

Pretty-print a dictionary object <indent>key: <non iterable item> <indent>key: <indent + INDENT_TAB><pretty-print iterable>

Parameters:
  • d – (dict)
  • exclude – (iterable of strings) keys to exclude from printing
  • indent – (int) initial indentation (recursive)
  • with_enumeration – (bool) enumerate 1st-level keys
  • recursive_enumeration – (bool) recursively enumerate iterables (does not enumerate 1st level keys)
  • out – Input/Output stream to dump values into
Raises CLIError:
 

if preconditions fail

kamaki.cli.utils.print_items(items, title=('id', 'name'), with_enumeration=False, with_redundancy=False, out=<open file '<stdout>', mode 'w' at 0x2ad439aa61e0>)[source]

print dict or list items in a list, using some values as title Objects of next level don’t inherit enumeration (default: off) or titles

Parameters:
  • items – (list) items are lists or dict
  • title – (tuple) keys to use their values as title
  • with_enumeration – (boolean) enumerate items (order id on title)
  • with_redundancy – (boolean) values in title also appear on body
  • out – Input/Output stream to dump values into
kamaki.cli.utils.print_json(data, out=<open file '<stdout>', mode 'w' at 0x2ad439aa61e0>)[source]

Print a list or dict as json in console

Parameters:
  • data – json-dumpable data
  • out – Input/Output stream to dump values into
kamaki.cli.utils.print_list(l, exclude=(), indent=0, with_enumeration=False, recursive_enumeration=False, out=<open file '<stdout>', mode 'w' at 0x2ad439aa61e0>)[source]

Pretty-print a list of items <indent>key: <non iterable item> <indent>key: <indent + INDENT_TAB><pretty-print iterable>

Parameters:
  • l – (list)
  • exclude – (iterable of strings) items to exclude from printing
  • indent – (int) initial indentation (recursive)
  • with_enumeration – (bool) enumerate 1st-level items
  • recursive_enumeration – (bool) recursively enumerate iterables (does not enumerate 1st level keys)
  • out – Input/Output stream to dump values into
Raises CLIError:
 

if preconditions fail

kamaki.cli.utils.remove_colors()[source]
kamaki.cli.utils.remove_from_items(list_of_dicts, key_to_remove)[source]
kamaki.cli.utils.split_input(line)[source]
kamaki.cli.utils.suggest_missing(miss=None, exclude=[])[source]
kamaki.cli.utils.to_bytes(size, format)[source]
Parameters:
  • size – (float) the size in the given format
  • format – (case insensitive) KiB, KB, MiB, MB, GiB, GB, TiB, TB
Returns:

(int) the size in bytes

Raises:
  • ValueError – if invalid size or format
  • AttributeError – if format is not str
  • TypeError – if size is not arithmetic or convertible to arithmetic

7.3. The clients API

7.3.1. Modules list

7.3.2. compute REST API

class kamaki.clients.compute.rest_api.ComputeRestClient(base_url, token)[source]

Bases: kamaki.clients.Client

flavors_get(flavor_id='', detail=False, changes_since=None, minDisk=None, minRam=None, marker=None, limit=None, success=200, **kwargs)[source]

GET base_url[/flavor_id][/command]

Parameters:
  • flavor_id – ignored if detail
  • detail – (bool)

— Parameters —

Parameters:
  • changes_since – when the flavor last changed
  • minDisk – minimum disk space in GB filter
  • minRam – minimum RAM filter
  • marker – UUID of the flavor at which to set a marker
  • limit – limit the number of returned values
Returns:

request response

floating_ip_pools_get(success=200, **kwargs)[source]
floating_ips_delete(ip='', success=204, **kwargs)[source]
floating_ips_get(ip='', success=200, **kwargs)[source]
floating_ips_post(json_data, ip='', success=200, **kwargs)[source]
images_delete(image_id='', success=204, **kwargs)[source]

DEL ETE base_url/images/<image_id>

Returns:request response
images_get(image_id='', detail=False, changes_since=None, server_name=None, name=None, status=None, marker=None, limit=None, type=None, success=200, **kwargs)[source]

GET base_url[/image_id][/command]

Parameters:
  • image_id – (str) ignored if detail
  • detail – (bool)

— Parameters — :param changes_since: when the image last changed status

Parameters:
  • server_name – Name of the server in URL format
  • name – Name of the image
  • status – Status of the image (e.g. filter on “ACTIVE”)
  • marker – UUID of the image at which you want to set a marker
  • limit – Integer value for the limit of values to return
  • type – Type of image (e.g. BASE, SERVER, or ALL)
Returns:

request response

images_metadata_delete(image_id, key, success=204, **kwargs)[source]

DEL ETE base_url/images/<image_id>/metadata/key

Returns:request response
images_metadata_get(image_id, key=None, success=200, **kwargs)[source]

GET base_url/<image_id>/metadata[/key]

Returns:request response
images_metadata_post(image_id, json_data=None, success=201, **kwargs)[source]

POST base_url/images/<image_id>/metadata

Returns:request response
images_metadata_put(image_id, key=None, json_data=None, success=201, **kwargs)[source]

PUT base_url/images/<image_id>/metadata

Returns:request response
limits_get(success=200, **kwargs)[source]

GET base_url/limits

Parameters:success – success code or list or tupple of accepted success codes. if server response code is not in this list, a ClientError raises
Returns:request response
servers_action_post(server_id, json_data=None, success=202, **kwargs)[source]

POST base_url/servers/<server_id>/action

Returns:request response
servers_delete(server_id, success=204, **kwargs)[source]

DEL ETE base_url/servers/<server_id>

Parameters:
  • json_data – a json-formated dict that will be send as data
  • success – success code (iterable of) codes
Raises ClientError:
 

if returned code not in success list

Returns:

request response

servers_get(server_id='', detail=False, changes_since=None, image=None, flavor=None, name=None, marker=None, limit=None, status=None, host=None, success=200, **kwargs)[source]

GET base_url/servers/[‘detail’ | <server_id>]

Parameters:
  • server_id – (int or int str) ignored if detail
  • detail – (boolean)
  • changes-since – A time/date stamp for when the server last changed status
  • image – Name of the image in URL format
  • flavor – Name of the flavor in URL format
  • name – Name of the server as a string
  • marker – UUID of the server at which you want to set a marker
  • limit – (int) limit of values to return
  • status – Status of the server (e.g. filter on “ACTIVE”)
  • host – Name of the host as a string
Returns:

request response

servers_ips_get(server_id, network_id=None, changes_since=None, success=(304, 200), **kwargs)[source]

GET base_url/servers/<server_id>/ips[/network_id]

Parameters:changes_since – time/date stamp in UNIX/epoch time. Checks for changes since a previous request.
Returns:request response
servers_metadata_delete(server_id, key, success=204, **kwargs)[source]

DEL ETE base_url/servers/<server_id>/metadata[/key]

Returns:request response
servers_metadata_get(server_id, key=None, success=200, **kwargs)[source]

GET base_url/servers/<server_id>/metadata[/key]

Returns:request response
servers_metadata_post(server_id, json_data=None, success=202, **kwargs)[source]

POST base_url/servers/<server_id>/metadata

Returns:request response
servers_metadata_put(server_id, key=None, json_data=None, success=204, **kwargs)[source]

PUT base_url/servers/<server_id>/metadata[/key]

Returns:request response
servers_post(security_group=None, user_data=None, availability_zone=None, json_data=None, success=202, **kwargs)[source]

POST base_url/servers

Parameters:
  • json_data – a json-formated dict that will be send as data
  • security_group – (str)
  • user_data – Use to pass configuration information or scripts upon launch. Must be Base64 encoded.
  • availability_zone – (str)
Returns:

request response

servers_put(server_id, server_name=None, json_data=None, success=204, **kwargs)[source]

PUT base_url/servers/<server_id>

Parameters:
  • json_data – a json-formated dict that will be send as data
  • success – success code (iterable of) codes
Raises ClientError:
 

if returned code not in success list

Returns:

request response

7.3.3. compute

class kamaki.clients.compute.ComputeClient(base_url, token)[source]

Bases: kamaki.clients.compute.rest_api.ComputeRestClient

OpenStack Compute API 1.1 client

alloc_floating_ip(tenant_id, pool=None)[source]
Parameters:
  • tenant_id – (str)
  • pool – (str) pool of ips to allocate from
Returns:

(dict) {fixed_ip: . id: . instance_id: . ip: . pool: .}

change_admin_password(server_id, new_password)[source]
Parameters:
  • server_id – (int)
  • new_password – (str)
confirm_resize_server(server_id)[source]

OS

create_server(name, flavor_id, image_id, security_group=None, user_data=None, availability_zone=None, metadata=None, personality=None, response_headers={'location': None})[source]

Submit request to create a new server

Parameters:
  • name – (str)
  • flavor_id – integer id denoting a preset hardware configuration
  • image_id – (str) id of the image of the virtual server
  • metadata – (dict) vm metadata
  • personality – a list of (file path, file contents) tuples, describing files to be injected into virtual server upon creation
Returns:

a dict with the new virtual server details

Raises ClientError:
 

wraps request errors

create_server_image(server_id, image_name, **metadata)[source]

OpenStack method for taking snapshots

create_server_metadata(server_id, key, val)[source]
Parameters:
  • server_id – integer (str or int)
  • key – (str)
  • val – (str)
Returns:

dict of updated key:val metadata

delete_floating_ip(tenant_id, fip_id=None)[source]
Parameters:
  • tenant_id – (str)
  • fip_id – (str) floating ip id (if None, all ips are deleted)
Returns:

(dict) request headers

delete_image(image_id)[source]
Parameters:image_id – (str)
delete_image_metadata(image_id, key)[source]
Parameters:
  • image_id – (str)
  • key – (str) metadatum key
Returns:

(dict) response headers

delete_server(server_id)[source]

Submit a deletion request for a server specified by id

Parameters:server_id – integer (str or int)
Returns:(dict) response headers
delete_server_metadata(server_id, key)[source]
Parameters:
  • server_id – integer (str or int)
  • key – (str) the meta key
Returns:

(dict) response headers

get_flavor_details(flavor_id)[source]
Parameters:flavor_id – integer (str or int)
Returns:dict
get_floating_ip(tenant_id, fip_id=None)[source]
Parameters:
  • tenant_id – (str)
  • fip_id – (str) floating ip id (if None, all ips are returned)
Returns:

(list) [ {fixed_ip: ..., id: ..., instance_id: ..., ip: ..., pool: ...}, ... ]

get_floating_ip_pools(tenant_id)[source]
Parameters:tenant_id – (str)
Returns:(dict) {floating_ip_pools:[{name: ...}, ...]}
get_floating_ips(tenant_id)[source]
Parameters:tenant_id – (str)
Returns:(dict) {floating_ips:[ {fixed_ip: ..., id: ..., instance_id: ..., ip: ..., pool: ...}, ... ]}
get_image_details(image_id, **kwargs)[source]
Parameters:image_id – integer (str or int)
Returns:dict
Raises ClientError:
 404 if image not available
get_image_metadata(image_id, key='', response_headers={'next': None, 'previous': None})[source]
Parameters:
  • image_id – (str)
  • key – (str) the metadatum key

:returns (dict) metadata if key not set, specific metadatum otherwise

get_server_details(server_id, changes_since=None, image=None, flavor=None, name=None, marker=None, limit=None, status=None, host=None, response_headers={'next': None, 'previous': None}, **kwargs)[source]

Return detailed info for a server

Parameters:server_id – integer (int or str)
Returns:dict with server details
get_server_metadata(server_id, key='', response_headers={'next': None, 'previous': None})[source]
Parameters:
  • server_id – integer (str or int)
  • key – (str) the metadatum key (all metadata if not given)
Returns:

a key:val dict of requests metadata

list_flavors(detail=False, response_headers={'next': None, 'previous': None})[source]
Parameters:detail – (bool) detailed flavor info if set, short if not
Returns:(list) flavor info
list_images(detail=False, response_headers={'previous': None, 'next': None})[source]
Parameters:detail – (bool) detailed info if set, short if not
Returns:dict id,name + full info if detail
list_servers(detail=False, changes_since=None, image=None, flavor=None, name=None, marker=None, limit=None, status=None, host=None, response_headers={'next': None, 'previous': None})[source]
Parameters:
  • detail – if true, append full server details to each item
  • response_headers – (dict) use it to get previous/next responses Keep the existing dict format to actually get the server responses Use it with very long lists or with marker
Returns:

list of server ids and names

reboot_server(server_id, hard=False)[source]
Parameters:
  • server_id – integer (str or int)
  • hard – perform a hard reboot if true, soft reboot otherwise
rebuild_server(server_id, response_headers={'location': None})[source]

OS

resize_server(server_id, flavor_id)[source]
Parameters:
  • server_id – (str)
  • flavor_id – (int)
Returns:

(dict) request headers

revert_resize_server(server_id)[source]

OS

shutdown_server(server_id)[source]

OS Extentions

start_server(server_id)[source]

OS Extentions

update_image_metadata(image_id, response_headers={'next': None, 'previous': None}, **metadata)[source]
Parameters:
  • image_id – (str)
  • metadata – dict
Returns:

updated metadata

update_server_metadata(server_id, response_headers={'next': None, 'previous': None}, **metadata)[source]
Parameters:
  • server_id – integer (str or int)
  • metadata – dict of key:val metadata
Returns:

dict of updated key:val metadata

update_server_name(server_id, new_name)[source]

Update the name of the server as reported by the API (does not modify the hostname used inside the virtual server)

Parameters:
  • server_id – integer (str or int)
  • new_name – (str)
Returns:

(dict) response headers

7.3.4. cyclades REST API

class kamaki.clients.cyclades.rest_api.CycladesRestClient(base_url, token)[source]

Bases: kamaki.clients.compute.ComputeClient

Synnefo Cyclades REST API Client

networks_delete(network_id='', command='', success=204, **kwargs)[source]

DEL ETE base_url/networks[/network_id][/command] request

Parameters:
  • network_id – integer (str or int)
  • command – (str) ‘detail’ or ‘’
  • success – success code or list or tuple of accepted success codes. if server response code is not in this list, a ClientError raises
Returns:

request response

networks_get(network_id='', command='', success=(200, 203), **kwargs)[source]

GET base_url/networks[/network_id][/command] request

Parameters:
  • network_id – integer (str or int)
  • command – (str) ‘detail’ or ‘’
  • success – success code or list or tuple of accepted success codes. if server response code is not in this list, a ClientError raises
Returns:

request response

networks_post(network_id='', command='', json_data=None, success=202, **kwargs)[source]

POST base_url/servers[/server_id]/[command] request

Parameters:
  • network_id – integer (str or int)
  • command – (str) ‘detail’ or ‘’
  • json_data – (dict) will be send as data
  • success – success code or list or tuple of accepted success codes. if server response code is not in this list, a ClientError raises
Returns:

request response

networks_put(network_id='', command='', json_data=None, success=204, **kwargs)[source]

PUT base_url/servers[/server_id]/[command] request

Parameters:
  • network_id – integer (str or int)
  • command – (str) ‘detail’ or ‘’
  • json_data – (dict) will be send as data
  • success – success code or list or tuple of accepted success codes. if server response code is not in this list, a ClientError raises
Returns:

request response

servers_stats_get(server_id, success=200, **kwargs)[source]

GET base_url/servers/<server_id>/stats

7.3.5. cyclades

class kamaki.clients.cyclades.CycladesClient(base_url, token)[source]

Bases: kamaki.clients.cyclades.rest_api.CycladesRestClient

Synnefo Cyclades Compute API client

alloc_floating_ip(pool=None, address=None)[source]
Parameters:
  • pool – (str) pool of ips to allocate from
  • address – (str) ip address to request
Returns:

(dict) { fixed_ip: ..., id: ..., instance_id: ..., ip: ..., pool: ...}

attach_floating_ip(server_id, address)[source]

Associate the address ip to server with server_id

Parameters:
  • server_id – (int)
  • address – (str) the ip address to assign to server (vm)
Returns:

(dict) request headers

Raises:
  • ValueError – if server_id cannot be converted to int
  • ValueError – if server_id is not of a int-convertable type
  • AssertionError – if address is emtpy
connect_server(server_id, network_id)[source]

Connect a server to a network

Parameters:
  • server_id – integer (str or int)
  • network_id – integer (str or int)
Returns:

(dict) response headers

create_network(name, cidr=None, gateway=None, type=None, dhcp=False)[source]
Parameters:
  • name – (str)
  • cidr – (str)
  • geteway – (str)
  • type – (str) if None, will use MAC_FILTERED as default Valid values: CUSTOM, IP_LESS_ROUTED, MAC_FILTERED, PHYSICAL_VLAN
  • dhcp – (bool)
Returns:

(dict) network detailed info

create_server(name, flavor_id, image_id, metadata=None, personality=None)[source]

Submit request to create a new server

Parameters:
  • name – (str)
  • flavor_id – integer id denoting a preset hardware configuration
  • image_id – (str) id denoting the OS image to run on virt. server
  • metadata – (dict) vm metadata updated by os/users image metadata
  • personality – a list of (file path, file contents) tuples, describing files to be injected into virtual server upon creation
Returns:

a dict with the new virtual server details

Raises ClientError:
 

wraps request errors

delete_floating_ip(fip_id=None)[source]
Parameters:fip_id – (str) floating ip id (if None, all ips are deleted)
Returns:(dict) request headers
Raises AssertionError:
 if fip_id is emtpy
delete_network(network_id)[source]
Parameters:network_id – integer (str or int)
Returns:(dict) response headers
Raises ClientError:
 421 Network in use
detach_floating_ip(server_id, address)[source]

Disassociate an address ip from the server with server_id

Parameters:
  • server_id – (int)
  • address – (str) the ip address to assign to server (vm)
Returns:

(dict) request headers

Raises:
  • ValueError – if server_id cannot be converted to int
  • ValueError – if server_id is not of a int-convertable type
  • AssertionError – if address is emtpy
disconnect_network_nics(netid)[source]
Parameters:netid – integer (str or int)
disconnect_server(server_id, nic_id)[source]
Parameters:
  • server_id – integer (str or int)
  • nic_id – (str)
Returns:

(int) the number of nics disconnected

get_firewall_profile(server_id)[source]
Parameters:server_id – integer (str or int)
Returns:(str) ENABLED | DISABLED | PROTECTED
Raises ClientError:
 520 No Firewall Profile
get_floating_ip(fip_id)[source]
Parameters:fip_id – (str) floating ip id
Returns:(dict) {fixed_ip: ..., id: ..., instance_id: ..., ip: ..., pool: ...},
Raises AssertionError:
 if fip_id is emtpy
get_floating_ip_pools()[source]
Returns:(dict) {floating_ip_pools:[{name: ...}, ...]}
get_floating_ips()[source]
Returns:(dict) {floating_ips: [fixed_ip: , id: , ip: , pool: ]}
get_network_details(network_id)[source]
Parameters:network_id – integer (str or int)
Returns:(dict)
get_server_console(server_id)[source]
Parameters:server_id – integer (str or int)
Returns:(dict) info to set a VNC connection to virtual server
get_server_stats(server_id)[source]
Parameters:server_id – integer (str or int)
Returns:(dict) auto-generated graphs of statistics (urls)
list_network_nics(network_id)[source]
Parameters:network_id – integer (str or int)
Returns:(list)
list_networks(detail=False)[source]
Parameters:detail – (bool)
Returns:(list) id,name if not detail else full info per network
list_server_nics(server_id)[source]
Parameters:server_id – integer (str or int)
Returns:(dict) network interface connections
set_firewall_profile(server_id, profile)[source]

Set the firewall profile for the public interface of a server

Parameters:
  • server_id – integer (str or int)
  • profile – (str) ENABLED | DISABLED | PROTECTED
Returns:

(dict) response headers

shutdown_server(server_id)[source]

Submit a shutdown request

Parameters:server_id – integer (str or int)
Returns:(dict) response headers
start_server(server_id)[source]

Submit a startup request

Parameters:server_id – integer (str or int)
Returns:(dict) response headers
update_network_name(network_id, new_name)[source]
Parameters:
  • network_id – integer (str or int)
  • new_name – (str)
Returns:

(dict) response headers

wait_firewall(server_id, current_status='DISABLED', delay=1, max_wait=100, wait_cb=None)[source]

Wait while the public network firewall status is current_status

Parameters:
  • server_id – integer (str or int)
  • current_status – (str) DISABLED | ENABLED | PROTECTED
  • delay – time interval between retries
  • wait_cb – if set a progressbar is used to show progress
Max_wait :

(int) timeout in secconds

Returns:

(str) the new mode if succesfull, (bool) False if timed out

wait_network(net_id, current_status='PENDING', delay=1, max_wait=100, wait_cb=None)[source]

Wait for network while its status is current_status

Parameters:
  • net_id – integer (str or int)
  • current_status – (str) PENDING | ACTIVE | DELETED
  • delay – time interval between retries
  • wait_cb – if set a progressbar is used to show progress
Max_wait :

(int) timeout in secconds

Returns:

(str) the new mode if succesfull, (bool) False if timed out

wait_server(server_id, current_status='BUILD', delay=1, max_wait=100, wait_cb=None)[source]

Wait for server while its status is current_status

Parameters:
  • server_id – integer (str or int)
  • current_status – (str) BUILD|ACTIVE|STOPPED|DELETED|REBOOT
  • delay – time interval between retries
  • wait_cb – if set a progressbar is used to show progress
Max_wait :

(int) timeout in secconds

Returns:

(str) the new mode if succesfull, (bool) False if timed out

7.3.6. storage

class kamaki.clients.storage.StorageClient(base_url, token, account=None, container=None)[source]

Bases: kamaki.clients.Client

OpenStack Object Storage API 1.0 client

copy_object(src_container, src_object, dst_container, dst_object=False)[source]

Copy an objects from src_contaier:src_object to dst_container[:dst_object]

Parameters:
  • src_container – (str)
  • src_object – (str)
  • dst_container – (str)
  • dst_object – (str)
create_container(container)[source]
Parameters:container – (str)
Raises ClientError:
 202 Container already exists
create_directory(obj)[source]
Parameters:obj – (str) directory-object name
Returns:(dict) request headers
create_object(obj, content_type='application/octet-stream', content_length=0)[source]
Parameters:
  • obj – (str) directory-object name
  • content_type – (str) explicitly set content_type
  • content_length – (int) explicitly set content length
Returns:

(dict) object creation headers

del_account_meta(metakey)[source]
Parameters:metakey – (str) metadatum key
del_object_meta(obj, metakey)[source]
Parameters:
  • obj – (str)
  • metakey – (str) the metadatum key
delete_container(container)[source]
Parameters:

container – (str)

Raises:
  • ClientError – 404 Container does not exist
  • ClientError – 409 Container not empty
delete_object(obj)[source]
Parameters:obj – (str)
Raises ClientError:
 404 Object not found
get_account_info()[source]
Returns:(dict)
get_container_info(container)[source]
Parameters:container – (str)
Returns:(dict)
Raises ClientError:
 404 Container does not exist
get_object_info(obj)[source]
Parameters:obj – (str)
Returns:(dict)
get_object_meta(obj)[source]
Parameters:obj – (str)
Returns:(dict)
list_containers()[source]
Returns:(dict)
list_objects(limit=None, marker=None, prefix=None, format=None, delimiter=None, path=None)[source]
Parameters:
  • limit – (integer) The amount of results requested
  • marker – (string) Return containers with name lexicographically after marker
  • prefix – (string) Return objects starting with prefix
  • format – (string) reply format can be json or xml (default:json)
  • delimiter – (string) Return objects up to the delimiter
  • path – (string) assume prefix = path and delimiter = / (overwrites prefix and delimiter)
Returns:

(dict)

Raises ClientError:
 

404 Invalid account

list_objects_in_path(path_prefix)[source]
Parameters:path_prefix – (str)
Raises ClientError:
 404 Invalid account
Returns:(dict)
move_object(src_container, src_object, dst_container, dst_object=False)[source]

Move an objects from src_contaier:src_object to dst_container[:dst_object]

Parameters:
  • src_container – (str)
  • src_object – (str)
  • dst_container – (str)
  • dst_object – (str)
replace_account_meta(metapairs)[source]
Parameters:metapais – (dict) key:val metadata pairs
replace_object_meta(metapairs)[source]
Parameters:metapairs – (dict) key:val metadata
upload_object(obj, f, size=None)[source]

A simple (naive) implementation.

Parameters:
  • obj – (str)
  • f – an open for reading file descriptor
  • size – (int) number of bytes to upload

7.3.7. pithos_rest_api

class kamaki.clients.pithos.rest_api.PithosRestClient(base_url, token, account=None, container=None)[source]

Bases: kamaki.clients.storage.StorageClient

account_get(limit=None, marker=None, format='json', show_only_shared=False, until=None, if_modified_since=None, if_unmodified_since=None, *args, **kwargs)[source]

Full Pithos+ GET at account level

— request parameters —

Parameters:
  • limit – (integer) The amount of results requested (server will use default value if None)
  • marker – string Return containers with name lexicographically after marker
  • format – (string) reply format can be json or xml (default: json)
  • shared – (bool) If true, only shared containers will be included in results
  • until – (string) optional timestamp

— request headers —

Parameters:
  • if_modified_since – (string) Retrieve if account has changed since provided timestamp
  • if_unmodified_since – (string) Retrieve if account has not changed since provided timestamp
Returns:

ConnectionResponse

account_head(until=None, if_modified_since=None, if_unmodified_since=None, *args, **kwargs)[source]

Full Pithos+ HEAD at account level

— request parameters —

Parameters:until – (string) optional timestamp

— request headers —

Parameters:
  • if_modified_since – (string) Retrieve if account has changed since provided timestamp
  • if_unmodified_since – (string) Retrieve if account has not change since provided timestamp
Returns:

ConnectionResponse

account_post(update=True, groups={}, metadata=None, quota=None, versioning=None, *args, **kwargs)[source]

Full Pithos+ POST at account level

— request parameters —

Parameters:update – (bool) if True, Do not replace metadata/groups

— request headers —

Parameters:
  • groups – (dict) Optional user defined groups in the form { ‘group1’:[‘user1’, ‘user2’, ...], ‘group2’:[‘userA’, ‘userB’, ...], }
  • metadata – (dict) Optional user defined metadata in the form { ‘name1’: ‘value1’, ‘name2’: ‘value2’, ... }
  • quota – (integer) If supported, sets the Account quota
  • versioning – (string) If supported, sets the Account versioning to ‘auto’ or some other supported versioning string
Returns:

ConnectionResponse

container_delete(until=None, delimiter=None, *args, **kwargs)[source]

Full Pithos+ DELETE at container level

— request parameters —

Parameters:until – (timestamp string) if defined, container is purged up to that time
Returns:ConnectionResponse
container_get(limit=None, marker=None, prefix=None, delimiter=None, path=None, format='json', meta=[], show_only_shared=False, until=None, if_modified_since=None, if_unmodified_since=None, *args, **kwargs)[source]

Full Pithos+ GET at container level

— request parameters —

Parameters:
  • limit – (integer) The amount of results requested (server will use default value if None)
  • marker – (string) Return containers with name lexicographically after marker
  • prefix – (string) Return objects starting with prefix
  • delimiter – (string) Return objects up to the delimiter
  • path – (string) assume prefix = path and delimiter = / (overwrites prefix and delimiter)
  • format – (string) reply format can be json or xml (default:json)
  • meta – (list) Return objects that satisfy the key queries in the specified comma separated list (use <key>, !<key> for existence queries, <key><op><value> for value queries, where <op> can be one of =, !=, <=, >=, <, >)
  • show_only_shared – (bool) If true, only shared containers will be included in results
  • until – (string) optional timestamp

— request headers —

Parameters:
  • if_modified_since – (string) Retrieve if account has changed since provided timestamp
  • if_unmodified_since – (string) Retrieve if account has not changed since provided timestamp
Returns:

ConnectionResponse

container_head(until=None, if_modified_since=None, if_unmodified_since=None, *args, **kwargs)[source]

Full Pithos+ HEAD at container level

— request params —

Parameters:until – (string) optional timestamp

— request headers —

Parameters:
  • if_modified_since – (string) Retrieve if account has changed since provided timestamp
  • if_unmodified_since – (string) Retrieve if account has not changed since provided timestamp
Returns:

ConnectionResponse

container_post(update=True, format='json', quota=None, versioning=None, metadata=None, content_type=None, content_length=None, transfer_encoding=None, *args, **kwargs)[source]

Full Pithos+ POST at container level

— request params —

Parameters:
  • update – (bool) if True, Do not replace metadata/groups
  • format – (string) json (default) or xml

— request headers —

Parameters:
  • quota – (integer) Size limit in KB
  • versioning – (string) ‘auto’ or other string supported by server
  • metadata – (dict) Optional user defined metadata in the form { ‘name1’: ‘value1’, ‘name2’: ‘value2’, ... }
  • content_type – (string) set a custom content type
  • content_length – (string) set a custrom content length
  • transfer_encoding – (string) set a custom transfer encoding
Returns:

ConnectionResponse

container_put(quota=None, versioning=None, metadata=None, *args, **kwargs)[source]

Full Pithos+ PUT at container level

— request headers —

Parameters:
  • quota – (integer) Size limit in KB
  • versioning – (string) ‘auto’ or other string supported by server
  • metadata – (dict) Optional user defined metadata in the form { ‘name1’: ‘value1’, ‘name2’: ‘value2’, ... }
Returns:

ConnectionResponse

object_copy(obj, destination, format='json', ignore_content_type=False, if_etag_match=None, if_etag_not_match=None, destination_account=None, content_type=None, content_encoding=None, content_disposition=None, source_version=None, permissions=None, public=None, metadata=None, *args, **kwargs)[source]

Full Pithos+ COPY at object level

— request parameters —

Parameters:
  • format – (string) json (default) or xml
  • ignore_content_type – (bool) Ignore the supplied Content-Type

— request headers —

Parameters:
  • if_etag_match – (string) if provided, copy only results with etag matching with this
  • if_etag_not_match – (string) if provided, copy only results with etag not matching with this
  • destination – (string) The destination path in the form /<container>/<object>
  • destination_account – (string) The destination account to copy to
  • content_type – (string) The MIME content type of the object
  • content_encoding – (string) The encoding of the object
  • content_disposition – (string) Object resentation style
  • source_version – (string) The source version to copy from
  • permissions – (dict) Object permissions in the form (all fields are optional) { ‘read’:[user1, group1, user2, ...], ‘write’:[‘user3, group2, group3, ...] }
  • public – (bool) If true, Object is published, False, unpublished
  • metadata – (dict) Optional user defined metadata in the form {‘meta-key-1’:’meta-value-1’, ‘meta-key-2’:’meta-value-2’, ...} Metadata are appended to the source metadata. In case of same keys, they replace the old metadata
Returns:

ConnectionResponse

object_delete(object, until=None, delimiter=None, *args, **kwargs)[source]

Full Pithos+ DELETE at object level

— request parameters —

Parameters:until – (string) Optional timestamp
Returns:ConnectionResponse
object_get(obj, format='json', hashmap=False, version=None, data_range=None, if_range=False, if_etag_match=None, if_etag_not_match=None, if_modified_since=None, if_unmodified_since=None, *args, **kwargs)[source]

Full Pithos+ GET at object level

— request parameters —

Parameters:
  • format – (string) json (default) or xml
  • hashmap – (bool) Optional request for hashmap
  • version – (string) optional version identified

— request headers —

Parameters:
  • data_range – (string) Optional range of data to retrieve
  • if_range – (bool)
  • if_etag_match – (string) if provided, return only results with etag matching with this
  • if_etag_not_match – (string) if provided, return only results with etag not matching with this
  • if_modified_since – (string) Retrieve if account has changed since provided timestamp
  • if_unmodified_since – (string) Retrieve if account has not changed since provided timestamp
Returns:

ConnectionResponse

object_head(obj, version=None, if_etag_match=None, if_etag_not_match=None, if_modified_since=None, if_unmodified_since=None, *args, **kwargs)[source]

Full Pithos+ HEAD at object level

— request parameters —

Parameters:version – (string) optional version identified

— request headers —

Parameters:
  • if_etag_match – (string) if provided, return only results with etag matching with this
  • if_etag_not_match – (string) if provided, return only results with etag not matching with this
  • if_modified_since – (string) Retrieve if account has changed since provided timestamp
  • if_unmodified_since – (string) Retrieve if account has not changed since provided timestamp
Returns:

ConnectionResponse

object_move(object, format='json', ignore_content_type=False, if_etag_match=None, if_etag_not_match=None, destination=None, destination_account=None, content_type=None, content_encoding=None, content_disposition=None, permissions={}, public=None, metadata={}, *args, **kwargs)[source]

Full Pithos+ COPY at object level

— request parameters —

Parameters:
  • format – (string) json (default) or xml
  • ignore_content_type – (bool) Ignore the supplied Content-Type

— request headers —

Parameters:
  • if_etag_match – (string) if provided, return only results with etag matching with this
  • if_etag_not_match – (string) if provided, return only results with etag not matching with this
  • destination – (string) The destination path in the form /<container>/<object>
  • destination_account – (string) The destination account to copy to
  • content_type – (string) The MIME content type of the object
  • content_encoding – (string) The encoding of the object
  • content_disposition – (string) Object presentation style
  • source_version – (string) The source version to copy from
  • permissions – (dict) Object permissions in the form (all fields are optional) { ‘read’:[user1, group1, user2, ...], ‘write’:[‘user3, group2, group3, ...] }
  • public – (bool) If true, Object is published, False, unpublished
  • metadata – (dict) Optional user defined metadata in the form {‘meta-key-1’:’meta-value-1’, ‘meta-key-2’:’meta-value-2’, ...}
Returns:

ConnectionResponse

object_post(obj, format='json', update=True, if_etag_match=None, if_etag_not_match=None, content_length=None, content_type=None, content_range=None, transfer_encoding=None, content_encoding=None, content_disposition=None, source_object=None, source_account=None, source_version=None, object_bytes=None, manifest=None, permissions={}, public=None, metadata={}, *args, **kwargs)[source]

Full Pithos+ POST at object level

— request parameters —

Parameters:
  • format – (string) json (default) or xml
  • update – (bool) Do not replace metadata

— request headers —

Parameters:
  • if_etag_match – (string) if provided, return only results with etag matching with this
  • if_etag_not_match – (string) if provided, return only results with etag not matching with this
  • content_length – (string) The size of the data written
  • content_type – (string) The MIME content type of the object
  • content_range – (string) The range of data supplied
  • transfer_encoding – (string) Set to chunked to specify incremental uploading (if used, Content-Length is ignored)
  • content_encoding – (string) The encoding of the object
  • content_disposition – (string) Object presentation style
  • source_object – (string) Update with data from the object at path /<container>/<object>
  • source_account – (string) The source account to update from
  • source_version – (string) The source version to copy from
  • object_bytes – (integer) The updated objects final size
  • manifest – (string) Object parts prefix as /<container>/<object>
  • permissions – (dict) Object permissions in the form (all fields are optional) { ‘read’:[user1, group1, user2, ...], ‘write’:[‘user3, group2, group3, ...] }
  • public – (bool) If true, Object is published, False, unpublished
  • metadata – (dict) Optional user defined metadata in the form {‘meta-key-1’:’meta-value-1’, ‘meta-key-2’:’meta-value-2’, ...}
Returns:

ConnectionResponse

object_put(obj, format='json', hashmap=False, delimiter=None, if_etag_match=None, if_etag_not_match=None, etag=None, content_length=None, content_type=None, transfer_encoding=None, copy_from=None, move_from=None, source_account=None, source_version=None, content_encoding=None, content_disposition=None, manifest=None, permissions=None, public=None, metadata=None, *args, **kwargs)[source]

Full Pithos+ PUT at object level

— request parameters —

Parameters:
  • format – (string) json (default) or xml
  • hashmap – (bool) Optional hashmap provided instead of data

— request headers —

Parameters:
  • if_etag_match – (string) if provided, return only results with etag matching with this
  • if_etag_not_match – (string) if provided, return only results with etag not matching with this
  • etag – (string) The MD5 hash of the object (optional to check written data)
  • content_length – (integer) The size of the data written
  • content_type – (string) The MIME content type of the object
  • transfer_encoding – (string) Set to chunked to specify incremental uploading (if used, Content-Length is ignored)
  • copy_from – (string) The source path in the form /<container>/<object>
  • move_from – (string) The source path in the form /<container>/<object>
  • source_account – (string) The source account to copy/move from
  • source_version – (string) The source version to copy from
  • conent_encoding – (string) The encoding of the object
  • content_disposition – (string) Presentation style of the object
  • manifest – (string) Object parts prefix in /<container>/<object> form
  • permissions – (dict) Object permissions in the form (all fields are optional) { ‘read’:[user1, group1, user2, ...], ‘write’:[‘user3, group2, group3, ...] }
  • public – (bool) If true, Object is published, False, unpublished
  • metadata – (dict) Optional user defined metadata in the form {‘meta-key-1’:’meta-value-1’, ‘meta-key-2’:’meta-value-2’, ...}
Returns:

ConnectionResponse

7.3.8. pithos

class kamaki.clients.pithos.PithosClient(base_url, token, account=None, container=None)[source]

Bases: kamaki.clients.pithos.rest_api.PithosRestClient

Synnefo Pithos+ API client

append_object(obj, source_file, upload_cb=None)[source]
Parameters:
  • obj – (str) remote object path
  • source_file – open file descriptor
  • upload_db – progress.bar for uploading
copy_object(src_container, src_object, dst_container, dst_object=None, source_version=None, source_account=None, public=False, content_type=None, delimiter=None)[source]
Parameters:
  • src_container – (str) source container
  • src_object – (str) source object path
  • dst_container – (str) destination container
  • dst_object – (str) destination object path
  • source_version – (str) source object version
  • source_account – (str) account to copy from
  • public – (bool)
  • content_type – (str)
  • delimiter – (str)
Returns:

(dict) response headers

create_container(container=None, sizelimit=None, versioning=None, metadata=None, **kwargs)[source]
Parameters:
  • container – (str) if not given, self.container is used instead
  • sizelimit – (int) container total size limit in bytes
  • versioning – (str) can be auto or whatever supported by server
  • metadata – (dict) Custom user-defined metadata of the form { ‘name1’: ‘value1’, ‘name2’: ‘value2’, ... }
Returns:

(dict) response headers

create_object_by_manifestation(obj, etag=None, content_encoding=None, content_disposition=None, content_type=None, sharing=None, public=None)[source]
Parameters:
  • obj – (str) remote object path
  • etag – (str)
  • content_encoding – (str)
  • content_disposition – (str)
  • content_type – (str)
  • sharing – {‘read’:[user and/or grp names], ‘write’:[usr and/or grp names]}
  • public – (bool)
Returns:

(dict) created object metadata

del_account_group(group)[source]
Parameters:group – (str)
del_account_meta(metakey)[source]
Parameters:metakey – (str) metadatum key
del_container(until=None, delimiter=None)[source]
Parameters:
  • until – (str) formated date
  • delimiter – (str) with / empty container
Raises:
  • ClientError – 404 Container does not exist
  • ClientError – 409 Container is not empty
del_container_meta(metakey)[source]
Parameters:metakey – (str) metadatum key
Returns:(dict) response headers
del_object(obj, until=None, delimiter=None)[source]
Parameters:
  • obj – (str) remote object path
  • until – (str) formated date
  • delimiter – (str)
del_object_meta(obj, metakey)[source]
Parameters:
  • obj – (str) remote object path
  • metakey – (str) metadatum key
del_object_sharing(obj)[source]
Parameters:obj – (str) remote object path
download_object(obj, dst, download_cb=None, version=None, resume=False, range_str=None, if_match=None, if_none_match=None, if_modified_since=None, if_unmodified_since=None)[source]

Download an object (multiple connections, random blocks)

Parameters:
  • obj – (str) remote object path
  • dst – open file descriptor (wb+)
  • download_cb – optional progress.bar object for downloading
  • version – (str) file version
  • resume – (bool) if set, preserve already downloaded file parts
  • range_str – (str) from, to are file positions (int) in bytes
  • if_match – (str)
  • if_none_match – (str)
  • if_modified_since – (str) formated date
  • if_unmodified_since – (str) formated date
download_to_string(obj, download_cb=None, version=None, range_str=None, if_match=None, if_none_match=None, if_modified_since=None, if_unmodified_since=None)[source]

Download an object to a string (multiple connections). This method uses threads for http requests, but stores all content in memory.

Parameters:
  • obj – (str) remote object path
  • download_cb – optional progress.bar object for downloading
  • version – (str) file version
  • range_str – (str) from, to are file positions (int) in bytes
  • if_match – (str)
  • if_none_match – (str)
  • if_modified_since – (str) formated date
  • if_unmodified_since – (str) formated date
Returns:

(str) the whole object contents

get_account_group()[source]
Returns:(dict)
get_account_info(until=None)[source]
Parameters:until – (str) formated date
Returns:(dict)
get_account_meta(until=None)[source]
Parameters:until – (str) formated date
Returns:(dict)
get_account_quota()[source]
Returns:(dict)
get_container_info(until=None)[source]
Parameters:until – (str) formated date
Returns:(dict)
Raises ClientError:
 404 Container not found
get_container_limit(container=None)[source]
Parameters:container – (str)
Returns:(dict)
get_container_meta(until=None)[source]
Parameters:until – (str) formated date
Returns:(dict)
get_container_object_meta(until=None)[source]
Parameters:until – (str) formated date
Returns:(dict)
get_container_versioning(container=None)[source]
Parameters:container – (str)
Returns:(dict)
get_object_hashmap(obj, version=None, if_match=None, if_none_match=None, if_modified_since=None, if_unmodified_since=None)[source]
Parameters:
  • obj – (str) remote object path
  • if_match – (str)
  • if_none_match – (str)
  • if_modified_since – (str) formated date
  • if_unmodified_since – (str) formated date
Returns:

(list)

get_object_info(obj, version=None)[source]
Parameters:
  • obj – (str) remote object path
  • version – (str)
Returns:

(dict)

get_object_meta(obj, version=None)[source]
Parameters:
  • obj – (str) remote object path
  • version – (str)
Returns:

(dict)

get_object_sharing(obj)[source]
Parameters:obj – (str) remote object path
Returns:(dict)
get_object_versionlist(obj)[source]
Parameters:obj – (str) remote object path
Returns:(list)
get_sharing_accounts(limit=None, marker=None, *args, **kwargs)[source]

Get accounts that share with self.account

Parameters:
  • limit – (str)
  • marker – (str)
Returns:

(dict)

list_containers()[source]
Returns:(dict)
move_object(src_container, src_object, dst_container, dst_object=False, source_account=None, source_version=None, public=False, content_type=None, delimiter=None)[source]
Parameters:
  • src_container – (str) source container
  • src_object – (str) source object path
  • dst_container – (str) destination container
  • dst_object – (str) destination object path
  • source_account – (str) account to move from
  • source_version – (str) source object version
  • public – (bool)
  • content_type – (str)
  • delimiter – (str)
Returns:

(dict) response headers

overwrite_object(obj, start, end, source_file, upload_cb=None)[source]

Overwrite a part of an object from local source file

Parameters:
  • obj – (str) remote object path
  • start – (int) position in bytes to start overwriting from
  • end – (int) position in bytes to stop overwriting at
  • source_file – open file descriptor
  • upload_db – progress.bar for uploading
publish_object(obj)[source]
Parameters:obj – (str) remote object path
Returns:(str) access url
purge_container(container=None)[source]

Delete an empty container and destroy associated blocks

set_account_group(group, usernames)[source]
Parameters:
  • group – (str)
  • usernames – (list)
set_account_meta(metapairs)[source]
Parameters:metapairs – (dict) {key1:val1, key2:val2, ...}
set_container_limit(limit)[source]
Parameters:limit – (int)
set_container_meta(metapairs)[source]
Parameters:metapairs – (dict) {key1:val1, key2:val2, ...}
set_container_versioning(versioning)[source]
Parameters:versioning – (str)
set_object_meta(obj, metapairs)[source]
Parameters:
  • obj – (str) remote object path
  • metapairs – (dict) {key1:val1, key2:val2, ...}
set_object_sharing(obj, read_permission=False, write_permission=False)[source]

Give read/write permisions to an object.

Parameters:
  • obj – (str) remote object path
  • read_permission – (list - bool) users and user groups that get read permission for this object - False means all previous read permissions will be removed
  • write_permission – (list - bool) of users and user groups to get write permission for this object - False means all previous write permissions will be removed
Returns:

(dict) response headers

truncate_object(obj, upto_bytes)[source]
Parameters:
  • obj – (str) remote object path
  • upto_bytes – max number of bytes to leave on file
Returns:

(dict) response headers

unpublish_object(obj)[source]
Parameters:obj – (str) remote object path
upload_from_string(obj, input_str, hash_cb=None, upload_cb=None, etag=None, if_etag_match=None, if_not_exist=None, content_encoding=None, content_disposition=None, content_type=None, sharing=None, public=None, container_info_cache=None)[source]

Upload an object using multiple connections (threads)

Parameters:
  • obj – (str) remote object path
  • input_str – (str) upload content
  • hash_cb – optional progress.bar object for calculating hashes
  • upload_cb – optional progress.bar object for uploading
  • etag – (str)
  • if_etag_match – (str) Push that value to if-match header at file creation
  • if_not_exist – (bool) If true, the file will be uploaded ONLY if it does not exist remotely, otherwise the operation will fail. Involves the case of an object with the same path is created while the object is being uploaded.
  • content_encoding – (str)
  • content_disposition – (str)
  • content_type – (str)
  • sharing – {‘read’:[user and/or grp names], ‘write’:[usr and/or grp names]}
  • public – (bool)
  • container_info_cache – (dict) if given, avoid redundant calls to server for container info (block size and hash information)
upload_object(obj, f, size=None, hash_cb=None, upload_cb=None, etag=None, if_etag_match=None, if_not_exist=None, content_encoding=None, content_disposition=None, content_type=None, sharing=None, public=None, container_info_cache=None)[source]

Upload an object using multiple connections (threads)

Parameters:
  • obj – (str) remote object path
  • f – open file descriptor (rb)
  • hash_cb – optional progress.bar object for calculating hashes
  • upload_cb – optional progress.bar object for uploading
  • etag – (str)
  • if_etag_match – (str) Push that value to if-match header at file creation
  • if_not_exist – (bool) If true, the file will be uploaded ONLY if it does not exist remotely, otherwise the operation will fail. Involves the case of an object with the same path is created while the object is being uploaded.
  • content_encoding – (str)
  • content_disposition – (str)
  • content_type – (str)
  • sharing – {‘read’:[user and/or grp names], ‘write’:[usr and/or grp names]}
  • public – (bool)
  • container_info_cache – (dict) if given, avoid redundant calls to server for container info (block size and hash information)
upload_object_unchunked(obj, f, withHashFile=False, size=None, etag=None, content_encoding=None, content_disposition=None, content_type=None, sharing=None, public=None)[source]
Parameters:
  • obj – (str) remote object path
  • f – open file descriptor
  • withHashFile – (bool)
  • size – (int) size of data to upload
  • etag – (str)
  • content_encoding – (str)
  • content_disposition – (str)
  • content_type – (str)
  • sharing – {‘read’:[user and/or grp names], ‘write’:[usr and/or grp names]}
  • public – (bool)
Returns:

(dict) created object metadata

7.3.9. image

class kamaki.clients.image.ImageClient(base_url, token)[source]

Bases: kamaki.clients.Client

Synnefo Plankton API client

add_member(image_id, member)[source]
Parameters:
  • image_id – (str)
  • member – (str) user to allow access to current user’s images
get_meta(image_id)[source]
Parameters:image_id – (string)
Returns:(list) image metadata (key:val)
list_members(image_id)[source]
Parameters:image_id – (str)
Returns:(list) users who can use current user’s images
list_public(detail=False, filters={}, order='')[source]
Parameters:
  • detail – (bool)
  • filters – (dict) request filters
  • order – (str) order listing by field (default is ascending, - for descending)
Returns:

(list) id,name + full image info if detail

list_shared(member)[source]
Parameters:member – (str) sharers account
Returns:(list) images shared by member
register(name, location, params={}, properties={})[source]

Register an image that is uploaded at location

Parameters:
  • name – (str)
  • location – (str or iterable) if iterable, then (user_uuid, container, image_path) else if string pithos://<user_uuid>/<container>/<image object>
  • params – (dict) image metadata (X-Image-Meta) can be id, store, disc_format, container_format, size, checksum, is_public, owner
  • properties – (dict) image properties (X-Image-Meta-Property)
Returns:

(dict) metadata of the created image

remove_member(image_id, member)[source]
Parameters:
  • image_id – (str)
  • member – (str) user to deprive from current user’s images
set_members(image_id, members)[source]
Parameters:
  • image_id – (str)
  • members – (list) user to deprive from current user’s images
unregister(image_id)[source]

Unregister an image

Parameters:image_id – (str)
Returns:(dict) response headers
update_image(image_id, name=None, disk_format=None, container_format=None, status=None, public=None, owner_id=None, **properties)[source]

7.3.10. astakos

class kamaki.clients.astakos.AstakosClient(base_url, token=None)[source]

Bases: kamaki.clients.Client

Synnefo Astakos API client

authenticate(token=None)[source]

Get authentication information and store it in this client As long as the AstakosClient instance is alive, the latest authentication information for this token will be available

Parameters:token – (str) custom token to authenticate
Returns:(dict) authentication information
get_service_details(service_type, token=None)[source]
Parameters:service_type – (str) compute, object-store, image, account, etc.
Returns:(dict) {name:..., type:..., endpoints:[...]}
Raises ClientError:
 
  1. if service_type not in service catalog
get_service_endpoints(service_type, version=None, token=None)[source]
Parameters:
  • service_type – (str) can be compute, object-store, etc.
  • version – (str) the version id of the service
Returns:

(dict) {SNF:uiURL, adminURL, internalURL, publicURL, ...}

Raises:
  • ClientError
    1. if service_type not in service catalog
  • ClientError
    1. if #matching endpoints != 1
get_services(token=None)[source]
Returns:(list) [{name:..., type:..., endpoints:[...]}, ...]
get_token(uuid)[source]
list_users()[source]

list cached users information

post_user_catalogs(uuids=None, displaynames=None)[source]

POST base_url/user_catalogs

Parameters:
  • uuids – (list or tuple) user uuids
  • displaynames – (list or tuple) usernames (mut. excl. to uuids)
Returns:

(dict) {uuid1: name1, uuid2: name2, ...} or oposite

term(key, token=None)[source]

Get (cached) term, from user credentials

user_info(token=None)[source]

Get (cached) user information

user_term(key, token=None)[source]

Get (cached) term, from user credentials

7.3.11. utils

kamaki.clients.utils.filter_in(d, prefix, exactMatch=False)[source]

Keep only entries of d prefixed with prefix

Parameters:
  • d – (dict) input
  • prefix – (str) prefix to match input keys against
  • exactMatch – (bool) key should fully match if True, just prefixed with prefix if False
Returns:

(dict) the updated d

kamaki.clients.utils.filter_out(d, prefix, exactMatch=False)[source]

Remove entries that are prefixed with prefix (case insensitive)

Parameters:
  • d – (dict) input
  • prefix – (str) prefix to match input keys against
  • exactMatch – (bool) key should fully match if True, just prefixed with prefix if False
Returns:

(dict) the updated d

kamaki.clients.utils.path4url(*args)[source]
Parameters:args – (list of str)
Returns:(str) a path in the form /args[0]/args[1]/...