Skip to content

List Backup Policies for All Existing Droplets

client.GPUDroplets.Backups.ListPolicies(ctx, query) (*GPUDropletBackupListPoliciesResponse, error)
get/v2/droplets/backups/policies

To list information about the backup policies for all Droplets in the account, send a GET request to /v2/droplets/backups/policies.

ParametersExpand Collapse
query GPUDropletBackupListPoliciesParams
Page param.Field[int64]optional

Which 'page' of paginated results to return.

minimum1
PerPage param.Field[int64]optional

Number of items returned per page

minimum1
maximum200
ReturnsExpand Collapse
type GPUDropletBackupListPoliciesResponse struct{…}

Information about the response itself.

Total int64optional

Number of objects returned by the request.

Accepts one of the following:
Policies map[string, GPUDropletBackupListPoliciesResponsePolicy]optional

A map where the keys are the Droplet IDs and the values are objects containing the backup policy information for each Droplet.

BackupEnabled booloptional

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

BackupPolicy DropletBackupPolicyoptional

An object specifying the backup policy for the Droplet.

Hour DropletBackupPolicyHouroptional

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

Accepts one of the following:
const DropletBackupPolicyHour0 DropletBackupPolicyHour = 0
const DropletBackupPolicyHour4 DropletBackupPolicyHour = 4
const DropletBackupPolicyHour8 DropletBackupPolicyHour = 8
const DropletBackupPolicyHour12 DropletBackupPolicyHour = 12
const DropletBackupPolicyHour16 DropletBackupPolicyHour = 16
const DropletBackupPolicyHour20 DropletBackupPolicyHour = 20
Plan DropletBackupPolicyPlanoptional

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

Accepts one of the following:
const DropletBackupPolicyPlanDaily DropletBackupPolicyPlan = "daily"
const DropletBackupPolicyPlanWeekly DropletBackupPolicyPlan = "weekly"
RetentionPeriodDays int64optional

The number of days the backup will be retained.

Weekday DropletBackupPolicyWeekdayoptional

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

Accepts one of the following:
const DropletBackupPolicyWeekdaySun DropletBackupPolicyWeekday = "SUN"
const DropletBackupPolicyWeekdayMon DropletBackupPolicyWeekday = "MON"
const DropletBackupPolicyWeekdayTue DropletBackupPolicyWeekday = "TUE"
const DropletBackupPolicyWeekdayWed DropletBackupPolicyWeekday = "WED"
const DropletBackupPolicyWeekdayThu DropletBackupPolicyWeekday = "THU"
const DropletBackupPolicyWeekdayFri DropletBackupPolicyWeekday = "FRI"
const DropletBackupPolicyWeekdaySat DropletBackupPolicyWeekday = "SAT"
WindowLengthHours int64optional

The length of the backup window starting from hour.

DropletID int64optional

The unique identifier for the Droplet.

NextBackupWindow DropletNextBackupWindowoptional

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

End Timeoptional

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

formatdate-time
Start Timeoptional

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

formatdate-time
List Backup Policies for All Existing Droplets
package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/-go"
  "github.com/stainless-sdks/-go/option"
)

func main() {
  client := gradient.NewClient(
    option.WithAccessToken("My Access Token"),
  )
  response, err := client.GPUDroplets.Backups.ListPolicies(context.TODO(), gradient.GPUDropletBackupListPoliciesParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.Meta)
}
{
  "meta": {
    "total": 1
  },
  "links": {
    "pages": {
      "last": "https://api.digitalocean.com/v2/images?page=2",
      "next": "https://api.digitalocean.com/v2/images?page=2"
    }
  },
  "policies": {
    "foo": {
      "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
{
  "meta": {
    "total": 1
  },
  "links": {
    "pages": {
      "last": "https://api.digitalocean.com/v2/images?page=2",
      "next": "https://api.digitalocean.com/v2/images?page=2"
    }
  },
  "policies": {
    "foo": {
      "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"
      }
    }
  }
}