-
Notifications
You must be signed in to change notification settings - Fork 396
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
131 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package displayers | ||
|
||
import ( | ||
"io" | ||
|
||
"github.com/digitalocean/doctl/do" | ||
) | ||
|
||
type DropletBackupPolicy struct { | ||
DropletBackupPolicies []do.DropletBackupPolicy | ||
} | ||
|
||
var _ Displayable = &DropletBackupPolicy{} | ||
|
||
func (d *DropletBackupPolicy) JSON(out io.Writer) error { | ||
return writeJSON(d.DropletBackupPolicies, out) | ||
} | ||
|
||
func (d *DropletBackupPolicy) Cols() []string { | ||
cols := []string{ | ||
"DropletID", "BackupEnabled", "BackupPolicyPlan", "BackupPolicyWeekday", "BackupPolicyHour", | ||
"BackupPolicyWindowLengthHours", "BackupPolicyRetentionPeriodDays", | ||
"NextBackupWindowStart", "NextBackupWindowEnd", | ||
} | ||
return cols | ||
} | ||
|
||
func (d *DropletBackupPolicy) ColMap() map[string]string { | ||
return map[string]string{ | ||
"DropletID": "Droplet ID", "BackupEnabled": "Backup Enabled", | ||
"BackupPolicyPlan": "Backup Policy Plan", "BackupPolicyWeekday": "Backup Policy Weekday", "BackupPolicyHour": "Backup Policy Hour", | ||
"BackupPolicyWindowLengthHours": "Backup Policy Window Length Hours", "BackupPolicyRetentionPeriodDays": "Backup Policy Retention Period Days", | ||
"NextBackupWindowStart": "Next Backup Window Start", "NextBackupWindowEnd": "Next Backup Window End", | ||
} | ||
} | ||
|
||
func (d *DropletBackupPolicy) KV() []map[string]any { | ||
out := make([]map[string]any, 0) | ||
for _, d := range d.DropletBackupPolicies { | ||
m := map[string]any{ | ||
"DropletID": d.DropletID, "BackupEnabled": d.BackupEnabled, "BackupPolicyPlan": d.BackupPolicy.Plan, | ||
"BackupPolicyWeekday": d.BackupPolicy.Weekday, "BackupPolicyHour": d.BackupPolicy.Hour, | ||
"BackupPolicyWindowLengthHours": d.BackupPolicy.WindowLengthHours, "BackupPolicyRetentionPeriodDays": d.BackupPolicy.RetentionPeriodDays, | ||
"NextBackupWindowStart": d.NextBackupWindow.Start, "NextBackupWindowEnd": d.NextBackupWindow.End, | ||
} | ||
out = append(out, m) | ||
} | ||
|
||
return out | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.