Profile

Profile

Profile is the class that is used to define the various preferences for different services. The preferences that are currently supported are service name, region, version and interface. The Profile and the Connection classes are the most important user facing classes.

Examples

The Profile class is constructed with no arguments.

Set Methods

A user’s preferences are set based on the service type. Service type would normally be something like ‘compute’, ‘identity’, ‘object-store’, etc.:

from openstack import profile
prof = profile.Profile()
prof.set_name('compute', 'matrix')
prof.set_region(prof.ALL, 'zion')
prof.set_version('identity', 'v3')
prof.set_interface('object-store', 'internal')
for service in prof.get_services():
    print(prof.get_filter(service.service_type)

The resulting preference print out would look something like:

service_type=compute,region=zion,service_name=matrix
service_type=network,region=zion
service_type=database,region=zion
service_type=image,region=zion
service_type=metering,region=zion
service_type=orchestration,region=zion
service_type=object-store,interface=internal,region=zion
service_type=identity,region=zion,version=v3

Profile Object

class openstack.profile.Profile(plugins=None)

User preference for each service.

Parameters:plugins – List of entry point namespaces to load.

Create a new Profile object with no preferences defined, but knowledge of the services. Services are identified by their service type, e.g.: ‘identity’, ‘compute’, etc.

ALL = '*'

Wildcard service identifier representing all services.

get_filter(service)

Get a service preference.

Parameters:service (str) – Desired service type.
get_services()

Get a list of all the known services.

set_name(service, name)

Set the desired name for the specified service.

Parameters:
  • service (str) – Service type.
  • name (str) – Desired service name.
set_region(service, region)

Set the desired region for the specified service.

Parameters:
  • service (str) – Service type.
  • region (str) – Desired service region.
set_version(service, version)

Set the desired version for the specified service.

Parameters:
  • service (str) – Service type.
  • version (str) – Desired service version.
set_api_version(service, api_version)

Set the desired API micro-version for the specified service.

Parameters:
  • service (str) – Service type.
  • api_version (str) – Desired service API micro-version.
set_interface(service, interface)

Set the desired interface for the specified service.

Parameters:
  • service (str) – Service type.
  • interface (str) – Desired service interface.
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.