SLA Domain APIs
Overview of GraphQL APIs for managing the creating, updating, querying and deleting of SLA Domains as well as assigning an SLA Domain to a snapshot.
The examples provided will need to be updated with the correct variables for the SLA Domain which is being managed. Examples variables may include SLA ID, SLA Name, or frequency.
Create SLA Domain
Used to create an SLA Domain. Note that the values of variables provided here are for illustrative purposes only.
MUTATION='{
"query": "mutation CreateSlaMutation($createGlobalSlaInput: CreateGlobalSlaInput!) {
createGlobalSla(input: $createGlobalSlaInput) {
id
__typename
}
}",
"variables": {
"createGlobalSlaInput": {
"name": "Your Name",
"description": "Your Description",
"snapshotSchedule": {
"daily": {
"basicSchedule": {
"frequency": 1,
"retention": 7,
"retentionUnit": "DAYS"
}
},
"monthly": {
"basicSchedule": {
"frequency": 1,
"retention": 1,
"retentionUnit": "MONTHS"
},
"dayOfMonth": "LAST_DAY"
}
},
"archivalSpecs": null,
"localRetentionLimit": null,
"backupWindows": [],
"firstFullBackupWindows": [],
"objectTypes": [
"VSPHERE_OBJECT_TYPE"
],
"objectSpecificConfigsInput": {
"awsRdsConfigInput": null,
"awsNativeS3SlaConfigInput": null,
"sapHanaConfigInput": null,
"db2ConfigInput": null,
"oracleConfigInput": null,
"mssqlConfigInput": null,
"mongoConfigInput": null,
"vmwareVmConfigInput": null,
"azureSqlDatabaseDbConfigInput": null,
"azureSqlManagedInstanceDbConfigInput": null
},
"replicationSpecsV2": null,
"isRetentionLockedSla": false
}
}
}'
curl -X POST https://$account.my.rubrik.com/api/graphql \
--header "authorization: Bearer $access_token" \
--header "content-type: application/json" \
--data "$(echo $MUTATION)"
Delete SLA Domain
MUTATION='{
"query": "mutation DeleteSlaMutation($id: UUID!, $userNote: String) {
deleteGlobalSla(id: $id, userNote: $userNote) {
success
__typename
}
}",
"variables": {
"id": "SLA_ID",
"userNote": ""
}
}'
curl -X POST https://$account.my.rubrik.com/api/graphql \
--header "authorization: Bearer $access_token" \
--header "content-type: application/json" \
--data "$(echo $MUTATION)"
Update SLA Domain
MUTATION='{
"query": "mutation UpdateSlaMutation($updateGlobalSlaInput: UpdateGlobalSlaInput!) {
updateGlobalSla(input: $updateGlobalSlaInput) {
id
__typename
}
}",
"variables": {
"updateGlobalSlaInput": {
"name": "Your SLA",
"description": "Your Description",
"snapshotSchedule": {
"daily": {
"basicSchedule": {
"frequency": 2,
"retention": 7,
"retentionUnit": "DAYS"
}
},
"monthly": {
"basicSchedule": {
"frequency": 1,
"retention": 1,
"retentionUnit": "MONTHS"
},
"dayOfMonth": "LAST_DAY"
}
},
"archivalSpecs": null,
"localRetentionLimit": null,
"backupWindows": [],
"firstFullBackupWindows": [],
"objectTypes": [
"VSPHERE_OBJECT_TYPE"
],
"objectSpecificConfigsInput": {
"awsRdsConfigInput": null,
"awsNativeS3SlaConfigInput": null,
"sapHanaConfigInput": null,
"db2ConfigInput": null,
"oracleConfigInput": null,
"mssqlConfigInput": null,
"mongoConfigInput": null,
"vmwareVmConfigInput": null,
"azureSqlDatabaseDbConfigInput": null,
"azureSqlManagedInstanceDbConfigInput": null
},
"replicationSpecsV2": null,
"isRetentionLockedSla": false,
"retentionLockMode": "NO_MODE",
"id": "f4251401-d359-4d63-bac0-28bcdf40d9f0",
"userNote": "",
"shouldApplyToExistingSnapshots": {
"value": false
},
"shouldApplyToNonPolicySnapshots": {
"value": false
}
}
}
}'
curl -X POST https://$account.my.rubrik.com/api/graphql \
--header "authorization: Bearer $access_token" \
--header "content-type: application/json" \
--data "$(echo $MUTATION)"
Pause SLA Domain
MUTATION='{
"query": "mutation PauseSLA($clusterId: [String!]!, $slaId: String!) {
pauseSla(input: {clusterUuids: $clusterId, pauseSla: true, slaId: $slaId}) {
success
__typename
}
}",
"variables": {
"clusterId": "CLUSTER_ID",
"slaId": "SLA_ID"
}
}'
curl -X POST https://$account.my.rubrik.com/api/graphql \
--header "authorization: Bearer $access_token" \
--header "content-type: application/json" \
--data "$(echo $MUTATION)"
Query Details of the SLA Domain
QUERY='{
"query": "query SLADomain{
slaDomain (id: "SLA_ID") {
id
name
version
...GlobalSlaReplyFragment
... on ClusterSlaDomain {
cdmId
...ClusterSlaDomainFragment
__typename
}
__typename
}
}
fragment GlobalSlaReplyFragment on GlobalSlaReply {
id
description
isRetentionLockedSla
retentionLockMode
baseFrequency {
duration
unit
__typename
}
ownerOrg {
id
name
__typename
}
backupWindows {
durationInHours
startTimeAttributes {
hour
minute
__typename
}
__typename
}
firstFullBackupWindows {
durationInHours
startTimeAttributes {
dayOfWeek {
day
__typename
}
hour
minute
__typename
}
__typename
}
snapshotSchedule {
...SnapshotSchedulesForSlaDomainFragment
__typename
}
localRetentionLimit {
duration
unit
__typename
}
archivalSpecs {
threshold
thresholdUnit
frequencies
archivalLocationToClusterMapping {
cluster {
id
name
__typename
}
location {
id
name
targetType
__typename
}
__typename
}
storageSetting {
id
name
groupType
targetType
targets {
id
name
cluster {
id
name
__typename
}
__typename
}
__typename
}
archivalTieringSpec {
coldStorageClass
shouldTierExistingSnapshots
minAccessibleDurationInSeconds
__typename
}
__typename
}
replicationSpecsV2 {
...DetailedReplicationSpecsV2ForSlaDomainFragment
__typename
}
objectTypes
isDefault
__typename
}
fragment SnapshotSchedulesForSlaDomainFragment on SnapshotSchedule {
minute {
basicSchedule {
frequency
retention
retentionUnit
__typename
}
__typename
}
hourly {
basicSchedule {
frequency
retention
retentionUnit
__typename
}
__typename
}
daily {
basicSchedule {
frequency
retention
retentionUnit
__typename
}
__typename
}
weekly {
basicSchedule {
frequency
retention
retentionUnit
__typename
}
dayOfWeek
__typename
}
monthly {
basicSchedule {
frequency
retention
retentionUnit
__typename
}
dayOfMonth
__typename
}
quarterly {
basicSchedule {
frequency
retention
retentionUnit
__typename
}
dayOfQuarter
quarterStartMonth
__typename
}
yearly {
basicSchedule {
frequency
retention
retentionUnit
__typename
}
dayOfYear
yearStartMonth
__typename
}
__typename
}
fragment DetailedReplicationSpecsV2ForSlaDomainFragment on ReplicationSpecV2 {
replicationLocalRetentionDuration {
duration
unit
__typename
}
cascadingArchivalSpecs {
archivalTieringSpec {
coldStorageClass
shouldTierExistingSnapshots
minAccessibleDurationInSeconds
isInstantTieringEnabled
__typename
}
archivalLocation {
id
name
targetType
... on RubrikManagedAwsTarget {
immutabilitySettings {
lockDurationDays
__typename
}
__typename
}
... on RubrikManagedAzureTarget {
immutabilitySettings {
lockDurationDays
__typename
}
__typename
}
... on CdmManagedAwsTarget {
immutabilitySettings {
lockDurationDays
__typename
}
__typename
}
... on CdmManagedAzureTarget {
immutabilitySettings {
lockDurationDays
__typename
}
__typename
}
... on RubrikManagedRcsTarget {
immutabilityPeriodDays
syncStatus
tier
__typename
}
... on RubrikManagedS3CompatibleTarget {
immutabilitySetting {
bucketLockDurationDays
__typename
}
__typename
}
__typename
}
frequency
archivalThreshold {
duration
unit
__typename
}
__typename
}
retentionDuration {
duration
unit
__typename
}
cluster {
id
name
version
__typename
}
targetMapping {
id
name
targets {
id
name
cluster {
id
name
__typename
}
__typename
}
__typename
}
awsTarget {
accountId
accountName
region
__typename
}
azureTarget {
region
__typename
}
__typename
}
fragment ClusterSlaDomainFragment on ClusterSlaDomain {
cluster {
id
name
version
__typename
}
ownerOrg {
id
name
__typename
}
baseFrequency {
duration
unit
__typename
}
backupWindows {
durationInHours
startTimeAttributes {
hour
minute
__typename
}
__typename
}
firstFullBackupWindows {
durationInHours
startTimeAttributes {
dayOfWeek {
day
__typename
}
hour
minute
__typename
}
__typename
}
snapshotSchedule {
...SnapshotSchedulesForSlaDomainFragment
__typename
}
archivalSpec {
archivalLocationName
archivalLocationId
threshold
thresholdUnit
__typename
}
archivalSpecs {
archivalLocationName
archivalLocationId
threshold
archivalTieringSpec {
isInstantTieringEnabled
minAccessibleDurationInSeconds
coldStorageClass
shouldTierExistingSnapshots
__typename
}
thresholdUnit
frequencies
__typename
}
replicationSpecsV2 {
...DetailedReplicationSpecsV2ForSlaDomainFragment
__typename
}
localRetentionLimit {
duration
unit
__typename
}
isRetentionLockedSla
retentionLockMode
__typename
}"
}'
curl -X POST https://$account.my.rubrik.com/api/graphql \
--header "authorization: Bearer $access_token" \
--header "content-type: application/json" \
--data "$(echo $QUERY)"
Query SLA Domains
QUERY='{
"query": "query SLADomains {
slaDomains {
nodes {
name
id
version
}
}
__typename
}"
}'
curl -X POST https://$account.my.rubrik.com/api/graphql \
--header "authorization: Bearer $access_token" \
--header "content-type: application/json" \
--data "$(echo $QUERY)"
Assign SLA Domain
MUTATION='{
"query": "mutation assignSla($objectIds: [UUID!]! $slaId: UUID) {
assignSla(input: {
objectIds: $objectIds
#slaDomainAssignType can be set to protectWithSlaId, noAssignment, doNotProtect
slaDomainAssignType: protectWithSlaId
slaOptionalId: $slaId
#shouldApplyToExistingSnapshots: false
#shouldApplyToNonPolicySnapshots: false
# Snapshot retention can be set to RETAIN_SNAPSHOTS, EXPIRE_IMMEDIATELY, KEEP_FOREVER, NOT_APPLICABLE
#existingSnapshotRetention: RETAIN_SNAPSHOTS
}) {
success
}
}",
"variables": {
"objectIds": ["00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000000"],
"slaId": "00000000-0000-0000-0000-000000000000"
}
}'
curl -X POST https://$account.my.rubrik.com/api/graphql \
--header "authorization: Bearer $access_token" \
--header "content-type: application/json" \
--data "$(echo $MUTATION)"