@@ -5,9 +5,11 @@ use super::operation_client::OperationClient;
5
5
use crate :: auth:: Authentication ;
6
6
use crate :: error:: { ClientErrorKind , Error , Result } ;
7
7
use log:: { info, warn} ;
8
+ use parsec_interface:: operations:: delete_client:: Operation as DeleteClient ;
8
9
use parsec_interface:: operations:: list_authenticators:: {
9
10
AuthenticatorInfo , Operation as ListAuthenticators ,
10
11
} ;
12
+ use parsec_interface:: operations:: list_clients:: Operation as ListClients ;
11
13
use parsec_interface:: operations:: list_keys:: { KeyInfo , Operation as ListKeys } ;
12
14
use parsec_interface:: operations:: list_opcodes:: Operation as ListOpcodes ;
13
15
use parsec_interface:: operations:: list_providers:: { Operation as ListProviders , ProviderInfo } ;
@@ -377,6 +379,39 @@ impl BasicClient {
377
379
}
378
380
}
379
381
382
+ /// **[Core Operation, Admin Operation]** Lists all clients currently having
383
+ /// data in the service.
384
+ pub fn list_clients ( & self ) -> Result < Vec < String > > {
385
+ let res = self . op_client . process_operation (
386
+ NativeOperation :: ListClients ( ListClients { } ) ,
387
+ ProviderID :: Core ,
388
+ & self . auth_data ,
389
+ ) ?;
390
+ if let NativeResult :: ListClients ( res) = res {
391
+ Ok ( res. clients )
392
+ } else {
393
+ // Should really not be reached given the checks we do, but it's not impossible if some
394
+ // changes happen in the interface
395
+ Err ( Error :: Client ( ClientErrorKind :: InvalidServiceResponseType ) )
396
+ }
397
+ }
398
+
399
+ /// **[Core Operation, Admin Operation]** Delete all data a client has in the service.
400
+ pub fn delete_client ( & self , client : String ) -> Result < ( ) > {
401
+ let res = self . op_client . process_operation (
402
+ NativeOperation :: DeleteClient ( DeleteClient { client } ) ,
403
+ ProviderID :: Core ,
404
+ & self . auth_data ,
405
+ ) ?;
406
+ if let NativeResult :: DeleteClient ( _) = res {
407
+ Ok ( ( ) )
408
+ } else {
409
+ // Should really not be reached given the checks we do, but it's not impossible if some
410
+ // changes happen in the interface
411
+ Err ( Error :: Client ( ClientErrorKind :: InvalidServiceResponseType ) )
412
+ }
413
+ }
414
+
380
415
/// **[Core Operation]** Send a ping request to the service.
381
416
///
382
417
/// This operation is intended for testing connectivity to the
0 commit comments