|
|
@@ -0,0 +1,24 @@
|
|
|
+from cloudbridge.providers.interfaces import CloudProvider
|
|
|
+
|
|
|
+
|
|
|
+class BaseCloudProvider(CloudProvider):
|
|
|
+
|
|
|
+ def name(self):
|
|
|
+ return str(self.__class__.__name__)
|
|
|
+
|
|
|
+ def has_service(self, service_type):
|
|
|
+ """
|
|
|
+ Checks whether this provider supports a given service.
|
|
|
+
|
|
|
+ :type service_type: str or :class:``.CloudProviderServiceType``
|
|
|
+ :param service_type: Type of service the check support for.
|
|
|
+
|
|
|
+ :rtype: bool
|
|
|
+ :return: ``True`` if the service type is supported.
|
|
|
+ """
|
|
|
+ try:
|
|
|
+ if getattr(self, service_type):
|
|
|
+ return True
|
|
|
+ except AttributeError:
|
|
|
+ pass # Undefined service type
|
|
|
+ return False
|