pub struct ClusterToken { /* private fields */ }Expand description
Local cluster auth token read from mounted file system
Token is re-used for at most 1 minute, and unless file is missing, will be reloaded every time after 1 minute If it is impossible to refresh token, then existing token will be used (actual token validity is within 10 minutes)
Implementations§
Source§impl ClusterToken
impl ClusterToken
Sourcepub fn new_token(file: Cow<'static, str>) -> Result<Self, KubeError>
pub fn new_token(file: Cow<'static, str>) -> Result<Self, KubeError>
Creates new ClusterToken by performing initial fetch of the token at file location
Returns error if unable to fetch.
After this, file is assumed to be always valid, but if re-fetch fails, it will use
existing token
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Checks if token is expired, returning true if that’s the case
Sourcepub fn refresh_if_expired(&mut self) -> bool
pub fn refresh_if_expired(&mut self) -> bool
Requests to perform token refresh if it expires
Returns true if token has been refreshed
Auto Trait Implementations§
impl Freeze for ClusterToken
impl RefUnwindSafe for ClusterToken
impl Send for ClusterToken
impl Sync for ClusterToken
impl Unpin for ClusterToken
impl UnsafeUnpin for ClusterToken
impl UnwindSafe for ClusterToken
Blanket Implementations§
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