-
Notifications
You must be signed in to change notification settings - Fork 483
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 a property service #132
Comments
+1 |
2 similar comments
+1 |
+1 |
The team has no bandwidth to try to implement this. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Goals
The purpose of having a service for properties are the following
Enable the dynamic nature of the properties
Once we have a standard service for properties, we can create a standard PolledConfigurationSource on the client side to get all the properties, which can be changed dynamically on the server.
Hide persistence details and rely on API
So that you can switch persistence store without affecting clients
Provide property management functionalities
We are aiming to support these functionalities initially
A set of REST APIs as well as some UI will be provided.
Support scopes and property filtering based on scopes
With the service, you can create properties with the same name but different scopes. A client can query the service to get the properties for certain scopes. For example, there can be properties with the same name, but different values for different applications. One application can query the service to get the property for that specific application.
Architecture
The service will be a web application that manages the properties as resources. It is a Jersey based RESTful service. Configuration and wiring of implementation specific objects will be done via dependency injection with Guice.
Property Model
The following is the proposed Java model for Property
The following interfaces defines some meta data and operational attributes which are implementation specific:
Data Access
The following is the interface for data access for the persistence store.
Some implementation loads all properties from persistence into memory. Additional functionalities are required for such implementation like refresh and keeping a certain level of data consistency. These functionalities will be defined in additional class/interface.
REST API
The REST API should support creation, retrieval, query/search, update and deletion of property.
The response code follows this convention:
200 - request is successful
400 - malformed request
404 - requested property does not exist (in retrieval, update and deletion)
405 - trying to update a field of property that is supposed to immutable
409 - In creation, property with the same key and scopes already exist
500 - unexpected server side exception occurred
Creation
Body of the POST request will be the serialized version of Property.
Response payload is the serialized version of the final property created, including property ID.
Example of request payload:
Example of response payload:
Update
Once a property is created, only the following fields allow update:
Scopes should not be updated. Instead, new property should be created with the desired new scope and the old property can be deleted if the scopes are no longer applicable.
The HTTP Verb for update should ideally be "PATCH". However, since it just gets standardized and there is limited support, we are going to use "POST" instead.
An example of UPDATE payload:
An example of UPDATE response:
Retrieval of a single property
Instead of put the property ID as part of path, it is added as a query parameter. The reason is that the ID may contain path character, for example "/", which will confuse the service. On the other hand, using URL encoded query parameter has better interoperability.
The payload of response will include the property.
Query of properties
This REST API is used to return a list of properties that matches scopes specified in the request.
For example
The query looks for properties that matches the following criteria:
Here is an example of response payload:
Deletion
There is no response payload. The response code indicates the result.
The text was updated successfully, but these errors were encountered: