@@ -27,6 +27,7 @@ api_versions!([
2727 // | example for the next person.
2828 // v
2929 // (next_int, IDENT), // NOTE: read the note at the start of this macro!
30+ ( 2 , ADD_RETENTION_POLICY_AND_TABLE_USAGE ) ,
3031 ( 1 , INITIAL ) ,
3132] ) ;
3233
@@ -200,6 +201,37 @@ pub trait ClickhouseAdminServerApi {
200201 async fn init_db (
201202 rqctx : RequestContext < Self :: Context > ,
202203 ) -> Result < HttpResponseUpdatedNoContent , HttpError > ;
204+
205+ /// Set the retention policy for timeseries data.
206+ #[ endpoint {
207+ method = PUT ,
208+ path = "/retention-policy" ,
209+ versions = VERSION_ADD_RETENTION_POLICY_AND_TABLE_USAGE ..,
210+ } ]
211+ async fn set_retention_policy (
212+ rqctx : RequestContext < Self :: Context > ,
213+ policy : TypedBody < latest:: retention:: RetentionPolicy > ,
214+ ) -> Result < HttpResponseUpdatedNoContent , HttpError > ;
215+
216+ /// Get the retention policy for timeseries data from the database
217+ #[ endpoint {
218+ method = GET ,
219+ path = "/retention-policy" ,
220+ versions = VERSION_ADD_RETENTION_POLICY_AND_TABLE_USAGE ..,
221+ } ]
222+ async fn retention_policy (
223+ rqctx : RequestContext < Self :: Context > ,
224+ ) -> Result < HttpResponseOk < latest:: retention:: RetentionPolicy > , HttpError > ;
225+
226+ /// Return the resource usage of database tables.
227+ #[ endpoint {
228+ method = GET ,
229+ path = "/usage/database" ,
230+ versions = VERSION_ADD_RETENTION_POLICY_AND_TABLE_USAGE ..,
231+ } ]
232+ async fn database_usage (
233+ rqctx : RequestContext < Self :: Context > ,
234+ ) -> Result < HttpResponseOk < latest:: usage:: DatabaseUsageResult > , HttpError > ;
203235}
204236
205237/// API interface for our clickhouse-admin-single server
@@ -235,4 +267,35 @@ pub trait ClickhouseAdminSingleApi {
235267 path_params : Path < latest:: server:: MetricInfoPath > ,
236268 query_params : Query < latest:: server:: TimeSeriesSettingsQuery > ,
237269 ) -> Result < HttpResponseOk < Vec < latest:: server:: SystemTimeSeries > > , HttpError > ;
270+
271+ /// Set the retention policy for timeseries data.
272+ #[ endpoint {
273+ method = PUT ,
274+ path = "/retention-policy" ,
275+ versions = VERSION_ADD_RETENTION_POLICY_AND_TABLE_USAGE ..,
276+ } ]
277+ async fn set_retention_policy (
278+ rqctx : RequestContext < Self :: Context > ,
279+ policy : TypedBody < latest:: retention:: RetentionPolicy > ,
280+ ) -> Result < HttpResponseUpdatedNoContent , HttpError > ;
281+
282+ /// Get the retention policy for timeseries data from the database
283+ #[ endpoint {
284+ method = GET ,
285+ path = "/retention-policy" ,
286+ versions = VERSION_ADD_RETENTION_POLICY_AND_TABLE_USAGE ..,
287+ } ]
288+ async fn retention_policy (
289+ rqctx : RequestContext < Self :: Context > ,
290+ ) -> Result < HttpResponseOk < latest:: retention:: RetentionPolicy > , HttpError > ;
291+
292+ /// Return the resource usage of database tables.
293+ #[ endpoint {
294+ method = GET ,
295+ path = "/usage/database" ,
296+ versions = VERSION_ADD_RETENTION_POLICY_AND_TABLE_USAGE ..,
297+ } ]
298+ async fn database_usage (
299+ rqctx : RequestContext < Self :: Context > ,
300+ ) -> Result < HttpResponseOk < latest:: usage:: DatabaseUsageResult > , HttpError > ;
238301}
0 commit comments