Skip to content

Commit f4a6cac

Browse files
cnivyanthsaiabhavanam-blipclaudesarvetiNr
authored
feat(cloud): add AWS EU Sovereign cloud provider support (#1368)
Co-authored-by: abhavanam <abhavanam@newrelic.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: sarveti <sarveti@newrelic.com>
1 parent 1ff3818 commit f4a6cac

File tree

3 files changed

+363
-0
lines changed

3 files changed

+363
-0
lines changed

pkg/cloud/cloud_api.go

Lines changed: 66 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/cloud/cloud_api_integration_test.go

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,3 +554,74 @@ func TestCloudAccount_OciLinkAccount(t *testing.T) {
554554
require.NotNil(t, unlinkResponse)
555555
require.Len(t, unlinkResponse.Errors, 0)
556556
}
557+
558+
func TestCloudAccount_AwsEuSovereignBasic(t *testing.T) {
559+
t.Parallel()
560+
561+
testAccountID, err := mock.GetTestAccountID()
562+
if err != nil {
563+
t.Skipf("%s", err)
564+
}
565+
566+
testARN := os.Getenv("INTEGRATION_TESTING_AWS_EU_SOVEREIGN_ARN")
567+
if testARN == "" {
568+
t.Skip("an AWS EU Sovereign ARN is required to run cloud account tests")
569+
return
570+
}
571+
572+
a := newIntegrationTestClient(t)
573+
// Reset everything
574+
getResponse, err := a.GetLinkedAccounts("aws_eu_sovereign")
575+
if err == nil {
576+
for _, linkedAccount := range *getResponse {
577+
if linkedAccount.NrAccountId == testAccountID {
578+
a.CloudUnlinkAccount(testAccountID, []CloudUnlinkAccountsInput{
579+
{
580+
LinkedAccountId: linkedAccount.ID,
581+
},
582+
})
583+
}
584+
}
585+
}
586+
587+
// Link the account
588+
linkResponse, err := a.CloudLinkAccount(testAccountID, CloudLinkCloudAccountsInput{
589+
AwsEuSovereign: []CloudAwsEuSovereignLinkAccountInput{
590+
{
591+
Arn: testARN,
592+
Name: "DTK Integration Testing EU Sovereign",
593+
},
594+
},
595+
})
596+
require.NoError(t, err)
597+
require.NotNil(t, linkResponse)
598+
require.Len(t, linkResponse.Errors, 0)
599+
600+
if len(linkResponse.LinkedAccounts) == 0 {
601+
t.Skip("skipping TestCloudAccount_AwsEuSovereignBasic due to no linked accounts")
602+
return
603+
}
604+
605+
// Get the linked account
606+
linkedAccountId := linkResponse.LinkedAccounts[0].ID
607+
608+
// Rename the account
609+
newName := "NEW-DTK-EU-SOVEREIGN-NAME"
610+
renameResponse, err := a.CloudRenameAccount(testAccountID, []CloudRenameAccountsInput{
611+
{
612+
LinkedAccountId: linkedAccountId,
613+
Name: newName,
614+
},
615+
})
616+
require.NoError(t, err)
617+
require.NotNil(t, renameResponse)
618+
619+
// Unlink the account
620+
unlinkResponse, err := a.CloudUnlinkAccount(testAccountID, []CloudUnlinkAccountsInput{
621+
{
622+
LinkedAccountId: linkedAccountId,
623+
},
624+
})
625+
require.NoError(t, err)
626+
require.NotNil(t, unlinkResponse)
627+
}

0 commit comments

Comments
 (0)