1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
// This file is @generated by prost-build.
/// Message used by AlloyDB connectors to exchange client and connection metadata
/// with the server after a successful TLS handshake. This metadata includes an
/// IAM token, which is used to authenticate users based on their IAM identity.
/// The sole purpose of this message is for the use of AlloyDB connectors.
/// Clients should not rely on this message directly as there can be breaking
/// changes in the future.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MetadataExchangeRequest {
/// Optional. Connector information.
#[prost(string, tag = "1")]
pub user_agent: ::prost::alloc::string::String,
/// Authentication type.
#[prost(enumeration = "metadata_exchange_request::AuthType", tag = "2")]
pub auth_type: i32,
/// IAM token used for both IAM user authentiation and
/// `alloydb.instances.connect` permission check.
#[prost(string, tag = "3")]
pub oauth2_token: ::prost::alloc::string::String,
}
/// Nested message and enum types in `MetadataExchangeRequest`.
pub mod metadata_exchange_request {
/// AuthType contains all supported authentication types.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum AuthType {
/// Authentication type is unspecified and DB_NATIVE is used by default
Unspecified = 0,
/// Database native authentication (user/password)
DbNative = 1,
/// Automatic IAM authentication
AutoIam = 2,
}
impl AuthType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
AuthType::Unspecified => "AUTH_TYPE_UNSPECIFIED",
AuthType::DbNative => "DB_NATIVE",
AuthType::AutoIam => "AUTO_IAM",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"AUTH_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"DB_NATIVE" => Some(Self::DbNative),
"AUTO_IAM" => Some(Self::AutoIam),
_ => None,
}
}
}
}
/// Message for response to metadata exchange request. The sole purpose of this
/// message is for the use of AlloyDB connectors. Clients should not rely on this
/// message directly as there can be breaking changes in the future.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MetadataExchangeResponse {
/// Response code.
#[prost(enumeration = "metadata_exchange_response::ResponseCode", tag = "1")]
pub response_code: i32,
/// Optional. Error message.
#[prost(string, tag = "2")]
pub error: ::prost::alloc::string::String,
}
/// Nested message and enum types in `MetadataExchangeResponse`.
pub mod metadata_exchange_response {
/// Response code.
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum ResponseCode {
/// Unknown response code
Unspecified = 0,
/// Success
Ok = 1,
/// Failure
Error = 2,
}
impl ResponseCode {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
ResponseCode::Unspecified => "RESPONSE_CODE_UNSPECIFIED",
ResponseCode::Ok => "OK",
ResponseCode::Error => "ERROR",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"RESPONSE_CODE_UNSPECIFIED" => Some(Self::Unspecified),
"OK" => Some(Self::Ok),
"ERROR" => Some(Self::Error),
_ => None,
}
}
}
}