Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions pkg/query-service/app/cloudintegrations/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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,
Expand Down
Loading