[][src]Struct aiven_rs::user::UserApi

pub struct UserApi { /* fields omitted */ }

Methods

impl UserApi[src]

pub async fn authenticate<'_, '_, T: Serialize + ?Sized>(
    &'_ self,
    json_body: &'_ T
) -> Result<UserAuth, AivenError>
[src]

Authenticate user and return token for following authorizations

Examples

Basic usage:

use std::collections::HashMap;
#[tokio::main]
async fn main()-> Result<(), Box<dyn std::error::Error>>{
let client = aiven_rs::AivenClient::new("https://api.aiven.io", "v1");
let mut json_body: HashMap<&str, String> = HashMap::new();
json_body.insert("email", "some-user-email".to_owned());
json_body.insert("password", "my_pass".to_owned());
// Optionally if 2FA is enabled
// json_body.insert("otp", o.into());
let output = client.user().authenticate(&json_body).await?;
Ok(())
}

pub async fn password_change<'_, '_, T: Serialize + ?Sized>(
    &'_ self,
    json_body: &'_ T
) -> Result<ResUserPasswordChange, AivenError>
[src]

Sets a new password for the user. Immediately expires all existing authentication tokens.

Examples

Basic usage:

use std::collections::HashMap;
#[tokio::main]
async fn main()-> Result<(), Box<dyn std::error::Error>>{
let client = aiven_rs::AivenClient::new("https://api.aiven.io", "v1");
let mut json_body: HashMap<&str, String> = HashMap::new();
json_body.insert("new_password", "newpassword".to_owned());
json_body.insert("password", "current_password".to_owned());
let output = client.user().password_change(&json_body).await?;
Ok(())
}

pub async fn complete_otp_config<'_, '_, T: Serialize + ?Sized>(
    &'_ self,
    json_body: &'_ T
) -> Result<ResCompleteOTPConfig, AivenError>
[src]

Complete one-time password configuration.

https://api.aiven.io/doc/#api-User-TwoFactorAuthConfigureOTP

Examples

Basic usage:

use std::collections::HashMap;
#[tokio::main]
async fn main()-> Result<(), Box<dyn std::error::Error>>{
let client = aiven_rs::AivenClient::new("https://api.aiven.io", "v1");
let mut json_body: HashMap<&str, String> = HashMap::new();
json_body.insert("otp", "987654".into());
json_body.insert("password", "abc123".into());
json_body.insert("uri", "otpauth://.....".into());
let output = client.user().complete_otp_config(&json_body).await?;
Ok(())
}

pub async fn configure_2fa<'_, '_, T: Serialize + ?Sized>(
    &'_ self,
    json_body: &'_ T
) -> Result<ResConfigure2fa, AivenError>
[src]

Configure two-factor authentication.

https://api.aiven.io/doc/#api-User-TwoFactorAuthConfigure.

Examples

Basic usage:

use std::collections::HashMap;
#[tokio::main]
async fn main()-> Result<(), Box<dyn std::error::Error>>{
let client = aiven_rs::AivenClient::new("https://api.aiven.io", "v1");
let mut json_body: HashMap<&str, String> = HashMap::new();
json_body.insert("method", "otp".into());
json_body.insert("otp", "987654".into());
let output = client.user().configure_2fa(&json_body).await?;
Ok(())
}

pub async fn confirm_email_address<'_, '_>(
    &'_ self,
    verification_code: &'_ str
) -> Result<ResConfirmUseremailAddress, AivenError>
[src]

Configure two-factor authentication.

https://api.aiven.io/doc/#api-User-TwoFactorAuthConfigure.

Examples

Basic usage:

use std::collections::HashMap;
#[tokio::main]
async fn main()-> Result<(), Box<dyn std::error::Error>>{
let client = aiven_rs::AivenClient::new("https://api.aiven.io", "v1");
let output = client.user().confirm_email_address("some-verification-code").await?;
Ok(())
}

pub async fn confirm_password_reset<'_, '_, '_>(
    &'_ self,
    new_password: &'_ str,
    verification_code: &'_ str
) -> Result<(), AivenError>
[src]

Confirm user password reset.

https://api.aiven.io/doc/#api-User-UserPasswordReset

Examples

Basic usage:

use std::collections::HashMap;
#[tokio::main]
async fn main()-> Result<(), Box<dyn std::error::Error>>{
let client = aiven_rs::AivenClient::new("https://api.aiven.io", "v1");
let output = client.user()
.confirm_password_reset("newpass","verificationcode")
.await?;
Ok(())
}

pub async fn create<'_, '_>(
    &'_ self,
    user_config: &'_ UserCreateConfig
) -> Result<ResUserCreate, AivenError>
[src]

Create a user

https://api.aiven.io/doc/#api-User-UserCreate

Examples

Basic usage:

use std::collections::HashMap;
use aiven_rs::user::types::UserCreateConfig;
#[tokio::main]
async fn main()-> Result<(), Box<dyn std::error::Error>>{
let client = aiven_rs::AivenClient::new("https://api.aiven.io", "v1");
let user_config = UserCreateConfig::default();
let output = client.user().create(&user_config).await?;
Ok(())
}

pub async fn create_access_token<'_, '_, T: Serialize + ?Sized>(
    &'_ self,
    json_body: &'_ T
) -> Result<AccessToken, AivenError>
[src]

Create new access token

https://api.aiven.io/doc/#api-User-AccessTokenCreate

Examples

Basic usage:

use std::collections::HashMap;
#[tokio::main]
async fn main()-> Result<(), Box<dyn std::error::Error>>{
let client = aiven_rs::AivenClient::new("https://api.aiven.io", "v1");
let mut json_body: HashMap<&str, String> = HashMap::new();
json_body.insert("description", "Integration client Alpha".into());
json_body.insert("extend_when_used", "true".into());
json_body.insert("max_age_seconds", "86400".into());
let output = client.user().create_access_token(&json_body).await?;
Ok(())
}

pub async fn delete_auth_method<'_, '_>(
    &'_ self,
    auth_method: &'_ str
) -> Result<(), AivenError>
[src]

Delete linked authentication method, and revoke all associated access tokens

https://api.aiven.io/doc/#api-User-UserAuthenticationMethodDelete

Examples

Basic usage:

use std::collections::HashMap;
#[tokio::main]
async fn main()-> Result<(), Box<dyn std::error::Error>>{
let client = aiven_rs::AivenClient::new("https://api.aiven.io", "v1");
let user_authentication_method_id = "somemethod-id";
let output = client.user().delete_auth_method(user_authentication_method_id).await?;
Ok(())
}

pub async fn expire_auth_tokens<'_>(&'_ self) -> Result<(), AivenError>[src]

Expire all authorization tokens.

https://api.aiven.io/doc/#api-User-UserExpireTokens

Examples

Basic usage:

use std::collections::HashMap;
#[tokio::main]
async fn main()-> Result<(), Box<dyn std::error::Error>>{
let client = aiven_rs::AivenClient::new("https://api.aiven.io", "v1");
let output = client.user().expire_auth_tokens().await?;
Ok(())
}

pub async fn info<'_>(&'_ self) -> Result<UserInfo, AivenError>[src]

Get information for the current session's user

Examples

Basic usage:

// Your example here

pub async fn auth_login_options<'_, '_, '_>(
    &'_ self,
    json_body: &'_ HashMap<&'_ str, String>
) -> Result<Vec<UserAuthLoginOptions>, AivenError>
[src]

Get available login options

Examples

Basic usage:

// Your example here

pub async fn list_access_tokens<'_>(
    &'_ self
) -> Result<AccessTokens, AivenError>
[src]

List all valid access tokens

https://api.aiven.io/doc/#api-User-AccessTokenList

Examples

Basic usage:

use std::collections::HashMap;
#[tokio::main]
async fn main()-> Result<(), Box<dyn std::error::Error>>{
let client = aiven_rs::AivenClient::new("https://api.aiven.io", "v1");
let output = client.user().list_access_tokens()
        .await
        .unwrap();
Ok(())
}

pub async fn list_linked_auth_methods<'_>(
    &'_ self
) -> Result<AuthenticationMethods, AivenError>
[src]

List linked authentication methods

https://api.aiven.io/doc/#api-User-UserAuthenticationMethodsList

Examples

Basic usage:

#[tokio::main]
async fn main()-> Result<(), Box<dyn std::error::Error>>{
let client = aiven_rs::AivenClient::new("https://api.aiven.io", "v1");
let response = client
        .user()
        .list_linked_auth_methods()
        .await
        .unwrap();
Ok(())
}

pub async fn logout<'_>(&'_ self) -> Result<(), AivenError>[src]

Logout user, removing current authentication token.

https://api.aiven.io/doc/#api-User-UserLogout

Examples

Basic usage:

#[tokio::main]
async fn main()-> Result<(), Box<dyn std::error::Error>>{
let client = aiven_rs::AivenClient::new("https://api.aiven.io", "v1");
let response = client
        .user()
        .logout()
        .await
        .unwrap();
Ok(())
}

pub async fn password_reset<'_, '_>(
    &'_ self,
    email: &'_ str
) -> Result<(), AivenError>
[src]

Request user password reset.

https://api.aiven.io/doc/#api-User-UserPasswordResetRequest

Examples

Basic usage:

#[tokio::main]
async fn main()-> Result<(), Box<dyn std::error::Error>>{
let client = aiven_rs::AivenClient::new("https://api.aiven.io", "v1");
let response = client
        .user()
        .password_reset("myemail.com")
        .await
        .unwrap();
Ok(())
}

pub async fn revoke_access_token<'_, '_>(
    &'_ self,
    token_prefix: &'_ str
) -> Result<(), AivenError>
[src]

Revoke an access token

Examples

Basic usage:

// Your example here

pub async fn update_access_token<'_, '_, '_>(
    &'_ self,
    token_prefix: &'_ str,
    description: &'_ str
) -> Result<AccessToken, AivenError>
[src]

Update an existing access token.

https://api.aiven.io/doc/#api-User-AccessTokenUpdate

Examples

Basic usage:

#[tokio::main]
async fn main()-> Result<(), Box<dyn std::error::Error>>{
let client = aiven_rs::AivenClient::new("https://api.aiven.io", "v1");
let response = client
        .user()
        .update_access_token("token-prefix", "some-description")
        .await
        .unwrap();
Ok(())
}

Auto Trait Implementations

impl !RefUnwindSafe for UserApi

impl Send for UserApi

impl Sync for UserApi

impl Unpin for UserApi

impl !UnwindSafe for UserApi

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,