Skip to content

Commit bef5ca0

Browse files
jemlognamkyu1999
andauthored
[Proposal] Support a LitmusChaos Java SDK (#4871)
* add litmus java sdk proposal Signed-off-by: Jemin <jemin9812@gmail.com> * update java-sdk-proposal Signed-off-by: Jemin <jemin9812@gmail.com> * docs: add usecase of sdk Signed-off-by: Jemin <jemin9812@gmail.com> --------- Signed-off-by: Jemin <jemin9812@gmail.com> Co-authored-by: Namkyu Park <53862866+namkyu1999@users.noreply.github.com>
1 parent faa6e48 commit bef5ca0

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed

proposals/java-sdk.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
| title | authors | creation-date | last-updated |
2+
|---------------------|--------------------------------------|---------------|--------------|
3+
| add litmus java sdk | [@jemlog](https://github.com/jemlog) | 2024-09-07 | 2024-09-07 |
4+
5+
# Adding Litmus Java SDK
6+
7+
- [Adding Litmus Java SDK](#adding-litmus-java-sdk)
8+
- [Summary](#summary)
9+
- [Motivation](#motivation)
10+
- [Goals](#goals)
11+
- [Non-Goals](#non-goals)
12+
- [Proposal](#proposal)
13+
- [Use Cases](#use-cases)
14+
- [Implementation Details](#implementation-details)
15+
- [Initialize client](#initialize-client)
16+
- [Use Client](#use-client)
17+
- [Risks and Mitigations](#risks-and-mitigations)
18+
- [Upgrade / Downgrade Strategy](#upgrade--downgrade-strategy)
19+
- [Drawbacks](#drawbacks)
20+
- [Alternatives](#alternatives)
21+
- [References](#references)
22+
23+
## Summary
24+
25+
The purpose of litmus-java-sdk is to provide a client that can easily access to auth and backend server of litmus.
26+
27+
## Motivation
28+
29+
Litmuschaos’ backend server uses graphQL as an API communication method.
30+
Graphql is not as familiar to developers as REST API, so it is difficult to call backend server directly.
31+
Therefore we planned to add a Java-based SDK that makes developers to communicate easily with litmus backend server.
32+
The SDK also provides an interface to communicate with the auth server to wrap the entire litmus control plane.
33+
34+
### Goals
35+
36+
- Add client calling the API for Auth Server
37+
- Add client calling graphQL for Backend Server
38+
39+
40+
### Non-Goals
41+
42+
- Changing APIs that auth server and backend server already provide is non-goal
43+
- Add auto configuration for SpringBoot is non-goal
44+
45+
## Proposal
46+
47+
### Use Cases
48+
49+
In organization, litmusChaos administrators can call java SDK to manage multiple users and projects.
50+
51+
### Implementation Details
52+
53+
#### Initialize client
54+
55+
```java
56+
public void init(){
57+
58+
String hostUrl = "http://localhost:3000";
59+
String username = "admin";
60+
String password = "litmus";
61+
62+
LitmusClient litmusClient = new LitmusClient(hostUrl, username, password);
63+
}
64+
```
65+
#### Use Client
66+
```java
67+
public void execute(){
68+
69+
String projectName = "demo project";
70+
String description = "demo project description";
71+
List<String> tags = Arrays.asList("litmus", "chaos");
72+
73+
CreateProjectRequest request = CreateProjectRequest.builder()
74+
.projectName("project")
75+
.description("description")
76+
.tags(tags)
77+
.build();
78+
79+
CreateProjectResponse response = litmusClient.createProject(request);
80+
}
81+
```
82+
## Risks and Mitigations
83+
84+
## Upgrade / Downgrade Strategy
85+
86+
## Drawbacks
87+
88+
It will be a great opportunity for administrators of litmusChaos to manage users and conduct experiments more conveniently.
89+
90+
## Alternatives
91+
92+
This is the first java sdk we created in Litmus. No other alternatives exist.
93+
94+
## References

0 commit comments

Comments
 (0)