Allow Bedrock Runtime selection during setup and login (#62222)

## Why

The app server's Bedrock setup and login flows always selected Mantle.
Clients using Bedrock Runtime had to configure that provider separately.

## What changed

Accept an optional `providerId` in `account/bedrock/setup` for AWS profiles
and environment credentials, and in `account/login/start` for Bedrock API
keys and AWS access keys. Pass `"amazon-bedrock-runtime"` to select
Runtime. Omit the field or pass `null` to keep the Mantle default.

Save configuration for the selected provider and check that provider for
an existing `aws.credential_export` before changing credential sources.

## Testing

Extend app-server tests to cover Runtime setup with profiles and
environment credentials, Runtime login with both key types, and Mantle
fallback. Verify that environment setup selects the Runtime default
model for a new thread and that a configured Runtime credential exporter
blocks profile setup.

GitOrigin-RevId: 6396b638208ab9b12f50f13f13bd517a919d0848
This commit is contained in:
alexsong-oai
2026-11-18 07:43:45 +00:00
committed by copyberry
parent bcff988bd1
commit 24e236514b
20 changed files with 267 additions and 44 deletions
@@ -2120,6 +2120,17 @@
"apiKey": {
"type": "string"
},
"providerId": {
"anyOf": [
{
"$ref": "#/definitions/BedrockProviderId"
},
{
"type": "null"
}
],
"description": "Defaults to Amazon Bedrock Mantle when omitted."
},
"region": {
"type": "string"
},
@@ -2145,6 +2156,17 @@
"accessKeyId": {
"type": "string"
},
"providerId": {
"anyOf": [
{
"$ref": "#/definitions/BedrockProviderId"
},
{
"type": "null"
}
],
"description": "Defaults to Amazon Bedrock Mantle when omitted."
},
"region": {
"type": "string"
},
@@ -15293,6 +15293,17 @@
"apiKey": {
"type": "string"
},
"providerId": {
"anyOf": [
{
"$ref": "#/definitions/v2/BedrockProviderId"
},
{
"type": "null"
}
],
"description": "Defaults to Amazon Bedrock Mantle when omitted."
},
"region": {
"type": "string"
},
@@ -15318,6 +15329,17 @@
"accessKeyId": {
"type": "string"
},
"providerId": {
"anyOf": [
{
"$ref": "#/definitions/v2/BedrockProviderId"
},
{
"type": "null"
}
],
"description": "Defaults to Amazon Bedrock Mantle when omitted."
},
"region": {
"type": "string"
},
@@ -11227,6 +11227,17 @@
"apiKey": {
"type": "string"
},
"providerId": {
"anyOf": [
{
"$ref": "#/definitions/BedrockProviderId"
},
{
"type": "null"
}
],
"description": "Defaults to Amazon Bedrock Mantle when omitted."
},
"region": {
"type": "string"
},
@@ -11252,6 +11263,17 @@
"accessKeyId": {
"type": "string"
},
"providerId": {
"anyOf": [
{
"$ref": "#/definitions/BedrockProviderId"
},
{
"type": "null"
}
],
"description": "Defaults to Amazon Bedrock Mantle when omitted."
},
"region": {
"type": "string"
},
@@ -1,6 +1,13 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"BedrockProviderId": {
"enum": [
"amazon-bedrock",
"amazon-bedrock-runtime"
],
"type": "string"
},
"LoginAppBrand": {
"enum": [
"codex",
@@ -119,6 +126,17 @@
"apiKey": {
"type": "string"
},
"providerId": {
"anyOf": [
{
"$ref": "#/definitions/BedrockProviderId"
},
{
"type": "null"
}
],
"description": "Defaults to Amazon Bedrock Mantle when omitted."
},
"region": {
"type": "string"
},
@@ -144,6 +162,17 @@
"accessKeyId": {
"type": "string"
},
"providerId": {
"anyOf": [
{
"$ref": "#/definitions/BedrockProviderId"
},
{
"type": "null"
}
],
"description": "Defaults to Amazon Bedrock Mantle when omitted."
},
"region": {
"type": "string"
},
@@ -1,6 +1,7 @@
// GENERATED CODE! DO NOT MODIFY BY HAND!
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { BedrockProviderId } from "./BedrockProviderId";
import type { LoginAppBrand } from "./LoginAppBrand";
export type LoginAccountParams = { "type": "apiKey", apiKey: string, } | { "type": "chatgpt", codexStreamlinedLogin?: boolean, useHostedLoginSuccessPage?: boolean, appBrand?: LoginAppBrand | null, } | { "type": "chatgptDeviceCode" } | { "type": "chatgptAuthTokens",
@@ -19,4 +20,12 @@ chatgptAccountId: string,
* When `null`, Codex attempts to derive the plan type from access-token
* claims. If unavailable, the plan defaults to `unknown`.
*/
chatgptPlanType?: string | null, } | { "type": "amazonBedrock", apiKey: string, region: string, } | { "type": "amazonBedrockAccessKeys", accessKeyId: string, secretAccessKey: string, sessionToken?: string | null, region: string, };
chatgptPlanType?: string | null, } | { "type": "amazonBedrock", apiKey: string, region: string,
/**
* Defaults to Amazon Bedrock Mantle when omitted.
*/
providerId?: BedrockProviderId | null, } | { "type": "amazonBedrockAccessKeys", accessKeyId: string, secretAccessKey: string, sessionToken?: string | null, region: string,
/**
* Defaults to Amazon Bedrock Mantle when omitted.
*/
providerId?: BedrockProviderId | null, };
@@ -3521,11 +3521,13 @@ mod tests {
v2::LoginAccountParams::AmazonBedrock {
api_key: "secret".to_string(),
region: "us-west-2".to_string(),
provider_id: None,
},
json!({
"type": "amazonBedrock",
"apiKey": "secret",
"region": "us-west-2"
"region": "us-west-2",
"providerId": null
}),
),
(
@@ -3534,13 +3536,15 @@ mod tests {
secret_access_key: "secret-access-key".to_string(),
session_token: Some("session-token".to_string()),
region: "us-west-2".to_string(),
provider_id: Some(v2::BedrockProviderId::AmazonBedrockRuntime),
},
json!({
"type": "amazonBedrockAccessKeys",
"accessKeyId": "access-key-id",
"secretAccessKey": "secret-access-key",
"sessionToken": "session-token",
"region": "us-west-2"
"region": "us-west-2",
"providerId": "amazon-bedrock-runtime"
}),
),
] {
@@ -1,3 +1,4 @@
use super::BedrockProviderId;
use super::ThreadUsage;
use crate::JsonSchema;
use crate::TS;
@@ -117,7 +118,13 @@ pub enum LoginAccountParams {
#[experimental("account/login/start.amazonBedrock")]
#[serde(rename = "amazonBedrock", rename_all = "camelCase")]
#[ts(rename = "amazonBedrock", rename_all = "camelCase")]
AmazonBedrock { api_key: String, region: String },
AmazonBedrock {
api_key: String,
region: String,
/// Defaults to Amazon Bedrock Mantle when omitted.
#[ts(optional = nullable)]
provider_id: Option<BedrockProviderId>,
},
/// [UNSTABLE] Managed Amazon Bedrock AWS access key login is experimental.
#[experimental("account/login/start.amazonBedrockAccessKeys")]
#[serde(rename = "amazonBedrockAccessKeys", rename_all = "camelCase")]
@@ -128,6 +135,9 @@ pub enum LoginAccountParams {
#[ts(optional = nullable)]
session_token: Option<String>,
region: String,
/// Defaults to Amazon Bedrock Mantle when omitted.
#[ts(optional = nullable)]
provider_id: Option<BedrockProviderId>,
},
}
@@ -1,3 +1,4 @@
use super::BedrockProviderId;
use crate::JsonSchema;
use crate::TS;
use serde::Deserialize;
@@ -50,10 +51,21 @@ pub enum AwsCredentialType {
pub enum BedrockSetupParams {
#[serde(rename_all = "camelCase")]
#[ts(rename_all = "camelCase")]
Profile { profile: String, region: String },
Profile {
profile: String,
region: String,
/// Defaults to Amazon Bedrock Mantle when omitted.
#[ts(optional = nullable)]
provider_id: Option<BedrockProviderId>,
},
#[serde(rename_all = "camelCase")]
#[ts(rename_all = "camelCase")]
Environment { region: String },
Environment {
region: String,
/// Defaults to Amazon Bedrock Mantle when omitted.
#[ts(optional = nullable)]
provider_id: Option<BedrockProviderId>,
},
}
#[derive(Serialize, Deserialize, Debug, Default, Clone, PartialEq, Eq, JsonSchema, TS)]
@@ -1048,6 +1048,7 @@ async fn test_login(
params: codex_app_server_protocol::LoginAccountParams::AmazonBedrock {
api_key,
region,
provider_id: None,
},
},
request_id,
+7 -5
View File
@@ -430,9 +430,11 @@ version-gate published policy bundles.
# Amazon Bedrock authentication
If `model_providers.amazon-bedrock.aws.credential_export` is configured, Bedrock setup and
Bedrock login return an error without changing configuration or saved credentials. Remove the
exporter configuration before selecting another credential source. `aws.credential_export` and
Bedrock setup and login accept an optional `providerId`: `amazon-bedrock` (Mantle) or
`amazon-bedrock-runtime`. Omission or `null` selects Mantle for compatibility. If the selected
provider has `aws.credential_export` configured, setup and login return an error without changing
configuration or saved credentials. Remove the exporter configuration before selecting another
credential source. `aws.credential_export` and
`aws.profile` cannot be configured together.
Application network restrictions apply to each AWS credential and region HTTP request and to
@@ -874,8 +876,8 @@ writes still require validation. Lower-precedence definitions can be overridden;
required definitions are read-only. Both capabilities are false when user
configuration is ignored. The flag does not establish credential validity or
whether a setup flow that also selects a default provider will succeed.
`account/bedrock/setup` targets `amazon-bedrock`; edits to `amazon-bedrock-runtime`
must use that provider's configuration paths instead.
`account/bedrock/setup` selects Mantle by default; pass `providerId: "amazon-bedrock-runtime"`
to select Runtime. Direct edits must use the selected provider's configuration paths.
Use `modelProvider/config/write` with a tagged `settings` patch. To create a
custom gateway, send `type: "customGateway"`, `name`, and `baseUrl`. Omit
@@ -8,6 +8,7 @@ use crate::external_auth::ExternalAuthBridge;
use crate::model_catalog::ModelCatalog;
use crate::outgoing_message::AccountNotification;
use chrono::DateTime;
use codex_app_server_protocol::BedrockProviderId;
use codex_app_server_protocol::DesktopOnboardingEntrypoint;
use codex_app_server_protocol::GetAccountRateLimitsParams;
use codex_core::McpRefreshReason;
@@ -408,11 +409,16 @@ impl AccountRequestProcessor {
)
.await;
}
LoginAccountParams::AmazonBedrock { api_key, region } => {
LoginAccountParams::AmazonBedrock {
api_key,
region,
provider_id,
} => {
self.login_amazon_bedrock_v2(
request_id,
BedrockLoginCredentials::ApiKey(api_key),
region,
provider_id.unwrap_or(BedrockProviderId::AmazonBedrock),
)
.await;
}
@@ -421,6 +427,7 @@ impl AccountRequestProcessor {
secret_access_key,
session_token,
region,
provider_id,
} => {
self.login_amazon_bedrock_v2(
request_id,
@@ -430,6 +437,7 @@ impl AccountRequestProcessor {
session_token,
},
region,
provider_id.unwrap_or(BedrockProviderId::AmazonBedrock),
)
.await;
}
@@ -536,6 +544,7 @@ impl AccountRequestProcessor {
request_id: ConnectionRequestId,
credentials: BedrockLoginCredentials,
region: String,
provider_id: BedrockProviderId,
) {
let result = async {
self.ensure_provider_login_allowed(CloudLoginProvider::AmazonBedrock)?;
@@ -569,6 +578,7 @@ impl AccountRequestProcessor {
let write = prepare_bedrock_provider(
&self.config_manager,
BedrockProviderConfig {
provider_id,
region: matches!(&credentials, BedrockLoginCredentials::AccessKeys { .. })
.then_some(region),
profile: None,
@@ -10,6 +10,7 @@ use codex_app_server_protocol::BedrockAwsProfile;
use codex_app_server_protocol::BedrockDiscoverParams;
use codex_app_server_protocol::BedrockDiscoverResponse;
use codex_app_server_protocol::BedrockEnvironmentCredential;
use codex_app_server_protocol::BedrockProviderId;
use codex_app_server_protocol::BedrockSetupParams;
use codex_app_server_protocol::BedrockSetupResponse;
use codex_app_server_protocol::ClientResponsePayload;
@@ -71,15 +72,21 @@ impl AccountRequestProcessor {
params: BedrockSetupParams,
) -> Result<Option<ClientResponsePayload>, JSONRPCErrorError> {
self.ensure_provider_login_allowed(CloudLoginProvider::AmazonBedrock)?;
let (profile, region) = match &params {
BedrockSetupParams::Profile { profile, region } => {
(Some(profile.trim()), region.trim())
}
BedrockSetupParams::Environment { region } => (None, region.trim()),
let (profile, region, provider_id) = match &params {
BedrockSetupParams::Profile {
profile,
region,
provider_id,
} => (Some(profile.trim()), region.trim(), *provider_id),
BedrockSetupParams::Environment {
region,
provider_id,
} => (None, region.trim(), *provider_id),
};
let write = prepare_bedrock_provider(
&self.config_manager,
BedrockProviderConfig {
provider_id: provider_id.unwrap_or(BedrockProviderId::AmazonBedrock),
region: Some(region),
profile,
},
@@ -3,6 +3,7 @@ use crate::config_manager::ConfigManager;
use crate::config_manager_service::PreparedProviderWrite;
use crate::error_code::internal_error;
use crate::error_code::invalid_request;
use codex_app_server_protocol::BedrockProviderId;
use codex_app_server_protocol::ConfigBatchWriteParams;
use codex_app_server_protocol::ConfigEdit;
use codex_app_server_protocol::ConfigWriteErrorCode;
@@ -11,8 +12,10 @@ use codex_app_server_protocol::MergeStrategy;
use codex_core::config::Config;
use codex_core::config::edit::ConfigEditsBuilder;
use codex_model_provider::AMAZON_BEDROCK_PROVIDER_ID;
use codex_model_provider::AMAZON_BEDROCK_RUNTIME_PROVIDER_ID;
pub(super) struct BedrockProviderConfig<'a> {
pub(super) provider_id: BedrockProviderId,
pub(super) region: Option<&'a str>,
pub(super) profile: Option<&'a str>,
}
@@ -29,8 +32,12 @@ pub(super) async fn prepare_bedrock_provider(
if let Some(region) = config.region {
settings.push(("aws.region", Some(region)));
}
let provider_id = match config.provider_id {
BedrockProviderId::AmazonBedrock => AMAZON_BEDROCK_PROVIDER_ID,
BedrockProviderId::AmazonBedrockRuntime => AMAZON_BEDROCK_RUNTIME_PROVIDER_ID,
};
let (write, provider) = config_manager
.prepare_provider_config(&layers, AMAZON_BEDROCK_PROVIDER_ID, settings)
.prepare_provider_config(&layers, provider_id, settings)
.map_err(map_config_error)?;
if provider
.aws
+20 -10
View File
@@ -1305,11 +1305,14 @@ async fn login_account_api_key_succeeds_and_notifies() -> Result<()> {
Ok(())
}
#[test_case("amazonBedrock"; "api_key")]
#[test_case("amazonBedrockAccessKeys"; "access_keys")]
#[test_case("amazonBedrock", "amazon-bedrock"; "legacy_api_key")]
#[test_case("amazonBedrockAccessKeys", "amazon-bedrock"; "legacy_access_keys")]
#[test_case("amazonBedrock", "amazon-bedrock-runtime"; "runtime_api_key")]
#[test_case("amazonBedrockAccessKeys", "amazon-bedrock-runtime"; "runtime_access_keys")]
#[tokio::test]
async fn login_amazon_bedrock_replaces_primary_auth_and_persists_provider(
credential_type: &str,
provider_id: &str,
) -> Result<()> {
let managed_access_keys = credential_type == "amazonBedrockAccessKeys";
let codex_home = TempDir::new()?;
@@ -1319,9 +1322,9 @@ async fn login_amazon_bedrock_replaces_primary_auth_and_persists_provider(
std::fs::write(
&config_path,
format!(
"{original_config}\n[model_providers.amazon-bedrock]\n\
"{original_config}\n[model_providers.{provider_id}]\n\
http_headers = {{ X-Existing = \"preserved\" }}\n\
[model_providers.amazon-bedrock.aws]\n\
[model_providers.{provider_id}.aws]\n\
profile = \"stale-profile\"\n\
region = \"us-east-1\"\n\
auth_refresh = {{ command = \"aws\" }}\n"
@@ -1336,7 +1339,11 @@ async fn login_amazon_bedrock_replaces_primary_auth_and_persists_provider(
let mut mcp = TestAppServer::builder()
.with_codex_home(codex_home.path())
.without_auto_env()
.with_env_overrides(&[("OPENAI_API_KEY", None)])
.with_env_overrides(&[
("OPENAI_API_KEY", None),
("OPENAI_FEDERATION_RULE_ID", None),
("OPENAI_IDENTITY_TOKEN_FILE", None),
])
.build_initialized_with_timeout(DEFAULT_READ_TIMEOUT)
.await?;
let mut expected_config = read_config_toml(codex_home.path())?;
@@ -1345,17 +1352,17 @@ async fn login_amazon_bedrock_replaces_primary_auth_and_persists_provider(
.expect("config should be a table")
.insert(
"model_provider".to_string(),
toml::Value::String("amazon-bedrock".to_string()),
toml::Value::String(provider_id.to_string()),
);
expected_config["model_providers"]["amazon-bedrock"]["aws"]
expected_config["model_providers"][provider_id]["aws"]
.as_table_mut()
.expect("AWS configuration should be a table")
.remove("profile");
if managed_access_keys {
expected_config["model_providers"]["amazon-bedrock"]["aws"]["region"] =
expected_config["model_providers"][provider_id]["aws"]["region"] =
toml::Value::String("us-west-2".to_string());
}
let params = if managed_access_keys {
let mut params = if managed_access_keys {
json!({
"type": credential_type,
"accessKeyId": " test-id ",
@@ -1370,6 +1377,9 @@ async fn login_amazon_bedrock_replaces_primary_auth_and_persists_provider(
"region": " us-west-2 ",
})
};
if provider_id == "amazon-bedrock-runtime" {
params["providerId"] = json!(provider_id);
}
let request_id = mcp.send_login_account_request(params).await?;
let response: JSONRPCResponse = timeout(
DEFAULT_READ_TIMEOUT,
@@ -1450,7 +1460,7 @@ async fn login_amazon_bedrock_replaces_primary_auth_and_persists_provider(
.expect("config should be a table");
expected_logout_config_root.remove("model_provider");
expected_logout_config_root.remove("model");
expected_logout_config["model_providers"]["amazon-bedrock"]
expected_logout_config["model_providers"][provider_id]
.as_table_mut()
.expect("Bedrock provider config should be a table")
.remove("aws");
@@ -70,6 +70,7 @@ async fn checks_current_provider_after_login_without_restart() -> Result<()> {
params: LoginAccountParams::AmazonBedrock {
api_key: "test-key".to_string(),
region: "us-west-2".to_string(),
provider_id: None,
},
})
.await?;
@@ -2,6 +2,7 @@ use anyhow::Result;
use app_test_support::TestAppServer;
use codex_app_server_protocol::BedrockDiscoverParams;
use codex_app_server_protocol::BedrockDiscoverResponse;
use codex_app_server_protocol::BedrockProviderId;
use codex_app_server_protocol::BedrockSetupParams;
use codex_app_server_protocol::BedrockSetupResponse;
use codex_app_server_protocol::ClientRequest;
@@ -39,6 +40,9 @@ async fn bedrock_app_server(
TestAppServer::builder()
.with_codex_home(codex_home)
.with_env_overrides(&[
("OPENAI_API_KEY", None),
("OPENAI_FEDERATION_RULE_ID", None),
("OPENAI_IDENTITY_TOKEN_FILE", None),
("AWS_CONFIG_FILE", Some(aws_config_path.as_ref())),
(
"AWS_SHARED_CREDENTIALS_FILE",
@@ -99,6 +103,7 @@ async fn discover_bedrock_profiles_and_environment_credentials() -> Result<()> {
request_id,
params: BedrockSetupParams::Environment {
region: " us-east-2 ".to_string(),
provider_id: Some(BedrockProviderId::AmazonBedrockRuntime),
},
})
.await?;
@@ -110,8 +115,8 @@ async fn discover_bedrock_profiles_and_environment_credentials() -> Result<()> {
assert_eq!(
config,
toml::toml! {
model_provider = "amazon-bedrock"
[model_providers.amazon-bedrock.aws]
model_provider = "amazon-bedrock-runtime"
[model_providers.amazon-bedrock-runtime.aws]
region = "us-east-2"
}
.into()
@@ -126,11 +131,11 @@ async fn discover_bedrock_profiles_and_environment_credentials() -> Result<()> {
})
.await?;
let default_model = models.data.iter().find(|model| model.is_default).unwrap();
assert!(default_model.model.starts_with("openai."));
assert!(default_model.model.starts_with("global.openai."));
let thread = app_server
.start_thread(ThreadStartParams::default())
.await?;
assert_eq!(thread.model_provider, "amazon-bedrock");
assert_eq!(thread.model_provider, "amazon-bedrock-runtime");
assert_eq!(thread.model, default_model.model);
Ok(())
@@ -158,15 +163,13 @@ async fn setup_bedrock_profile_and_environment() -> Result<()> {
)
.await?;
let response: BedrockSetupResponse = app_server
.request(|request_id| ClientRequest::BedrockSetup {
request_id,
params: BedrockSetupParams::Profile {
profile: " engineering ".to_string(),
region: " us-west-2 ".to_string(),
},
})
let request_id = app_server
.send_raw_request(
"account/bedrock/setup",
Some(json!({"type":"profile", "profile":" engineering ", "region":" us-west-2 "})),
)
.await?;
let response: BedrockSetupResponse = app_server.read_response(request_id).await?;
assert_eq!(response, BedrockSetupResponse {});
let config: toml::Value = toml::from_str(&std::fs::read_to_string(&config_path)?)?;
assert_eq!(
@@ -185,6 +188,7 @@ async fn setup_bedrock_profile_and_environment() -> Result<()> {
request_id,
params: BedrockSetupParams::Environment {
region: "us-east-1".to_string(),
provider_id: None,
},
})
.await?;
@@ -215,6 +219,30 @@ async fn setup_bedrock_profile_and_environment() -> Result<()> {
.into()
);
let _: BedrockSetupResponse = app_server
.request(|request_id| ClientRequest::BedrockSetup {
request_id,
params: BedrockSetupParams::Profile {
profile: "engineering".to_string(),
region: "us-west-2".to_string(),
provider_id: Some(BedrockProviderId::AmazonBedrockRuntime),
},
})
.await?;
let saved: toml::Value = toml::from_str(&std::fs::read_to_string(&config_path)?)?;
let mut expected = config;
expected["model_provider"] = "amazon-bedrock-runtime".into();
expected["model_providers"].as_table_mut().unwrap().insert(
"amazon-bedrock-runtime".to_string(),
toml::toml! {
[aws]
profile = "engineering"
region = "us-west-2"
}
.into(),
);
assert_eq!(saved, expected);
let managed_home = TempDir::new()?;
let managed_config_path = managed_home.path().join("config.toml");
std::fs::write(&managed_config_path, "model_provider = 'openai'")?;
@@ -255,6 +283,7 @@ async fn setup_bedrock_profile_and_environment() -> Result<()> {
params: BedrockSetupParams::Profile {
profile: "engineering".to_string(),
region: "us-west-2".to_string(),
provider_id: None,
},
})
.await?;
@@ -358,7 +387,9 @@ async fn setup_bedrock_rejects_invalid_or_conflicting_credentials() -> Result<()
let source_path = layered_home_path.join(source_file);
let active_path = layered_home_path.join("selected.config.toml");
let exporter_config = "[model_providers.amazon-bedrock.aws.credential_export]\n\
command = \"secret-command\"\nargs = [\"secret-argument\"]\n";
command = \"secret-command\"\nargs = [\"secret-argument\"]\n\
[model_providers.amazon-bedrock-runtime.aws.credential_export]\n\
command = \"runtime-command\"\n";
std::fs::write(&config_path, "")?;
std::fs::write(&active_path, "")?;
std::fs::write(&source_path, exporter_config)?;
@@ -384,6 +415,10 @@ async fn setup_bedrock_rejects_invalid_or_conflicting_credentials() -> Result<()
"account/bedrock/setup",
json!({"type": "environment", "region": "us-west-2"}),
),
(
"account/bedrock/setup",
json!({"type": "profile", "profile": "engineering", "region": "us-west-2", "providerId": "amazon-bedrock-runtime"}),
),
(
"account/login/start",
json!({"type": "amazonBedrock", "apiKey": "new-key", "region": "us-west-2"}),
+15 -3
View File
@@ -759,7 +759,11 @@ impl AuthModeWidget {
BedrockCredential::ApiKey(api_key) => request_handle
.request_typed::<LoginAccountResponse>(ClientRequest::LoginAccount {
request_id,
params: LoginAccountParams::AmazonBedrock { api_key, region },
params: LoginAccountParams::AmazonBedrock {
api_key,
region,
provider_id: None,
},
})
.await
.map_err(|error| error.to_string())
@@ -772,7 +776,11 @@ impl AuthModeWidget {
BedrockCredential::Profile(profile) => request_handle
.request_typed::<BedrockSetupResponse>(ClientRequest::BedrockSetup {
request_id,
params: BedrockSetupParams::Profile { profile, region },
params: BedrockSetupParams::Profile {
profile,
region,
provider_id: None,
},
})
.await
.map(|_| ())
@@ -780,7 +788,10 @@ impl AuthModeWidget {
BedrockCredential::Environment => request_handle
.request_typed::<BedrockSetupResponse>(ClientRequest::BedrockSetup {
request_id,
params: BedrockSetupParams::Environment { region },
params: BedrockSetupParams::Environment {
region,
provider_id: None,
},
})
.await
.map(|_| ())
@@ -797,6 +808,7 @@ impl AuthModeWidget {
secret_access_key,
session_token,
region,
provider_id: None,
},
})
.await