mirror of
https://github.com/openai/codex.git
synced 2026-11-28 07:32:19 +00:00
## What changed - Implement `account/bedrock/discover` to report AWS profiles and available environment credentials. - Implement `account/bedrock/setup` for validated AWS profiles and environment credentials, persisting the selected region and profile in the Bedrock provider configuration. - Resolve Bedrock authentication according to the selected credential source, and clear stale profile configuration when using a Codex-managed Bedrock API key. ## Testing - Cover profile and environment discovery, setup validation and persistence, conflicting credentials, and authentication-source precedence. GitOrigin-RevId: 16d700cb0843df768c2fdb6d0c8d26c3402e93df
72 lines
2.2 KiB
Rust
72 lines
2.2 KiB
Rust
use crate::JsonSchema;
|
|
use crate::TS;
|
|
use serde::Deserialize;
|
|
use serde::Serialize;
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct BedrockDiscoverParams {}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct BedrockDiscoverResponse {
|
|
pub profiles: Vec<BedrockAwsProfile>,
|
|
pub environment_credentials: Vec<BedrockEnvironmentCredential>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct BedrockAwsProfile {
|
|
pub name: String,
|
|
pub region: Option<String>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct BedrockEnvironmentCredential {
|
|
#[serde(rename = "type")]
|
|
#[ts(rename = "type")]
|
|
pub credential_type: AwsCredentialType,
|
|
pub region: Option<String>,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub enum AwsCredentialType {
|
|
AccessKeys,
|
|
BedrockApiKey,
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(tag = "type", rename_all = "camelCase")]
|
|
#[ts(tag = "type", rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub enum BedrockSetupParams {
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(rename_all = "camelCase")]
|
|
Profile { profile: String, region: String },
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(rename_all = "camelCase")]
|
|
Environment { region: String },
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(rename_all = "camelCase")]
|
|
AccessKeys {
|
|
access_key_id: String,
|
|
secret_access_key: String,
|
|
#[ts(optional = nullable)]
|
|
session_token: Option<String>,
|
|
region: String,
|
|
},
|
|
}
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, Eq, JsonSchema, TS)]
|
|
#[serde(rename_all = "camelCase")]
|
|
#[ts(export_to = "v2/")]
|
|
pub struct BedrockSetupResponse {}
|