rubrik-sdk-for-powershell icon indicating copy to clipboard operation
rubrik-sdk-for-powershell copied to clipboard

Create, Modify and Delete Archival Locations

Open DamaniN opened this issue 5 years ago • 2 comments

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.

DamaniN avatar Sep 09 '19 21:09 DamaniN

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.

jaapbrasser avatar Sep 10 '19 03:09 jaapbrasser

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'
}

DamaniN avatar Sep 10 '19 15:09 DamaniN