The ServiceFilter
is the base class
for service identifiers and user service preferences. Each
Resource
has a service identifier to
associate the resource with a service. An example of a service identifier
would be openstack.compute.compute_service.ComputeService
.
The preferences are stored in the
Profile
object.
The service preference and the service identifier are joined to create a
filter to match a service.
The ServiceFilter
class can be built
with a service type, interface, region, name, and version.
Create a compute service and service preference. Join the services and match:
from openstack import service_filter
from openstack.compute import compute_service
default = compute_service.ComputeService()
preference = service_filter.ServiceFilter('compute', version='v2')
result = preference.join(default)
matches = (result.match_service_type('compute') and
result.match_service_name('Hal9000') and
result.match_region('DiscoveryOne') and
result.match_interface('public'))
print(str(result))
print("matches=" + str(matches))
The resulting output from the code:
service_type=compute,interface=public,version=v2
matches=True
openstack.service_filter.
ServiceFilter
(service_type, interface='public', region=None, service_name=None, version=None, api_version=None, requires_project_id=False)¶Create a service identifier.
Parameters: |
|
---|
get_module
()¶Get the full module name associated with the service.
get_service_module
()¶Get the module version of the service name.
This would often be the same as the service type except in cases like object store where the service type is object-store and the module is object_store.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.