rockcarver / frodo-lib

A library to manage ForgeRock Identity Cloud tenants, ForgeOps deployments, and classic deployments.
MIT License
9 stars 19 forks source link

Improve MappingOps #425

Closed phalestrivir closed 2 months ago

phalestrivir commented 2 months ago

This PR improves MappingOps functions by fixing bugs, improving code, and adding tests.

The changes here are necessary for the PR in frodo-cli that adds the new mapping command.

One thing to note is that this PR adds a sorting function for sorting mappings in the readMappings function according to sync order. This is good for the list and rename sub-commands in the CLI where ordering mappings by sync order would be a nice feature to have. There is an endpoint that is supposed to return all mappings in correct sync order which should be used instead when reading mappings, but I found that it doesn't always work as described in the documentation. In short, I found that not all mappings are always returned from the endpoint, and when I have successfully pulled all mappings from the endpoint, I found that the legacy mappings were ordered after the regular mappings instead of before as it should be according to the documentation. It's possible that the endpoint may not work as intended due to how I am creating/importing the regular mappings, but I'm not certain. In my experience, I haven't found a way to get the endpoint to work consistently, but if we can find a way to get it to work then we should probably use it instead.