Skip to content

PCCP-7638: Enhance HttpApiClient for Alletra streaming API support [DO NOT REVIEW]#86

Draft
NimbleMike wants to merge 2 commits intov1.3.xfrom
add-alletra-streaming-api-support
Draft

PCCP-7638: Enhance HttpApiClient for Alletra streaming API support [DO NOT REVIEW]#86
NimbleMike wants to merge 2 commits intov1.3.xfrom
add-alletra-streaming-api-support

Conversation

@NimbleMike
Copy link

The Alletra MP supports using multipart/form-data upload to send a software update file to the Alletra. The details are available here:

https://pages.github.hpe.com/hpe-3par-mgmt/ssmc-onnode/2.6.0/api/public_and_private/index.html#post-/api/v3/softwareupdate/upload

Because the Morpheus HttpApiClient callStreamApi did not support the format required by the Alletra, we initially developed our own streaming support which you can see here:

https://github.com/HPE-EMU/morpheus-storage-abstraction/blob/18aca8b4d354feab7ba1851b668000736fc272a5/src/main/groovy/com/hpe/sal/alletra/mp/api/ApiUtils.groovy#L91

This PR enhances the HttpApiClient callStreamApi such that it can support uploading software updates to the Alletra. Special consideration has been made to avoid any regression issues.

  • The JSON unmarshaller that was at the tail end of callJsonApi has been separated into a private parseJsonResponse member function. This allows the reuse of the code when decoding the JSON response returned from a streamed request sent to the Alletra.
  • Added support for opts.body instanceof File to support file uploads to the Alletra.
  • The callStreamApi now populates the rtn.setContent on success or failure. It also sets the StatusCode. These changes are done to be identical to how the existing callApi handler does it. Setting the additional properties enables the parseJsonResponse to unmarshal the JSON data.

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.

1 participant