Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

[docstring] Create docstring for poppy transport and manager layers #36

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions doc/source/poppy.manager.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,14 @@
:members:
:undoc-members:
:show-inheritance:


.. automodule:: poppy.manager.default.background_job
:members:
:undoc-members:
:show-inheritance:

.. automodule:: poppy.manager.default.health
:members:
:undoc-members:
:show-inheritance:
25 changes: 22 additions & 3 deletions poppy/manager/base/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,41 @@ def __init__(self, manager):

@property
def storage_controller(self):
"""Return storage controller.

:return: Storage controller
:rtype: poppy.storage.cassandra.services.ServicesController
"""
return self.manager.storage.services_controller

@property
def providers(self):
"""Return provider module.

:return: Provider module
:rtype: poppy.provider.akamai
"""
return self.manager.providers

@property
def metrics_controller(self):
"""Return metrics controller.

:return: Metrics controller
:rtype: poppy.metrics.blueflood.services.ServicesController
"""
return self.manager.metrics.services_controller

@abc.abstractmethod
def get_metrics_by_domain(self, project_id, domain_name, **extras):
"""get analytics metrics by domain
"""Get analytics metrics by domain.

:param project_id: The project id
:type project_id: int

:param domain_name: The domain name
:type domain_name: str

:param project_id
:param domain_name
:raises: NotImplementedError
"""
raise NotImplementedError
8 changes: 7 additions & 1 deletion poppy/manager/base/background_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ def __init__(self, manager):
def post_job(self, job_type, kwargs):
"""Posts a background job to the distributed task driver.

:raises: NotImplementedError
:param job_type: The job type
:type job_type: str

:param kwargs: Extra arguments for the task engine
:type kwargs: dict

:raise: NotImplementedError
"""
raise NotImplementedError
4 changes: 4 additions & 0 deletions poppy/manager/base/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,8 @@ def __init__(self, driver):

@property
def driver(self):
"""Return the instance of the driver

:return: Driver's instance
"""
return self._driver
45 changes: 35 additions & 10 deletions poppy/manager/base/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,71 +33,96 @@ def __init__(self, conf, storage, providers, dns, distributed_task,

@property
def conf(self):
"""conf
"""Return the configuration for the driver.

:returns conf
:return: Configuration
:rtype: dict
"""
return self._conf

@property
def storage(self):
"""storage
"""Return the storage module for the driver.

:returns storage
:return: Storage module
:rtype: poppy.storage.cassandra
"""
return self._storage

@property
def providers(self):
"""providers
"""Return the provider module for the driver.

:returns providers
:return: Providers module
:rtype: poppy.provider.akamai
"""
return self._providers

@property
def dns(self):
"""Return the dns module for the driver.

:return: DNS module
:rtype: poppy.provider.dns
"""
return self._dns

@property
def distributed_task(self):
"""Return the distributed_task module for the driver.

:return: distributed_task module
:rtype: poppy.provider.distributed_task
"""
return self._distributed_task

@property
def notification(self):
"""Return the notification module for the driver.

:return: notification module
:rtype: poppy.provider.notification
"""

return self._notification

@property
def metrics(self):
"""Return the metrics module for the driver.

:return: metrics module
:rtype: poppy.provider.metrics
"""

return self._metrics

@abc.abstractproperty
def analytics_controller(self):
"""Returns the driver's analytics controller
"""Return the driver's analytics controller.

:raises NotImplementedError
"""
raise NotImplementedError

@abc.abstractproperty
def services_controller(self):
"""Returns the driver's services controller
"""Return the driver's services controller.

:raises NotImplementedError
"""
raise NotImplementedError

@abc.abstractproperty
def flavors_controller(self):
"""Returns the driver's flavors controller
"""Return the driver's flavors controller.

:raises NotImplementedError
"""
raise NotImplementedError

@abc.abstractproperty
def health_controller(self):
"""Returns the driver's health controller
"""Return the driver's health controller.

:raises NotImplementedError
"""
Expand Down
40 changes: 24 additions & 16 deletions poppy/manager/base/flavors.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,52 +32,60 @@ def __init__(self, manager):

@property
def storage(self):
"""storage
"""Return StorageController for this FlavorController.

:returns: the storage object
:return: The storage object
"""
return self._storage

@property
def providers(self):
"""storage
"""Get list of providers for this FlavorController.

:returns: the list of provider drivers
:return: The list of provider drivers
"""
return self._providers

@abc.abstractmethod
def list(self):
"""list
"""Get list of the supported flavors.

:raises: NotImplementedError
:raise: NotImplementedError
"""
raise NotImplementedError

@abc.abstractmethod
def get(self, flavor_id):
"""GET
"""Get Flavor details for the given flavor id

:param flavor_id
:raises: NotImplementedError
:param flavor_id: Flavor id to get the flavor details
:type flavor_id: str

:raise: NotImplementedError
"""
raise NotImplementedError

@abc.abstractmethod
def add(self, flavor):
"""POST
"""Add a new flavor.

:param flavor: Flavor details
:type flavor: poppy.model.flavor.Flavor

:param flavor
:raises: NotImplementedError
:raise: NotImplementedError
"""
raise NotImplementedError

@abc.abstractmethod
def delete(self, flavor_id, provider_id):
"""DELETE
"""Delete a flavor.

:param flavor_id: The flavor id to delete
:type flavor_id: str

:param provider_id: The provider id of the flavor
:type provider_id: str

:param flavor_id
:param provider_id
:raises: NotImplementedError
:raise: NotImplementedError
"""
raise NotImplementedError
26 changes: 17 additions & 9 deletions poppy/manager/base/health.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,44 +34,52 @@ def __init__(self, manager):

@abc.abstractmethod
def health(self):
"""Returns the health of storage and providers
"""Returns the health of storage and providers.

:raises: NotImplementedError
"""
raise NotImplementedError

@abc.abstractmethod
def is_provider_alive(self, provider_name):
"""Returns the health of provider
"""Returns the health of provider.

:param provider_name: The provider name
:type provider_name: str

:param provider_name
:raises: NotImplementedError
"""
raise NotImplementedError

@abc.abstractmethod
def is_distributed_task_alive(self, distributed_task_name):
"""Returns the health of distributed_task
"""Returns the health of distributed_task.

:param distributed_task_name: The task name
:type distributed_task_name: str

:param distributed_task_name
:raises: NotImplementedError
"""
raise NotImplementedError

@abc.abstractmethod
def is_dns_alive(self, dns_name):
"""Returns the health of DNS Provider
"""Returns the health of DNS Provider.

:param dns_name: The DNS name
:type dns_name: str

:param dns_name
:raises: NotImplementedError
"""
raise NotImplementedError

@abc.abstractmethod
def is_storage_alive(self, storage_name):
"""Returns the health of storage
"""Returns the health of storage.

:param storage_name: The name of the storage
:type storage_name: str

:param storage_name
:raises: NotImplementedError
"""
raise NotImplementedError
3 changes: 1 addition & 2 deletions poppy/manager/base/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ def __init__(self, manager):

@abc.abstractmethod
def get(self):
"""get
"""Get JSON text with all resources info.

:param self
:raises: NotImplementedError
"""
raise NotImplementedError
17 changes: 12 additions & 5 deletions poppy/manager/base/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,19 @@ class NotificationWrapper(object):
""""ProviderWrapper class."""

def send(self, ext, subject, mail_content):
"""Send notifications with subject and mail_content
"""Send notifications with subject and mail_content.

:param ext
:param subject
:param mail_content
:returns: ext.obj.services_controller.send(subject, mail_content)
:param ext:
:type ext:

:param subject: The subject text
:type subject: str

:param mail_content: The mail content
:type mail_content: str

:return: ext.obj.services_controller.send(subject, mail_content)
:rtype: ext.obj.services_controller.send
"""

return ext.obj.services_controller.send(subject, mail_content)
Loading