Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gmicol
Copy link
Collaborator

@gmicol gmicol commented Dec 12, 2024

Fixes #107

Addition of a new module nd_rest to handle generic ND REST API requests.

@gmicol gmicol added enhancement New feature or request jira-sync Sync this issue to Jira labels Dec 12, 2024
@gmicol gmicol self-assigned this Dec 12, 2024
@github-actions github-actions bot changed the title [minor_change] Add nd_rest as a new generic ND REST API module. (DNCE-242) [minor_change] Add nd_rest as a new generic ND REST API module. (DNCE-242) (DCNE-242) Dec 12, 2024
@gmicol gmicol changed the title [minor_change] Add nd_rest as a new generic ND REST API module. (DNCE-242) (DCNE-242) [minor_change] Add nd_rest as a new generic ND REST API module. (DCNE-242) Dec 12, 2024
@gmicol gmicol force-pushed the nd_rest branch 2 times, most recently from b5a4cdf to 1af8cb5 Compare December 16, 2024 17:35
plugins/modules/nd_rest.py Show resolved Hide resolved
- Some payloads are known not to be idempotent, so be careful when constructing payloads.
"""

EXAMPLES = r"""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing a PATCH example, but see examples for all the others. Should we add?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should, I will add it.

plugins/modules/nd_rest.py Show resolved Hide resolved
plugins/modules/nd_rest.py Show resolved Hide resolved
nd = NDModule(module)

# Validate content/payload
if content and isinstance(content, str) and HAS_YAML:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we also validate json data?

tests/integration/inventory.networking Outdated Show resolved Hide resolved
tests/integration/inventory.networking Outdated Show resolved Hide resolved
- cisco.nd.modules

notes:
- Some payloads are known not to be idempotent, so be careful when constructing payloads.
Copy link
Collaborator

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?

description:
- Sets the payload of the API request directly.
- This may be convenient to template simple requests.
- For anything complex use the C(template) lookup plugin (see examples).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps I am missing this example

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forgot to add an example for this case, will add it

type: str
required: true
aliases: [ uri ]
content:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we also provide a file path with content?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should add a new attribute for that

plugins/modules/nd_rest.py Show resolved Hide resolved
plugins/modules/nd_rest.py Show resolved Hide resolved
}
}

- name: Query Security Domain using GET method
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this module also support query strings in the path of GET requests?
Should we add some examples using parameters such as, filter, orderBy and the pagination options?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request jira-sync Sync this issue to Jira
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generic ND REST API Module (DCNE-242)
3 participants