-
Notifications
You must be signed in to change notification settings - Fork 14
/
cloud_backup.go
114 lines (91 loc) · 6.04 KB
/
cloud_backup.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
package gobizfly
import (
"context"
"strings"
)
const (
dashboardPath = "/dashboard"
)
var _ CloudBackupService = (*cloudBackupService)(nil)
type cloudBackupService struct {
client *Client
}
type CloudBackupService interface {
CloudBackupListActivities(ctx context.Context) ([]*CloudBackupActivity, error)
ListTenantRecoveryPoints(ctx context.Context) ([]*CloudBackupMachineRecoveryPoint, error)
DeleteMultipleRecoveryPoints(ctx context.Context, payload CloudBackupDeleteMultipleRecoveryPointPayload) error
ListDirectoryRecoveryPoints(ctx context.Context, machineID string, directoryID string) ([]*CloudBackupMachineRecoveryPoint, error)
RecoveryPointAction(ctx context.Context, recoveryPointID string, payload *CloudBackupRecoveryPointActionPayload) (*CloudBackupMachineRecoveryPoint, error)
ListMachineRecoveryPoints(ctx context.Context, machineID string) ([]*CloudBackupExtendedRecoveryPoint, error)
GetRecoveryPoint(ctx context.Context, recoveryPointID string) (*CloudBackupMachineRecoveryPoint, error)
DeleteRecoveryPoint(ctx context.Context, recoveryPointID string) error
ListRecoveryPointItems(ctx context.Context, recoveryPointID string) ([]*CloudBackupRecoveryPointItem, error)
RestoreRecoveryPoint(ctx context.Context, recoveryPointID string, payload *CloudBackupRestoreRecoveryPointPayload) error
ListStorageVaults(ctx context.Context) ([]*CloudBackupStorageVault, error)
GetStorageVault(ctx context.Context, vaultID string) (*CloudBackupStorageVault, error)
CreateStorageVault(ctx context.Context, payload *CloudBackupCreateStorageVaultPayload) (*CloudBackupStorageVault, error)
ListTenantMachines(ctx context.Context, listOption *CloudBackupListMachineParams) ([]*CloudBackupMachine, error)
CreateMachine(ctx context.Context, payload *CloudBackupCreateMachinePayload) (*CloudBackupExtendedMachine, error)
GetMachine(ctx context.Context, machineID string) (*CloudBackupMachine, error)
PatchMachine(ctx context.Context, machineID string, payload *CloudBackupPatchMachinePayload) (*CloudBackupMachine, error)
DeleteMachine(ctx context.Context, machineID string, payload *CloudBackupDeleteMachinePayload) error
ActionMachine(ctx context.Context, machineID string, payload *CloudBackupActionMachinePayload) error
ResetMachineSecretKey(ctx context.Context, machineID string) (*CloudBackupExtendedMachine, error)
ActionDirectory(ctx context.Context, machineID string, payload *CloudBackupStateDirectoryAction) error
ListMachineBackupDirectories(ctx context.Context, machineID string) ([]*CloudBackupDirectory, error)
CreateBackupDirectory(ctx context.Context, machineID string, payload *CloudBackupCreateDirectoryPayload) (*CloudBackupDirectory, error)
GetBackupDirectory(ctx context.Context, machineID string, directoryID string) (*CloudBackupDirectory, error)
PatchBackupDirectory(ctx context.Context, machineID string, directoryID string, payload *CloudBackupPatchDirectoryPayload) (*CloudBackupDirectory, error)
DeleteBackupDirectory(ctx context.Context, machineID string, directoryID string, payload *CloudBackupDeleteDirectoryPayload) error
ListTenantDirectories(ctx context.Context) ([]*CloudBackupDirectory, error)
ActionBackupDirectory(ctx context.Context, machineID string, directoryID string, payload *CloudBackupActionDirectoryPayload) error
DeleteMultipleDirectories(ctx context.Context, machineID string, payload *CloudBackupDeleteMultipleDirectoriesPayload) error
ActionMultipleDirectories(ctx context.Context, machineID string, payload *CloudBackupActionMultipleDirectoriesPayload) error
ListTenantPolicies(ctx context.Context) ([]*CloudBackupPolicy, error)
CreatePolicy(ctx context.Context, payload *CloudBackupCreatePolicyPayload) (*CloudBackupPolicy, error)
GetBackupDirectoryPolicy(ctx context.Context, machineID string, directoryID string) (*CloudBackupPolicy, error)
GetPolicy(ctx context.Context, policyID string) (*CloudBackupPolicy, error)
PatchPolicy(ctx context.Context, policyID string, payload *CloudBackupPatchPolicyPayload) (*CloudBackupPolicy, error)
DeletePolicy(ctx context.Context, policyID string) error
ListAppliedPolicyDirectories(ctx context.Context, policyID string) ([]*CloudBackupDirectory, error)
ActionPolicyDirectory(ctx context.Context, policyID string, payload *CloudBackupActionPolicyDirectoryPayload) error
}
func (cb *cloudBackupService) dashboardPath() string {
return dashboardPath
}
func (cb *cloudBackupService) machinesPath() string {
return strings.Join([]string{cb.dashboardPath(), "machines"}, "/")
}
func (cb *cloudBackupService) itemMachinePath(id string) string {
return strings.Join([]string{cb.machinesPath(), id}, "/")
}
func (cb *cloudBackupService) machineDirectoryPath(machineID string, directoryID string) string {
return strings.Join([]string{cb.machinesPath(), machineID, "directories", directoryID}, "/")
}
func (cb *cloudBackupService) machineDirectoryRecoveryPointPath(machineID string, directoryID string) string {
return strings.Join([]string{cb.machineDirectoryPath(machineID, directoryID), "recovery-points"}, "/")
}
func (cb *cloudBackupService) activityPath() string {
return strings.Join([]string{cb.dashboardPath(), "activity"}, "/")
}
func (cb *cloudBackupService) directoryPath() string {
return strings.Join([]string{cb.dashboardPath(), "backup-directories"}, "/")
}
func (cb *cloudBackupService) policyPath() string {
return strings.Join([]string{cb.dashboardPath(), "policies"}, "/")
}
func (cb *cloudBackupService) itemPolicyPath(policyID string) string {
return strings.Join([]string{cb.policyPath(), policyID}, "/")
}
func (cb *cloudBackupService) recoveryPointPath() string {
return strings.Join([]string{cb.dashboardPath(), "recovery-points"}, "/")
}
func (cb *cloudBackupService) itemRecoveryPointPath(recoveryPointID string) string {
return strings.Join([]string{cb.recoveryPointPath(), recoveryPointID}, "/")
}
func (cb *cloudBackupService) storageVaultsPath() string {
return strings.Join([]string{cb.dashboardPath(), "storage-vaults"}, "/")
}
func (cb *cloudBackupService) itemStorageVaultPath(storageVaultID string) string {
return strings.Join([]string{cb.storageVaultsPath(), storageVaultID}, "/")
}