File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed
Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ edition = "2018"
1313documentation = " https://docs.rs/crate/parsec-client"
1414
1515[dependencies ]
16- parsec-interface = { git = " https://github.com/parallaxsecond/parsec-interface-rs" , rev = " c8a59544fac04df347f51d19323f4a0b5bb9580d " }
16+ parsec-interface = { git = " https://github.com/parallaxsecond/parsec-interface-rs" , rev = " 0a20255e5cb73d3c4499a73d147d7c4a2b45ac5f " }
1717num = " 0.3.0"
1818log = " 0.4.11"
1919derivative = " 2.1.1"
Original file line number Diff line number Diff line change @@ -377,6 +377,18 @@ impl BasicClient {
377377 }
378378 }
379379
380+ /// Get the key attributes.
381+ ///
382+ /// This is a convenience method that uses `list_keys` underneath.
383+ pub fn key_attributes ( & self , key_name : & str ) -> Result < Attributes > {
384+ Ok ( self
385+ . list_keys ( ) ?
386+ . into_iter ( )
387+ . find ( |key_info| key_info. name == key_name)
388+ . ok_or ( crate :: error:: Error :: Client ( ClientErrorKind :: NotFound ) ) ?
389+ . attributes )
390+ }
391+
380392 /// **[Core Operation, Admin Operation]** Lists all clients currently having
381393 /// data in the service.
382394 pub fn list_clients ( & self ) -> Result < Vec < String > > {
Original file line number Diff line number Diff line change @@ -42,6 +42,8 @@ pub enum ClientErrorKind {
4242 NoAuthenticator ,
4343 /// Required parameter was not provided
4444 MissingParam ,
45+ /// The requested resource was not found.
46+ NotFound ,
4547}
4648
4749impl From < ClientErrorKind > for Error {
@@ -65,6 +67,7 @@ impl fmt::Display for ClientErrorKind {
6567 ClientErrorKind :: NoProvider => write ! ( f, "client is missing an implicit provider" ) ,
6668 ClientErrorKind :: NoAuthenticator => write ! ( f, "service is not reporting any authenticators or none of the reported ones are supported by the client" ) ,
6769 ClientErrorKind :: MissingParam => write ! ( f, "one of the `Option` parameters was required but was not provided" ) ,
70+ ClientErrorKind :: NotFound => write ! ( f, "one of the resources required in the operation was not found" )
6871 }
6972 }
7073}
You can’t perform that action at this time.
0 commit comments