HewlettPackard / oneview-sdk-ruby

This project is no longer being developed and has limited support. In the near future this repository will be fully deprecated. Please consider using other OneView projects, such as Golang and Python.
Apache License 2.0
12 stars 16 forks source link

Resource retrieve! should not get index for resource #300

Closed jsmartt closed 3 years ago

jsmartt commented 6 years ago

Scenario/Intent

Improve the performance of the resource #retrieve! method.

Environment Details

Steps to Reproduce

call #retrieve! on any resource and follow the REST calls being made

Expected Result

Do an intelligent lookup of the resource. Instead of getting the entire list of resources and filtering with Ruby code, it should send the query in the OneView API request, so only that resource is returned. If the URI is set, it can even just do a refresh.

Another option is to create an additional method, but I believe the idea of #retrieve! is to be a performant, safe retrieval using unique attributes.

Actual Result

This method is really not much more than a wrapper for ::find_by(*args).first. When there are large numbers of resources, the current implementation is slow and potentially dangerously memory-intensive.

AsisBagga commented 3 years ago

This SDK has limited support and will not be actively developed for the foreseeable future.