-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[minor_change] Add nd_rest as a new generic ND REST API module. (DCNE-242) #109
base: master
Are you sure you want to change the base?
Conversation
b5a4cdf
to
1af8cb5
Compare
plugins/modules/nd_rest.py
Outdated
- cisco.nd.modules | ||
|
||
notes: | ||
- Some payloads are known not to be idempotent, so be careful when constructing payloads. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we add link reference to nd api docs and or swagger reference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you mean here fo example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a reference that points to api documentation of ND like: https://developer.cisco.com/docs/nexus-dashboard/latest/api-reference/
…and file as input for the module. Add new tests.
@@ -56,6 +56,33 @@ def sanitize_list(list_to_sanitize, keys=None, values=None, list_recursive=True, | |||
return result | |||
|
|||
|
|||
def sanitize(obj_to_sanitize, keys=None, values=None, recursive=True, remove_none_values=True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a reason to copy the code in this function instead of wrapping the existing functions into this function?
payload=content, | ||
) | ||
|
||
method = nd.params.get("method").upper() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we also allow for upper inputs?
# Append previous state of the object | ||
if method in ("PUT", "DELETE", "PATCH"): | ||
nd.existing = nd.previous = sanitize(nd.query_obj(path, ignore_not_found_error=True), keys_to_sanitize) | ||
if method != "GET": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do we set for previous GET combination, just empty dict? or should we set the current value?
Fixes #107
Addition of a new module
nd_rest
to handle generic ND REST API requests.