pub struct ServiceAccountCredentials { /* private fields */ }Expand description
Get service account credentials instance service account key should be:
- in the local file and YDB_SERVICE_ACCOUNT_KEY_FILE_CREDENTIALS environment variable should point to it
- in the local file and it’s path is specified
- in the json format string
Example:
use ydb::ServiceAccountCredentials;
let cred = ServiceAccountCredentials::from_env();or
use ydb::ServiceAccountCredentials;
let json = "....";
let cred = ServiceAccountCredentials::from_json(json);or
use ydb::ServiceAccountCredentials;
let cred = ServiceAccountCredentials::new("service_account_id", "key_id", "private_key");or
use ydb::ServiceAccountCredentials;
let cred = ServiceAccountCredentials::from_file("/path/to/file");Implementations§
Source§impl ServiceAccountCredentials
impl ServiceAccountCredentials
pub fn new( service_account_id: impl Into<String>, key_id: impl Into<String>, private_key: impl Into<String>, ) -> Self
pub fn with_url(self, url: impl Into<String>) -> Self
pub fn from_env() -> YdbResult<Self>
pub fn from_file(path: impl AsRef<Path>) -> YdbResult<Self>
pub fn from_json(json_key: &str) -> YdbResult<Self>
Trait Implementations§
Source§impl Credentials for ServiceAccountCredentials
impl Credentials for ServiceAccountCredentials
fn create_token(&self) -> YdbResult<TokenInfo>
fn debug_string(&self) -> String
Auto Trait Implementations§
impl Freeze for ServiceAccountCredentials
impl RefUnwindSafe for ServiceAccountCredentials
impl Send for ServiceAccountCredentials
impl Sync for ServiceAccountCredentials
impl Unpin for ServiceAccountCredentials
impl UnwindSafe for ServiceAccountCredentials
Blanket Implementations§
Source§impl<T> Any for T
impl<T> Any for T
Source§fn type_id_compat(&self) -> TypeId
fn type_id_compat(&self) -> TypeId
TODO: once 1.33.0 is the minimum supported compiler version, remove
Any::type_id_compat and use StdAny::type_id instead.
https://github.com/rust-lang/rust/issues/27745
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request