Skip to content

Commit

Permalink
Document the Inventory plugin base class.
Browse files Browse the repository at this point in the history
Add its required 'process' method.
  • Loading branch information
forestmonster committed Feb 1, 2019
1 parent d49e53c commit a746d8e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion diffy/plugins/bases/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ class InventoryPlugin(Plugin):
type = "inventory"
_schema = PluginOptionSchema

def poll(self, queue, **kwargs):
def process(self, **kwargs):
raise NotImplementedError
26 changes: 23 additions & 3 deletions docs/developer/plugins/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Several interfaces exist for extending Diffy:
* Payload (diffy.plugins.bases.payload)
* Persistence (diffy.plugins.bases.persistence)
* Target (diffy.plugins.bases.target)
* Inventory (diffy.plugins.bases.inventory)

Each interface has its own functions that will need to be defined in order for
your plugin to work correctly. See :ref:`Plugin Interfaces <PluginInterfaces>`
Expand Down Expand Up @@ -175,15 +176,34 @@ The PersistencePlugin requires two functions to be implemented::
Target
------

Target plugins give the Diffy the ability interact with external systems to
resolve targets for commands.
Target plugins give Diffy the ability to interact with external systems to resolve
targets for commands.

The TargetPlugin requires one function to be implemented::
The TargetPlugin class requires one function to be implemented::

def get(self, key, **kwargs):
# fetch targets based on key


Inventory
---------

Inventory plugins interact with asset inventory services to pull a list of
targets for baselining and analysis.

Inheriting from the InventoryPlugin class requires that you implement a ``process``
method::

def process(self, **kwargs):
# Process a new set of targets from a desired source.
#
# This method should handle the interaction with your desired source,
# and then send the results to :meth:`diffy_api.core.async_baseline`.
#
# If you poll the source regularly, ensure that you
# only request recently deployed assets.


Testing
=======

Expand Down

0 comments on commit a746d8e

Please sign in to comment.