pub enum GcpCredentials {
AccessToken {
token: String,
},
ImpersonatedServiceAccount {
config: GcpImpersonationConfig,
source: Map<String, Value>,
},
ServiceAccountKey {
json: String,
},
ServiceMetadata,
ProjectedServiceAccount {
service_account_email: String,
token_file: String,
},
ExternalAccount {
audience: String,
credential_source_file: String,
service_account_impersonation_url: Option<String>,
subject_token_type: String,
token_url: String,
},
AuthorizedUser {
client_id: String,
client_secret: String,
refresh_token: String,
},
}Expand description
Authentication options for talking to GCP APIs.
JSON schema
{
"description": "Authentication options for talking to GCP APIs.",
"oneOf": [
{
"description": "Use an already-minted OAuth2 access token.",
"type": "object",
"required": [
"token",
"type"
],
"properties": {
"token": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"accessToken"
]
}
}
},
{
"description": "Use a refreshable service account impersonation source.",
"type": "object",
"required": [
"config",
"source",
"type"
],
"properties": {
"config": {
"$ref": "#/components/schemas/GcpImpersonationConfig"
},
"source": {
"description": "Source configuration used to call IAMCredentials.",
"type": "object"
},
"type": {
"type": "string",
"enum": [
"impersonatedServiceAccount"
]
}
}
},
{
"description": "Use a full Service Account JSON key (as string). A short-lived JWT will\nbe created and exchanged for a bearer token automatically.",
"type": "object",
"required": [
"json",
"type"
],
"properties": {
"json": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"serviceAccountKey"
]
}
}
},
{
"description": "Use GCP metadata server for authentication (for instances running on GCP)",
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"enum": [
"serviceMetadata"
]
}
}
},
{
"description": "Use projected service account token (for Kubernetes workload identity)",
"type": "object",
"required": [
"service_account_email",
"token_file",
"type"
],
"properties": {
"service_account_email": {
"description": "Service account email",
"type": "string"
},
"token_file": {
"description": "Path to the projected service account token",
"type": "string"
},
"type": {
"type": "string",
"enum": [
"projectedServiceAccount"
]
}
}
},
{
"description": "Use an external account credential configuration.",
"type": "object",
"required": [
"audience",
"credential_source_file",
"subject_token_type",
"token_url",
"type"
],
"properties": {
"audience": {
"description": "Workload identity audience.",
"type": "string"
},
"credential_source_file": {
"description": "Path to the subject token file.",
"type": "string"
},
"service_account_impersonation_url": {
"description": "Optional service account impersonation URL.",
"type": [
"string",
"null"
]
},
"subject_token_type": {
"description": "Subject token type for STS token exchange.",
"type": "string"
},
"token_url": {
"description": "STS token exchange URL.",
"type": "string"
},
"type": {
"type": "string",
"enum": [
"externalAccount"
]
}
}
},
{
"description": "Use gcloud Application Default Credentials (authorized_user).\nExchanges refresh_token for an access_token via Google's OAuth2 endpoint.",
"type": "object",
"required": [
"client_id",
"client_secret",
"refresh_token",
"type"
],
"properties": {
"client_id": {
"description": "OAuth2 client ID",
"type": "string"
},
"client_secret": {
"description": "OAuth2 client secret",
"type": "string"
},
"refresh_token": {
"description": "OAuth2 refresh token",
"type": "string"
},
"type": {
"type": "string",
"enum": [
"authorizedUser"
]
}
}
}
]
}Variants§
AccessToken
Use an already-minted OAuth2 access token.
ImpersonatedServiceAccount
Use a refreshable service account impersonation source.
Fields
§
config: GcpImpersonationConfigServiceAccountKey
Use a full Service Account JSON key (as string). A short-lived JWT will be created and exchanged for a bearer token automatically.
ServiceMetadata
ProjectedServiceAccount
Use projected service account token (for Kubernetes workload identity)
Fields
ExternalAccount
Use an external account credential configuration.
Fields
AuthorizedUser
Use gcloud Application Default Credentials (authorized_user). Exchanges refresh_token for an access_token via Google’s OAuth2 endpoint.
Trait Implementations§
Source§impl Clone for GcpCredentials
impl Clone for GcpCredentials
Source§fn clone(&self) -> GcpCredentials
fn clone(&self) -> GcpCredentials
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GcpCredentials
impl Debug for GcpCredentials
Source§impl<'de> Deserialize<'de> for GcpCredentials
impl<'de> Deserialize<'de> for GcpCredentials
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<&GcpCredentials> for GcpCredentials
impl From<&GcpCredentials> for GcpCredentials
Source§fn from(value: &GcpCredentials) -> Self
fn from(value: &GcpCredentials) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for GcpCredentials
impl RefUnwindSafe for GcpCredentials
impl Send for GcpCredentials
impl Sync for GcpCredentials
impl Unpin for GcpCredentials
impl UnsafeUnpin for GcpCredentials
impl UnwindSafe for GcpCredentials
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