The keystoneclient.base Module

Base utilities to build API operation managers and objects on top of.

class keystoneclient.base.CrudManager(api)

Bases: keystoneclient.base.Manager

Base manager class for manipulating Keystone entities.

Children of this class are expected to define a collection_key and key.

  • collection_key: Usually a plural noun by convention (e.g. entities); used to refer collections in both URL’s (e.g. /v3/entities) and JSON objects containing a list of member resources (e.g. {‘entities’: [{}, {}, {}]}).
  • key: Usually a singular noun by convention (e.g. entity); used to refer to an individual member of the collection.
build_url(base_url=None, **kwargs)

Builds a resource URL for the given kwargs.

Given an example collection where collection_key = ‘entities’ and key = ‘entity’, the following URL’s could be generated.

By default, the URL will represent a collection of entities, e.g.:

/entities

If kwargs contains an entity_id, then the URL will represent a specific member, e.g.:

/entities/{entity_id}

If a base_url is provided, the generated URL will be appended to it.

collection_key = None
create(**kwargs)
delete(**kwargs)
get(**kwargs)
head(**kwargs)
key = None
list(base_url=None, **kwargs)
put(base_url=None, **kwargs)
update(**kwargs)
class keystoneclient.base.Manager(api)

Bases: object

Managers interact with a particular type of API (servers, flavors, images, etc.) and provide CRUD operations for them.

resource_class = None
class keystoneclient.base.ManagerWithFind(api)

Bases: keystoneclient.base.Manager

Like a Manager, but with additional find()/findall() methods.

find(**kwargs)

Find a single item with attributes matching **kwargs.

This isn’t very efficient: it loads the entire list then filters on the Python side.

findall(**kwargs)

Find all items with attributes matching **kwargs.

This isn’t very efficient: it loads the entire list then filters on the Python side.

class keystoneclient.base.Resource(manager, info, loaded=False)

Bases: object

A resource represents a particular instance of an object (tenant, user, etc). This is pretty much just a bag for attributes.

Parameters:
  • manager – Manager object
  • info – dictionary representing resource attributes
  • loaded – prevent lazy-loading if set to True
delete()
get()
is_loaded()
set_loaded(val)
keystoneclient.base.getid(obj)

Abstracts the common pattern of allowing both an object or an object’s ID (UUID) as a parameter when dealing with relationships.

Previous topic

The keystoneclient.access Module

Next topic

The keystoneclient.client Module

This Page