Skip to content

droplets: support usage-based backup policies#996

Closed
theredspoon wants to merge 1 commit intodigitalocean:mainfrom
theredspoon:securobi/usage-based-backup-policy-request-tests
Closed

droplets: support usage-based backup policies#996
theredspoon wants to merge 1 commit intodigitalocean:mainfrom
theredspoon:securobi/usage-based-backup-policy-request-tests

Conversation

@theredspoon
Copy link
Copy Markdown

@theredspoon theredspoon commented Apr 16, 2026

Summary

  • add window_length_hours and retention_period_days to DropletBackupPolicyRequest
  • include those fields in Droplet create, multi-create, and backup-policy action payloads when set
  • omit empty weekday from backup-policy action payloads, which allows usage-based policies such as intra_daily_4h

Context

DigitalOcean supports newer usage-based Droplet backup policies such as:

{
  "plan": "intra_daily_4h",
  "hour": 0,
  "window_length_hours": 4,
  "retention_period_days": 7
}

godo can already read these fields through DropletBackupPolicyConfig, but DropletBackupPolicyRequest and the Droplet action helpers could only send plan, weekday, and hour.

This is needed by the Terraform/OpenTofu provider so it can model usage-based backup policies without out-of-band API calls. Related provider issue: digitalocean/terraform-provider-digitalocean#1525.

Tests

go test -run 'TestDroplets_CreateWithUsageBasedBackupPolicy|TestDroplets_CreateMultipleWithUsageBasedBackupPolicy' ./...
go test .
go test ./...

@theredspoon theredspoon force-pushed the securobi/usage-based-backup-policy-request-tests branch from 97def56 to b8ddec4 Compare April 16, 2026 20:33
@theredspoon theredspoon deleted the securobi/usage-based-backup-policy-request-tests branch April 16, 2026 20:35
@theredspoon
Copy link
Copy Markdown
Author

Superseded by #997.

I renamed the fork branch to remove an internal project namespace from public PR metadata. GitHub closed this cross-fork PR during the branch rename, so I reopened the same change from the neutral branch:

The replacement PR uses the same commit and branch name droplets/usage-based-backup-policy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant