-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add support specifying Azure resource groups for RSC features (#160) * Add retry to allVpcsByRegion request (#162) * Move the retry handling into the Request function (#165) * Expose account name and FQDN (#166) * Add support for Azure shared exocompute (#167) * Fix an issue with AWS exocompute customer supplied security groups (#168) * Add support for Azure archival locations (#169) * Fix Azure permission upgrade issue (#170) * Increase the korg job wait attempts to 50 (#171) * Skip disabling AWS Exocompute for non-CFT workflow (#172) * Fix CreateStorageSetting's NativeID field (#173) * Use RSC_MANAGED_CLUSTER permission group (#174) * Extend AddClusterToExocomputeConfig to return setup YAML (#175) * Disable S3 protection before removing the feature (#176) * Fix failing Azure integration tests (#177) * Work around an AWS multiple features removal issue (#178) * Add functions to look up cloud accounts by native ID and name (#180) * Add support for updating AWS archival location bucket tags (#179)
- Loading branch information
1 parent
737319a
commit 3f4311a
Showing
88 changed files
with
5,372 additions
and
2,300 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
// Copyright 2024 Rubrik, Inc. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to | ||
// deal in the Software without restriction, including without limitation the | ||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | ||
// sell copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
|
||
package main | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"log" | ||
|
||
"github.com/google/uuid" | ||
"github.com/rubrikinc/rubrik-polaris-sdk-for-go/pkg/polaris" | ||
"github.com/rubrikinc/rubrik-polaris-sdk-for-go/pkg/polaris/azure" | ||
"github.com/rubrikinc/rubrik-polaris-sdk-for-go/pkg/polaris/graphql/core" | ||
polaris_log "github.com/rubrikinc/rubrik-polaris-sdk-for-go/pkg/polaris/log" | ||
) | ||
|
||
// Note: This example requires an existing Azure account with exocompute | ||
// configured in RSC. | ||
func main() { | ||
ctx := context.Background() | ||
|
||
// Load configuration and create a client. | ||
polAccount, err := polaris.DefaultServiceAccount(true) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
logger := polaris_log.NewStandardLogger() | ||
if err := polaris.SetLogLevelFromEnv(logger); err != nil { | ||
log.Fatal(err) | ||
} | ||
client, err := polaris.NewClientWithLogger(polAccount, logger) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
azureClient := azure.Wrap(client) | ||
|
||
// The AWS account ID of the existing AWS account with exocompute | ||
// configured. | ||
hostAccountID := azure.SubscriptionID(uuid.MustParse("3cad3091-a1b3-4e0e-823d-84589568983e")) | ||
|
||
// Add the AWS default account to Polaris. Usually resolved using the | ||
// environment variables AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and | ||
// AWS_DEFAULT_REGION. | ||
subscription := azure.Subscription(uuid.MustParse("e4b247e7-66c5-4f10-9042-1eeac424c7a4"), | ||
"my-domain.onmicrosoft.com") | ||
accountID, err := azureClient.AddSubscription(ctx, subscription, core.FeatureCloudNativeProtection, azure.Regions("us-east-2")) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
fmt.Printf("Account ID: %v\n", accountID) | ||
|
||
// Map the application account to an existing exocompute host account. | ||
err = azureClient.MapExocompute(ctx, hostAccountID, azure.CloudAccountID(accountID)) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
// Retrieve the exocompute host account for the application account. | ||
hostID, err := azureClient.ExocomputeHostAccount(ctx, azure.CloudAccountID(accountID)) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
fmt.Printf("Exocompute Host Account: %v\n", hostID) | ||
|
||
// Unmap the application account from the shared exocompute host account. | ||
err = azureClient.UnmapExocompute(ctx, azure.CloudAccountID(accountID)) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
// Remove the AWS account from Polaris. | ||
err = azureClient.RemoveSubscription(ctx, azure.CloudAccountID(accountID), core.FeatureCloudNativeProtection, false) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.