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

Accessing a Resource's State #35

Open
duglin opened this issue Oct 29, 2018 · 5 comments
Open

Accessing a Resource's State #35

duglin opened this issue Oct 29, 2018 · 5 comments

Comments

@duglin
Copy link

duglin commented Oct 29, 2018

Is there any reason why "state" isn't just part of each object instead of under a different url (e.g. /resource/state) ? It would be good if each object had "state" (just like each has "labels") to provide some consistency. Then a user can GET a resource and see it all in one response object instead of having to GET /resource and GET /resource/state.

This would then also allow for a more consistent pattern between sync and async - meaning doing a GET on a resource URL will always tell us what's going on with it.

@KirilKabakchiev
Copy link
Member

KirilKabakchiev commented Oct 29, 2018

It's currently included as both options. If you look at the service instances / bindings responses they currently include the state in the response. There is also the separate subresource API for each resource (for example service_instances/service_instance_id/state. I agree that one of the approaches should be chosen.

What I am not 100% if this state and all its conditions would be required by any client - the CLI will probably not need so detailed information for visualization and the business logic for processing and reconciling the state would probably (atleast at first) be running in the same Go process (be it async of the API or not). So returning the whole state in each api response might or might not be too much ?

Another option is the create / delete / patch apis to not include state and just returh 202 and location header . Then this location (most probably the get api for the resource) can include details about the resource state/status

@duglin
Copy link
Author

duglin commented Oct 29, 2018

I'd prefer to start with the simple approach.... GET returns it all. Then if we find that too much info is returned we can then optimize things. E.g. add a "?skipConditions=true" type of thing or some other filtering mechanism. But starting out with the approach of 2 GETs just to get a resource's full set of metadata will probably really annoy people.

@KirilKabakchiev
Copy link
Member

I agree, let’s start simple with no subresource apis.

Next interesting point would be - do all apis (create, patch, delete,get) also return a state or another option would be for them to just return 202 and location of the get api - the get api would then include state

@duglin
Copy link
Author

duglin commented Oct 29, 2018

See: #36

@KirilKabakchiev KirilKabakchiev changed the title state object Accessing a Resource's State Oct 30, 2018
@KirilKabakchiev
Copy link
Member

Added some details in #31 on that.

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

No branches or pull requests

2 participants