@@ -34,6 +34,7 @@ impl<T: CliConfig> Cli<T> {
34
34
CliCommand :: CreateGroup => Self :: cli_create_group ( ) ,
35
35
CliCommand :: UpdateGroup => Self :: cli_update_group ( ) ,
36
36
CliCommand :: DeleteGroup => Self :: cli_delete_group ( ) ,
37
+ CliCommand :: ListJobs => Self :: cli_list_jobs ( ) ,
37
38
CliCommand :: MagicLinkExchange => Self :: cli_magic_link_exchange ( ) ,
38
39
CliCommand :: MagicLinkSend => Self :: cli_magic_link_send ( ) ,
39
40
CliCommand :: AuthzCodeRedirect => Self :: cli_authz_code_redirect ( ) ,
@@ -274,7 +275,9 @@ impl<T: CliConfig> Cli<T> {
274
275
. arg (
275
276
:: clap:: Arg :: new ( "expires-at" )
276
277
. long ( "expires-at" )
277
- . value_parser ( :: clap:: value_parser!( chrono:: DateTime <chrono:: offset:: Utc >) )
278
+ . value_parser ( :: clap:: value_parser!(
279
+ :: chrono:: DateTime <:: chrono:: offset:: Utc >
280
+ ) )
278
281
. required_unless_present ( "json-body" ) ,
279
282
)
280
283
. arg (
@@ -460,6 +463,17 @@ impl<T: CliConfig> Cli<T> {
460
463
. about ( "Delete a group" )
461
464
}
462
465
466
+ pub fn cli_list_jobs ( ) -> :: clap:: Command {
467
+ :: clap:: Command :: new ( "" )
468
+ . arg (
469
+ :: clap:: Arg :: new ( "rfd" )
470
+ . long ( "rfd" )
471
+ . value_parser ( :: clap:: value_parser!( :: std:: string:: String ) )
472
+ . required ( true ) ,
473
+ )
474
+ . about ( "List all jobs for a RFD" )
475
+ }
476
+
463
477
pub fn cli_magic_link_exchange ( ) -> :: clap:: Command {
464
478
:: clap:: Command :: new ( "" )
465
479
. arg (
@@ -746,7 +760,9 @@ impl<T: CliConfig> Cli<T> {
746
760
. arg (
747
761
:: clap:: Arg :: new ( "expires-at" )
748
762
. long ( "expires-at" )
749
- . value_parser ( :: clap:: value_parser!( chrono:: DateTime <chrono:: offset:: Utc >) )
763
+ . value_parser ( :: clap:: value_parser!(
764
+ :: chrono:: DateTime <:: chrono:: offset:: Utc >
765
+ ) )
750
766
. required ( false ) ,
751
767
)
752
768
. arg (
@@ -1520,6 +1536,7 @@ impl<T: CliConfig> Cli<T> {
1520
1536
CliCommand :: CreateGroup => self . execute_create_group ( matches) . await ,
1521
1537
CliCommand :: UpdateGroup => self . execute_update_group ( matches) . await ,
1522
1538
CliCommand :: DeleteGroup => self . execute_delete_group ( matches) . await ,
1539
+ CliCommand :: ListJobs => self . execute_list_jobs ( matches) . await ,
1523
1540
CliCommand :: MagicLinkExchange => self . execute_magic_link_exchange ( matches) . await ,
1524
1541
CliCommand :: MagicLinkSend => self . execute_magic_link_send ( matches) . await ,
1525
1542
CliCommand :: AuthzCodeRedirect => self . execute_authz_code_redirect ( matches) . await ,
@@ -1856,7 +1873,8 @@ impl<T: CliConfig> Cli<T> {
1856
1873
matches : & :: clap:: ArgMatches ,
1857
1874
) -> anyhow:: Result < ( ) > {
1858
1875
let mut request = self . client . create_api_user_token ( ) ;
1859
- if let Some ( value) = matches. get_one :: < chrono:: DateTime < chrono:: offset:: Utc > > ( "expires-at" )
1876
+ if let Some ( value) =
1877
+ matches. get_one :: < :: chrono:: DateTime < :: chrono:: offset:: Utc > > ( "expires-at" )
1860
1878
{
1861
1879
request = request. body_map ( |body| body. expires_at ( value. clone ( ) ) )
1862
1880
}
@@ -2101,6 +2119,26 @@ impl<T: CliConfig> Cli<T> {
2101
2119
}
2102
2120
}
2103
2121
2122
+ pub async fn execute_list_jobs ( & self , matches : & :: clap:: ArgMatches ) -> anyhow:: Result < ( ) > {
2123
+ let mut request = self . client . list_jobs ( ) ;
2124
+ if let Some ( value) = matches. get_one :: < :: std:: string:: String > ( "rfd" ) {
2125
+ request = request. rfd ( value. clone ( ) ) ;
2126
+ }
2127
+
2128
+ self . config . execute_list_jobs ( matches, & mut request) ?;
2129
+ let result = request. send ( ) . await ;
2130
+ match result {
2131
+ Ok ( r) => {
2132
+ self . config . success_item ( & r) ;
2133
+ Ok ( ( ) )
2134
+ }
2135
+ Err ( r) => {
2136
+ self . config . error ( & r) ;
2137
+ Err ( anyhow:: Error :: new ( r) )
2138
+ }
2139
+ }
2140
+ }
2141
+
2104
2142
pub async fn execute_magic_link_exchange (
2105
2143
& self ,
2106
2144
matches : & :: clap:: ArgMatches ,
@@ -2364,7 +2402,8 @@ impl<T: CliConfig> Cli<T> {
2364
2402
request = request. body_map ( |body| body. device_code ( value. clone ( ) ) )
2365
2403
}
2366
2404
2367
- if let Some ( value) = matches. get_one :: < chrono:: DateTime < chrono:: offset:: Utc > > ( "expires-at" )
2405
+ if let Some ( value) =
2406
+ matches. get_one :: < :: chrono:: DateTime < :: chrono:: offset:: Utc > > ( "expires-at" )
2368
2407
{
2369
2408
request = request. body_map ( |body| body. expires_at ( value. clone ( ) ) )
2370
2409
}
@@ -3540,6 +3579,14 @@ pub trait CliConfig {
3540
3579
Ok ( ( ) )
3541
3580
}
3542
3581
3582
+ fn execute_list_jobs (
3583
+ & self ,
3584
+ matches : & :: clap:: ArgMatches ,
3585
+ request : & mut builder:: ListJobs ,
3586
+ ) -> anyhow:: Result < ( ) > {
3587
+ Ok ( ( ) )
3588
+ }
3589
+
3543
3590
fn execute_magic_link_exchange (
3544
3591
& self ,
3545
3592
matches : & :: clap:: ArgMatches ,
@@ -3914,6 +3961,7 @@ pub enum CliCommand {
3914
3961
CreateGroup ,
3915
3962
UpdateGroup ,
3916
3963
DeleteGroup ,
3964
+ ListJobs ,
3917
3965
MagicLinkExchange ,
3918
3966
MagicLinkSend ,
3919
3967
AuthzCodeRedirect ,
@@ -3982,6 +4030,7 @@ impl CliCommand {
3982
4030
CliCommand :: CreateGroup ,
3983
4031
CliCommand :: UpdateGroup ,
3984
4032
CliCommand :: DeleteGroup ,
4033
+ CliCommand :: ListJobs ,
3985
4034
CliCommand :: MagicLinkExchange ,
3986
4035
CliCommand :: MagicLinkSend ,
3987
4036
CliCommand :: AuthzCodeRedirect ,
0 commit comments