@ -122,49 +122,29 @@ pub enum Args {
/// See `lunanode sshkey help`
SshKey ( SshKeySubArgs ) ,
}
/// Specifies an internal function which can only be called on LunaNodeRequests whoes response type implements Debug. This could be set in the structure itself, and probably should be.
fn print_req < T : LunaNodeRequest > ( req : & T ) -> Result < ( ) , LNError >
where
< T as LunaNodeRequest > ::Response : std ::fmt ::Debug
{
let ans = req . make_request ( ) ? ;
println! ( "{:#?}" , ans ) ;
Ok ( ( ) )
}
impl Args {
pub fn make_request ( & self ) -> Result < ( ) , LNError > {
match self {
Self ::SshKey ( SshKeySubArgs ::List ( ssk_list ) ) = > {
let list = ssk_list . make_request ( ) ? ;
println! ( "{:#?}" , list ) ;
} ,
Self ::Record ( RecordSubArgs ::List ( rec_list ) ) = > {
let list = rec_list . make_request ( ) ? ;
println! ( "{:#?}" , list ) ;
} ,
Self ::Network ( NetworkSubArgs ::List ( net_list ) ) = > {
let list = net_list . make_request ( ) ? ;
println! ( "{:#?}" , list ) ;
} ,
Self ::Floating ( FloatingSubArgs ::List ( ip_list ) ) = > {
let list = ip_list . make_request ( ) ? ;
println! ( "{:#?}" , list ) ;
} ,
Self ::Vm ( VmSubArgs ::List ( vm_list ) ) = > {
let list = vm_list . make_request ( ) ? ;
println! ( "{:#?}" , list ) ;
} ,
Self ::Volume ( VolumeSubArgs ::List ( vol_list ) ) = > {
let list = vol_list . make_request ( ) ? ;
println! ( "{:#?}" , list ) ;
} ,
Self ::Image ( ImageSubArgs ::List ( image_list ) ) = > {
let list = image_list . make_request ( ) ? ;
println! ( "{:#?}" , list ) ;
} ,
Self ::Billing ( BillingSubArgs ::Credit ( billing_credit ) ) = > {
let credit = billing_credit . make_request ( ) ? ;
println! ( "{:#?}" , credit ) ;
} ,
Self ::Zone ( ZoneSubArgs ::List ( zone_list ) ) = > {
let list = zone_list . make_request ( ) ? ;
println! ( "{:#?}" , list ) ;
} ,
Self ::Dyn ( DynSubArgs ::List ( dyn_list ) ) = > {
let list = dyn_list . make_request ( ) ? ;
println! ( "{:#?}" , list ) ;
} ,
Self ::SshKey ( SshKeySubArgs ::List ( ssk_list ) ) = > print_req ( ssk_list ) ? ,
Self ::Record ( RecordSubArgs ::List ( rec_list ) ) = > print_req ( rec_list ) ? ,
Self ::Network ( NetworkSubArgs ::List ( net_list ) ) = > print_req ( net_list ) ? ,
Self ::Floating ( FloatingSubArgs ::List ( ip_list ) ) = > print_req ( ip_list ) ? ,
Self ::Vm ( VmSubArgs ::List ( vm_list ) ) = > print_req ( vm_list ) ? ,
Self ::Volume ( VolumeSubArgs ::List ( vol_list ) ) = > print_req ( vol_list ) ? ,
Self ::Image ( ImageSubArgs ::List ( image_list ) ) = > print_req ( image_list ) ? ,
Self ::Billing ( BillingSubArgs ::Credit ( billing_credit ) ) = > print_req ( billing_credit ) ? ,
Self ::Zone ( ZoneSubArgs ::List ( zone_list ) ) = > print_req ( zone_list ) ? ,
Self ::Dyn ( DynSubArgs ::List ( dyn_list ) ) = > print_req ( dyn_list ) ? ,
}
Ok ( ( ) )
}