Skip to content

Commit be025a4

Browse files
Added support for new APIs - updateBackupRepository, listImportVmTasks
1 parent 85034eb commit be025a4

File tree

7 files changed

+522
-0
lines changed

7 files changed

+522
-0
lines changed

cloudstack/BackupService.go

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ type BackupServiceIface interface {
7171
GetBackupByID(id string, opts ...OptionFunc) (*Backup, int, error)
7272
RestoreBackup(p *RestoreBackupParams) (*RestoreBackupResponse, error)
7373
NewRestoreBackupParams(id string) *RestoreBackupParams
74+
UpdateBackupRepository(p *UpdateBackupRepositoryParams) (*UpdateBackupRepositoryResponse, error)
75+
NewUpdateBackupRepositoryParams(id string) *UpdateBackupRepositoryParams
7476
UpdateBackupOffering(p *UpdateBackupOfferingParams) (*UpdateBackupOfferingResponse, error)
7577
NewUpdateBackupOfferingParams(id string) *UpdateBackupOfferingParams
7678
UpdateBackupSchedule(p *UpdateBackupScheduleParams) (*UpdateBackupScheduleResponse, error)
@@ -4720,6 +4722,178 @@ type RestoreBackupResponse struct {
47204722
Success bool `json:"success"`
47214723
}
47224724

4725+
type UpdateBackupRepositoryParams struct {
4726+
p map[string]interface{}
4727+
}
4728+
4729+
func (p *UpdateBackupRepositoryParams) toURLValues() url.Values {
4730+
u := url.Values{}
4731+
if p.p == nil {
4732+
return u
4733+
}
4734+
if v, found := p.p["address"]; found {
4735+
u.Set("address", v.(string))
4736+
}
4737+
if v, found := p.p["crosszoneinstancecreation"]; found {
4738+
vv := strconv.FormatBool(v.(bool))
4739+
u.Set("crosszoneinstancecreation", vv)
4740+
}
4741+
if v, found := p.p["id"]; found {
4742+
u.Set("id", v.(string))
4743+
}
4744+
if v, found := p.p["mountopts"]; found {
4745+
u.Set("mountopts", v.(string))
4746+
}
4747+
if v, found := p.p["name"]; found {
4748+
u.Set("name", v.(string))
4749+
}
4750+
return u
4751+
}
4752+
4753+
func (p *UpdateBackupRepositoryParams) SetAddress(v string) {
4754+
if p.p == nil {
4755+
p.p = make(map[string]interface{})
4756+
}
4757+
p.p["address"] = v
4758+
}
4759+
4760+
func (p *UpdateBackupRepositoryParams) ResetAddress() {
4761+
if p.p != nil && p.p["address"] != nil {
4762+
delete(p.p, "address")
4763+
}
4764+
}
4765+
4766+
func (p *UpdateBackupRepositoryParams) GetAddress() (string, bool) {
4767+
if p.p == nil {
4768+
p.p = make(map[string]interface{})
4769+
}
4770+
value, ok := p.p["address"].(string)
4771+
return value, ok
4772+
}
4773+
4774+
func (p *UpdateBackupRepositoryParams) SetCrosszoneinstancecreation(v bool) {
4775+
if p.p == nil {
4776+
p.p = make(map[string]interface{})
4777+
}
4778+
p.p["crosszoneinstancecreation"] = v
4779+
}
4780+
4781+
func (p *UpdateBackupRepositoryParams) ResetCrosszoneinstancecreation() {
4782+
if p.p != nil && p.p["crosszoneinstancecreation"] != nil {
4783+
delete(p.p, "crosszoneinstancecreation")
4784+
}
4785+
}
4786+
4787+
func (p *UpdateBackupRepositoryParams) GetCrosszoneinstancecreation() (bool, bool) {
4788+
if p.p == nil {
4789+
p.p = make(map[string]interface{})
4790+
}
4791+
value, ok := p.p["crosszoneinstancecreation"].(bool)
4792+
return value, ok
4793+
}
4794+
4795+
func (p *UpdateBackupRepositoryParams) SetId(v string) {
4796+
if p.p == nil {
4797+
p.p = make(map[string]interface{})
4798+
}
4799+
p.p["id"] = v
4800+
}
4801+
4802+
func (p *UpdateBackupRepositoryParams) ResetId() {
4803+
if p.p != nil && p.p["id"] != nil {
4804+
delete(p.p, "id")
4805+
}
4806+
}
4807+
4808+
func (p *UpdateBackupRepositoryParams) GetId() (string, bool) {
4809+
if p.p == nil {
4810+
p.p = make(map[string]interface{})
4811+
}
4812+
value, ok := p.p["id"].(string)
4813+
return value, ok
4814+
}
4815+
4816+
func (p *UpdateBackupRepositoryParams) SetMountopts(v string) {
4817+
if p.p == nil {
4818+
p.p = make(map[string]interface{})
4819+
}
4820+
p.p["mountopts"] = v
4821+
}
4822+
4823+
func (p *UpdateBackupRepositoryParams) ResetMountopts() {
4824+
if p.p != nil && p.p["mountopts"] != nil {
4825+
delete(p.p, "mountopts")
4826+
}
4827+
}
4828+
4829+
func (p *UpdateBackupRepositoryParams) GetMountopts() (string, bool) {
4830+
if p.p == nil {
4831+
p.p = make(map[string]interface{})
4832+
}
4833+
value, ok := p.p["mountopts"].(string)
4834+
return value, ok
4835+
}
4836+
4837+
func (p *UpdateBackupRepositoryParams) SetName(v string) {
4838+
if p.p == nil {
4839+
p.p = make(map[string]interface{})
4840+
}
4841+
p.p["name"] = v
4842+
}
4843+
4844+
func (p *UpdateBackupRepositoryParams) ResetName() {
4845+
if p.p != nil && p.p["name"] != nil {
4846+
delete(p.p, "name")
4847+
}
4848+
}
4849+
4850+
func (p *UpdateBackupRepositoryParams) GetName() (string, bool) {
4851+
if p.p == nil {
4852+
p.p = make(map[string]interface{})
4853+
}
4854+
value, ok := p.p["name"].(string)
4855+
return value, ok
4856+
}
4857+
4858+
// You should always use this function to get a new UpdateBackupRepositoryParams instance,
4859+
// as then you are sure you have configured all required params
4860+
func (s *BackupService) NewUpdateBackupRepositoryParams(id string) *UpdateBackupRepositoryParams {
4861+
p := &UpdateBackupRepositoryParams{}
4862+
p.p = make(map[string]interface{})
4863+
p.p["id"] = id
4864+
return p
4865+
}
4866+
4867+
// Update a backup repository
4868+
func (s *BackupService) UpdateBackupRepository(p *UpdateBackupRepositoryParams) (*UpdateBackupRepositoryResponse, error) {
4869+
resp, err := s.cs.newPostRequest("updateBackupRepository", p.toURLValues())
4870+
if err != nil {
4871+
return nil, err
4872+
}
4873+
4874+
var r UpdateBackupRepositoryResponse
4875+
if err := json.Unmarshal(resp, &r); err != nil {
4876+
return nil, err
4877+
}
4878+
4879+
return &r, nil
4880+
}
4881+
4882+
type UpdateBackupRepositoryResponse struct {
4883+
Address string `json:"address"`
4884+
Capacitybytes int64 `json:"capacitybytes"`
4885+
Created string `json:"created"`
4886+
Crosszoneinstancecreation bool `json:"crosszoneinstancecreation"`
4887+
Id string `json:"id"`
4888+
JobID string `json:"jobid"`
4889+
Jobstatus int `json:"jobstatus"`
4890+
Name string `json:"name"`
4891+
Provider string `json:"provider"`
4892+
Type string `json:"type"`
4893+
Zoneid string `json:"zoneid"`
4894+
Zonename string `json:"zonename"`
4895+
}
4896+
47234897
type UpdateBackupOfferingParams struct {
47244898
p map[string]interface{}
47254899
}

cloudstack/BackupService_mock.go

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)