-
Notifications
You must be signed in to change notification settings - Fork 2
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
Create abstractions for using cloudlaunch-cli as a library #4
Comments
Just want to get some feedback on the API design. I haven't implemented anything yet but I was thinking of an API that mimics the REST API hierarchically. This is a sketch of what I have in mind:
I was also thinking it would be nice if results allowed calling sub-routes of the API (hard to put in words). Here's what I mean, you could do the following:
but you can also create a task for a deployment with a deployment result directly with something like the following:
What do you guys think? |
Looks good to me! |
Sounds good to me too. I think it looks pretty close to the cloudbridge API too, so that would make things easier/consistent across the stack. Really like the sub-routes idea. |
Okay I figured out the problem with coreapi. The issue is that for deployments viewset Probably this is a schema generation issue. It doesn't make much sense to me that The only workaround I can think of would be to rename the
See also |
Nice working tracking that down. Seems ok to rename archived to avoid the conflict? The requests route seems ok too, if coreapi is overcomplicating things for what it offers. I was wondering though, coreapi does generate client side objects right? So if we go down the requests route, would we manually have to write client wrapper classes? |
I reorganized the source code and also renamed APIResponse to APIResource. I also implemented a simple form of attribute access that proxies to the response data dictionary. I think we'll want some sort of mapping for nested type so that those can be converted as well. For example, Deployment has a 'latest_task' attribute which should be converted to the Task wrapper object once we have it. |
@afgane @nuwang I've taken a first stab at implementing wrapper resource classes for Deployment and Task. If you guys want to jump in and add more endpoints and resource classes, feel free. I've started adding some unit tests but I think I will focus next on adding some additional tests for the APIEndpoint wrapper classes. |
@machristie I went through the cloudlaunch-cli code in greater detail and I've gained an appreciation of the design - I think it's a very generic/flexible design and has tremendously shortened the amount of code that needs to be written. I was also comparing it to cloudbridge while going through the code, because I was hoping we could have some cross-pollination of ideas as well as improve consistency between the two, given that they are very similar in terms of what they do (interfacing with ReSTFUL resources/subresources) and also belong to the same CloudVE suite. So what follows is a kind of comparative critique - I'm just noting things here so we could take it up for discussion perhaps at our next meeting.
|
A bit of clarification on the circular import issue. This is where the circular import becomes a problem - when the resource needs import the child service: |
Thanks for the in depth feedback @nuwang ! I'll provide some responses here but it might be easier to discuss at our next meeting.
Also not following the circular import issue, but it sounds interesting. |
@nuwang I just committed a change that addresses some of the comments you made in your review.
|
Create some abstractions for easily using cloudlaunch-cli as a python library for calling the CloudLaunch REST API.
TODO
.update()
and.delete()
methods on API response objectsreturn iterator for paginated resultsmoved to issue Support pagination in APIEndpoint #9Issue: PUT/PATCH doesn't work with openapi, attributes are converted to query parameters (openapi bug?)The issue had to do with thearchived
form and query parameter of DeploymentsViewSet, see comment belowDEFERRED
maybe not needed, seems to be related to coreapi PUT/PATCH bugcreate
,update
create
. APIResource's are designed to wrap API responses, not to be used in making requests.The text was updated successfully, but these errors were encountered: