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.
The Profile
class is constructed
with no arguments.
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
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_services
()¶Get a list of all the known services.
set_name
(service, name)¶Set the desired name for the specified service.
Parameters: |
---|
set_region
(service, region)¶Set the desired region for the specified service.
Parameters: |
---|
set_version
(service, version)¶Set the desired version for the specified service.
Parameters: |
---|
set_api_version
(service, api_version)¶Set the desired API micro-version for the specified service.
Parameters: |
---|
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.