-
-
Notifications
You must be signed in to change notification settings - Fork 154
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
Update: Provide the ability to view and set the default provider used for resource types. #1799
Conversation
Making consistent and intuitive APIs is hard in the first place and when you have a single dimensioned url structure to do it with even more so.... This is not a strict opinion as this needs to change but just my view on how I'd structure the API: Basically I am thinking about what should come first: resource type or provider? Now this PR makes it "provider first":
I see also potential for a race condition - there is no guarantee that nothing else changed the default provider that you just set or that you think you set a moment ago. Do you expect this api to be called by clients? r is this more like a server setting: "use this plugin as the target for write requests always" and this is more a question of plugin management and part of the server's admin / settings ui? |
Is this actually two independent features?
|
Technically yes. The thinking was to have the changes that support the use case together but will split them out. |
I think it has value as both a server setting and a client callable end point (with suitable credentials supplied).
Are you talking about UI setting being made at the same time as the client API being used? Where there is a race that is having to be managed is the loading and processing of the persisted settings against the available plugins. When the API is initialising there is no guarantee that all plugins have finished being loaded by the plugin manager, so applying persisted settings is more challenging. It would be nice if there were |
I will look to move the saved configuration to Do I just create a new key at the root of the settings JSON
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added 2 very minor changes, see the commit log.
Good to go, but this does not rebase on master cleanly - here is a squashed & rebased version, did not want to force push it on this branch, but feel free to do that & merge.
Not all resource providers will support creating / updating resources e.g.
charts-plugin
.When there are multiple providers registered for a resource type, the first plugin / provider registered will be used for write operations unless the provider to use is specified in the request.
Definition:
default provider
= provider used for write operations (when?provider=<plugin-id>
is not specified in the request).Provide the ability to view and set the
default provider
for specific resource types and persist the selection bewteen restarts.Implemented in this PR:
/resources/{resourcetype}/_providers
endpoint -> List the registered resource providers for the resource type/resources/{resourcetype}/_default
endpoint -> Return the default provider for the resource type/resources/{resourcetype}/_default/{providerid}
-> Set the default provider for a resource typeExample: Set the default provider for a routes to plugin with the id
my-provider-id