Struct ubiq::credentials::Credentials
source · pub struct Credentials { /* private fields */ }Expand description
The aggregation of the individual credential components
Implementations§
source§impl Credentials
impl Credentials
sourcepub fn new(
opt_path: Option<String>,
opt_prof: Option<String>
) -> Result<Credentials>
pub fn new( opt_path: Option<String>, opt_prof: Option<String> ) -> Result<Credentials>
Create a Credentials object from a file, the environment, or a combination of the two.
opt_pathis a path to the credentials file and may beNone, in which case, the file at the “default” location will be used.opt_profis the name of the profile to be loaded from the file and may beNone, in which case, the “default” profile will be used.
If the path is not specified, the file at the default location will
be loaded, and variables in the environment (if present) will take
precedence. If the path is specified, the variables from the file
will take precedence, except for the HOST variable. The UBIQ_HOST
variable in the environment always takes precedence.
If the host was not specified at all, a suitable default will be provided. Upon successful return, all credential components will be present.
sourcepub fn create(
papi: String,
sapi: String,
srsa: String,
opt_host: Option<String>
) -> Credentials
pub fn create( papi: String, sapi: String, srsa: String, opt_host: Option<String> ) -> Credentials
Create credentials from manually-specified components
papicorresponds to theACCESS_KEY_IDsapicorresponds to theSECRET_SIGNING_KEYsrsacorresponds to theSECRET_CRYPTO_ACCES_KEYopt_hostis the host name of the API server and may beNone. As before, the host may or may not contain the HTTP scheme.
The function populates the components of the credentials as specified except for the host which will have the scheme added if it is missing. As such, the function always succeeds.