pub struct AuthCredential {
pub auth_type: Value,
pub resource_ref: Option<String>,
pub api_key: Option<String>,
pub http: Option<Value>,
pub service_account: Option<Value>,
pub oauth2: Option<Value>,
}Expand description
Data class representing an authentication credential. To exchange for the actual credential, please use CredentialExchanger.exchangeCredential(). @example // API Key Auth const authCredential: AuthCredential = { authType: AuthCredentialTypes.API_KEY, apiKey: “your_api_key”, }; @example // HTTP Auth const authCredential: AuthCredential = { authType: AuthCredentialTypes.HTTP, http: { scheme: “basic”, credentials: { username: “user”, password: “password”, }, } } @example // OAuth2 Bearer Token in HTTP Header const authCredential: AuthCredential = { authType: AuthCredentialTypes.HTTP, http: { scheme: “bearer”, credentials: { token: “your_access_token”, }, } } @example // OAuth2 Auth with Authorization Code Flow const authCredential: AuthCredential = { authType: AuthCredentialTypes.OAUTH2, oauth2: { clientId: “your_client_id”, clientSecret: “your_client_secret”, } } @example: // Open ID Connect Auth const authCredential: AuthCredential = { authType: AuthCredentialTypes.OPEN_ID_CONNECT, oauth2: { clientId: “1234”, clientSecret: “secret”, redirectUri: “https://example.com”, scopes: [“scope1”, “scope2”], } } @example: // Auth with resource reference const authCredential: AuthCredential = { authType: AuthCredentialTypes.API_KEY, resourceRef: “projects/1234/locations/us-central1/resources/resource1” }
Fields§
§auth_type: Value§resource_ref: Option<String>Resource reference for the credential. This will be supported in the future.
api_key: Option<String>§http: Option<Value>§service_account: Option<Value>§oauth2: Option<Value>Trait Implementations§
Source§impl Clone for AuthCredential
impl Clone for AuthCredential
Source§fn clone(&self) -> AuthCredential
fn clone(&self) -> AuthCredential
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more