Skip to content

Commit 7a211c8

Browse files
Alex Holmbergclaude
authored andcommitted
fix(api): use working endpoint for check_provider_connection
The endpoint /api/cloud-credentials/provider/{provider} may not exist. Changed to use list_cloud_credentials_for_project (which works) and filter by provider. This is the same approach the wizard uses via get_provider_deployment_statuses. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent d198ccc commit 7a211c8

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

src/platform/api/client.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -573,21 +573,19 @@ impl PlatformApiClient {
573573
/// SECURITY NOTE: This method only returns connection STATUS, never actual credentials.
574574
/// The agent should never have access to OAuth tokens, API keys, or other secrets.
575575
///
576-
/// Endpoint: GET /api/cloud-credentials/provider/:provider?projectId=xxx
576+
/// Uses: GET /api/cloud-credentials?projectId=xxx (lists all, then filters)
577577
pub async fn check_provider_connection(
578578
&self,
579579
provider: &CloudProvider,
580580
project_id: &str,
581581
) -> Result<Option<CloudCredentialStatus>> {
582-
let path = format!(
583-
"/api/cloud-credentials/provider/{}?projectId={}",
584-
provider.as_str(),
585-
project_id
586-
);
587-
// API wraps responses in { "data": ... }, so we need GenericResponse
588-
let response: Option<GenericResponse<CloudCredentialStatus>> =
589-
self.get_optional(&path).await?;
590-
Ok(response.map(|r| r.data))
582+
// Use the list endpoint (which works) and filter by provider
583+
// The single-provider endpoint may not exist on the backend
584+
let all_credentials = self.list_cloud_credentials_for_project(project_id).await?;
585+
let matching = all_credentials
586+
.into_iter()
587+
.find(|c| c.provider.eq_ignore_ascii_case(provider.as_str()));
588+
Ok(matching)
591589
}
592590

593591
/// List all cloud credentials for a project

0 commit comments

Comments
 (0)