Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Dax Mickelson committed Sep 24, 2019
2 parents d1b67b5 + ba2de7a commit acc2d75
Showing 1 changed file with 40 additions and 2 deletions.
42 changes: 40 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ file and the Class you create to match the associated API method from the Quick
what class is associated wot which FMC API method.
* 99% of the time your Class should inherit from APIClassTemplate to get all the additional Class methods. No need for
you to re-write that code!
* In both the api_objects' dunder init and the sub-package's dunder init please import your specific Class and add it to
the dunder all variable.
* In both the api_objects' `__init__.py` and the sub-package's `__init__.py` please import your specific Class and add it
to the `__all__` variable.
* Lastly, please create a "unit-test" for your new Class' features. These unit-tests are referenced from the
TestingUserScript.py file. Think of these "tests" as the best documentation that user's of the FMCAPI will have in
knowing how to use that particular Class. (Unless you want to write up good use documentation too.) :-)
Expand All @@ -23,3 +23,41 @@ parse_kwargs() class methods. It's been my experience that the FMC is VERY touch
we might as well accept that we need to manage what is sent. So, you'll see that each API class has VALID_JSON_DATA and
VALID_FOR_KWARGS variables. These are lists of variable names we will allow. Be sure to create/update these variables as
you create/modify the Class(es).
* I know that the FMC API documentation is horrible for identifying which FMC version first released an API feature.
That said, please do your best to associate your Class to the correct version in which it was released. This is what
the FIRST_SUPPORTED_FMC_VERSION variable is for.
* The various FMC API methods have differing rules on what is/isn't allowed in the 'name' field. Please use the
VALID_CHARACTERS_FOR_NAME variable is to provide a regex "string" that describes what is permitted. The real issue
here is whether spaces are/aren't permitted in the 'name'.
* When performing a GET, and not specifying an 'id', will generally render a list of all objects for that API method.
Some of these allow the ability to filter/search by name. Use the FILTER_BY_NAME boolean variable to specify if this
is possible.
* If you copy/paste one Class to create a new one: **PLEASE** carefully comb through the copied code and update it to be
accurate to your new Class. Remove unneeded variables and class methods. Update any logging/comments to match the
new Class.
* If specific variables are required for an FMC's API method please ensure your Class' REQUIRED_FOR_<method> variable
is set correctly. (e.g. REQUIRED_FOR_GET = 'id')
* If you have a method in your Class that is used to add objects to a list (like a list of networks for a network group)
please use the following for the action variable (as applicable): 'add', 'remove', 'clear'. This will provide a
consistent "language" to the user's of fmcapi.
For example:
```
def foo(self, action='', ...):
if 'action' == 'add':
blah
elif 'action' == 'remove':
blah
elif 'action == 'clear':
blah
```
* If you have a method in your Class that is used to add another class object (not a list like described above)
please use the following for the action variable (as applicable): 'set', 'clear'. This will provide a consistent
"language" to the user's of fmcapi.
For example:
```
def foo(self, action='', ...):
if 'action' == 'set':
blah
elif 'action == 'clear':
blah
```

0 comments on commit acc2d75

Please sign in to comment.