Index
In Rubrik, snapshots are a point-in-time copy of data, coupled with metadata. Snapshots can be managed by an SLA Domain, ahearing to the policy's archival, replication, and retention rules. Snapshot's can also be unmanaged, which means they are not tied to a specific policy, and retained forever.
Retrieving Snapshots for a Workload
When retrieving snapshots for a workload, use that workload's RSC id
. If using snappableConnection
to list objects, use the fid
field from the query. In the case of MSSQL databases, you must use the dagId
from the MSSQL database object.
query {
snapshotOfASnappableConnection(
workloadId: "123e4567-e89b-12d3-a456-426614174000"
) {
nodes {
id
date
isIndexed
isOnDemandSnapshot
isQuarantined
isAnomaly
isExpired
expirationDate
...on CdmSnapshot {
isRetentionLocked
legalHoldInfo {
shouldHoldInPlace
}
snapshotRetentionInfo {
localInfo {
isSnapshotPresent
isExpirationDateCalculated
expirationTime
}
archivalInfos {
isSnapshotPresent
isExpirationDateCalculated
expirationTime
}
replicationInfos {
isSnapshotPresent
isExpirationDateCalculated
expirationTime
}
}
fileCount
consistencyLevel
}
...on PolarisSnapshot {
snapshotRetentionInfo {
localInfo {
isSnapshotPresent
isExpirationDateCalculated
expirationTime
}
archivalInfos {
isSnapshotPresent
isExpirationDateCalculated
expirationTime
}
replicationInfos {
isSnapshotPresent
isExpirationDateCalculated
expirationTime
}
}
polarisConsistencyLevel: consistencyLevel
}
}
}
}
#!/bin/bash
# RSC_TOKEN="YOUR_RSC_ACCESS_TOKEN"
query="query { snapshotOfASnappableConnection( workloadId: \\\"123e4567-e89b-12d3-a456-426614174000\\\" ) { nodes { id date isIndexed isOnDemandSnapshot isQuarantined isAnomaly isExpired expirationDate ...on CdmSnapshot { isRetentionLocked legalHoldInfo { shouldHoldInPlace } snapshotRetentionInfo { localInfo { isSnapshotPresent isExpirationDateCalculated expirationTime } archivalInfos { isSnapshotPresent isExpirationDateCalculated expirationTime } replicationInfos { isSnapshotPresent isExpirationDateCalculated expirationTime } } fileCount consistencyLevel } ...on PolarisSnapshot { snapshotRetentionInfo { localInfo { isSnapshotPresent isExpirationDateCalculated expirationTime } archivalInfos { isSnapshotPresent isExpirationDateCalculated expirationTime } replicationInfos { isSnapshotPresent isExpirationDateCalculated expirationTime } } polarisConsistencyLevel: consistencyLevel } } } }"
# Execute the GraphQL query with curl
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $RSC_TOKEN" \
-d "{\"query\": \"$query\"}" \
https://example.my.rubrik.com/api/graphql
Assigning an SLA to a Snapshot
$query = New-RscMutation -GqlMutation assignRetentionSLAToSnapshots
$query.Var.globalSlaAssignType = [RubrikSecurityCloud.Types.SlaAssignTypeEnum]::PROTECT_WITH_SLA_ID
$query.Var.snapshotFids = @("124a67b6-be5a-5181-9447-fac686bc9949")
$query.Var.globalSlaOptionalFid = "123e4567-e89b-12d3-a456-426614174000"
$query.invoke()
#!/bin/bash
# RSC_TOKEN="YOUR_RSC_ACCESS_TOKEN"
query="mutation { assignRetentionSLAToSnapshots( snapshotFids: [\\\"b77f85ae-62d1-435b-9abf-2a1d97c6802f\\\"] globalSlaAssignType: protectWithSlaId globalSlaOptionalFid: \\\"5b6e44ca-9a0d-42e8-a6ba-952159c69bab\\\" ) { success } }"
# Execute the GraphQL query with curl
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $RSC_TOKEN" \
-d "{\"query\": \"$query\"}" \
https://example.my.rubrik.com/api/graphql
Deleting Unmanaged Snapshots
Unmanaged snapshots have no policy and will be retained forever until deleted. A snapshot is an unmanaged or "forever" if isExpirationDateCalculated
is true and expirationTime
is null.
#!/bin/bash
# RSC_TOKEN="YOUR_RSC_ACCESS_TOKEN"
query="mutation { deleteUnmanagedSnapshots(input: { snapshotIds: [\\\"124a67b6-be5a-5181-9447-fac686bc9949\\\"] }) { success } }"
# Execute the GraphQL query with curl
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $RSC_TOKEN" \
-d "{\"query\": \"$query\"}" \
https://example.my.rubrik.com/api/graphql