Skip to content
  • Auto
  • Light
  • Dark

Retrieve Policy

Retrieve the Backup Policy for an Existing Droplet
gpu_droplets.backups.retrieve_policy(intdroplet_id) -> BackupRetrievePolicyResponse
get/v2/droplets/{droplet_id}/backups/policy

To show information about an individual Droplet's backup policy, send a GET request to /v2/droplets/$DROPLET_ID/backups/policy.

ParametersExpand Collapse
droplet_id: int
minimum1
ReturnsExpand Collapse
class BackupRetrievePolicyResponse:
policy: Optional[Policy]
backup_enabled: Optional[bool]

A boolean value indicating whether backups are enabled for the Droplet.

backup_policy: Optional[DropletBackupPolicy]

An object specifying the backup policy for the Droplet.

hour: Optional[Literal[0, 4, 8, 3 more]]

The hour of the day that the backup window will start.

Accepts one of the following:
0
4
8
12
16
20
plan: Optional[Literal["daily", "weekly"]]

The backup plan used for the Droplet. The plan can be either daily or weekly.

Accepts one of the following:
"daily"
"weekly"
retention_period_days: Optional[int]

The number of days the backup will be retained.

weekday: Optional[Literal["SUN", "MON", "TUE", 4 more]]

The day of the week on which the backup will occur.

Accepts one of the following:
"SUN"
"MON"
"TUE"
"WED"
"THU"
"FRI"
"SAT"
window_length_hours: Optional[int]

The length of the backup window starting from hour.

droplet_id: Optional[int]

The unique identifier for the Droplet.

next_backup_window: Optional[DropletNextBackupWindow]

An object containing keys with the start and end times of the window during which the backup will occur.

end: Optional[datetime]

A time value given in ISO8601 combined date and time format specifying the end of the Droplet's backup window.

formatdate-time
start: Optional[datetime]

A time value given in ISO8601 combined date and time format specifying the start of the Droplet's backup window.

formatdate-time
Retrieve the Backup Policy for an Existing Droplet
from gradient import Gradient

client = Gradient(
    access_token="My Access Token",
)
response = client.gpu_droplets.backups.retrieve_policy(
    3164444,
)
print(response.policy)
{
  "policy": {
    "backup_enabled": true,
    "backup_policy": {
      "hour": 0,
      "plan": "daily",
      "retention_period_days": 7,
      "weekday": "SUN",
      "window_length_hours": 4
    },
    "droplet_id": 7101383,
    "next_backup_window": {
      "end": "2019-12-04T23:00:00Z",
      "start": "2019-12-04T00:00:00Z"
    }
  }
}
Returns Examples
{
  "policy": {
    "backup_enabled": true,
    "backup_policy": {
      "hour": 0,
      "plan": "daily",
      "retention_period_days": 7,
      "weekday": "SUN",
      "window_length_hours": 4
    },
    "droplet_id": 7101383,
    "next_backup_window": {
      "end": "2019-12-04T23:00:00Z",
      "start": "2019-12-04T00:00:00Z"
    }
  }
}