Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Create, Modify and Delete Archival Locations #445

Open
DamaniN opened this issue Sep 9, 2019 · 2 comments
Open

Create, Modify and Delete Archival Locations #445

DamaniN opened this issue Sep 9, 2019 · 2 comments

Comments

@DamaniN
Copy link

DamaniN commented Sep 9, 2019

Is your feature request related to a problem? Please describe.

There are no cmdlets to create, modify or delete archival locations.

Describe the solution you'd like

New cmdlets to create, modify and delete archival locations. Specifically for AWS and Azure. The cmdlets should also include the ability to create, modify and delete the Cloud Compute settings and Proxies in these archival locations.

Describe alternatives you've considered

Already using Invoke-RubirkRESTCall to do this work. It would be easier with cmdlets. The cmdlets would also have avoided/solved #441.

@jaapbrasser
Copy link
Contributor

Can you provide some samples of the Rubrik API calls you're currently executing. Then we can ensure this functionality will be part of the new functions.

@DamaniN
Copy link
Author

DamaniN commented Sep 10, 2019

Create an Archival Location with Compute Settings enabled (AWS example):

$body =@{
    "objectStoreType" = "S3"
    "name" = "$archiveName"
    "accessKey" = "$iamUserAccessKey"
    "bucket" = "$bucketName"
    "defaultRegion" = "$region"
    "isComputeEnabled" = $true
    "isConsolidationEnabled" = $true
    "defaultComputeNetworkConfig" = @{
      "subnetId" = "$subnetId"
      "vNetId" = "$vpcId"
      "securityGroupId" = "$securityGroupId"
    }
    "storageClass" = "$storageClass"
    "encryptionType" = "$encryptionType"
    "secretKey" = "$iamUserSecretKey"
    "kmsMasterKeyId" = "$kmsKeyId"
}

$archivalLocationJob = Invoke-RubrikRESTCall -Endpoint 'archive/object_store' -Method POST `
                                             -api 'internal' -Body $body```

Wait for the archival location to create and gather information such as it's ID for later use. This needs to be redone as some sort of status poll to Rubrik rather than an arbitrary timer:

Start-Sleep -Seconds 60

$query = @{"name" = "$archiveName"}
$archivalLocationId = ((Invoke-RubrikRESTCall -Endpoint 'archive/object_store' -Method GET -api 'internal' `
                                         -Query $query).data).id
Write-Verbose $archivalLocationId

Remove Archival Location:

$query = @{"name" = "$archiveName"}

$archivalLocationIds = ((Invoke-RubrikRESTCall -Endpoint 'archive/object_store' -Method GET -api 'internal' `
                                         -Query $query).data).id

foreach ($archivalLocationId in $archivalLocationIds) {
    Invoke-RubrikRESTCall -Endpoint "archive/location/$archivalLocationId/owner/pause" `
                            -Method POST -api 'internal'
    Invoke-RubrikRESTCall -Endpoint "archive/location/$archivalLocationId" `
                            -Method DELETE -api 'internal'
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants