chore: cloud integrations: include cloud account id in account status response (#6833)

This commit is contained in:
Raj Kamal Singh 2025-01-16 22:51:35 +05:30 committed by GitHub
parent 92299e1b08
commit 8e11a988be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 4 deletions

View File

@ -127,8 +127,9 @@ func (c *Controller) GenerateConnectionUrl(
}
type AccountStatusResponse struct {
Id string `json:"id"`
Status AccountStatus `json:"status"`
Id string `json:"id"`
CloudAccountId *string `json:"cloud_account_id,omitempty"`
Status AccountStatus `json:"status"`
}
func (c *Controller) GetAccountStatus(
@ -146,8 +147,9 @@ func (c *Controller) GetAccountStatus(
}
resp := AccountStatusResponse{
Id: account.Id,
Status: account.status(),
Id: account.Id,
CloudAccountId: account.CloudAccountId,
Status: account.status(),
}
return &resp, nil

View File

@ -52,6 +52,7 @@ func TestAWSIntegrationAccountLifecycle(t *testing.T) {
accountStatusResp := testbed.GetAccountStatusFromQS("aws", testAccountId)
require.Equal(testAccountId, accountStatusResp.Id)
require.Nil(accountStatusResp.Status.Integration.LastHeartbeatTsMillis)
require.Nil(accountStatusResp.CloudAccountId)
// The unconnected account should not show up in connected accounts list yet
accountsListResp1 := testbed.GetConnectedAccountsListFromQS("aws")
@ -75,6 +76,8 @@ func TestAWSIntegrationAccountLifecycle(t *testing.T) {
// Polling for connection status from UI should now return latest status
accountStatusResp1 := testbed.GetAccountStatusFromQS("aws", testAccountId)
require.Equal(testAccountId, accountStatusResp1.Id)
require.NotNil(accountStatusResp1.CloudAccountId)
require.Equal(testAWSAccountId, *accountStatusResp1.CloudAccountId)
require.NotNil(accountStatusResp1.Status.Integration.LastHeartbeatTsMillis)
require.LessOrEqual(
tsMillisBeforeAgentCheckIn,