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

Add meta data parameter to get_devices. #26

Open
iunderwood opened this issue Feb 24, 2023 · 2 comments
Open

Add meta data parameter to get_devices. #26

iunderwood opened this issue Feb 24, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@iunderwood
Copy link

This is to add a toggle to return all the metadata fields with a device when getting the devices.

   def get_devices(self, metadata=False):
        """
        :return: returns list of devices added in FortiManager
        """
        session = self.login()
        payload = \
            {
                "method": "get",
                "params": 
                    [
                        {
                            "url": f"/dvmdb/adom/{self.adom}/device/"
                        }
                    ]
            }
        if metadata is True:
            payload['params'][0].update({"meta fields": ["*"]})

        payload.update({"session": self.sessionid})
        get_devices = session.post(
            url=self.base_url, json=payload, verify=False)
        return get_devices.json()

According to the FNDN, metadata is not returned by default.

@akshaymane920 akshaymane920 added the enhancement New feature or request label Feb 26, 2023
@akshaymane920
Copy link
Owner

akshaymane920 commented Feb 26, 2023

I didn't knew this because unfortunately I don't have the access to FNDN 🥲, let me update the method by this week, Thanks!!.
Or would you like to do it?, I shall merge the PR.🙂

@iunderwood
Copy link
Author

I'll do a PR this week. Thanks!

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

No branches or pull requests

2 participants