File tree Expand file tree Collapse file tree 2 files changed +34
-3
lines changed Expand file tree Collapse file tree 2 files changed +34
-3
lines changed Original file line number Diff line number Diff line change @@ -130,8 +130,7 @@ class TJsonLocalRpc : public TViewerPipeClient {
130
130
return false ;
131
131
}
132
132
}
133
- const auto & params (Event->Get ()->Request .GetParams ());
134
- Params2Proto (params, request);
133
+ Params2Proto (Params, request);
135
134
if (!ValidateRequest (request)) {
136
135
return false ;
137
136
}
Original file line number Diff line number Diff line change @@ -23,6 +23,27 @@ class TOperationList : public TOperationListRpc {
23
23
AllowedMethods = {HTTP_METHOD_GET};
24
24
}
25
25
26
+ bool ValidateRequest (Ydb::Operations::ListOperationsRequest& request) override {
27
+ if (!TBase::ValidateRequest (request)) {
28
+ return false ;
29
+ }
30
+ ui64 offset = FromStringWithDefault<ui64>(Params.Get (" offset" ), 0 );
31
+ ui64 limit = FromStringWithDefault<ui64>(Params.Get (" limit" ), 0 );
32
+ if (offset >= 0 && limit > 0 ) {
33
+ if (offset % limit != 0 ) {
34
+ ReplyAndPassAway (GetHTTPBADREQUEST (" text/plain" , " offset must be a multiple of limit" ));
35
+ return false ;
36
+ }
37
+ if (limit > 100 ) {
38
+ ReplyAndPassAway (GetHTTPBADREQUEST (" text/plain" , " limit must be less than or equal to 100" ));
39
+ return false ;
40
+ }
41
+ request.set_page_size (limit);
42
+ request.set_page_token (std::to_string (offset / limit + 1 ));
43
+ }
44
+ return true ;
45
+ }
46
+
26
47
static YAML::Node GetSwagger () {
27
48
YAML::Node node = YAML::Load (R"___(
28
49
get:
@@ -42,7 +63,8 @@ class TOperationList : public TOperationListRpc {
42
63
kind:
43
64
* `ss/backgrounds`
44
65
* `export`
45
- * `import`
66
+ * `import/S3`
67
+ * `import/YT`
46
68
* `buildindex`
47
69
* `scriptexec`
48
70
required: true
@@ -57,6 +79,16 @@ class TOperationList : public TOperationListRpc {
57
79
description: page token
58
80
required: false
59
81
type: string
82
+ - name: offset
83
+ in: query
84
+ description: offset. must be a multiple of limit
85
+ required: false
86
+ type: integer
87
+ - name: limit
88
+ in: query
89
+ description: limit. must be less than or equal to 100
90
+ required: false
91
+ type: integer
60
92
responses:
61
93
200:
62
94
description: OK
You can’t perform that action at this time.
0 commit comments