pub struct TailscaleClient {
pub base_url: String,
pub token: String,
/* private fields */
}
Expand description
A client for interacting with Tailscale’s v2 API.
Fields§
§base_url: String
§token: String
Implementations§
Source§impl TailscaleClient
impl TailscaleClient
Sourcepub fn new(token: String) -> Self
pub fn new(token: String) -> Self
Creates a new TailscaleClient with the given token, automatically setting the base URL to https://api.tailscale.com/api/v2
Sourcepub async fn whoami(&self) -> Result<WhoAmIResponse, Box<dyn Error>>
pub async fn whoami(&self) -> Result<WhoAmIResponse, Box<dyn Error>>
Example method to call the /whoami
endpoint which returns information
about the current user and their Tailnets.
Sourcepub async fn create_auth_key(
&self,
tailnet: &str,
all: bool,
req_body: &CreateAuthKeyRequest,
) -> Result<CreateAuthKeyResponse, Box<dyn Error>>
pub async fn create_auth_key( &self, tailnet: &str, all: bool, req_body: &CreateAuthKeyRequest, ) -> Result<CreateAuthKeyResponse, Box<dyn Error>>
Creates a new auth key in the specified tailnet, returning the newly generated key.
The all
parameter is optional in the API, but here we surface it directly
to match the Tailscale docs example (e.g., ?all=true
).
Auto Trait Implementations§
impl Freeze for TailscaleClient
impl !RefUnwindSafe for TailscaleClient
impl Send for TailscaleClient
impl Sync for TailscaleClient
impl Unpin for TailscaleClient
impl !UnwindSafe for TailscaleClient
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