-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from ukfast/draas-support
add DRaaS service
- Loading branch information
Showing
12 changed files
with
2,625 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package draas | ||
|
||
import "fmt" | ||
|
||
// SolutionNotFoundError indicates a solution was not found | ||
type SolutionNotFoundError struct { | ||
ID string | ||
} | ||
|
||
func (e *SolutionNotFoundError) Error() string { | ||
return fmt.Sprintf("Solution not found with ID [%s]", e.ID) | ||
} | ||
|
||
// IOPSTierNotFoundError indicates an IOPS tier was not found | ||
type IOPSTierNotFoundError struct { | ||
ID string | ||
} | ||
|
||
func (e *IOPSTierNotFoundError) Error() string { | ||
return fmt.Sprintf("IOPS tier not found with ID [%s]", e.ID) | ||
} | ||
|
||
// FailoverPlanNotFoundError indicates a failover plan was not found | ||
type FailoverPlanNotFoundError struct { | ||
ID string | ||
} | ||
|
||
func (e *FailoverPlanNotFoundError) Error() string { | ||
return fmt.Sprintf("Failover plan not found with ID [%s]", e.ID) | ||
} | ||
|
||
// ComputeResourceNotFoundError indicates compute resources was not found | ||
type ComputeResourceNotFoundError struct { | ||
ID string | ||
} | ||
|
||
func (e *ComputeResourceNotFoundError) Error() string { | ||
return fmt.Sprintf("Compute resources not found with ID [%s]", e.ID) | ||
} | ||
|
||
// HardwarePlanNotFoundError indicates hardware plan was not found | ||
type HardwarePlanNotFoundError struct { | ||
ID string | ||
} | ||
|
||
func (e *HardwarePlanNotFoundError) Error() string { | ||
return fmt.Sprintf("Hardware plan not found with ID [%s]", e.ID) | ||
} | ||
|
||
// BillingTypeNotFoundError indicates billing type was not found | ||
type BillingTypeNotFoundError struct { | ||
ID string | ||
} | ||
|
||
func (e *BillingTypeNotFoundError) Error() string { | ||
return fmt.Sprintf("Billing type not found with ID [%s]", e.ID) | ||
} |
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,106 @@ | ||
//go:generate go run ../../gen/model_paginated_gen.go -package draas -typename Solution,BackupResource,IOPSTier,FailoverPlan,ComputeResource,HardwarePlan,Replica,BillingType -destination model_paginated.go | ||
package draas | ||
|
||
// Solution represents a solution | ||
type Solution struct { | ||
ID string `json:"id"` | ||
Name string `json:"name"` | ||
IOPSTierID string `json:"iops_tier_id"` | ||
BillingTypeID string `json:"billing_type_id"` | ||
} | ||
|
||
// BackupResource represents backup resources for a solution | ||
type BackupResource struct { | ||
ID string `json:"id"` | ||
Name string `json:"name"` | ||
// Quota in DB | ||
Quota int `json:"quota"` | ||
// Used quota in DB | ||
UsedQuota int `json:"used_quota"` | ||
} | ||
|
||
// IOPSTier represents an IOPS tier | ||
type IOPSTier struct { | ||
ID string `json:"id"` | ||
IOPSLimit string `json:"iops_limit"` | ||
} | ||
|
||
// BackupService represents the backup service for a solution | ||
type BackupService struct { | ||
Service string `json:"service"` | ||
AccountName string `json:"account_name"` | ||
Gateway string `json:"gateway"` | ||
Port int `json:"port"` | ||
} | ||
|
||
// FailoverPlan represents a failover plan | ||
type FailoverPlan struct { | ||
ID string `json:"id"` | ||
Name string `json:"name"` | ||
Description string `json:"description"` | ||
Status string `json:"status"` | ||
VMs struct { | ||
Name string `json:"name"` | ||
} `json:"vms"` | ||
} | ||
|
||
// ComputeResource represents compute resources for a solution | ||
type ComputeResource struct { | ||
ID string `json:"id"` | ||
HardwarePlanID string `json:"hardware_plan_id"` | ||
Memory struct { | ||
// Used memory in GB | ||
Used float32 `json:"used"` | ||
// Memory limit in GB | ||
Limit float32 `json:"limit"` | ||
} `json:"memory"` | ||
CPU struct { | ||
Used int `json:"used"` | ||
} `json:"cpu"` | ||
Storage []struct { | ||
Name string `json:"name"` | ||
// Used storage in GB | ||
Used int `json:"used"` | ||
// Storage limit in GB | ||
Limit int `json:"limit"` | ||
} `json:"storage"` | ||
} | ||
|
||
// HardwarePlan represents a hardware plan | ||
type HardwarePlan struct { | ||
ID string `json:"id"` | ||
Name string `json:"name"` | ||
Description string `json:"description"` | ||
Limits struct { | ||
Processor int `json:"processor"` | ||
Memory int `json:"memory"` | ||
} `json:"limits"` | ||
Networks struct { | ||
Public int `json:"public"` | ||
Private int `json:"private"` | ||
} `json:"networks"` | ||
Storage struct { | ||
ID string `json:"id"` | ||
Name string `json:"name"` | ||
Type string `json:"Type"` | ||
Quota int `json:"quota"` | ||
} `json:"storage"` | ||
} | ||
|
||
// Replica represents a replica | ||
type Replica struct { | ||
ID string `json:"id"` | ||
Name string `json:"name"` | ||
Platform string `json:"platform"` | ||
CPU int `json:"cpu"` | ||
RAM int `json:"ram"` | ||
HDD int `json:"hdd"` | ||
IOPS int `json:"iops"` | ||
Power bool `json:"power"` | ||
} | ||
|
||
// BillingType represents a billing type | ||
type BillingType struct { | ||
ID string `json:"id"` | ||
Type string `json:"type"` | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,11 @@ | ||
package draas | ||
|
||
// PatchSolutionRequest represents a request to patch a solution | ||
type PatchSolutionRequest struct { | ||
Name string `json:"name,omitempty"` | ||
IOPSTierID string `json:"iops_tier_id,omitempty"` | ||
} | ||
|
||
type ResetBackupServiceCredentialsRequest struct { | ||
Password string `json:"password"` | ||
} |
Oops, something went wrong.