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

CASMCMS-9225: Move PCS client to new paradigm #400

Open
wants to merge 3 commits into
base: casmcms-9225-04-operator-api-client
Choose a base branch
from

Conversation

mharding-hpe
Copy link
Contributor

@mharding-hpe mharding-hpe commented Dec 17, 2024

CASMCMS-9225 as a whole involves changes to a number of different files in BOS. In order to aid with review, I'm breaking the overall thing up into smaller PRs. Each will be built on top of each other, and will be merging into the main PR branch. Only once each sub-PR has been approved and merged will I merge that branch into develop.
Full list of sub-PRs:

  1. Added basic paging ability for GET requests to list components
  2. Create generic endpoint classes
  3. Create generic API client class
  4. Create ApiClients class and provide it to BOS operators inside a context manager
  5. Move PCS client to new paradigm
  6. Move BSS client to new paradigm
  7. Move CFS client to new paradigm
  8. Move BOS client to new paradigm
  9. Move IMS client to new paradigm
  10. Move HSM client to new paradigm
  11. CHANGELOG update, linting, update utils

The BasePcsEndpoint class is the base class for all PCS endpoints. Because it is a subclass of BaseEndpoint, it means that it will return the JSON bodies from the request responses. We create a custom error handler class (PcsRequestErrorHandler) to make this new version of the PCS client match the existing PCS client behavior. Namely, it re-raises exceptions as PowerControlExceptions.

There are two PCS endpoints -- PowerStatusEndpoint and TransitionsEndpoint. The functions defined for the previous PCS client have been moved into one of these endpoints. They function the same way they did before, except that they use the endpoint class methods for the API calls they make, and they no longer need to worry about any of the exception handling. When reviewing these functions, I will likely defer changes based on issues that already existed in the functions in the original PCS client, unless they are serious or have become more serious as a consequence of this changeover.

The PCSClient class wraps up the two PCS endpoints as a client. The base BOS operator code is updated so that this client is included in its ApiClients class. The BOS operators which use the PCS client are updated to now use it via the ApiClients class.

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

Successfully merging this pull request may close these issues.

2 participants