UserPreference 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 visibility. The UserPreference and the Connection classes are the most important user facing classes.
The UserPreference class is constructed with no arguments.
The user preferences are set based on the service type. Service type would normally be something like ‘compute’, ‘identity’, ‘object-store’, etc.:
from openstack import user_preference
pref = user_preference.UserPreference()
pref.set_name('compute', 'matrix')
pref.set_region(pref.ALL, 'zion')
pref.set_version('identity', 'v3')
pref.set_visibility('object-store', 'internal')
for service in pref.get_services():
print str(pref.get_preference(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,visibility=internal,region=zion
service_type=identity,region=zion,version=v3
User preference for each service.
Create a new UserPreference object with no preferences defined, but knowledge of the services. Services are identified by their service type, e.g.: ‘identity’, ‘compute’, etc.
Wildcard service identifier representing all services.
Get a service preference.
Parameters: | service (str) – Desired service type. |
---|
Get a list of all the known services.
Set the desired name for the specified service.
Parameters: |
|
---|
Set the desired region for the specified service.
Parameters: |
|
---|
Set the desired version for the specified service.
Parameters: |
|
---|
Set the desired visibility for the specified service.
Parameters: |
|
---|