File tree Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -119,4 +119,5 @@ pub enum Command {
119119 } ,
120120
121121 DowngradeProTrials ,
122+ FixRetentionPolicies ,
122123}
Original file line number Diff line number Diff line change @@ -166,7 +166,6 @@ impl Client {
166166 pub async fn get_expired_protrials ( & self ) -> Result < Vec < String > > {
167167 self . inner . get_json ( "/admin/users/protrial-downgrade" ) . await
168168 }
169-
170169 pub async fn downgrade_protrial ( & self , user_id : & str ) -> Result < String > {
171170 self . inner
172171 . put_json (
@@ -175,4 +174,16 @@ impl Client {
175174 )
176175 . await
177176 }
177+
178+ pub async fn get_projects_for_retention_policy ( & self ) -> Result < Vec < String > > {
179+ self . inner . get_json ( "/admin/log-retention" ) . await
180+ }
181+ pub async fn fix_retention_policy ( & self , project_id : & str ) -> Result < String > {
182+ self . inner
183+ . put_json (
184+ format ! ( "/admin/log-retention/{project_id}" ) ,
185+ Option :: < ( ) > :: None ,
186+ )
187+ . await
188+ }
178189}
Original file line number Diff line number Diff line change @@ -164,6 +164,16 @@ pub async fn run(args: Args) {
164164 tokio:: time:: sleep ( tokio:: time:: Duration :: from_millis ( 1000 ) ) . await ;
165165 }
166166 }
167+ Command :: FixRetentionPolicies => {
168+ let projects = client. get_projects_for_retention_policy ( ) . await . unwrap ( ) ;
169+ eprintln ! ( "Starting fix of {} log retention policies" , projects. len( ) ) ;
170+ for pid in projects {
171+ println ! ( "{pid}" ) ;
172+ println ! ( " {:?}" , client. fix_retention_policy( & pid) . await ) ;
173+ // prevent api rate limiting
174+ tokio:: time:: sleep ( tokio:: time:: Duration :: from_millis ( 1000 ) ) . await ;
175+ }
176+ }
167177 } ;
168178}
169179
You can’t perform that action at this time.
0 commit comments