22
22
import org .apache .inlong .manager .client .api .ClientConfiguration ;
23
23
import org .apache .inlong .manager .client .api .service .InlongStreamApi ;
24
24
import org .apache .inlong .manager .client .api .util .ClientUtils ;
25
+ import org .apache .inlong .manager .common .util .Preconditions ;
25
26
import org .apache .inlong .manager .pojo .common .Response ;
27
+ import org .apache .inlong .manager .pojo .stream .InlongStreamBriefInfo ;
26
28
import org .apache .inlong .manager .pojo .stream .InlongStreamInfo ;
27
29
import org .apache .inlong .manager .pojo .stream .InlongStreamPageRequest ;
28
- import org .apache .inlong .manager .common .util .Preconditions ;
29
30
30
31
import java .util .List ;
31
32
@@ -49,6 +50,12 @@ public Integer createStreamInfo(InlongStreamInfo streamInfo) {
49
50
return response .getData ();
50
51
}
51
52
53
+ /**
54
+ * Query whether the inlong stream ID exists
55
+ *
56
+ * @param streamInfo inlong stream info
57
+ * @return true: exists, false: does not exist
58
+ */
52
59
public Boolean isStreamExists (InlongStreamInfo streamInfo ) {
53
60
final String groupId = streamInfo .getInlongGroupId ();
54
61
final String streamId = streamInfo .getInlongStreamId ();
@@ -60,6 +67,12 @@ public Boolean isStreamExists(InlongStreamInfo streamInfo) {
60
67
return response .getData ();
61
68
}
62
69
70
+ /**
71
+ * InlongStream info that needs to be modified
72
+ *
73
+ * @param streamInfo inlong stream info that needs to be modified
74
+ * @return whether succeed
75
+ */
63
76
public Pair <Boolean , String > updateStreamInfo (InlongStreamInfo streamInfo ) {
64
77
Response <Boolean > resp = ClientUtils .executeHttpCall (inlongStreamApi .updateStream (streamInfo ));
65
78
@@ -86,6 +99,19 @@ public InlongStreamInfo getStreamInfo(String groupId, String streamId) {
86
99
}
87
100
}
88
101
102
+ /**
103
+ * Paging query inlong stream brief info list
104
+ *
105
+ * @param request query request
106
+ * @return inlong stream brief list
107
+ */
108
+ public PageInfo <InlongStreamBriefInfo > listByCondition (InlongStreamPageRequest request ) {
109
+ Response <PageInfo <InlongStreamBriefInfo >> response = ClientUtils .executeHttpCall (
110
+ inlongStreamApi .listByCondition (request ));
111
+ ClientUtils .assertRespSuccess (response );
112
+ return response .getData ();
113
+ }
114
+
89
115
/**
90
116
* Get inlong stream info.
91
117
*/
@@ -99,4 +125,78 @@ public List<InlongStreamInfo> listStreamInfo(String inlongGroupId) {
99
125
return response .getData ().getList ();
100
126
}
101
127
128
+ /**
129
+ * Create stream in synchronous/asynchronous way.
130
+ *
131
+ * @param groupId inlong group id
132
+ * @param streamId inlong stream id
133
+ * @return whether succeed
134
+ */
135
+ public boolean startProcess (String groupId , String streamId ) {
136
+ Preconditions .checkNotEmpty (groupId , "InlongGroupId should not be empty" );
137
+ Preconditions .checkNotEmpty (streamId , "InlongStreamId should not be empty" );
138
+ Response <Boolean > response = ClientUtils .executeHttpCall (inlongStreamApi .startProcess (groupId , streamId ));
139
+ ClientUtils .assertRespSuccess (response );
140
+ return response .getData ();
141
+ }
142
+
143
+ /**
144
+ * Suspend stream in synchronous/asynchronous way.
145
+ *
146
+ * @param groupId inlong group id
147
+ * @param streamId inlong stream id
148
+ * @return whether succeed
149
+ */
150
+ public boolean suspendProcess (String groupId , String streamId ) {
151
+ Preconditions .checkNotEmpty (groupId , "InlongGroupId should not be empty" );
152
+ Preconditions .checkNotEmpty (streamId , "InlongStreamId should not be empty" );
153
+ Response <Boolean > response = ClientUtils .executeHttpCall (inlongStreamApi .suspendProcess (groupId , streamId ));
154
+ ClientUtils .assertRespSuccess (response );
155
+ return response .getData ();
156
+ }
157
+
158
+ /**
159
+ * Restart stream in synchronous/asynchronous way.
160
+ *
161
+ * @param groupId inlong group id
162
+ * @param streamId inlong stream id
163
+ * @return whether succeed
164
+ */
165
+ public boolean restartProcess (String groupId , String streamId ) {
166
+ Preconditions .checkNotEmpty (groupId , "InlongGroupId should not be empty" );
167
+ Preconditions .checkNotEmpty (streamId , "InlongStreamId should not be empty" );
168
+ Response <Boolean > response = ClientUtils .executeHttpCall (inlongStreamApi .restartProcess (groupId , streamId ));
169
+ ClientUtils .assertRespSuccess (response );
170
+ return response .getData ();
171
+ }
172
+
173
+ /**
174
+ * Delete stream in synchronous/asynchronous way.
175
+ *
176
+ * @param groupId inlong group id
177
+ * @param streamId inlong stream id
178
+ * @return whether succeed
179
+ */
180
+ public boolean deleteProcess (String groupId , String streamId ) {
181
+ Preconditions .checkNotEmpty (groupId , "InlongGroupId should not be empty" );
182
+ Preconditions .checkNotEmpty (streamId , "InlongStreamId should not be empty" );
183
+ Response <Boolean > response = ClientUtils .executeHttpCall (inlongStreamApi .deleteProcess (groupId , streamId ));
184
+ ClientUtils .assertRespSuccess (response );
185
+ return response .getData ();
186
+ }
187
+
188
+ /**
189
+ * Delete the specified inlong stream
190
+ *
191
+ * @param groupId inlong group id
192
+ * @param streamId inlong stream id
193
+ * @return whether succeed
194
+ */
195
+ public boolean delete (String groupId , String streamId ) {
196
+ Preconditions .checkNotEmpty (groupId , "InlongGroupId should not be empty" );
197
+ Preconditions .checkNotEmpty (streamId , "InlongStreamId should not be empty" );
198
+ Response <Boolean > response = ClientUtils .executeHttpCall (inlongStreamApi .delete (groupId , streamId ));
199
+ ClientUtils .assertRespSuccess (response );
200
+ return response .getData ();
201
+ }
102
202
}
0 commit comments